11#ifndef vtkWebGPUBatchedPolyDataMapper_h
12#define vtkWebGPUBatchedPolyDataMapper_h
16#include "vtkRenderingWebGPUModule.h"
22VTK_ABI_NAMESPACE_BEGIN
120 bool homogeneousCellSize,
bool useEdgeArray)
override;
123 bool homogeneousCellSize,
bool useEdgeArray)
override;
127 vtkWebGPUActor* wgpuActor, std::string& vss, std::string& fss)
override;
130 std::string& fss)
override;
162 std::map<std::uintptr_t, std::unique_ptr<BatchElement>> VTKPolyDataToBatchElement;
163 std::map<unsigned int, std::uintptr_t> FlatIndexToPolyData;
165 struct CompositeDataProperties
167 vtkTypeUInt32 ApplyOverrideColors = 0;
168 vtkTypeFloat32 Opacity = 0;
169 vtkTypeUInt32 CompositeId = 0;
170 vtkTypeUInt32 Pickable = 1;
171 vtkTypeFloat32 Ambient[3] = {};
172 vtkTypeUInt32 CellIdOffsetForVerts = 0;
173 vtkTypeFloat32 Diffuse[3] = {};
174 vtkTypeUInt32 CellIdOffsetForLines = 0;
175 vtkTypeUInt32 CellIdOffsetForPolys = 0;
176 vtkTypeUInt32 CellIdOffsetForSelector = 0;
180 WGPUBuffer Buffer =
nullptr;
181 std::uint64_t Size = 0;
182 std::uint32_t BindingSize = 0;
184 StorageBuffer CompositeDataPropertyStorage;
185 vtkTimeStamp ResourcesSyncTimeStamp;
187 std::size_t CurrentDrawMeshId = 0;
188 std::uint32_t MinStorageBufferOffsetAlignment = 0;
190 bool AllocateCompositeDataPropertyStorageBuffer(vtkWebGPUConfiguration* wgpuConfiguration);
represents an object (geometry & properties) in a rendered scene
a class that renders hierarchical polygonal data
general representation of visualization data
a simple class to control print indentation
concrete dataset represents vertices, lines, polygons, and triangle strips
represent surface properties of a geometric object
abstract specification for renderers
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool EnsureInput() override
Override to ensure batch is not empty.
void RenderPiece(vtkRenderer *renderer, vtkActor *actor) override
Implemented by sub classes.
std::vector< WGPUBindGroupEntry > GetTopologyBindGroupEntries(vtkWebGPUCellToPrimitiveConverter::TopologySourceType topologySourceType, bool homogeneousCellSize, bool useEdgeArray) override
Override to customize bindings when homogeneousCellSize=true.
vtkWebGPUBatchedPolyDataMapper()
void ReplaceVertexShaderPicking(GraphicsPipelineType pipelineType, vtkWebGPURenderer *wgpuRenderer, vtkWebGPUActor *wgpuActor, std::string &vss) override
void ReplaceFragmentShaderColors(GraphicsPipelineType pipelineType, vtkWebGPURenderer *wgpuRenderer, vtkWebGPUActor *wgpuActor, std::string &fss) override
BatchElement * GetBatchElement(vtkPolyData *polydata)
API to add and query a BatchElement instance per vtkPolyData.
void UnmarkBatchElements()
void ReplaceVertexShaderCellId(GraphicsPipelineType pipelineType, vtkWebGPURenderer *renderer, vtkWebGPUActor *actor, std::string &vss) override
std::vector< WGPUBindGroupLayoutEntry > GetMeshBindGroupLayoutEntries() override
Override to add another binding for CompositeDataPropertyStorage.
vtkWebGPUCompositePolyDataMapperDelegator::BatchElement BatchElement
API to add and query a BatchElement instance per vtkPolyData.
bool ShouldReleaseGraphicsResourcesOnSync() override
Override to detect changes in the polydata batch.
unsigned long GetPointAttributeByteSize(vtkWebGPUPolyDataMapper::PointDataAttributes attribute) override
Override to accumulate the sizes of the given attribute from all the polydata in the batch.
void ReplaceShaderCustomBindings(GraphicsPipelineType pipelineType, vtkWebGPURenderer *wgpuRenderer, vtkWebGPUActor *wgpuActor, std::string &vss, std::string &fss) override
void ClearUnmarkedBatchElements()
std::vector< vtkPolyData * > GetRenderedList() const
Accessor to the ordered list of PolyData that we last drew.
void UpdateMeshGeometryBuffers(vtkWebGPUConfiguration *wgpuConfiguration) override
Override to upload all the polydata from the batch.
std::vector< WGPUBindGroupEntry > GetMeshBindGroupEntries() override
Override to add another binding for CompositeDataPropertyStorage.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
void UpdateMeshTopologyBuffers(vtkWebGPUConfiguration *wgpuConfiguration, vtkProperty *displayProperty) override
Override to upload all the polydata from the batch.
vtkMTimeType GetMTime() override
Returns the maximum of our and Parent vtkCompositePolyDataMapper's MTime.
void ReplaceFragmentShaderPicking(GraphicsPipelineType pipelineType, vtkWebGPURenderer *wgpuRenderer, vtkWebGPUActor *wgpuActor, std::string &fss) override
void DeducePointCellAttributeAvailability() override
Override to call super class for each polydata in batch.
std::vector< WGPUBindGroupLayoutEntry > GetTopologyBindGroupLayoutEntries(bool homogeneousCellSize, bool useEdgeArray) override
Override to customize bindings when homogeneousCellSize=true.
void ReplaceShaderCustomDef(GraphicsPipelineType pipelineType, vtkWebGPURenderer *wgpuRenderer, vtkWebGPUActor *wgpuActor, std::string &vss, std::string &fss) override
~vtkWebGPUBatchedPolyDataMapper() override
static vtkWebGPUBatchedPolyDataMapper * New()
unsigned long GetCellAttributeByteSize(vtkWebGPUPolyDataMapper::CellDataAttributes attribute) override
Override to accumulate the sizes of the given attribute from all the polydata in the batch.
int CanUseTextureMapForColoring(vtkDataObject *) override
Returns if we can use texture maps for scalar coloring.
void ClearBatchElements()
API to add and query a BatchElement instance per vtkPolyData.
DrawCallArgs GetDrawCallArgs(GraphicsPipelineType pipelineType, vtkWebGPUCellToPrimitiveConverter::TopologySourceType topologySourceType) override
Override to return the correct vertex offset and vertex count for the mesh currently being drawn with...
void AddBatchElement(unsigned int flatIndex, BatchElement &&batchElement)
API to add and query a BatchElement instance per vtkPolyData.
void SetParent(vtkCompositePolyDataMapper *parent)
DrawCallArgs GetDrawCallArgsForDrawingVertices(vtkWebGPUCellToPrimitiveConverter::TopologySourceType topologySourceType) override
Override to return the correct vertex offset and vertex count for the mesh currently being drawn with...
TopologySourceType
All supported types of topology.
vtkCompositePolyDataMapperDelegator::BatchElement BatchElement
Create a webgpu device for use in rendering and compute pipelines.
PointDataAttributes
All the attributes supported by the point data buffer.
friend class vtkWebGPURenderer
vtkWebGPUPolyDataMapper()
GraphicsPipelineType
This mapper uses different WGPURenderPipeline to render a list of primitives.
CellDataAttributes
All the attributes supported by the cell data buffer.
window superclass for vtkRenderWindow
vtkTypeUInt32 vtkMTimeType