vtkGeometryRepresentation.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
16 #ifndef vtkGeometryRepresentation_h
17 #define vtkGeometryRepresentation_h
18 
20 #include "vtkProperty.h" // needed for VTK_POINTS etc.
21 #include "vtkRemotingViewsModule.h" // needed for exports
22 #include "vtkVector.h" // for vtkVector.
23 
24 #include <set> // needed for std::set
25 #include <string> // needed for std::string
26 #include <unordered_map> // needed for std::unordered_map
27 
29 class vtkMapper;
32 class vtkPVLODActor;
33 class vtkScalarsToColors;
34 class vtkTexture;
35 
37 {
38 // This is defined to either vtkQuadricClustering or vtkmLevelOfDetail in the
39 // implementation file:
41 }
42 
43 class VTKREMOTINGVIEWS_EXPORT vtkGeometryRepresentation : public vtkPVDataRepresentation
44 {
45 
46 public:
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
58  vtkInformation* outInfo) override;
59 
64  void SetVisibility(bool val) override;
65 
67 
71  void SetBlockColorsDistinctValues(int distinctValues);
72  int GetBlockColorsDistinctValues();
74 
78  virtual void SetSuppressLOD(bool suppress) { this->SuppressLOD = suppress; }
79 
81 
88  vtkSetMacro(Ambient, double);
89  vtkSetMacro(Diffuse, double);
90  vtkSetMacro(Specular, double);
91  vtkGetMacro(Ambient, double);
92  vtkGetMacro(Diffuse, double);
93  vtkGetMacro(Specular, double);
95 
97  {
98  POINTS = VTK_POINTS,
99  WIREFRAME = VTK_WIREFRAME,
100  SURFACE = VTK_SURFACE,
101  SURFACE_WITH_EDGES = 3
102  };
103 
105 
109  void SetCoordinateShiftScaleMethod(int val);
110  int GetCoordinateShiftScaleMethod();
112 
114 
118  vtkSetClampMacro(Representation, int, POINTS, SURFACE_WITH_EDGES);
119  vtkGetMacro(Representation, int);
121 
126  virtual void SetRepresentation(const char*);
127 
131  vtkDataObject* GetRenderedDataObject(int port) override;
132 
134 
139  vtkSetMacro(RequestGhostCellsIfNeeded, bool);
140  vtkGetMacro(RequestGhostCellsIfNeeded, bool);
141  vtkBooleanMacro(RequestGhostCellsIfNeeded, bool);
143 
148  virtual void SetNormalArray(const char* val);
149 
154  virtual void SetTCoordArray(const char* val);
155 
160  virtual void SetTangentArray(const char* val);
161 
162  //***************************************************************************
163  // Forwarded to vtkPVGeometryFilter
164  virtual void SetUseOutline(int);
165  void SetTriangulate(int);
166  void SetNonlinearSubdivisionLevel(int);
167  void SetMatchBoundariesIgnoringCellOrder(int);
168  virtual void SetGenerateFeatureEdges(bool);
169 
170  //***************************************************************************
171  // Forwarded to vtkProperty.
172  virtual void SetAmbientColor(double r, double g, double b);
173  virtual void SetColor(double r, double g, double b);
174  virtual void SetDiffuseColor(double r, double g, double b);
175  virtual void SetEdgeColor(double r, double g, double b);
176  virtual void SetInteractiveSelectionColor(double r, double g, double b);
177  virtual void SetInterpolation(int val);
178  virtual void SetLineWidth(double val);
179  virtual void SetOpacity(double val);
180  virtual void SetEdgeOpacity(double val);
181  virtual void SetPointSize(double val);
182  virtual void SetSpecularColor(double r, double g, double b);
183  virtual void SetSpecularPower(double val);
184  virtual void SetLuminosity(double val);
185  virtual void SetRenderPointsAsSpheres(bool);
186  virtual void SetRenderLinesAsTubes(bool);
187  virtual void SetRoughness(double val);
188  virtual void SetMetallic(double val);
189  virtual void SetEdgeTint(double r, double g, double b);
190  virtual void SetAnisotropy(double val);
191  virtual void SetAnisotropyRotation(double val);
192  virtual void SetBaseIOR(double val);
193  virtual void SetCoatIOR(double val);
194  virtual void SetCoatStrength(double val);
195  virtual void SetCoatRoughness(double val);
196  virtual void SetCoatNormalScale(double val);
197  virtual void SetCoatColor(double r, double g, double b);
198  virtual void SetBaseColorTexture(vtkTexture* tex);
199  virtual void SetMaterialTexture(vtkTexture* tex);
200  virtual void SetAnisotropyTexture(vtkTexture* tex);
201  virtual void SetNormalTexture(vtkTexture* tex);
202  virtual void SetCoatNormalTexture(vtkTexture* tex);
203  virtual void SetEmissiveTexture(vtkTexture* tex);
204  virtual void SetNormalScale(double val);
205  virtual void SetOcclusionStrength(double val);
206  virtual void SetEmissiveFactor(double rval, double gval, double bval);
207  virtual void SetShowTexturesOnBackface(bool);
208 
209  //***************************************************************************
210  // Forwarded to Actor.
211  virtual void SetOrientation(double, double, double);
212  virtual void SetOrigin(double, double, double);
213  virtual void SetPickable(int val);
214  virtual void SetPosition(double, double, double);
215  virtual void SetScale(double, double, double);
216  virtual void SetTexture(vtkTexture*);
217  virtual void SetUserTransform(const double[16]);
218  virtual void SetFlipTextures(bool);
219 
220  //***************************************************************************
221  // Forwarded to all textures
222  virtual void SetRepeatTextures(bool);
223  vtkGetMacro(RepeatTextures, bool);
224  virtual void SetInterpolateTextures(bool);
225  vtkGetMacro(InterpolateTextures, bool);
226  virtual void SetUseMipmapTextures(bool);
227  vtkGetMacro(UseMipmapTextures, bool);
228 
229  //***************************************************************************
230  // Forwarded to Mapper and LODMapper.
231  virtual void SetInterpolateScalarsBeforeMapping(int val);
232  virtual void SetLookupTable(vtkScalarsToColors* val);
233  virtual void SetColorMissingArraysWithNanColor(bool val);
234  virtual void SetSeamlessU(bool);
235  virtual void SetSeamlessV(bool);
237 
244  virtual void SetMapScalars(int val);
245  virtual void SetStatic(int val);
247 
251  virtual void SetSelection(vtkSelection* selection);
252 
256  vtkPVLODActor* GetActor() { return this->GetRenderedProp(); }
257 
259 
265  vtkSetStringMacro(ActiveAssembly);
266  vtkGetStringMacro(ActiveAssembly);
268 
270 
273  void AddBlockSelector(const char*);
274  void RemoveAllBlockSelectors();
276 
278 
281  void SetBlockColor(const char*, double, double, double);
282  void RemoveAllBlockColors();
284 
286 
289  void SetBlockOpacity(const char*, double);
290  void RemoveAllBlockOpacities();
292 
296  const char* GetColorArrayName();
297 
305  static bool GetBounds(
306  vtkDataObject* dataObject, double bounds[6], vtkCompositeDataDisplayAttributes* cdAttributes);
307 
309 
313  virtual void SetEnableScaling(int v);
314  virtual void SetScalingArrayName(const char*);
315  virtual void SetScalingFunction(vtkPiecewiseFunction* pwf);
317 
321  virtual void SetMaterial(const char*);
322 
324 
330  vtkSetMacro(UseDataPartitions, bool);
331  vtkGetMacro(UseDataPartitions, bool);
333 
335 
338  virtual void SetUseShaderReplacements(bool);
339  vtkGetMacro(UseShaderReplacements, bool);
341 
347  virtual void SetShaderReplacements(const char*);
348 
353  void SetArrayIdNames(const char* pointArray, const char* cellArray) override;
354 
355 protected:
357  ~vtkGeometryRepresentation() override;
358 
365  virtual void SetupDefaults();
366 
370  int FillInputPortInformation(int port, vtkInformation* info) override;
371 
383 
387  int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
388  vtkInformationVector* outputVector) override;
389 
395  bool AddToView(vtkView* view) override;
396 
402  bool RemoveFromView(vtkView* view) override;
403 
407  virtual void UpdateColoringParameters();
408 
412  virtual vtkPVLODActor* GetRenderedProp() { return this->Actor; }
413 
414  // Progress Callback
415  void HandleGeometryRepresentationProgress(vtkObject* caller, unsigned long, void*);
416 
424  void PopulateBlockAttributes(vtkCompositeDataDisplayAttributes* attrs, vtkDataObject* outputData);
425 
430  void ComputeVisibleDataBounds();
431 
435  void UpdateShaderReplacements();
436 
443  virtual bool NeedsOrderedCompositing();
444 
448  virtual void SetPointArrayToProcess(int p, const char* val);
449 
454 
459 
460  char* ActiveAssembly = nullptr;
464  double Ambient;
465  double Specular;
466  double Diffuse;
470  double VisibleDataBounds[6];
471 
473 
475 
477 
480 
481  bool BlockAttrChanged = false;
483  bool UpdateBlockAttrLOD = false;
484 
485  std::set<std::string> BlockSelectors;
486  std::unordered_map<std::string, double> BlockOpacities;
487  std::unordered_map<std::string, vtkVector3d> BlockColors;
488 
489 private:
491  void operator=(const vtkGeometryRepresentation&) = delete;
492 };
493 
494 #endif
vtkGeometryRepresentation_detail::DecimationFilterType
Definition: vtkGeometryRepresentationInternal.h:100
vtkGeometryRepresentation::UseShaderReplacements
bool UseShaderReplacements
Definition: vtkGeometryRepresentation.h:478
vtkDataRepresentation::New
static vtkDataRepresentation * New()
vtkGeometryRepresentation::LODOutlineFilter
vtkPVGeometryFilter * LODOutlineFilter
Definition: vtkGeometryRepresentation.h:453
vtkGeometryRepresentation::BlockOpacities
std::unordered_map< std::string, double > BlockOpacities
Definition: vtkGeometryRepresentation.h:486
vtkGeometryRepresentation
representation for showing any datasets as external shell of polygons.
Definition: vtkGeometryRepresentation.h:43
vtkPVGeometryFilter
Geometry filter that does outlines for volumes.
Definition: vtkPVGeometryFilter.h:42
vtkPVDataRepresentation.h
vtkGeometryRepresentation::LODMapper
vtkMapper * LODMapper
Definition: vtkGeometryRepresentation.h:456
vtkAlgorithm
vtkGeometryRepresentation::ShaderReplacementsString
std::string ShaderReplacementsString
Definition: vtkGeometryRepresentation.h:479
vtkInformationVector
vtkTimeStamp
vtkPVDataRepresentation::AddToView
bool AddToView(vtkView *view) override
Making these methods public.
vtkPVDataRepresentation::SetArrayIdNames
virtual void SetArrayIdNames(const char *vtkNotUsed(pointArray), const char *vtkNotUsed(cellArray))
Specify the array names used for the selection.
Definition: vtkPVDataRepresentation.h:226
vtkGeometryRepresentation::BlockSelectors
std::set< std::string > BlockSelectors
Definition: vtkGeometryRepresentation.h:485
vtkObject
vtkVector.h
vtkGeometryRepresentation_detail
Definition: vtkGeometryRepresentation.h:36
vtkGeometryRepresentation::Specular
double Specular
Definition: vtkGeometryRepresentation.h:465
vtkPVDataRepresentation::SetVisibility
virtual void SetVisibility(bool val)
Get/Set the visibility for this representation.
Definition: vtkPVDataRepresentation.h:89
vtkSelection
vtkGeometryRepresentation::InterpolateTextures
bool InterpolateTextures
Definition: vtkGeometryRepresentation.h:462
vtkPVDataRepresentation::RequestUpdateExtent
int RequestUpdateExtent(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
VTK_WIREFRAME
#define VTK_WIREFRAME
vtkGeometryRepresentation::BlockColors
std::unordered_map< std::string, vtkVector3d > BlockColors
Definition: vtkGeometryRepresentation.h:487
vtkGeometryRepresentation::GetActor
vtkPVLODActor * GetActor()
Provides access to the actor used by this representation.
Definition: vtkGeometryRepresentation.h:256
vtkGeometryRepresentation::RepeatTextures
bool RepeatTextures
Definition: vtkGeometryRepresentation.h:461
vtkGeometryRepresentation::GeometryFilter
vtkAlgorithm * GeometryFilter
Definition: vtkGeometryRepresentation.h:450
vtkCompositeDataDisplayAttributes
vtkGeometryRepresentation::PWF
vtkPiecewiseFunction * PWF
Definition: vtkGeometryRepresentation.h:474
vtkPVDataRepresentation::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Overridden to invoke vtkCommand::UpdateDataEvent.
vtkTexture
vtkGeometryRepresentation::Actor
vtkPVLODActor * Actor
Definition: vtkGeometryRepresentation.h:457
vtkProperty.h
vtkPVDataRepresentation::RemoveFromView
bool RemoveFromView(vtkView *view) override
Making these methods public.
vtkGeometryRepresentation::BlockAttributeTime
vtkTimeStamp BlockAttributeTime
Definition: vtkGeometryRepresentation.h:482
vtkGeometryRepresentation::Mapper
vtkMapper * Mapper
Definition: vtkGeometryRepresentation.h:455
vtkGeometryRepresentation::Property
vtkProperty * Property
Definition: vtkGeometryRepresentation.h:458
vtkGeometryRepresentation::Representation
int Representation
Definition: vtkGeometryRepresentation.h:467
vtkPassInputTypeAlgorithm::FillInputPortInformation
virtual int FillInputPortInformation(int port, vtkInformation *info)
vtkMapper
vtkView
vtkIndent
VTK_SURFACE
#define VTK_SURFACE
vtkPVDataRepresentation::ProcessViewRequest
virtual int ProcessViewRequest(vtkInformationRequestKey *request_type, vtkInformation *inInfo, vtkInformation *outInfo)
vtkAlgorithm::ProcessRequest() equivalent for rendering passes.
vtkGeometryRepresentation::RequestGhostCellsIfNeeded
bool RequestGhostCellsIfNeeded
Definition: vtkGeometryRepresentation.h:469
vtkGeometryRepresentation::Ambient
double Ambient
Definition: vtkGeometryRepresentation.h:464
vtkInformationRequestKey
vtkGeometryRepresentation::UseDataPartitions
bool UseDataPartitions
Definition: vtkGeometryRepresentation.h:476
vtkScalarsToColors
vtkGeometryRepresentation::Diffuse
double Diffuse
Definition: vtkGeometryRepresentation.h:466
vtkPiecewiseFunction
vtkInformation
vtkGeometryRepresentation::SuppressLOD
bool SuppressLOD
Definition: vtkGeometryRepresentation.h:468
vtkGeometryRepresentation::MultiBlockMaker
vtkAlgorithm * MultiBlockMaker
Definition: vtkGeometryRepresentation.h:451
vtkGeometryRepresentation::Decimator
vtkGeometryRepresentation_detail::DecimationFilterType * Decimator
Definition: vtkGeometryRepresentation.h:452
vtkPVDataRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
vtkGeometryRepresentation::VisibleDataBoundsTime
vtkTimeStamp VisibleDataBoundsTime
Definition: vtkGeometryRepresentation.h:472
VTK_POINTS
#define VTK_POINTS
vtkGeometryRepresentation::UseMipmapTextures
bool UseMipmapTextures
Definition: vtkGeometryRepresentation.h:463
vtkGeometryRepresentation::SetSuppressLOD
virtual void SetSuppressLOD(bool suppress)
Enable/Disable LOD;.
Definition: vtkGeometryRepresentation.h:78
vtkProperty
vtkPVLODActor
an actor that supports multiple levels of detail
Definition: vtkPVLODActor.h:25
vtkGeometryRepresentation::GetRenderedProp
virtual vtkPVLODActor * GetRenderedProp()
Used in ConvertSelection to locate the prop used for actual rendering.
Definition: vtkGeometryRepresentation.h:412
vtkPVDataRepresentation
Definition: vtkPVDataRepresentation.h:23
vtkDataObject
vtkGeometryRepresentation::RepresentationTypes
RepresentationTypes
Definition: vtkGeometryRepresentation.h:96
vtkPVDataRepresentation::GetRenderedDataObject
virtual vtkDataObject * GetRenderedDataObject(int vtkNotUsed(port))
Returns the data object that is rendered from the given input port.
Definition: vtkPVDataRepresentation.h:95