VTK  9.3.20240919
vtkWebGPUPointCloudMapperInternals.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 vtkWebGPUPointCloudMapperInternals_h
5#define vtkWebGPUPointCloudMapperInternals_h
6
7#include "vtkObject.h"
8#include "vtkRenderingWebGPUModule.h"
9#include "vtkSmartPointer.h"
11#include "vtk_wgpu.h"
12
13class vtkPolyData;
14class vtkRenderer;
20
21VTK_ABI_NAMESPACE_BEGIN
22
26class VTKRENDERINGWEBGPU_NO_EXPORT vtkWebGPUPointCloudMapperInternals : public vtkObject
27{
28public:
31
32 void PrintSelf(ostream& os, vtkIndent indent) override;
33
35
43 {
44 wgpu::BindGroup BindGroup = nullptr;
45 wgpu::RenderPipeline Pipeline = nullptr;
46 wgpu::Buffer FramebufferWidthUniformBuffer = nullptr;
47 };
48
49protected:
52
53private:
55 void operator=(const vtkWebGPUPointCloudMapperInternals&) = delete;
56
58
62 vtkWebGPURenderWindow* GetRendererRenderWindow(vtkRenderer* ren);
63
67 void Initialize(vtkRenderer* ren);
68
78 void UpdateRenderWindowDepthBuffer(vtkRenderer* ren);
79
84 void CreateCopyDepthBufferRenderPipeline(vtkWebGPURenderWindow* wgpuRenderWindow);
85
90 void CopyDepthBufferToRenderWindow(vtkWebGPURenderWindow* wgpuRenderWindow);
91
99 void Update(vtkRenderer* ren);
100
104 void UseRenderWindowDevice(vtkRenderer* ren);
105
109 void ResizeToRenderWindow(vtkRenderer* ren);
110
114 void InitializeDepthCopyPass(vtkRenderer* ren);
115
119 void InitializePointRenderPass(vtkRenderer* ren);
120
127 void UploadPointsToGPU();
128
136 void UploadColorsToGPU();
137
142 void UploadCameraVPMatrix(vtkRenderer* ren);
143
144 // Whether or not the compute pipeline has been initialized
145 bool Initialized = false;
146
147 // Compute pipeline for the point cloud rendering
149
150 // Compute pass that copies the depth buffer of the render window into the custom depth
151 // buffer for rendering the points
153 // Compute pass that renders the points to the framebuffer of the render window of the
154 // WebGPURenderer
156
157 // Custom depth buffer for the render of the points
159 // Index of the buffer that contains the point data in the render point pass
160 int PointBufferIndex = -1;
161 // Index of the buffer that holds the colors of the points in float format in the point render
162 // pass
163 int PointColorBufferIndex = -1;
164
165 // Custom depth buffer that contains the depth of the points after they've been rendered
166 int PointDepthBufferIndex = -1;
167 // Index of the view-projection matrix buffer in the render point pass
168 int CameraVPBufferIndex = -1;
169 // Index of the framebuffer in the render point pass
170 int FrameBufferRenderTextureIndex = -1;
171
172 // The renderer culling pass always calls GetBounds() on the mappers. We use this opportunity to
173 // cache the polyData input so that we can reuse it later without having to call on the expensive
174 // GetInput() function
175 vtkPolyData* CachedInput = nullptr;
176 // MTime of the last points we uploaded to the GPU
177 vtkMTimeType LastPointsMTime = 0;
178 // MTime of the last point data (for point colors) we uploaded to the GPU
179 vtkMTimeType LastPointDataMTime = 0;
180
181 // Contains the wgpu objects for refereing to the render pipeline that copies the point depth
182 // buffer to the depth buffer of the render window
183 CopyDepthBufferRenderPipeline CopyDepthBufferPipeline;
184
185 // vtkWebGPUComputePointCloudMapper whose internals this instance is
186 vtkWebGPUComputePointCloudMapper* ParentMapper = nullptr;
187};
188VTK_ABI_NAMESPACE_END
189
190#endif
191// VTK-HeaderTest-Exclude: vtkWebGPUBindGroupInternals.h
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
concrete dataset represents vertices, lines, polygons, and triangle strips
abstract specification for renderers
Hold a reference to a vtkObjectBase instance.
Represents the set of parameters that will be used to create a compute shader buffer on the device wh...
A compute pass is an abstraction for offloading computation from the CPU onto the GPU using WebGPU co...
A compute pipeline is the orchestrator of a collection of compute passes.
The point cloud renderer uses WebGPU compute shaders to render the point cells of a polydata onto the...
Internal implementation details of vtkWebGPUPointCloudMapper.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkWebGPUPointCloudMapperInternals * New()
void SetMapper(vtkWebGPUComputePointCloudMapper *mapper)
Structure that contains the wgpu objects necessary for the use of the render pipeline that copies the...
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270