VTK  9.7.1
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
8 #ifndef vtkWebGPUTexture_h
9 #define vtkWebGPUTexture_h
10 
11 #include "vtkTexture.h"
12 
13 #include "vtkRenderingWebGPUModule.h" // For export macro
14 #include "vtkWeakPointer.h" // for weak pointer
15 #include "vtkWebGPURenderTextureDeviceResource.h" // for vtkWebGPURenderTextureDeviceResource
16 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
17 #include "vtk_wgpu.h" // for webgpu
18 
19 #include <array> // for std::array
20 #include <tuple> // for std::tuple
21 
22 VTK_ABI_NAMESPACE_BEGIN
24 class vtkRenderWindow;
26 class VTKRENDERINGWEBGPU_EXPORT VTK_MARSHALAUTO vtkWebGPUTexture : public vtkTexture
27 {
28 public:
29  static vtkWebGPUTexture* New();
31  static vtkOverrideAttribute* CreateOverrideAttributes();
32  vtkTypeMacro(vtkWebGPUTexture, vtkTexture);
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
40  void Render(vtkRenderer* ren) override;
41 
45  void Load(vtkRenderer*) override;
46 
50  void PostRender(vtkRenderer*) override;
51 
58  void ReleaseGraphicsResources(vtkWindow*) override;
59 
63  int GetTextureUnit() override;
64 
68  int IsTranslucent() override;
69 
71 
72 protected:
74  ~vtkWebGPUTexture() override;
75 
76 private:
77  vtkWebGPUTexture(const vtkWebGPUTexture&) = delete;
78  void operator=(const vtkWebGPUTexture&) = delete;
79 
80  vtkTimeStamp LoadTime;
82  int TextureIndex;
83 
84  bool IsValidTextureIndex();
85  bool CanDataPlaneBeUsedDirectlyAsColors(vtkDataArray* inputScalars);
86  std::tuple<vtkWebGPURenderTextureDeviceResource::TextureDimension, std::array<unsigned int, 3>>
87  GetTextureDimensionAndSize(vtkImageData* imageData);
88  vtkWebGPURenderTextureDeviceResource::TextureFormat GetTextureFormatFromImageData(
89  int numComponents, int dataType);
90 };
91 #define vtkWebGPUTexture_OVERRIDE_ATTRIBUTES vtkWebGPUTexture::CreateOverrideAttributes()
92 VTK_ABI_NAMESPACE_END
93 #endif
Attribute for vtkObjectFactory overrides.
virtual void PostRender(vtkRenderer *)
Cleans up after the texture rendering to restore the state of the graphics context.
Definition: vtkTexture.h:76
vtkWebGPUTexture is a concrete implementation of the abstract class vtkTexture for WebGPU...
record modification and/or execution time
Definition: vtkTimeStamp.h:24
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this texture.
Definition: vtkTexture.h:83
abstract specification for renderers
Definition: vtkRenderer.h:63
Hold a reference to a vtkObjectBase instance.
Definition: vtkMeta.h:23
virtual void Load(vtkRenderer *)
Abstract interface to renderer.
Definition: vtkTexture.h:90
virtual void Render(vtkRenderer *ren)
Renders a texture map.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
virtual int IsTranslucent()
Is this Texture Translucent? returns false (0) if the texture is either fully opaque or has only full...
a simple class to control print indentation
Definition: vtkIndent.h:28
static vtkTexture * New()
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
TextureFormat
RGBA8_UNORM: Uses RGB + alpha.
handles properties associated with a texture map
Definition: vtkTexture.h:58
#define VTK_NEWINSTANCE
virtual int GetTextureUnit()
Return the texture unit used for this texture.
Definition: vtkTexture.h:244
create a window for renderers to draw into
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
#define VTK_MARSHALAUTO