VTK  9.4.20250210
vtkWebGPUBatchedPolyDataMapper.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
11#ifndef vtkWebGPUBatchedPolyDataMapper_h
12#define vtkWebGPUBatchedPolyDataMapper_h
13
15
16#include "vtkRenderingWebGPUModule.h" // for export macro
17#include "vtkWebGPUCompositePolyDataMapperDelegator.h" // for struct BatchElement
18
19#include <cstdint> // for std::uintptr_t
20#include <memory> // for unique_ptr
21
22VTK_ABI_NAMESPACE_BEGIN
24class vtkPolyData;
25
26class VTKRENDERINGWEBGPU_EXPORT vtkWebGPUBatchedPolyDataMapper : public vtkWebGPUPolyDataMapper
27{
28public:
31 void PrintSelf(ostream& os, vtkIndent indent) override;
32
34
38 void AddBatchElement(unsigned int flatIndex, BatchElement&& batchElement);
42
46 std::vector<vtkPolyData*> GetRenderedList() const;
48
52 void RenderPiece(vtkRenderer* renderer, vtkActor* actor) override;
55
60
61protected:
64
65 // Reference to CPDM
66 vtkCompositePolyDataMapper* Parent = nullptr;
67 // Maps an address of a vtkPolyData to its rendering attributes.
68 std::map<std::uintptr_t, std::unique_ptr<BatchElement>> VTKPolyDataToBatchElement;
69 std::map<unsigned int, std::uintptr_t> FlatIndexToPolyData;
70
71 // Upload timestamp of override colors.
73 bool LastBlockVisibility = true;
74 bool LastUseNanColor = false;
75
77 bool applyOverrides, double overrideOpacity, const vtkColor3d& overrideAmbientColor,
78 const vtkColor3d& overrideDiffuseColor);
79
80private:
82 void operator=(const vtkWebGPUBatchedPolyDataMapper&) = delete;
83};
84
85VTK_ABI_NAMESPACE_END
86#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
a class that renders hierarchical polygonal data
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.
record modification and/or execution time
A WebGPU mapper for batched rendering of vtkPolyData.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void RenderPiece(vtkRenderer *renderer, vtkActor *actor) override
Implemented by sub classes.
BatchElement * GetBatchElement(vtkPolyData *polydata)
API to add and query a BatchElement instance per vtkPolyData.
std::map< std::uintptr_t, std::unique_ptr< BatchElement > > VTKPolyDataToBatchElement
void WriteOverrideColorBuffer(vtkSmartPointer< vtkWebGPUConfiguration > wgpuConfiguration, bool applyOverrides, double overrideOpacity, const vtkColor3d &overrideAmbientColor, const vtkColor3d &overrideDiffuseColor)
std::vector< vtkPolyData * > GetRenderedList() const
Accessor to the ordered list of PolyData that we last drew.
vtkMTimeType GetMTime() override
Returns the maximum of our and Parent vtkCompositePolyDataMapper's MTime.
~vtkWebGPUBatchedPolyDataMapper() override
static vtkWebGPUBatchedPolyDataMapper * New()
std::map< unsigned int, std::uintptr_t > FlatIndexToPolyData
void ClearBatchElements()
API to add and query a BatchElement instance per vtkPolyData.
void AddBatchElement(unsigned int flatIndex, BatchElement &&batchElement)
API to add and query a BatchElement instance per vtkPolyData.
void SetParent(vtkCompositePolyDataMapper *parent)
vtkCompositePolyDataMapperDelegator::BatchElement BatchElement
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270