VTK  9.7.20260912
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
8#include "vtkObject.h"
9#include "vtkRenderingWebGPUModule.h"
10#include "vtkSmartPointer.h"
12#include "vtk_wgpu.h"
13
14class vtkPolyData;
15class vtkRenderer;
21
22VTK_ABI_NAMESPACE_BEGIN
23
27class VTKRENDERINGWEBGPU_NO_EXPORT vtkWebGPUPointCloudMapperInternals : public vtkObject
28{
29public:
32
33 void PrintSelf(ostream& os, vtkIndent indent) override;
34
36
44 {
45 vtkWebGPU::BindGroup BindGroup = nullptr;
46 vtkWebGPU::RenderPipeline Pipeline = nullptr;
47 vtkWebGPU::Buffer FramebufferWidthUniformBuffer = nullptr;
48 };
49
50protected:
53
54private:
56 void operator=(const vtkWebGPUPointCloudMapperInternals&) = delete;
57
59
63 vtkWebGPURenderWindow* GetRendererRenderWindow(vtkRenderer* renderer);
64
68 void Initialize(vtkRenderer* renderer);
69
79 void UpdateRenderWindowDepthBuffer(vtkRenderer* renderer);
80
85 void CreateCopyDepthBufferRenderPipeline(vtkWebGPURenderWindow* wgpuRenderWindow);
86
91 void CopyDepthBufferToRenderWindow(vtkWebGPURenderWindow* wgpuRenderWindow);
92
100 void Update(vtkRenderer* renderer);
101
105 void UseRenderWindowDevice(vtkRenderer* renderer);
106
110 void ResizeToRenderWindow(vtkRenderer* renderer);
111
115 void InitializeDepthCopyPass(vtkRenderer* renderer);
116
120 void InitializePointRenderPass(vtkRenderer* renderer);
121
128 void UploadPointsToGPU();
129
137 void UploadColorsToGPU();
138
143 void UploadCameraVPMatrix(vtkRenderer* renderer);
144
145 // Whether or not the compute pipeline has been initialized
146 bool Initialized = false;
147
148 // Compute pipeline for the point cloud rendering
150
151 // Compute pass that copies the depth buffer of the render window into the custom depth
152 // buffer for rendering the points
154 // Compute pass that renders the points to the framebuffer of the render window of the
155 // WebGPURenderer
157
158 // Custom depth buffer for the render of the points
160 // Index of the buffer that contains the point data in the render point pass
161 int PointBufferIndex = -1;
162 // Index of the buffer that holds the colors of the points in float format in the point render
163 // pass
164 int PointColorBufferIndex = -1;
165
166 // Custom depth buffer that contains the depth of the points after they've been rendered
167 int PointDepthBufferIndex = -1;
168 // Index of the view-projection matrix buffer in the render point pass
169 int CameraVPBufferIndex = -1;
170 // Index of the framebuffer in the render point pass
171 int FrameBufferRenderTextureIndex = -1;
172
173 // The renderer culling pass always calls GetBounds() on the mappers. We use this opportunity to
174 // cache the polyData input so that we can reuse it later without having to call on the expensive
175 // GetInput() function
176 vtkPolyData* CachedInput = nullptr;
177 // MTime of the last points we uploaded to the GPU
178 vtkMTimeType LastPointsMTime = 0;
179 // MTime of the last point data (for point colors) we uploaded to the GPU
180 vtkMTimeType LastPointDataMTime = 0;
181
182 // Contains the wgpu objects for refereing to the render pipeline that copies the point depth
183 // buffer to the depth buffer of the render window
184 CopyDepthBufferRenderPipeline CopyDepthBufferPipeline;
185
186 // vtkWebGPUComputePointCloudMapper whose internals this instance is
187 vtkWebGPUComputePointCloudMapper* ParentMapper = nullptr;
188};
189VTK_ABI_NAMESPACE_END
190
191#endif
192// VTK-HeaderTest-Exclude: vtkWebGPUBindGroupInternals.h
a simple class to control print indentation
Definition vtkIndent.h:108
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...
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)
WebGPU rendering window.
Structure that contains the wgpu objects necessary for the use of the render pipeline that copies the...
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:318
Reference-counted ownership for WebGPU C API handles.