VTK
vtkHAVSVolumeMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Visualization Toolkit
4 Module: vtkHAVSVolumeMapper.h
5 
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
16 /* Copyright 2005, 2006 by University of Utah. */
17 
120 #ifndef vtkHAVSVolumeMapper_h
121 #define vtkHAVSVolumeMapper_h
122 
123 #include "vtkRenderingVolumeModule.h" // For export macro
125 
126 #define VTK_KBUFFER_SIZE_2 0
127 #define VTK_KBUFFER_SIZE_6 1
128 #define VTK_FIELD_LEVEL_OF_DETAIL 0
129 #define VTK_AREA_LEVEL_OF_DETAIL 1
130 
131 
132 class vtkUnstructuredGrid;
133 class vtkDepthRadixSortUnstructuredGrid;
134 class vtkHAVSSortedFace;
135 
136 class VTKRENDERINGVOLUME_EXPORT vtkHAVSVolumeMapper : public vtkUnstructuredGridVolumeMapper
137 {
138 public:
139  static vtkHAVSVolumeMapper *New();
140  vtkTypeMacro(vtkHAVSVolumeMapper,
142  void PrintSelf(ostream& os, vtkIndent indent) override;
143 
145 
148  vtkSetMacro(PartiallyRemoveNonConvexities, bool);
149  vtkGetMacro(PartiallyRemoveNonConvexities, bool);
151 
153 
156  vtkSetMacro(LevelOfDetailTargetTime, float);
157  vtkGetMacro(LevelOfDetailTargetTime, float);
159 
161 
164  vtkSetMacro(LevelOfDetail, bool);
165  vtkGetMacro(LevelOfDetail, bool);
167 
169 
172  void SetLevelOfDetailMethod(int);
173  vtkGetMacro(LevelOfDetailMethod, int);
175  {this->SetLevelOfDetailMethod(VTK_FIELD_LEVEL_OF_DETAIL);}
177  {this->SetLevelOfDetailMethod(VTK_AREA_LEVEL_OF_DETAIL);}
179 
181 
184  vtkSetMacro(KBufferSize,int);
185  vtkGetMacro(KBufferSize,int);
187  {this->SetKBufferSize(VTK_KBUFFER_SIZE_2);}
189  {this->SetKBufferSize(VTK_KBUFFER_SIZE_6);}
191 
198  virtual bool SupportedByHardware(vtkRenderer *vtkNotUsed(r))
199  {return false; }
200 
202 
206  virtual void SetGPUDataStructures(bool) = 0;
207  vtkGetMacro(GPUDataStructures, bool);
209 
210 protected:
212  ~vtkHAVSVolumeMapper() override;
213 
214  virtual void Initialize(vtkRenderer *ren, vtkVolume *vol) = 0;
215  void InitializePrimitives(vtkVolume *vol);
216  void InitializeScalars();
217  void InitializeLevelOfDetail();
218  void InitializeLookupTables(vtkVolume *vol);
219 
220  void FRadixSort(vtkHAVSSortedFace *array, vtkHAVSSortedFace *temp, int lo, int up);
221  void FRadix(int byte, int len, vtkHAVSSortedFace *source, vtkHAVSSortedFace *dest, int *count);
222 
223  void UpdateLevelOfDetail(float targetTime);
224  void PartialVisibilitySort(float *eye);
225  bool CheckInitializationError();
226 
227  enum
228  {
229  NO_INIT_ERROR=0,
230  NON_TETRAHEDRA=1,
231  UNSUPPORTED_EXTENSIONS=2,
232  NO_SCALARS=3,
233  CELL_DATA=4,
234  NO_CELLS=5
235  };
236 
237  // Mesh
238  float *Vertices;
239  float *Scalars;
240  double ScalarRange[2];
241  unsigned int *Triangles;
242  unsigned int *OrderedTriangles;
243  vtkHAVSSortedFace *SortedFaces;
244  vtkHAVSSortedFace *RadixTemp;
245  float *Centers;
246  unsigned int NumberOfVertices;
247  unsigned int NumberOfCells;
248  unsigned int NumberOfScalars;
249  unsigned int NumberOfTriangles;
250 
251  // Level-Of-Detail
254  unsigned int *BoundaryTriangles;
255  unsigned int *InternalTriangles;
261 
262  // K-Buffer
268  float Diagonal;
271 
272  // Lookup Tables
275 
276  // State and Timing Stats
286 
287 private:
288  vtkHAVSVolumeMapper(const vtkHAVSVolumeMapper&) = delete;
289  void operator=(const vtkHAVSVolumeMapper&) = delete;
290 };
291 #endif
vtkTimeStamp ColorTransferFunctionMTime
unsigned int * InternalTriangles
#define VTK_KBUFFER_SIZE_2
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:50
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
record modification and/or execution time
Definition: vtkTimeStamp.h:35
void SetLevelOfDetailMethodArea()
Set/get the current level-of-detail method.
virtual bool SupportedByHardware(vtkRenderer *vtkNotUsed(r))
Check hardware support for the HAVS algorithm.
unsigned int NumberOfBoundaryTriangles
abstract specification for renderers
Definition: vtkRenderer.h:63
void SetLevelOfDetailMethodField()
Set/get the current level-of-detail method.
#define VTK_FIELD_LEVEL_OF_DETAIL
unsigned int NumberOfInternalTriangles
a simple class to control print indentation
Definition: vtkIndent.h:39
Abstract class for a unstructured grid volume mapper.
#define VTK_AREA_LEVEL_OF_DETAIL
#define VTK_KBUFFER_SIZE_6
dataset represents arbitrary combinations of all possible cell types
vtkTimeStamp AlphaTransferFunctionMTime
unsigned int * OrderedTriangles
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
void SetKBufferSizeTo2()
Set the kbuffer size.
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkHAVSSortedFace * SortedFaces
static vtkAlgorithm * New()
vtkHAVSSortedFace * RadixTemp
unsigned int * BoundaryTriangles
unsigned int LevelOfDetailTriangleCount
vtkTimeStamp UnstructuredGridMTime
void SetKBufferSizeTo6()
Set the kbuffer size.
Hardware-Assisted Visibility Sorting unstructured grid mapper.
unsigned int NumberOfTriangles