VTK  9.4.20241112
vtkWebGPUTexture.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3
4#ifndef vtkWebGPUTexture_h
5#define vtkWebGPUTexture_h
6
7#include "vtkObject.h"
8#include "vtkRenderingWebGPUModule.h" // For export macro
9
10VTK_ABI_NAMESPACE_BEGIN
11
16class VTKRENDERINGWEBGPU_EXPORT vtkWebGPUTexture : public vtkObject
17{
18public:
21
22 void PrintSelf(ostream& os, vtkIndent indent) override;
23
32 {
33 RGBA8_UNORM = 0,
37 DEPTH_24_PLUS_8_STENCIL
38 };
39
48 {
49 DIMENSION_1D = 0,
51 DIMENSION_3D
52 };
53
65 {
66 UNDEFINED = 0,
69 READ_WRITE_STORAGE
70 };
71
83 {
84 FLOAT = 0,
88 UNSIGNED_INT
89 };
90
100 {
101 VTK_DATA_ARRAY = 0,
102 STD_VECTOR
103 };
104
108 virtual unsigned int GetBytesPerPixel() const;
109
114 unsigned int GetPixelComponentsCount() const;
115
117
120 unsigned int GetWidth() const { return Extents[0]; }
121 void SetWidth(unsigned int width) { Extents[0] = width; }
123
125
128 unsigned int GetHeight() const { return Extents[1]; }
129 void SetHeight(unsigned int height) { Extents[1] = height; }
131
133
136 unsigned int GetDepth() const { return Extents[2]; }
137 void SetDepth(unsigned int depth) { Extents[2] = depth; }
139
141
147 void GetSize(unsigned int& x, unsigned int& y, unsigned int& z) const;
148 void GetSize(unsigned int& x, unsigned int& y) const;
149 void GetSize(unsigned int* xyz);
150 unsigned int* GetSize();
151
152 virtual void SetSize(unsigned int x, unsigned int y, unsigned int z = 1);
153 virtual void SetSize(unsigned int* xyz);
155
157
163
165
171
173
179
181
187
189
192 vtkGetMacro(MipLevelCount, unsigned int);
193 vtkSetMacro(MipLevelCount, unsigned int);
195
196protected:
199
200private:
201 vtkWebGPUTexture(const vtkWebGPUTexture&) = delete;
202 void operator=(const vtkWebGPUTexture&) = delete;
203
204 // Number of pixels in X, Y and Z direction.
205 // Defaulting to 1 in the Z direction because 2D textures are assumed to be the common case.
206 unsigned int Extents[3] = { 0, 0, 1 };
207
208 // Is the texture 1D, 2D or 3D
209 TextureDimension Dimension = TextureDimension::DIMENSION_2D;
210
211 // The format of the texture: RGB or RGBA?
212 TextureFormat Format = TextureFormat::RGBA8_UNORM;
213
214 // The read/write mode of the texture
215 TextureMode Mode = TextureMode::UNDEFINED;
216
217 // The type of value produced when sampling the texture in the shader
218 TextureSampleType SampleType = TextureSampleType::FLOAT;
219
220 // Maximum number of mipmap levels supported by the texture
221 unsigned int MipLevelCount = 1;
222};
223
224VTK_ABI_NAMESPACE_END
225
226#endif
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
Abstraction class for WebGPU textures.
vtkGetEnumMacro(Dimension, TextureDimension)
Get/set the texture dimension.
void SetDepth(unsigned int depth)
Get/set the depth in pixels of the texture.
vtkSetEnumMacro(Format, TextureFormat)
Get/set the texture format.
vtkGetEnumMacro(Mode, TextureMode)
Get/set the texture format.
unsigned int GetWidth() const
Get/set the width in pixels of the texture.
vtkSetEnumMacro(Mode, TextureMode)
Get/set the texture format.
unsigned int GetPixelComponentsCount() const
Returns the number of components per pixel for the format of this texture.
~vtkWebGPUTexture() override
void GetSize(unsigned int *xyz)
Get/set the size of the texture.
virtual void SetSize(unsigned int x, unsigned int y, unsigned int z=1)
Get/set the size of the texture.
unsigned int GetHeight() const
Get/set the height in pixels of the texture.
void SetHeight(unsigned int height)
Get/set the height in pixels of the texture.
TextureMode
How will the texture be used by the shader.
void GetSize(unsigned int &x, unsigned int &y, unsigned int &z) const
Get/set the size of the texture.
TextureDataType
Because the compute texture can accept multiple data types as input (std::vector, vtkDataArray) but w...
vtkSetEnumMacro(SampleType, TextureSampleType)
Get/set the texture sample type.
vtkSetEnumMacro(Dimension, TextureDimension)
Get/set the texture dimension.
TextureDimension
How the texture data is arranged.
unsigned int * GetSize()
Get/set the size of the texture.
vtkGetEnumMacro(SampleType, TextureSampleType)
Get/set the texture sample type.
void SetWidth(unsigned int width)
Get/set the width in pixels of the texture.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
unsigned int GetDepth() const
Get/set the depth in pixels of the texture.
TextureSampleType
Determines what kind of value is returned when reading from the texture in the compute shader.
virtual void SetSize(unsigned int *xyz)
Get/set the size of the texture.
virtual unsigned int GetBytesPerPixel() const
Number of bytes used per pixel.
static vtkWebGPUTexture * New()
TextureFormat
RGBA8_UNORM: Uses RGB + alpha.
vtkGetEnumMacro(Format, TextureFormat)
Get/set the texture format.
void GetSize(unsigned int &x, unsigned int &y) const
Get/set the size of the texture.