3#ifndef vtkWebGPUPolyDataMapper_h
4#define vtkWebGPUPolyDataMapper_h
8#include "vtkRenderingWebGPUModule.h"
12#include <unordered_set>
14VTK_ABI_NAMESPACE_BEGIN
16class vtkTypeFloat32Array;
95 int fieldAssociation,
int componentno = -1)
override;
103 int fieldAssociation,
int componentno = -1)
override;
139 int uniformsBinding);
146 int uniformsBinding);
244 vtkTypeUInt32 Start = 0;
245 vtkTypeUInt32 NumTuples = 0;
246 vtkTypeUInt32 NumComponents = 0;
247 vtkTypeUInt32 Pad = 0;
265 bool InitializedPipeline =
false;
266 bool UpdatedPrimitiveSizes =
false;
267 bool UpdatedGeometryBuffers =
false;
268 bool UpdatedPrimitiveBuffers =
false;
269 bool HasPointColors =
false;
270 bool HasPointNormals =
false;
271 bool HasPointTangents =
false;
272 bool HasPointUVs =
false;
273 bool HasCellColors =
false;
274 bool HasCellNormals =
false;
301 vtkTypeUInt32 VertexCount = 0;
309 unsigned long EdgeArrayCount = 0;
324 wgpu::Buffer GetPointDataWGPUBuffer() {
return this->MeshSSBO.
Point.
Buffer; }
329 wgpu::Buffer GetCellDataWGPUBuffer() {
return this->MeshSSBO.
Cell.
Buffer; }
337 std::vector<vtkSmartPointer<vtkWebGPUComputeRenderBuffer>> SetupComputeRenderBuffers;
342 std::unordered_set<vtkSmartPointer<vtkWebGPUComputeRenderBuffer>> NotSetupComputeRenderBuffers;
347 const PointDataAttributes PointDataAttributesOrder[PointDataAttributes::POINT_NB_ATTRIBUTES] = {
348 PointDataAttributes::POINT_POSITIONS, PointDataAttributes::POINT_COLORS,
349 PointDataAttributes::POINT_NORMALS, PointDataAttributes::POINT_TANGENTS,
350 PointDataAttributes::POINT_UVS
356 const CellDataAttributes CellDataAttributesOrder[CellDataAttributes::CELL_NB_ATTRIBUTES] = {
357 CellDataAttributes::CELL_EDGES, CellDataAttributes::CELL_COLORS,
358 CellDataAttributes::CELL_NORMALS
abstract class specifies interface to map data
represents an object (geometry & properties) in a rendered scene
object to represent cell connectivity
abstract superclass for arrays of numeric data
a simple class to control print indentation
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
abstract superclass for all actors, volumes and annotations
abstract specification for renderers
Hold a reference to a vtkObjectBase instance.
record modification and/or execution time
Render buffers are returned by calls to vtkWebGPUPolyDataMapper::AcquirePointAttributeComputeRenderBu...
PointDataAttributes
All the attributes supported by the point data buffer.
unsigned long GetPointAttributeByteSize(vtkWebGPUPolyDataMapper::PointDataAttributes attribute)
Returns the size of the 'sub-buffer' within the whole point data SSBO for the given attribute.
wgpu::BindGroupLayout MeshAttributeBindGroupLayout
vtkTimeStamp PointCellAttributesBuildTimestamp
void ProcessSelectorPixelBuffers(vtkHardwareSelector *sel, std::vector< unsigned int > &pixeloffsets, vtkProp *prop) override
allows a mapper to update a selections color buffers Called from a prop which in turn is called from ...
bool GetSupportsSelection() override
void SetupBindGroups(const wgpu::Device &device, vtkRenderer *renderer)
Creates bind groups for all the buffers in the MeshGeometryBuffers struct.
PrimitiveBindGroupInfo PointPrimitiveBGInfo
wgpu::BindGroup MeshAttributeBindGroup
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
PrimitiveBindGroupInfo TrianglePrimitiveBGInfo
vtkIdType GetPointAttributeByteOffset(PointDataAttributes attribute)
Returns the offset at which the 'sub-buffer' of 'attribute' starts within the mesh SSBO point data bu...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
unsigned long GetCellAttributeElementSize(vtkWebGPUPolyDataMapper::CellDataAttributes attribute)
Returns the size in bytes of one element of the given attribute.
void MapDataArrayToVertexAttribute(const char *vertexAttributeName, const char *dataArrayName, int fieldAssociation, int componentno=-1) override
Select a data array from the point/cell data and map it to a generic vertex attribute.
void EncodeRenderCommands(vtkRenderer *renderer, vtkActor *act, const wgpu::RenderBundleEncoder &bundleEncoder)
void RemoveAllVertexAttributeMappings() override
Remove all vertex attributes.
wgpu::ShaderModule Shader
PrimitiveBindGroupInfo LinePrimitiveBGInfo
MeshAttributeBuffers MeshSSBO
vtkSmartPointer< vtkWebGPUComputeRenderBuffer > AcquirePointAttributeComputeRenderBuffer(PointDataAttributes attribute, int bufferGroup, int bufferBinding, int uniformsGroup, int uniformsBinding)
Returns an already configured (ready to be added to a vtkWebGPUComputePipeline) buffer bound to the g...
void SetupPipelineLayout(const wgpu::Device &device, vtkRenderer *renderer, vtkActor *actor)
Sets up bindgroup layouts and creates a pipeline layout.
vtkSmartPointer< vtkWebGPUComputeRenderBuffer > AcquireCellAttributeComputeRenderBuffer(CellDataAttributes attribute, int bufferGroup, int bufferBinding, int uniformsGroup, int uniformsBinding)
Same as AcquirePointAttributeComputeRenderBuffer but for cell data attributes.
wgpu::PipelineLayout PipelineLayout
unsigned long GetExactPointBufferSize()
Enqueues a write command on the device queue for all buffers whose data is outdated.
void ShallowCopy(vtkAbstractMapper *m) override
Make a shallow copy of this mapper.
vtkIdType GetCellAttributeByteOffset(CellDataAttributes attribute)
Returns the offset at which the 'sub-buffer' of 'attribute' starts within the mesh SSBO cell data buf...
vtkWebGPUPolyDataMapper()
bool UpdateMeshIndexBuffers(const wgpu::Device &device)
void RemoveVertexAttributeMapping(const char *vertexAttributeName) override
Remove a vertex attribute mapping.
static vtkWebGPUPolyDataMapper * New()
vtkTypeFloat32Array * ComputeEdgeArray(vtkCellArray *polys)
~vtkWebGPUPolyDataMapper() override
bool UpdateMeshGeometryBuffers(vtkWebGPURenderWindow *wgpuRenWin, const wgpu::Device &device, vtkActor *actor)
void MapDataArrayToMultiTextureAttribute(const char *tname, const char *dataArrayName, int fieldAssociation, int componentno=-1) override
void EncodeRenderCommands(vtkRenderer *renderer, vtkActor *act, const wgpu::RenderPassEncoder &passEncoder)
unsigned long GetCellAttributeByteSize(vtkWebGPUPolyDataMapper::CellDataAttributes attribute)
Returns the size of the 'sub-buffer' within the whole cell data SSBO for the given attribute.
bool LastScalarVisibility
std::vector< unsigned long > GetExactConnecitivityBufferSizes()
void SetupGraphicsPipeline(const wgpu::Device &device, vtkRenderer *renderer, vtkActor *actor)
Creates the graphics pipeline.
void RenderPiece(vtkRenderer *ren, vtkActor *act) override
Implemented by sub classes.
wgpu::BindGroupLayout PrimitiveBindGroupLayout
vtkTimeStamp Primitive2CellIDsBuildTimestamp
unsigned long GetExactCellBufferSize()
wgpu::Buffer AttributeDescriptorBuffer
unsigned long GetPointAttributeElementSize(vtkWebGPUPolyDataMapper::PointDataAttributes attribute)
Returns the size in bytes of one element of the given attribute.
CellDataAttributes
All the attributes supported by the cell data buffer.
void ComputeBounds() override
Called in GetBounds().
window superclass for vtkRenderWindow
struct vtkWebGPUPolyDataMapper::MeshAttributeBuffers::@202 Cell
struct vtkWebGPUPolyDataMapper::MeshAttributeBuffers::@201 Point
AttributeDescriptor Positions
AttributeDescriptor CellColors
AttributeDescriptor CellNormals
AttributeDescriptor Normals
AttributeDescriptor CellEdgeArray
AttributeDescriptor Colors
AttributeDescriptor Tangents
wgpu::BindGroup BindGroup
wgpu::Buffer PrimitiveSizeBuffer
wgpu::RenderPipeline Pipeline