VTK  9.5.20251112
vtkCompositePolyDataMapper.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
44#ifndef vtkCompositePolyDataMapper_h
45#define vtkCompositePolyDataMapper_h
46
47#include "vtkPolyDataMapper.h"
48
49#include "vtkRenderingCoreModule.h" // for export macro
50#include "vtkStateStorage.h" // for ivar
51#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
52
53#include <array> // for ColorResult. Remove when double* GetBlockColor gets removed.
54#include <memory> // for unique_ptr
55#include <vector> // for return
56
57VTK_ABI_NAMESPACE_BEGIN
58class vtkActor;
63class vtkInformation;
64class vtkPolyData;
65class vtkRenderer;
66class vtkTexture;
67
68class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkCompositePolyDataMapper : public vtkPolyDataMapper
69{
70public:
73 void PrintSelf(ostream& os, vtkIndent indent) override;
74
79 void Render(vtkRenderer* renderer, vtkActor* actor) override;
80
82
85 double* GetBounds() VTK_SIZEHINT(6) override;
86 void GetBounds(double bounds[6]) override { this->Superclass::GetBounds(bounds); }
88
92 void ShallowCopy(vtkAbstractMapper* mapper) override;
93
98
100
105 bool HasOpaqueGeometry() override;
108
110
116
118
121 void SetBlockVisibility(unsigned int index, bool visible);
122 bool GetBlockVisibility(unsigned int index);
123 void RemoveBlockVisibility(unsigned int index);
126
128
131 void SetBlockColor(unsigned int index, const double color[3]);
132 void SetBlockColor(unsigned int index, double r, double g, double b)
133 {
134 double color[3] = { r, g, b };
135 this->SetBlockColor(index, color);
136 }
137 void GetBlockColor(unsigned int index, double color[3]);
138 void RemoveBlockColor(unsigned int index);
141
143
146 void SetBlockOpacity(unsigned int index, double opacity);
147 double GetBlockOpacity(unsigned int index);
148 void RemoveBlockOpacity(unsigned int index);
151
153
156 void SetBlockScalarMode(unsigned int index, int value);
157 int GetBlockScalarMode(unsigned int index);
158 void RemoveBlockScalarMode(unsigned int index);
161
163
166 void SetBlockArrayAccessMode(unsigned int index, int value);
167 int GetBlockArrayAccessMode(unsigned int index);
168 void RemoveBlockArrayAccessMode(unsigned int index);
171
173
176 void SetBlockArrayComponent(unsigned int index, int value);
177 int GetBlockArrayComponent(unsigned int index);
178 void RemoveBlockArrayComponent(unsigned int index);
181
183
186 void SetBlockArrayId(unsigned int index, int value);
187 int GetBlockArrayId(unsigned int index);
188 void RemoveBlockArrayId(unsigned int index);
191
193
196 void SetBlockArrayName(unsigned int index, const std::string& value);
197 std::string GetBlockArrayName(unsigned int index);
198 void RemoveBlockArrayName(unsigned int index);
201
203
206 void SetBlockFieldDataTupleId(unsigned int index, vtkIdType value);
208 void RemoveBlockFieldDataTupleId(unsigned int index);
211
213
219 void SetBlockTextureImage(unsigned int index, vtkSmartPointer<vtkImageData> textureImage);
220 void SetBlockTexture(unsigned int index, vtkSmartPointer<vtkTexture> texture);
222 void RemoveBlockTexture(unsigned int index);
225
227
233 vtkSetMacro(ColorMissingArraysWithNanColor, bool);
234 vtkGetMacro(ColorMissingArraysWithNanColor, bool);
235 vtkBooleanMacro(ColorMissingArraysWithNanColor, bool);
237
239
244 int idx, int port, int connection, int fieldAssociation, const char* name) override;
246 int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override;
247 void SetInputArrayToProcess(int idx, vtkInformation* info) override;
249
253 std::vector<vtkPolyData*> GetRenderedList();
254
260 vtkHardwareSelector* sel, std::vector<unsigned int>& pixeloffsets, vtkProp* prop) override;
261
265 void SetVBOShiftScaleMethod(int method) override;
266
272 void SetPauseShiftScale(bool pauseShiftScale) override;
273
278
279protected:
282
283 MapperHashType InsertPolyData(vtkPolyData* polydata, const unsigned int& flatIndex);
284
291
295 int FillInputPortInformation(int port, vtkInformation* info) override;
296
305
313 {
314 }
315
322 {
323 }
324
329
334
338 void ComputeBounds() override;
339
340 bool RecursiveHasTranslucentGeometry(vtkDataObject* dobj, unsigned int& flat_index);
341
343 vtkRenderer* renderer, vtkActor* actor, vtkDataObject* dobj, unsigned int& flat_index);
344
351
356
361 bool ColorMissingArraysWithNanColor = false;
362
367
369 bool HasTranslucentGeometry = false;
373
374private:
376 void operator=(const vtkCompositePolyDataMapper&) = delete;
377
378 class vtkInternals;
379 std::unique_ptr<vtkInternals> Internals;
380};
381
382VTK_ABI_NAMESPACE_END
383#endif
abstract class specifies interface to map data
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
void SetInputArrayToProcess(const char *name, int fieldAssociation, int component=vtkArrayComponents::AllComponents)
Set the input data arrays that this algorithm will process.
Rendering attributes for a multi-block dataset.
abstract superclass for composite (multi-block or AMR) datasets
Delegates rendering of multiple polydata that share similar signatures.
a class that renders hierarchical polygonal data
std::vector< vtkPolyData * > GetRenderedList()
Accessor to the ordered list of PolyData that we last drew.
void SetBlockFieldDataTupleId(unsigned int index, vtkIdType value)
void RemoveBlockColor(unsigned int index)
Set/get the color for a block given its flat index.
vtkCompositeDataDisplayAttributes * GetCompositeDataDisplayAttributes()
Set/get the composite data set attributes.
double GetBlockOpacity(unsigned int index)
Set/get the opacity for a block given its flat index.
MapperHashType InsertPolyData(vtkPolyData *polydata, const unsigned int &flatIndex)
bool GetBlockVisibility(unsigned int index)
Set/get the visibility for a block given its flat index.
void SetBlockArrayAccessMode(unsigned int index, int value)
void ComputeBounds() override
Need to loop over the hierarchy to compute bounds.
void SetCompositeDataDisplayAttributes(vtkCompositeDataDisplayAttributes *attributes)
Set/get the composite data set attributes.
void RemoveBlockArrayAccessMode(unsigned int index)
vtkSmartPointer< vtkTexture > GetBlockTexture(unsigned int index)
Set/Get/Remove the texture for a specific block in the rendered composite data given the flat index.
void RemoveBlockOpacity(unsigned int index)
Set/get the opacity for a block given its flat index.
virtual vtkCompositePolyDataMapperDelegator * CreateADelegator()
This is the build method for creating the delegator.
void RemoveBlockColors()
Set/get the color for a block given its flat index.
vtkPolyDataMapper::MapperHashType GenerateHash(vtkPolyData *polydata) override
Creates an empty polydata mapper and asks the mapper to hash the polydata.
void SetVBOShiftScaleMethod(int method) override
A convenience method for enabling/disabling the VBO's shift+scale transform.
int GetBlockScalarMode(unsigned int index)
void RemoveBlockTextures()
Set/Get/Remove the texture for a specific block in the rendered composite data given the flat index.
vtkExecutive * CreateDefaultExecutive() override
We need to override this method because the standard streaming demand driven pipeline is not what we ...
void RemoveBlockArrayName(unsigned int index)
vtkMTimeType GetMTime() override
Overridden to include vtkCompositeDataDisplayAttributes' mtime.
vtkNew< vtkPolyDataMapper > PrototypeMapper
A prototype of the object factory override mapper.
void RemoveBlockVisibility(unsigned int index)
Set/get the visibility for a block given its flat index.
void SetBlockArrayComponent(unsigned int index, int value)
void SetBlockVisibility(unsigned int index, bool visible)
Set/get the visibility for a block given its flat index.
bool RecursiveHasTranslucentGeometry(vtkDataObject *dobj, unsigned int &flat_index)
virtual void PreRender(const std::vector< vtkSmartPointer< vtkCompositePolyDataMapperDelegator > > &, vtkRenderer *, vtkActor *)
Invoked just before all delegators render their datasets.
void SetBlockScalarMode(unsigned int index, int value)
void SetInputArrayToProcess(int idx, int port, int connection, int fieldAssociation, int fieldAttributeType) override
Call SetInputArrayToProcess on helpers.
void SetBlockArrayId(unsigned int index, int value)
void Render(vtkRenderer *renderer, vtkActor *actor) override
Standard method for rendering a mapper.
void ShallowCopy(vtkAbstractMapper *mapper) override
Make a shallow copy of this mapper.
void ReleaseGraphicsResources(vtkWindow *) override
Release the underlying resources associated with this mapper.
void GetBlockColor(unsigned int index, double color[3])
Set/get the color for a block given its flat index.
void SetPauseShiftScale(bool pauseShiftScale) override
Pause updates of shift-scale parameters based on camera position.
vtkSmartPointer< vtkCompositeDataDisplayAttributes > CompositeAttributes
Composite data set attributes.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetBlockColor(unsigned int index, const double color[3])
Set/get the color for a block given its flat index.
static vtkCompositePolyDataMapper * New()
void RemoveBlockOpacities()
Set/get the opacity for a block given its flat index.
void SetBlockTexture(unsigned int index, vtkSmartPointer< vtkTexture > texture)
Set/Get/Remove the texture for a specific block in the rendered composite data given the flat index.
void RemoveBlockVisibilities()
Set/get the visibility for a block given its flat index.
void RemoveBlockScalarMode(unsigned int index)
void SetInputArrayToProcess(int idx, vtkInformation *info) override
Call SetInputArrayToProcess on helpers.
void RemoveBlockArrayId(unsigned int index)
void RemoveBlockArrayComponent(unsigned int index)
int GetBlockArrayComponent(unsigned int index)
double * GetBounds() override
Standard vtkProp method to get 3D bounds of a 3D prop.
void SetBlockArrayName(unsigned int index, const std::string &value)
void BuildRenderValues(vtkRenderer *renderer, vtkActor *actor, vtkDataObject *dobj, unsigned int &flat_index)
std::string GetBlockArrayName(unsigned int index)
~vtkCompositePolyDataMapper() override
void RemoveBlockTexture(unsigned int index)
Set/Get/Remove the texture for a specific block in the rendered composite data given the flat index.
void SetBlockOpacity(unsigned int index, double opacity)
Set/get the opacity for a block given its flat index.
virtual void PostRender(const std::vector< vtkSmartPointer< vtkCompositePolyDataMapperDelegator > > &, vtkRenderer *, vtkActor *)
Invoked just after all delegators render their datasets.
virtual vtkDataObjectTreeIterator * MakeAnIterator(vtkCompositeDataSet *dataset)
Initialize an iterator for the composite dataset.
void RemoveBlockFieldDataTupleId(unsigned int index)
vtkIdType GetBlockFieldDataTupleId(unsigned int index)
int GetBlockArrayId(unsigned int index)
bool HasTranslucentPolygonalGeometry() override
Some introspection on the type of data the mapper will render used by props to determine if they shou...
bool HasOpaqueGeometry() override
Some introspection on the type of data the mapper will render used by props to determine if they shou...
void SetBlockColor(unsigned int index, double r, double g, double b)
Set/get the color for a block given its flat index.
void SetInputArrayToProcess(int idx, int port, int connection, int fieldAssociation, const char *name) override
Call SetInputArrayToProcess on helpers.
void SetBlockTextureImage(unsigned int index, vtkSmartPointer< vtkImageData > textureImage)
Set/Get/Remove the texture for a specific block in the rendered composite data given the flat index.
int FillInputPortInformation(int port, vtkInformation *info) override
Need to define the type of data handled by this mapper.
vtkTimeStamp BoundsMTime
Time stamp for computation of bounds.
int GetBlockArrayAccessMode(unsigned int index)
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 ...
superclass for composite data iterators
general representation of visualization data
Superclass for all pipeline executives in VTK.
a simple class to control print indentation
Definition vtkIndent.h:108
Store vtkAlgorithm input/output information.
double * GetBounds() override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
Allocate and hold a VTK object.
Definition vtkNew.h:167
map vtkPolyData to graphics primitives
std::uintptr_t MapperHashType
concrete dataset represents vertices, lines, polygons, and triangle strips
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:69
abstract specification for renderers
Hold a reference to a vtkObjectBase instance.
Class to make storing and comparing state quick and easy.
handles properties associated with a texture map
Definition vtkTexture.h:168
record modification and/or execution time
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkIdType
Definition vtkType.h:367
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:322
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO