VTK  9.7.20261105
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
8#include "vtkDataObject.h"
9#include "vtkMapper.h"
10#include "vtkMatrix3x3.h"
11#include "vtkMatrix4x4.h"
12#include "vtkNew.h"
13#include "vtkRenderingWebGPUModule.h"
14#include "vtkTransform.h"
16
17#include "vtk_wgpu.h"
18
19VTK_ABI_NAMESPACE_BEGIN
20
21class VTKRENDERINGWEBGPU_NO_EXPORT vtkWebGPUActorInternals
22{
24
25public:
27 {
29 {
30 vtkTypeFloat32 World[4][4] = {};
31 vtkTypeFloat32 Normal[3][4] = {};
32 } Transform;
33
35 {
36 // Point size in pixels - applicable when points are visible.
37 vtkTypeFloat32 PointSize = 0;
38 // Line width in pixels - applicable when lines/edges are visible.
39 vtkTypeFloat32 LineWidth = 0;
40 // Edge width in pixels - applicable when edges are visible and UseLineWidthForEdgeThickness
41 // is false.
42 vtkTypeFloat32 EdgeWidth = 0;
43 // Custom flags used to encode various integer/boolean properties.
44 vtkTypeUInt32 Flags = 0;
45 // Additional custom flags used to encode various integer/boolean properties.
46 vtkTypeUInt32 Flags2 = 0;
47 // Coincident topology polygon offset factor (for surface/triangle pipelines).
48 vtkTypeFloat32 CoinPolygonFactor = 0;
49 // Coincident topology polygon offset units (for surface/triangle pipelines).
50 vtkTypeFloat32 CoinPolygonOffset = 0;
51 // Coincident topology line offset factor (for wireframe/line pipelines).
52 vtkTypeFloat32 CoinLineFactor = 0;
53 // Coincident topology line offset units (for wireframe/line pipelines).
54 vtkTypeFloat32 CoinLineOffset = 0;
55 // Coincident topology point offset units (for point pipelines).
56 vtkTypeFloat32 CoinPointOffset = 0;
57 } RenderOpts;
58 vtkTypeUInt32 Pad[2];
59
61 {
62 // Material ambient color - applicable when shading type is global.
63 vtkTypeFloat32 AmbientColor[3] = {};
64 vtkTypeUInt32 Pad1 = 0;
65 // Material diffuse color - applicable when shading type is global.
66 vtkTypeFloat32 DiffuseColor[3] = {};
67 vtkTypeUInt32 Pad2 = 0;
68 // Material specular color - applicable when shading type is global.
69 vtkTypeFloat32 SpecularColor[3] = {};
70 vtkTypeUInt32 Pad3 = 0;
71 // Edge color
72 vtkTypeFloat32 EdgeColor[3] = {};
73 vtkTypeUInt32 Pad4 = 0;
74 // Vertex color
75 vtkTypeFloat32 VertexColor[3] = {};
76 // Material ambient color intensity.
77 vtkTypeFloat32 AmbientIntensity = 0;
78 // Material diffuse color intensity.
79 vtkTypeFloat32 DiffuseIntensity = 1;
80 // Material specular color intensity.
81 vtkTypeFloat32 SpecularIntensity = 0;
82 // Material specular power.
83 vtkTypeFloat32 SpecularPower = 0;
84 // Opacity level
85 vtkTypeFloat32 Opacity = 0;
86 // Interpolation type
87 vtkTypeUInt32 InterpolationType = VTK_FLAT;
88 // Id to color by
89 vtkTypeUInt32 Id = 0;
90 } ColorOpts;
91 };
92
94 {
95 bool Value = false;
96 vtkTimeStamp TimeStamp;
97
98 public:
102 void SetValue(bool newValue)
103 {
104 this->Value = newValue;
105 this->TimeStamp.Modified();
106 }
107
111 bool GetValue() const { return Value; }
112
117 bool IsOutdated(vtkMapper* mapper) const
118 {
119 if (mapper->GetMTime() > this->TimeStamp)
120 {
121 return true;
122 }
123 if (auto* inputDataObject = mapper->GetInputDataObject(0, 0))
124 {
125 return inputDataObject->GetMTime() > this->TimeStamp;
126 }
127 return false;
128 }
129 };
130
132
136
140
145
146 vtkWebGPU::BindGroupLayout ActorBindGroupLayout;
147 vtkWebGPU::BindGroup ActorBindGroup;
148 vtkWebGPU::Buffer ActorBuffer;
149
150 vtkTypeUInt32 Id = 0;
151
152 void PopulateBindgroupLayouts(std::vector<WGPUBindGroupLayout>& layouts)
153 {
154 layouts.emplace_back(this->ActorBindGroupLayout.Get());
155 }
156};
157
158VTK_ABI_NAMESPACE_END
159#endif
vtkDataObject * GetInputDataObject(int port, int connection)
Get the data object that will contain the algorithm input for the given port and given connection.
abstract class specifies interface to map data to graphics primitives
Definition vtkMapper.h:107
vtkMTimeType GetMTime() override
Overload standard modified time function.
Allocate and hold a VTK object.
Definition vtkNew.h:168
record modification and/or execution time
void Modified()
Set this objects time to the current time.
bool GetValue() const
Returns the cached Value.
void SetValue(bool newValue)
Update the cached value with the new value.
bool IsOutdated(vtkMapper *mapper) const
Returns true if the timestamp of the cached value is older than the mapper's MTime or the MTime of it...
void PopulateBindgroupLayouts(std::vector< WGPUBindGroupLayout > &layouts)
vtkNew< vtkMatrix3x3 > NormalMatrix
MapperBooleanCache MapperHasTranslucentPolygonalGeometry
vtkNew< vtkTransform > NormalTransform
vtkNew< vtkMatrix4x4 > MCWCMatrix
vtkWebGPU::BindGroup ActorBindGroup
vtkWebGPU::BindGroupLayout ActorBindGroupLayout
MapperBooleanCache MapperHasOpaqueGeometry
#define VTK_FLAT
Reference-counted ownership for WebGPU C API handles.