3 #ifndef vtkWebGPURenderer_h
4 #define vtkWebGPURenderer_h
8 #include "vtkRenderingWebGPUModule.h"
14 #include <unordered_set>
20 VTK_ABI_NAMESPACE_BEGIN
45 vtkGetMacro(LightingComplexity,
int);
53 RenderPostRasterization
59 void Clear()
override;
93 void ConfigureComputePipelines();
100 const std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>>& GetSetupPreRenderComputePipelines();
101 const std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>>&
102 GetSetupPostRenderComputePipelines();
117 layouts.emplace_back(this->SceneBindGroupLayout);
149 vtkSetMacro(UseRenderBundles,
bool);
150 vtkBooleanMacro(UseRenderBundles,
bool);
151 vtkGetMacro(UseRenderBundles,
bool);
191 this->RebuildRenderBundle =
true;
192 this->Bundle =
nullptr;
198 vtkGetMacro(RebuildRenderBundle,
bool);
224 void SetupBindGroupLayouts();
226 void CreateBuffers();
228 void SetupSceneBindGroup();
231 void BeginRecording();
234 std::size_t WriteLightsBuffer(std::size_t
offset = 0);
235 std::size_t WriteSceneTransformsBuffer(std::size_t
offset = 0);
250 void PreRenderComputePipelines();
251 void PostRenderComputePipelines();
264 void PostRasterizationRender();
269 void AddPostRasterizationActor(
vtkActor* actor);
275 std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>> SetupPreRenderComputePipelines;
276 std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>> SetupPostRenderComputePipelines;
281 std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>> NotSetupPreRenderComputePipelines;
282 std::vector<vtkSmartPointer<vtkWebGPUComputePipeline>> NotSetupPostRenderComputePipelines;
291 std::vector<vtkActor*> PostRasterizationActors;
296 wgpu::CommandBuffer EncodePropListRenderCommand(
vtkProp** propList,
int listLength);
303 void RecordRenderCommands();
305 wgpu::RenderPassEncoder WGPURenderEncoder;
306 wgpu::RenderBundleEncoder WGPUBundleEncoder;
307 wgpu::Buffer SceneTransformBuffer;
308 wgpu::Buffer SceneLightsBuffer;
310 wgpu::BindGroup SceneBindGroup;
311 wgpu::BindGroupLayout SceneBindGroupLayout;
314 bool UseRenderBundles =
true;
315 bool RebuildRenderBundle =
false;
317 wgpu::RenderBundle Bundle;
319 int LightingComplexity = 0;
320 std::size_t NumberOfLightsUsed = 0;
321 std::vector<std::size_t> LightIDs;
322 std::size_t AllocatedLightsBufferSize = 0;
323 std::size_t PreviousLightCount = 0;
337 bool ComputeBuffersInitialized =
false;
348 bool DrawBackgroundInClearPass =
true;
356 std::unordered_set<vtkProp*> PropsRendered;
359 #define vtkWebGPURenderer_OVERRIDE_ATTRIBUTES vtkWebGPURenderer::CreateOverrideAttributes()
360 VTK_ABI_NAMESPACE_END
abstract superclass for all actors, volumes and annotations
Attribute for vtkObjectFactory overrides.
represents an object (geometry & properties) in a rendered scene
void PopulateBindgroupLayouts(std::vector< wgpu::BindGroupLayout > &layouts)
virtual void ReleaseGraphicsResources(vtkWindow *)
void InvalidateBundle()
Forces the renderer to re-record draw commands into a render bundle.
vtkTypeUInt32 vtkMTimeType
record modification and/or execution time
The point cloud renderer uses WebGPU compute shaders to render the point cells of a polydata onto the...
abstract specification for renderers
virtual void SetEnvironmentTexture(vtkTexture *texture, bool isSRGB=false)
Set/Get the environment texture used for image based lighting.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
window superclass for vtkRenderWindow
Context in which a vtkRenderPass will render.
abstract interface to OpenGL FBOs
a simple class to control print indentation
wgpu::BindGroup GetSceneBindGroup()
virtual int UpdateLights()
Ask all lights to load themselves into rendering pipeline.
handles properties associated with a texture map
wgpu::RenderPassEncoder GetRenderPassEncoder()
virtual int UpdateGeometry(vtkFrameBufferObjectBase *fbo=nullptr)
Ask all props to update and draw any opaque and translucent geometry.
abstract class specifies interface to map data
std::unordered_set< vtkProp * > GetPropsRendered()
Returns the list of the actors that were rendered last frame.
wgpu::RenderBundleEncoder GetRenderBundleEncoder()
virtual void DeviceRender()
Create an image.
virtual int UpdateTranslucentPolygonalGeometry()
Ask all props to update and draw any translucent polygonal geometry.
This culler does both frustum culling and occlusion culling.
static vtkRenderer * New()
Create a vtkRenderer with a black background, a white ambient light, two-sided lighting turned on...
virtual int UpdateOpaquePolygonalGeometry()
Ask all props to update and draw any opaque polygonal geometry.
virtual void Clear()
Clear the image to the background color.
vtkGetEnumMacro(GradientMode, GradientModes)
Specify the direction of the gradient background.