00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00119 #ifndef __vtkHAVSVolumeMapper_h
00120 #define __vtkHAVSVolumeMapper_h
00121
00122 #include "vtkUnstructuredGridVolumeMapper.h"
00123
00124 #define VTK_KBUFFER_SIZE_2 0
00125 #define VTK_KBUFFER_SIZE_6 1
00126 #define VTK_FIELD_LEVEL_OF_DETAIL 0
00127 #define VTK_AREA_LEVEL_OF_DETAIL 1
00128
00129
00130 class vtkUnstructuredGrid;
00131 class vtkDepthRadixSortUnstructuredGrid;
00132 class vtkHAVSSortedFace;
00133
00134 class VTK_VOLUMERENDERING_EXPORT vtkHAVSVolumeMapper : public vtkUnstructuredGridVolumeMapper
00135 {
00136 public:
00137 static vtkHAVSVolumeMapper *New();
00138 vtkTypeRevisionMacro(vtkHAVSVolumeMapper,
00139 vtkUnstructuredGridVolumeMapper);
00140 virtual void PrintSelf(ostream& os, vtkIndent indent);
00141
00143
00144 vtkSetMacro(PartiallyRemoveNonConvexities, bool);
00145 vtkGetMacro(PartiallyRemoveNonConvexities, bool);
00147
00149
00151 vtkSetMacro(LevelOfDetailTargetTime, float);
00152 vtkGetMacro(LevelOfDetailTargetTime, float);
00154
00156
00157 vtkSetMacro(LevelOfDetail, bool);
00158 vtkGetMacro(LevelOfDetail, bool);
00160
00162
00163 void SetLevelOfDetailMethod(int);
00164 vtkGetMacro(LevelOfDetailMethod, int);
00165 void SetLevelOfDetailMethodField()
00166 {this->SetLevelOfDetailMethod(VTK_FIELD_LEVEL_OF_DETAIL);}
00167 void SetLevelOfDetailMethodArea()
00168 {this->SetLevelOfDetailMethod(VTK_AREA_LEVEL_OF_DETAIL);}
00170
00172
00173 vtkSetMacro(KBufferSize,int);
00174 vtkGetMacro(KBufferSize,int);
00175 void SetKBufferSizeTo2()
00176 {this->SetKBufferSize(VTK_KBUFFER_SIZE_2);}
00177 void SetKBufferSizeTo6()
00178 {this->SetKBufferSize(VTK_KBUFFER_SIZE_6);}
00180
00185 virtual bool SupportedByHardware() {return false; }
00186
00188
00190 virtual void SetGPUDataStructures(bool) = 0;
00191 vtkGetMacro(GPUDataStructures, bool);
00193
00194 protected:
00195 vtkHAVSVolumeMapper();
00196 ~vtkHAVSVolumeMapper();
00197
00198
00199 virtual void Initialize(vtkRenderer *ren, vtkVolume *vol) = 0;
00200 void InitializePrimitives(vtkVolume *vol);
00201 void InitializeScalars();
00202 void InitializeLevelOfDetail();
00203 void InitializeLookupTables(vtkVolume *vol);
00204
00205 void FRadixSort(vtkHAVSSortedFace *array, vtkHAVSSortedFace *temp, int lo, int up);
00206 void FRadix(int byte, int len, vtkHAVSSortedFace *source, vtkHAVSSortedFace *dest, int *count);
00207
00208 void UpdateLevelOfDetail(float targetTime);
00209 void PartialVisibilitySort(float *eye);
00210 bool CheckInitializationError();
00211
00212 enum
00213 {
00214 NO_INIT_ERROR=0,
00215 NON_TETRAHEDRA=1,
00216 UNSUPPORTED_EXTENSIONS=2,
00217 NO_SCALARS=3,
00218 CELL_DATA=4,
00219 NO_CELLS=5
00220 };
00221
00222
00223 float *Vertices;
00224 float *Scalars;
00225 double ScalarRange[2];
00226 unsigned int *Triangles;
00227 unsigned int *OrderedTriangles;
00228 vtkHAVSSortedFace *SortedFaces;
00229 vtkHAVSSortedFace *RadixTemp;
00230 float *Centers;
00231 unsigned int NumberOfVertices;
00232 unsigned int NumberOfCells;
00233 unsigned int NumberOfScalars;
00234 unsigned int NumberOfTriangles;
00235
00236
00237 unsigned int NumberOfBoundaryTriangles;
00238 unsigned int NumberOfInternalTriangles;
00239 unsigned int *BoundaryTriangles;
00240 unsigned int *InternalTriangles;
00241 unsigned int LevelOfDetailTriangleCount;
00242 float CurrentLevelOfDetail;
00243 float LevelOfDetailTargetTime;
00244 bool LevelOfDetail;
00245 int LevelOfDetailMethod;
00246
00247
00248 int KBufferState;
00249 float MaxEdgeLength;
00250 float LevelOfDetailMaxEdgeLength;
00251 float UnitDistance;
00252 bool GPUDataStructures;
00253 float Diagonal;
00254 bool PartiallyRemoveNonConvexities;
00255 int KBufferSize;
00256
00257
00258 float *TransferFunction;
00259 int TransferFunctionSize;
00260
00261
00262 bool Initialized;
00263 int InitializationError;
00264 int FrameNumber;
00265 float TotalRenderTime;
00266 vtkTimeStamp ColorTransferFunctionMTime;
00267 vtkTimeStamp AlphaTransferFunctionMTime;
00268 vtkTimeStamp UnstructuredGridMTime;
00269 vtkTimeStamp ScalarsMTime;
00270 vtkVolume *LastVolume;
00271
00272
00273 private:
00274 vtkHAVSVolumeMapper(const vtkHAVSVolumeMapper&);
00275 void operator=(const vtkHAVSVolumeMapper&);
00276 };
00277 #endif