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 vtkTypeMacro(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
00182
00186 virtual bool SupportedByHardware(vtkRenderer *vtkNotUsed(r))
00187 {return false; }
00189
00191
00193 virtual void SetGPUDataStructures(bool) = 0;
00194 vtkGetMacro(GPUDataStructures, bool);
00196
00197 protected:
00198 vtkHAVSVolumeMapper();
00199 ~vtkHAVSVolumeMapper();
00200
00201
00202 virtual void Initialize(vtkRenderer *ren, vtkVolume *vol) = 0;
00203 void InitializePrimitives(vtkVolume *vol);
00204 void InitializeScalars();
00205 void InitializeLevelOfDetail();
00206 void InitializeLookupTables(vtkVolume *vol);
00207
00208 void FRadixSort(vtkHAVSSortedFace *array, vtkHAVSSortedFace *temp, int lo, int up);
00209 void FRadix(int byte, int len, vtkHAVSSortedFace *source, vtkHAVSSortedFace *dest, int *count);
00210
00211 void UpdateLevelOfDetail(float targetTime);
00212 void PartialVisibilitySort(float *eye);
00213 bool CheckInitializationError();
00214
00215 enum
00216 {
00217 NO_INIT_ERROR=0,
00218 NON_TETRAHEDRA=1,
00219 UNSUPPORTED_EXTENSIONS=2,
00220 NO_SCALARS=3,
00221 CELL_DATA=4,
00222 NO_CELLS=5
00223 };
00224
00225
00226 float *Vertices;
00227 float *Scalars;
00228 double ScalarRange[2];
00229 unsigned int *Triangles;
00230 unsigned int *OrderedTriangles;
00231 vtkHAVSSortedFace *SortedFaces;
00232 vtkHAVSSortedFace *RadixTemp;
00233 float *Centers;
00234 unsigned int NumberOfVertices;
00235 unsigned int NumberOfCells;
00236 unsigned int NumberOfScalars;
00237 unsigned int NumberOfTriangles;
00238
00239
00240 unsigned int NumberOfBoundaryTriangles;
00241 unsigned int NumberOfInternalTriangles;
00242 unsigned int *BoundaryTriangles;
00243 unsigned int *InternalTriangles;
00244 unsigned int LevelOfDetailTriangleCount;
00245 float CurrentLevelOfDetail;
00246 float LevelOfDetailTargetTime;
00247 bool LevelOfDetail;
00248 int LevelOfDetailMethod;
00249
00250
00251 int KBufferState;
00252 float MaxEdgeLength;
00253 float LevelOfDetailMaxEdgeLength;
00254 float UnitDistance;
00255 bool GPUDataStructures;
00256 float Diagonal;
00257 bool PartiallyRemoveNonConvexities;
00258 int KBufferSize;
00259
00260
00261 float *TransferFunction;
00262 int TransferFunctionSize;
00263
00264
00265 bool Initialized;
00266 int InitializationError;
00267 int FrameNumber;
00268 float TotalRenderTime;
00269 vtkTimeStamp ColorTransferFunctionMTime;
00270 vtkTimeStamp AlphaTransferFunctionMTime;
00271 vtkTimeStamp UnstructuredGridMTime;
00272 vtkTimeStamp ScalarsMTime;
00273 vtkVolume *LastVolume;
00274
00275
00276 private:
00277 vtkHAVSVolumeMapper(const vtkHAVSVolumeMapper&);
00278 void operator=(const vtkHAVSVolumeMapper&);
00279 };
00280 #endif