dox/VolumeRendering/vtkUnstructuredGridVolumeZSweepMapper.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkUnstructuredGridVolumeZSweepMapper.h,v $
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 =========================================================================*/
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 // Internal classes
00057 class vtkScreenEdge;
00058 class vtkSpan;
00059 class vtkPixelListFrame;
00060 class vtkUseSet;
00061 class vtkVertices;
00062 class vtkSimpleScreenEdge;
00063 class vtkDoubleScreenEdge;
00064 class vtkVertexEntry;
00065 class vtkPixelListEntryMemory;
00066 
00067 class VTK_VOLUMERENDERING_EXPORT vtkUnstructuredGridVolumeZSweepMapper : public vtkUnstructuredGridVolumeMapper
00068 {
00069 public:
00070   vtkTypeRevisionMacro(vtkUnstructuredGridVolumeZSweepMapper,vtkUnstructuredGridVolumeMapper);
00071   void PrintSelf( ostream& os, vtkIndent indent );
00072   
00074   static vtkUnstructuredGridVolumeZSweepMapper *New();
00075   
00077 
00087   vtkSetMacro(ScalarMode,int);
00088   vtkGetMacro(ScalarMode,int);
00089   void SetScalarModeToDefault() {
00090     this->SetScalarMode(VTK_SCALAR_MODE_DEFAULT);};
00091   void SetScalarModeToUsePointData() {
00092     this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_DATA);};
00093   void SetScalarModeToUseCellData() {
00094     this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_DATA);};
00095   void SetScalarModeToUsePointFieldData() {
00096     this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_FIELD_DATA);};
00097   void SetScalarModeToUseCellFieldData() {
00098     this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_FIELD_DATA);};
00100   
00102 
00106   virtual void SelectScalarArray(int arrayNum); 
00107   virtual void SelectScalarArray(const char* arrayName); 
00109   
00111 
00112   virtual char* GetArrayName() { return this->ArrayName; }
00113   virtual int GetArrayId() { return this->ArrayId; }
00114   virtual int GetArrayAccessMode() { return this->ArrayAccessMode; }
00116 
00118   const char *GetScalarModeAsString();
00119 
00121 
00124   vtkSetClampMacro( ImageSampleDistance, float, 0.1f, 100.0f );
00125   vtkGetMacro( ImageSampleDistance, float );
00127 
00129 
00131   vtkSetClampMacro( MinimumImageSampleDistance, float, 0.1f, 100.0f );
00132   vtkGetMacro( MinimumImageSampleDistance, float );
00134 
00136 
00138   vtkSetClampMacro( MaximumImageSampleDistance, float, 0.1f, 100.0f );
00139   vtkGetMacro( MaximumImageSampleDistance, float );
00141 
00143 
00146   vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
00147   vtkGetMacro( AutoAdjustSampleDistances, int );
00148   vtkBooleanMacro( AutoAdjustSampleDistances, int );
00150   
00152 
00154   vtkSetClampMacro( IntermixIntersectingGeometry, int, 0, 1 );
00155   vtkGetMacro( IntermixIntersectingGeometry, int );
00156   vtkBooleanMacro( IntermixIntersectingGeometry, int );
00158 
00163   int GetMaxPixelListSize();
00164   
00167   void SetMaxPixelListSize(int size);
00168   
00170 
00172   virtual void SetRayIntegrator(vtkUnstructuredGridVolumeRayIntegrator *ri);
00173   vtkGetObjectMacro(RayIntegrator, vtkUnstructuredGridVolumeRayIntegrator);
00175   
00176 //BTX
00178 
00180   void Render(vtkRenderer *ren,
00181               vtkVolume *vol);
00183   
00184   vtkGetVectorMacro( ImageInUseSize, int, 2 );
00185   vtkGetVectorMacro( ImageOrigin, int, 2 );
00186   vtkGetVectorMacro( ImageViewportSize, int , 2 );
00187 //ETX
00188   
00189 protected:
00190   vtkUnstructuredGridVolumeZSweepMapper();
00191   ~vtkUnstructuredGridVolumeZSweepMapper();
00192   
00194   void BuildUseSets();
00195   
00197 
00199   void ReorderTriangle(vtkIdType v[3],
00200                        vtkIdType w[3]);
00202 
00204 
00207   void ProjectAndSortVertices(vtkRenderer *ren,
00208                               vtkVolume *vol);
00210   
00212   void CreateAndCleanPixelList();
00213   
00216   void MainLoop(vtkRenderWindow *renWin);
00217   
00220   void CompositeFunction(double zTarget);
00221   
00223   unsigned char ColorComponentRealToByte(float color);
00224   
00226   void RasterizeFace(vtkIdType faceIds[3]);
00227   
00229 
00231   void RasterizeTriangle(vtkVertexEntry *ve0,vtkVertexEntry *ve1,
00232                          vtkVertexEntry *ve2);
00234   
00236 
00238   void RasterizeSpan(int y,
00239                      vtkScreenEdge *left,
00240                      vtkScreenEdge *right);
00242   
00244 
00247   void RasterizeLine(vtkVertexEntry *v0,
00248                      vtkVertexEntry *v1);
00250   
00251   void StoreRenderTime(vtkRenderer *ren,
00252                        vtkVolume *vol,
00253                        float t);
00254   
00255   float RetrieveRenderTime(vtkRenderer *ren,
00256                            vtkVolume *vol);
00257   
00259 
00260   double GetZBufferValue(int x,
00261                          int y);
00263   
00264   double GetMinimumBoundsDepth(vtkRenderer *ren,
00265                                vtkVolume *vol);
00266   
00269   void AllocateUseSet(vtkIdType size);
00270   
00273   void AllocateVertices(vtkIdType size);
00274   
00276   void SavePixelListFrame();
00277   
00278   int MaxPixelListSize;
00279   
00280   float ImageSampleDistance;
00281   float MinimumImageSampleDistance;
00282   float MaximumImageSampleDistance;
00283   int AutoAdjustSampleDistances;
00284   
00285   vtkRayCastImageDisplayHelper *ImageDisplayHelper;
00286   
00287   // This is how big the image would be if it covered the entire viewport
00288   int ImageViewportSize[2];
00289   
00290   // This is how big the allocated memory for image is. This may be bigger
00291   // or smaller than ImageFullSize - it will be bigger if necessary to 
00292   // ensure a power of 2, it will be smaller if the volume only covers a
00293   // small region of the viewport
00294   int ImageMemorySize[2];
00295   
00296   // This is the size of subregion in ImageSize image that we are using for
00297   // the current image. Since ImageSize is a power of 2, there is likely
00298   // wasted space in it. This number will be used for things such as clearing
00299   // the image if necessary.
00300   int ImageInUseSize[2];
00301   
00302   // This is the location in ImageFullSize image where our ImageSize image
00303   // is located.
00304   int ImageOrigin[2];
00305   
00306   // This is the allocated image
00307   unsigned char *Image;
00308   
00309   // This is the accumulating double RGBA image
00310   float *RealRGBAImage;
00311   
00312   float *RenderTimeTable;
00313   vtkVolume **RenderVolumeTable;
00314   vtkRenderer **RenderRendererTable;
00315   int RenderTableSize;
00316   int RenderTableEntries;
00317   
00318   int IntermixIntersectingGeometry;
00319 
00320   float *ZBuffer;
00321   int ZBufferSize[2];
00322   int ZBufferOrigin[2];
00323   
00324   int ScalarMode;
00325   char *ArrayName;
00326   int ArrayId;
00327   int ArrayAccessMode;
00328   
00329   vtkDataArray *Scalars;
00330   int CellScalars;
00331   
00332   vtkSpan *Span;
00333   vtkPixelListFrame *PixelListFrame;
00334   
00335   // Used by BuildUseSets().
00336   vtkGenericCell *Cell;
00337   
00338   vtkUseSet *UseSet;
00339   
00340   vtkPriorityQueue *EventList;
00341   vtkVertices *Vertices;
00342   
00343   vtkTransform *PerspectiveTransform;
00344   vtkMatrix4x4 *PerspectiveMatrix;
00345   
00346   // Used by the main loop
00347   int MaxPixelListSizeReached;
00348   int XBounds[2];
00349   int YBounds[2];
00350   
00351   vtkSimpleScreenEdge *SimpleEdge;
00352   vtkDoubleScreenEdge *DoubleEdge;
00353   
00354   vtkUnstructuredGridVolumeRayIntegrator *RayIntegrator;
00355   vtkUnstructuredGridVolumeRayIntegrator *RealRayIntegrator;
00356   
00357   vtkTimeStamp SavedTriangleListMTime;
00358   
00359   // Used during compositing
00360   vtkDoubleArray *IntersectionLengths;
00361   vtkDoubleArray *NearIntersections;
00362   vtkDoubleArray *FarIntersections;
00363   
00364   // Benchmark
00365   vtkIdType MaxRecordedPixelListSize;
00366   
00367   
00368   vtkPixelListEntryMemory *MemoryManager;
00369 private:
00370   vtkUnstructuredGridVolumeZSweepMapper(const vtkUnstructuredGridVolumeZSweepMapper&);  // Not implemented.
00371   void operator=(const vtkUnstructuredGridVolumeZSweepMapper&);  // Not implemented.
00372 };
00373 
00374 #endif

Generated on Mon Mar 10 13:05:59 2008 for VTK by  doxygen 1.5.1