VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkHAVSVolumeMapper.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 00016 /* Copyright 2005, 2006 by University of Utah. */ 00017 00119 #ifndef __vtkHAVSVolumeMapper_h 00120 #define __vtkHAVSVolumeMapper_h 00121 00122 #include "vtkRenderingVolumeModule.h" // For export macro 00123 #include "vtkUnstructuredGridVolumeMapper.h" 00124 00125 #define VTK_KBUFFER_SIZE_2 0 00126 #define VTK_KBUFFER_SIZE_6 1 00127 #define VTK_FIELD_LEVEL_OF_DETAIL 0 00128 #define VTK_AREA_LEVEL_OF_DETAIL 1 00129 00130 00131 class vtkUnstructuredGrid; 00132 class vtkDepthRadixSortUnstructuredGrid; 00133 class vtkHAVSSortedFace; 00134 00135 class VTKRENDERINGVOLUME_EXPORT vtkHAVSVolumeMapper : public vtkUnstructuredGridVolumeMapper 00136 { 00137 public: 00138 static vtkHAVSVolumeMapper *New(); 00139 vtkTypeMacro(vtkHAVSVolumeMapper, 00140 vtkUnstructuredGridVolumeMapper); 00141 virtual void PrintSelf(ostream& os, vtkIndent indent); 00142 00144 00145 vtkSetMacro(PartiallyRemoveNonConvexities, bool); 00146 vtkGetMacro(PartiallyRemoveNonConvexities, bool); 00148 00150 00152 vtkSetMacro(LevelOfDetailTargetTime, float); 00153 vtkGetMacro(LevelOfDetailTargetTime, float); 00155 00157 00158 vtkSetMacro(LevelOfDetail, bool); 00159 vtkGetMacro(LevelOfDetail, bool); 00161 00163 00164 void SetLevelOfDetailMethod(int); 00165 vtkGetMacro(LevelOfDetailMethod, int); 00166 void SetLevelOfDetailMethodField() 00167 {this->SetLevelOfDetailMethod(VTK_FIELD_LEVEL_OF_DETAIL);} 00168 void SetLevelOfDetailMethodArea() 00169 {this->SetLevelOfDetailMethod(VTK_AREA_LEVEL_OF_DETAIL);} 00171 00173 00174 vtkSetMacro(KBufferSize,int); 00175 vtkGetMacro(KBufferSize,int); 00176 void SetKBufferSizeTo2() 00177 {this->SetKBufferSize(VTK_KBUFFER_SIZE_2);} 00178 void SetKBufferSizeTo6() 00179 {this->SetKBufferSize(VTK_KBUFFER_SIZE_6);} 00181 00183 00187 virtual bool SupportedByHardware(vtkRenderer *vtkNotUsed(r)) 00188 {return false; } 00190 00192 00194 virtual void SetGPUDataStructures(bool) = 0; 00195 vtkGetMacro(GPUDataStructures, bool); 00197 00198 protected: 00199 vtkHAVSVolumeMapper(); 00200 ~vtkHAVSVolumeMapper(); 00201 00202 //BTX 00203 virtual void Initialize(vtkRenderer *ren, vtkVolume *vol) = 0; 00204 void InitializePrimitives(vtkVolume *vol); 00205 void InitializeScalars(); 00206 void InitializeLevelOfDetail(); 00207 void InitializeLookupTables(vtkVolume *vol); 00208 00209 void FRadixSort(vtkHAVSSortedFace *array, vtkHAVSSortedFace *temp, int lo, int up); 00210 void FRadix(int byte, int len, vtkHAVSSortedFace *source, vtkHAVSSortedFace *dest, int *count); 00211 00212 void UpdateLevelOfDetail(float targetTime); 00213 void PartialVisibilitySort(float *eye); 00214 bool CheckInitializationError(); 00215 00216 enum 00217 { 00218 NO_INIT_ERROR=0, 00219 NON_TETRAHEDRA=1, 00220 UNSUPPORTED_EXTENSIONS=2, 00221 NO_SCALARS=3, 00222 CELL_DATA=4, 00223 NO_CELLS=5 00224 }; 00225 00226 // Mesh 00227 float *Vertices; 00228 float *Scalars; 00229 double ScalarRange[2]; 00230 unsigned int *Triangles; 00231 unsigned int *OrderedTriangles; 00232 vtkHAVSSortedFace *SortedFaces; 00233 vtkHAVSSortedFace *RadixTemp; 00234 float *Centers; 00235 unsigned int NumberOfVertices; 00236 unsigned int NumberOfCells; 00237 unsigned int NumberOfScalars; 00238 unsigned int NumberOfTriangles; 00239 00240 // Level-Of-Detail 00241 unsigned int NumberOfBoundaryTriangles; 00242 unsigned int NumberOfInternalTriangles; 00243 unsigned int *BoundaryTriangles; 00244 unsigned int *InternalTriangles; 00245 unsigned int LevelOfDetailTriangleCount; 00246 float CurrentLevelOfDetail; 00247 float LevelOfDetailTargetTime; 00248 bool LevelOfDetail; 00249 int LevelOfDetailMethod; 00250 00251 // K-Buffer 00252 int KBufferState; 00253 float MaxEdgeLength; 00254 float LevelOfDetailMaxEdgeLength; 00255 float UnitDistance; 00256 bool GPUDataStructures; 00257 float Diagonal; 00258 bool PartiallyRemoveNonConvexities; 00259 int KBufferSize; 00260 00261 // Lookup Tables 00262 float *TransferFunction; 00263 int TransferFunctionSize; 00264 00265 // State and Timing Stats 00266 bool Initialized; 00267 int InitializationError; 00268 int FrameNumber; 00269 float TotalRenderTime; 00270 vtkTimeStamp ColorTransferFunctionMTime; 00271 vtkTimeStamp AlphaTransferFunctionMTime; 00272 vtkTimeStamp UnstructuredGridMTime; 00273 vtkTimeStamp ScalarsMTime; 00274 vtkVolume *LastVolume; 00275 //ETX 00276 00277 private: 00278 vtkHAVSVolumeMapper(const vtkHAVSVolumeMapper&); // Not implemented. 00279 void operator=(const vtkHAVSVolumeMapper&); // Not implemented. 00280 }; 00281 #endif