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 
119 #ifndef __vtkHAVSVolumeMapper_h
120 #define __vtkHAVSVolumeMapper_h
121 
123 
124 #define VTK_KBUFFER_SIZE_2 0
125 #define VTK_KBUFFER_SIZE_6 1
126 #define VTK_FIELD_LEVEL_OF_DETAIL 0
127 #define VTK_AREA_LEVEL_OF_DETAIL 1
128 
129 
130 class vtkUnstructuredGrid;
131 class vtkDepthRadixSortUnstructuredGrid;
132 class vtkHAVSSortedFace;
133 
135 {
136 public:
137  static vtkHAVSVolumeMapper *New();
138  vtkTypeMacro(vtkHAVSVolumeMapper,
140  virtual void PrintSelf(ostream& os, vtkIndent indent);
141 
143 
144  vtkSetMacro(PartiallyRemoveNonConvexities, bool);
145  vtkGetMacro(PartiallyRemoveNonConvexities, bool);
147 
149 
151  vtkSetMacro(LevelOfDetailTargetTime, float);
152  vtkGetMacro(LevelOfDetailTargetTime, float);
154 
156 
157  vtkSetMacro(LevelOfDetail, bool);
158  vtkGetMacro(LevelOfDetail, bool);
160 
162 
163  void SetLevelOfDetailMethod(int);
164  vtkGetMacro(LevelOfDetailMethod, int);
165  void SetLevelOfDetailMethodField()
166  {this->SetLevelOfDetailMethod(VTK_FIELD_LEVEL_OF_DETAIL);}
167  void SetLevelOfDetailMethodArea()
168  {this->SetLevelOfDetailMethod(VTK_AREA_LEVEL_OF_DETAIL);}
170 
172 
173  vtkSetMacro(KBufferSize,int);
174  vtkGetMacro(KBufferSize,int);
175  void SetKBufferSizeTo2()
176  {this->SetKBufferSize(VTK_KBUFFER_SIZE_2);}
177  void SetKBufferSizeTo6()
178  {this->SetKBufferSize(VTK_KBUFFER_SIZE_6);}
180 
182 
186  virtual bool SupportedByHardware(vtkRenderer *vtkNotUsed(r))
187  {return false; }
189 
191 
193  virtual void SetGPUDataStructures(bool) = 0;
194  vtkGetMacro(GPUDataStructures, bool);
196 
197 protected:
200 
201 //BTX
202  virtual void Initialize(vtkRenderer *ren, vtkVolume *vol) = 0;
203  void InitializePrimitives(vtkVolume *vol);
204  void InitializeScalars();
205  void InitializeLevelOfDetail();
206  void InitializeLookupTables(vtkVolume *vol);
207 
208  void FRadixSort(vtkHAVSSortedFace *array, vtkHAVSSortedFace *temp, int lo, int up);
209  void FRadix(int byte, int len, vtkHAVSSortedFace *source, vtkHAVSSortedFace *dest, int *count);
210 
211  void UpdateLevelOfDetail(float targetTime);
212  void PartialVisibilitySort(float *eye);
213  bool CheckInitializationError();
214 
215  enum
216  {
217  NO_INIT_ERROR=0,
218  NON_TETRAHEDRA=1,
219  UNSUPPORTED_EXTENSIONS=2,
220  NO_SCALARS=3,
221  CELL_DATA=4,
222  NO_CELLS=5
223  };
224 
225  // Mesh
226  float *Vertices;
227  float *Scalars;
228  double ScalarRange[2];
229  unsigned int *Triangles;
230  unsigned int *OrderedTriangles;
231  vtkHAVSSortedFace *SortedFaces;
232  vtkHAVSSortedFace *RadixTemp;
233  float *Centers;
234  unsigned int NumberOfVertices;
235  unsigned int NumberOfCells;
236  unsigned int NumberOfScalars;
237  unsigned int NumberOfTriangles;
238 
239  // Level-Of-Detail
242  unsigned int *BoundaryTriangles;
243  unsigned int *InternalTriangles;
249 
250  // K-Buffer
256  float Diagonal;
259 
260  // Lookup Tables
263 
264  // State and Timing Stats
274 //ETX
275 
276 private:
277  vtkHAVSVolumeMapper(const vtkHAVSVolumeMapper&); // Not implemented.
278  void operator=(const vtkHAVSVolumeMapper&); // Not implemented.
279 };
280 #endif