00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00037 #ifndef __vtkUnstructuredGridVolumeZSweepMapper_h
00038 #define __vtkUnstructuredGridVolumeZSweepMapper_h
00039
00040 #include "vtkUnstructuredGridVolumeMapper.h"
00041
00042 class vtkRenderer;
00043 class vtkVolume;
00044 class vtkRayCastImageDisplayHelper;
00045 class vtkCell;
00046 class vtkGenericCell;
00047 class vtkIdList;
00048 class vtkPriorityQueue;
00049 class vtkTransform;
00050 class vtkMatrix4x4;
00051 class vtkVolumeProperty;
00052 class vtkDoubleArray;
00053 class vtkUnstructuredGridVolumeRayIntegrator;
00054 class vtkRenderWindow;
00055
00056
00057
00058 namespace vtkUnstructuredGridVolumeZSweepMapperNamespace
00059 {
00060 class vtkScreenEdge;
00061 class vtkSpan;
00062 class vtkPixelListFrame;
00063 class vtkUseSet;
00064 class vtkVertices;
00065 class vtkSimpleScreenEdge;
00066 class vtkDoubleScreenEdge;
00067 class vtkVertexEntry;
00068 class vtkPixelListEntryMemory;
00069 };
00070
00071
00072 class VTK_VOLUMERENDERING_EXPORT vtkUnstructuredGridVolumeZSweepMapper : public vtkUnstructuredGridVolumeMapper
00073 {
00074 public:
00075 vtkTypeMacro(vtkUnstructuredGridVolumeZSweepMapper,vtkUnstructuredGridVolumeMapper);
00076 void PrintSelf( ostream& os, vtkIndent indent );
00077
00079 static vtkUnstructuredGridVolumeZSweepMapper *New();
00080
00082
00085 vtkSetClampMacro( ImageSampleDistance, float, 0.1f, 100.0f );
00086 vtkGetMacro( ImageSampleDistance, float );
00088
00090
00092 vtkSetClampMacro( MinimumImageSampleDistance, float, 0.1f, 100.0f );
00093 vtkGetMacro( MinimumImageSampleDistance, float );
00095
00097
00099 vtkSetClampMacro( MaximumImageSampleDistance, float, 0.1f, 100.0f );
00100 vtkGetMacro( MaximumImageSampleDistance, float );
00102
00104
00107 vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
00108 vtkGetMacro( AutoAdjustSampleDistances, int );
00109 vtkBooleanMacro( AutoAdjustSampleDistances, int );
00111
00113
00115 vtkSetClampMacro( IntermixIntersectingGeometry, int, 0, 1 );
00116 vtkGetMacro( IntermixIntersectingGeometry, int );
00117 vtkBooleanMacro( IntermixIntersectingGeometry, int );
00119
00124 int GetMaxPixelListSize();
00125
00128 void SetMaxPixelListSize(int size);
00129
00131
00133 virtual void SetRayIntegrator(vtkUnstructuredGridVolumeRayIntegrator *ri);
00134 vtkGetObjectMacro(RayIntegrator, vtkUnstructuredGridVolumeRayIntegrator);
00136
00137
00139
00141 void Render(vtkRenderer *ren,
00142 vtkVolume *vol);
00144
00145 vtkGetVectorMacro( ImageInUseSize, int, 2 );
00146 vtkGetVectorMacro( ImageOrigin, int, 2 );
00147 vtkGetVectorMacro( ImageViewportSize, int , 2 );
00148
00149
00150 protected:
00151 vtkUnstructuredGridVolumeZSweepMapper();
00152 ~vtkUnstructuredGridVolumeZSweepMapper();
00153
00155 void BuildUseSets();
00156
00158
00160 int ReorderTriangle(vtkIdType v[3],
00161 vtkIdType w[3]);
00163
00165
00168 void ProjectAndSortVertices(vtkRenderer *ren,
00169 vtkVolume *vol);
00171
00173 void CreateAndCleanPixelList();
00174
00177 void MainLoop(vtkRenderWindow *renWin);
00178
00181 void CompositeFunction(double zTarget);
00182
00184 unsigned char ColorComponentRealToByte(float color);
00185
00187 void RasterizeFace(vtkIdType faceIds[3], int externalSide);
00188
00189
00191
00193 void RasterizeTriangle(
00194 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *ve0,
00195 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *ve1,
00196 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *ve2,
00197 bool exitFace);
00199
00201
00203 void RasterizeSpan(int y,
00204 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkScreenEdge *left,
00205 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkScreenEdge *right,
00206 bool exitFace);
00208
00210
00213 void RasterizeLine(
00214 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *v0,
00215 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *v1,
00216 bool exitFace);
00217
00219
00220 void StoreRenderTime(vtkRenderer *ren,
00221 vtkVolume *vol,
00222 float t);
00223
00224 float RetrieveRenderTime(vtkRenderer *ren,
00225 vtkVolume *vol);
00226
00228
00229 double GetZBufferValue(int x,
00230 int y);
00232
00233 double GetMinimumBoundsDepth(vtkRenderer *ren,
00234 vtkVolume *vol);
00235
00238 void AllocateUseSet(vtkIdType size);
00239
00242 void AllocateVertices(vtkIdType size);
00243
00245 void SavePixelListFrame();
00246
00247 int MaxPixelListSize;
00248
00249 float ImageSampleDistance;
00250 float MinimumImageSampleDistance;
00251 float MaximumImageSampleDistance;
00252 int AutoAdjustSampleDistances;
00253
00254 vtkRayCastImageDisplayHelper *ImageDisplayHelper;
00255
00256
00257 int ImageViewportSize[2];
00258
00259
00260
00261
00262
00263 int ImageMemorySize[2];
00264
00265
00266
00267
00268
00269 int ImageInUseSize[2];
00270
00271
00272
00273 int ImageOrigin[2];
00274
00275
00276 unsigned char *Image;
00277
00278
00279 float *RealRGBAImage;
00280
00281 float *RenderTimeTable;
00282 vtkVolume **RenderVolumeTable;
00283 vtkRenderer **RenderRendererTable;
00284 int RenderTableSize;
00285 int RenderTableEntries;
00286
00287 int IntermixIntersectingGeometry;
00288
00289 float *ZBuffer;
00290 int ZBufferSize[2];
00291 int ZBufferOrigin[2];
00292
00293 vtkDataArray *Scalars;
00294 int CellScalars;
00295
00296
00297
00298
00299 double FaceScalars[2];
00300 int FaceSide;
00301
00302
00303 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSpan *Span;
00304 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkPixelListFrame *PixelListFrame;
00305
00306
00307 vtkGenericCell *Cell;
00308
00309 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkUseSet *UseSet;
00310
00311 vtkPriorityQueue *EventList;
00312 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertices *Vertices;
00313
00314 vtkTransform *PerspectiveTransform;
00315 vtkMatrix4x4 *PerspectiveMatrix;
00316
00317
00318 int MaxPixelListSizeReached;
00319 int XBounds[2];
00320 int YBounds[2];
00321
00322 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSimpleScreenEdge *SimpleEdge;
00323 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkDoubleScreenEdge *DoubleEdge;
00324
00325 vtkUnstructuredGridVolumeRayIntegrator *RayIntegrator;
00326 vtkUnstructuredGridVolumeRayIntegrator *RealRayIntegrator;
00327
00328 vtkTimeStamp SavedTriangleListMTime;
00329
00330
00331 vtkDoubleArray *IntersectionLengths;
00332 vtkDoubleArray *NearIntersections;
00333 vtkDoubleArray *FarIntersections;
00334
00335
00336 vtkIdType MaxRecordedPixelListSize;
00337
00338
00339 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkPixelListEntryMemory *MemoryManager;
00340
00341 private:
00342 vtkUnstructuredGridVolumeZSweepMapper(const vtkUnstructuredGridVolumeZSweepMapper&);
00343 void operator=(const vtkUnstructuredGridVolumeZSweepMapper&);
00344 };
00345
00346 #endif