VTK  9.7.1
vtkWebGPUActorInternals.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 vtkWebGPUActorInternals_h
5 #define vtkWebGPUActorInternals_h
6 
7 #include "vtkMapper.h"
8 #include "vtkMatrix3x3.h"
9 #include "vtkMatrix4x4.h"
10 #include "vtkNew.h"
11 #include "vtkRenderingWebGPUModule.h"
12 #include "vtkTransform.h"
14 
15 #include <vtk_wgpu.h>
16 
17 VTK_ABI_NAMESPACE_BEGIN
18 
19 class VTKRENDERINGWEBGPU_NO_EXPORT vtkWebGPUActorInternals
20 {
22 
23 public:
24  struct ActorBlock
25  {
27  {
28  vtkTypeFloat32 World[4][4] = {};
29  vtkTypeFloat32 Normal[3][4] = {};
30  } Transform;
31 
33  {
34  // Point size in pixels - applicable when points are visible.
35  vtkTypeFloat32 PointSize = 0;
36  // Line width in pixels - applicable when lines/edges are visible.
37  vtkTypeFloat32 LineWidth = 0;
38  // Edge width in pixels - applicable when edges are visible and UseLineWidthForEdgeThickness
39  // is false.
40  vtkTypeFloat32 EdgeWidth = 0;
41  // Custom flags used to encode various integer/boolean properties.
42  vtkTypeUInt32 Flags = 0;
43  // Additional custom flags used to encode various integer/boolean properties.
44  vtkTypeUInt32 Flags2 = 0;
45  // Coincident topology polygon offset factor (for surface/triangle pipelines).
46  vtkTypeFloat32 CoinPolygonFactor = 0;
47  // Coincident topology polygon offset units (for surface/triangle pipelines).
48  vtkTypeFloat32 CoinPolygonOffset = 0;
49  // Coincident topology line offset factor (for wireframe/line pipelines).
50  vtkTypeFloat32 CoinLineFactor = 0;
51  // Coincident topology line offset units (for wireframe/line pipelines).
52  vtkTypeFloat32 CoinLineOffset = 0;
53  // Coincident topology point offset units (for point pipelines).
54  vtkTypeFloat32 CoinPointOffset = 0;
55  } RenderOpts;
56  vtkTypeUInt32 Pad[2];
57 
58  struct ColorOptions
59  {
60  // Material ambient color - applicable when shading type is global.
61  vtkTypeFloat32 AmbientColor[3] = {};
62  vtkTypeUInt32 Pad1 = 0;
63  // Material diffuse color - applicable when shading type is global.
64  vtkTypeFloat32 DiffuseColor[3] = {};
65  vtkTypeUInt32 Pad2 = 0;
66  // Material specular color - applicable when shading type is global.
67  vtkTypeFloat32 SpecularColor[3] = {};
68  vtkTypeUInt32 Pad3 = 0;
69  // Edge color
70  vtkTypeFloat32 EdgeColor[3] = {};
71  vtkTypeUInt32 Pad4 = 0;
72  // Vertex color
73  vtkTypeFloat32 VertexColor[3] = {};
74  // Material ambient color intensity.
75  vtkTypeFloat32 AmbientIntensity = 0;
76  // Material diffuse color intensity.
77  vtkTypeFloat32 DiffuseIntensity = 1;
78  // Material specular color intensity.
79  vtkTypeFloat32 SpecularIntensity = 0;
80  // Material specular power.
81  vtkTypeFloat32 SpecularPower = 0;
82  // Opacity level
83  vtkTypeFloat32 Opacity = 0;
84  // Interpolation type
85  vtkTypeUInt32 InterpolationType = VTK_FLAT;
86  // Id to color by
87  vtkTypeUInt32 Id = 0;
88  } ColorOpts;
89  };
90 
92  {
93  bool Value = false;
94  vtkTimeStamp TimeStamp;
95 
96  public:
100  void SetValue(bool newValue)
101  {
102  this->Value = newValue;
103  this->TimeStamp.Modified();
104  }
105 
109  bool GetValue() const { return Value; }
110 
114  bool IsOutdated(vtkMapper* mapper) const { return mapper->GetMTime() > this->TimeStamp; }
115  };
116 
118 
121 
125 
130 
131  wgpu::BindGroupLayout ActorBindGroupLayout;
132  wgpu::BindGroup ActorBindGroup;
133  wgpu::Buffer ActorBuffer;
134 
135  vtkTypeUInt32 Id = 0;
136 
137  void PopulateBindgroupLayouts(std::vector<wgpu::BindGroupLayout>& layouts)
138  {
139  layouts.emplace_back(this->ActorBindGroupLayout);
140  }
141 };
142 
143 VTK_ABI_NAMESPACE_END
144 #endif
MapperBooleanCache MapperHasTranslucentPolygonalGeometry
bool IsOutdated(vtkMapper *mapper) const
Returns true if the timestamp of the cached value is older than the mapper's MTime.
record modification and/or execution time
Definition: vtkTimeStamp.h:24
void Modified()
Set this objects time to the current time.
void SetValue(bool newValue)
Update the cached value with the new value.
MapperBooleanCache MapperHasOpaqueGeometry
vtkNew< vtkTransform > NormalTransform
wgpu::BindGroupLayout ActorBindGroupLayout
vtkNew< vtkMatrix3x3 > NormalMatrix
#define VTK_FLAT
Definition: vtkProperty.h:37
bool GetValue() const
Returns the cached Value.
vtkMTimeType GetMTime() override
Overload standard modified time function.
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:77
void PopulateBindgroupLayouts(std::vector< wgpu::BindGroupLayout > &layouts)
vtkNew< vtkMatrix4x4 > MCWCMatrix