Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

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_RENDERING_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 
00206   void ProjectAndSortVertices(vtkRenderer *ren,
00207                               vtkVolume *vol);
00209   
00211   void CreateAndCleanPixelList();
00212   
00214   void MainLoop(vtkRenderWindow *renWin);
00215   
00218   void CompositeFunction(double zTarget);
00219   
00221   unsigned char ColorComponentRealToByte(float color);
00222   
00224   void RasterizeFace(vtkIdType faceIds[3]);
00225   
00227 
00229   void RasterizeTriangle(vtkVertexEntry *ve0,vtkVertexEntry *ve1,
00230                          vtkVertexEntry *ve2);
00232   
00234 
00236   void RasterizeSpan(int y,
00237                      vtkScreenEdge *left,
00238                      vtkScreenEdge *right);
00240   
00242 
00245   void RasterizeLine(vtkVertexEntry *v0,
00246                      vtkVertexEntry *v1);
00248   
00249   void StoreRenderTime(vtkRenderer *ren,
00250                        vtkVolume *vol,
00251                        float t);
00252   
00253   float RetrieveRenderTime(vtkRenderer *ren,
00254                            vtkVolume *vol);
00255   
00257 
00258   double GetZBufferValue(int x,
00259                          int y);
00261   
00262   double GetMinimumBoundsDepth(vtkRenderer *ren,
00263                                vtkVolume *vol);
00264   
00267   void AllocateUseSet(vtkIdType size);
00268   
00271   void AllocateVertices(vtkIdType size);
00272   
00274   void SavePixelListFrame();
00275   
00276   int MaxPixelListSize;
00277   
00278   float ImageSampleDistance;
00279   float MinimumImageSampleDistance;
00280   float MaximumImageSampleDistance;
00281   int AutoAdjustSampleDistances;
00282   
00283   vtkRayCastImageDisplayHelper *ImageDisplayHelper;
00284   
00285   // This is how big the image would be if it covered the entire viewport
00286   int ImageViewportSize[2];
00287   
00288   // This is how big the allocated memory for image is. This may be bigger
00289   // or smaller than ImageFullSize - it will be bigger if necessary to 
00290   // ensure a power of 2, it will be smaller if the volume only covers a
00291   // small region of the viewport
00292   int ImageMemorySize[2];
00293   
00294   // This is the size of subregion in ImageSize image that we are using for
00295   // the current image. Since ImageSize is a power of 2, there is likely
00296   // wasted space in it. This number will be used for things such as clearing
00297   // the image if necessary.
00298   int ImageInUseSize[2];
00299   
00300   // This is the location in ImageFullSize image where our ImageSize image
00301   // is located.
00302   int ImageOrigin[2];
00303   
00304   // This is the allocated image
00305   unsigned char *Image;
00306   
00307   // This is the accumulating double RGBA image
00308   float *RealRGBAImage;
00309   
00310   float *RenderTimeTable;
00311   vtkVolume **RenderVolumeTable;
00312   vtkRenderer **RenderRendererTable;
00313   int RenderTableSize;
00314   int RenderTableEntries;
00315   
00316   int IntermixIntersectingGeometry;
00317 
00318   float *ZBuffer;
00319   int ZBufferSize[2];
00320   int ZBufferOrigin[2];
00321   
00322   int ScalarMode;
00323   char *ArrayName;
00324   int ArrayId;
00325   int ArrayAccessMode;
00326   
00327   vtkDataArray *Scalars;
00328   int CellScalars;
00329   
00330   vtkSpan *Span;
00331   vtkPixelListFrame *PixelListFrame;
00332   
00333   // Used by BuildUseSets().
00334   vtkGenericCell *Cell;
00335   
00336   vtkUseSet *UseSet;
00337   
00338   vtkPriorityQueue *EventList;
00339   vtkVertices *Vertices;
00340   
00341   vtkTransform *PerspectiveTransform;
00342   vtkMatrix4x4 *PerspectiveMatrix;
00343   
00344   // Used by the main loop
00345   int MaxPixelListSizeReached;
00346   int XBounds[2];
00347   int YBounds[2];
00348   
00349   vtkSimpleScreenEdge *SimpleEdge;
00350   vtkDoubleScreenEdge *DoubleEdge;
00351   
00352   vtkUnstructuredGridVolumeRayIntegrator *RayIntegrator;
00353   vtkUnstructuredGridVolumeRayIntegrator *RealRayIntegrator;
00354   
00355   vtkTimeStamp SavedTriangleListMTime;
00356   
00357   // Used during compositing
00358   vtkDoubleArray *IntersectionLengths;
00359   vtkDoubleArray *NearIntersections;
00360   vtkDoubleArray *FarIntersections;
00361   
00362   // Benchmark
00363   vtkIdType MaxRecordedPixelListSize;
00364   
00365   
00366   vtkPixelListEntryMemory *MemoryManager;
00367 private:
00368   vtkUnstructuredGridVolumeZSweepMapper(const vtkUnstructuredGridVolumeZSweepMapper&);  // Not implemented.
00369   void operator=(const vtkUnstructuredGridVolumeZSweepMapper&);  // Not implemented.
00370 };
00371 
00372 #endif

Generated on Mon Jan 21 23:07:36 2008 for VTK by  doxygen 1.4.3-20050530