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 =========================================================================*/
00034 #ifndef __vtkUnstructuredGridVolumeZSweepMapper_h
00035 #define __vtkUnstructuredGridVolumeZSweepMapper_h
00036 
00037 #include "vtkUnstructuredGridVolumeMapper.h"
00038 
00039 class vtkRenderer;
00040 class vtkVolume;
00041 class vtkRayCastImageDisplayHelper;
00042 class vtkCell;
00043 class vtkGenericCell;
00044 class vtkIdList;
00045 class vtkPriorityQueue;
00046 class vtkTransform;
00047 class vtkMatrix4x4;
00048 class vtkVolumeProperty;
00049 class vtkDoubleArray;
00050 class vtkUnstructuredGridVolumeRayIntegrator;
00051 class vtkRenderWindow;
00052 
00053 // Internal classes
00054 class vtkScreenEdge;
00055 class vtkSpan;
00056 class vtkPixelListFrame;
00057 class vtkUseSet;
00058 class vtkVertices;
00059 class vtkSimpleScreenEdge;
00060 class vtkDoubleScreenEdge;
00061 class vtkVertexEntry;
00062 class vtkPixelListEntryMemory;
00063 
00064 class VTK_VOLUMERENDERING_EXPORT vtkUnstructuredGridVolumeZSweepMapper : public vtkUnstructuredGridVolumeMapper
00065 {
00066 public:
00067   vtkTypeRevisionMacro(vtkUnstructuredGridVolumeZSweepMapper,vtkUnstructuredGridVolumeMapper);
00068   void PrintSelf( ostream& os, vtkIndent indent );
00069   
00071   static vtkUnstructuredGridVolumeZSweepMapper *New();
00072   
00074 
00084   vtkSetMacro(ScalarMode,int);
00085   vtkGetMacro(ScalarMode,int);
00086   void SetScalarModeToDefault() {
00087     this->SetScalarMode(VTK_SCALAR_MODE_DEFAULT);};
00088   void SetScalarModeToUsePointData() {
00089     this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_DATA);};
00090   void SetScalarModeToUseCellData() {
00091     this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_DATA);};
00092   void SetScalarModeToUsePointFieldData() {
00093     this->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_FIELD_DATA);};
00094   void SetScalarModeToUseCellFieldData() {
00095     this->SetScalarMode(VTK_SCALAR_MODE_USE_CELL_FIELD_DATA);};
00097   
00099 
00103   virtual void SelectScalarArray(int arrayNum); 
00104   virtual void SelectScalarArray(const char* arrayName); 
00106   
00108 
00109   virtual char* GetArrayName() { return this->ArrayName; }
00110   virtual int GetArrayId() { return this->ArrayId; }
00111   virtual int GetArrayAccessMode() { return this->ArrayAccessMode; }
00113 
00115   const char *GetScalarModeAsString();
00116 
00118 
00121   vtkSetClampMacro( ImageSampleDistance, float, 0.1f, 100.0f );
00122   vtkGetMacro( ImageSampleDistance, float );
00124 
00126 
00128   vtkSetClampMacro( MinimumImageSampleDistance, float, 0.1f, 100.0f );
00129   vtkGetMacro( MinimumImageSampleDistance, float );
00131 
00133 
00135   vtkSetClampMacro( MaximumImageSampleDistance, float, 0.1f, 100.0f );
00136   vtkGetMacro( MaximumImageSampleDistance, float );
00138 
00140 
00143   vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
00144   vtkGetMacro( AutoAdjustSampleDistances, int );
00145   vtkBooleanMacro( AutoAdjustSampleDistances, int );
00147   
00149 
00151   vtkSetClampMacro( IntermixIntersectingGeometry, int, 0, 1 );
00152   vtkGetMacro( IntermixIntersectingGeometry, int );
00153   vtkBooleanMacro( IntermixIntersectingGeometry, int );
00155 
00160   int GetMaxPixelListSize();
00161   
00164   void SetMaxPixelListSize(int size);
00165   
00167 
00169   virtual void SetRayIntegrator(vtkUnstructuredGridVolumeRayIntegrator *ri);
00170   vtkGetObjectMacro(RayIntegrator, vtkUnstructuredGridVolumeRayIntegrator);
00172   
00173 //BTX
00175 
00177   void Render(vtkRenderer *ren,
00178               vtkVolume *vol);
00180   
00181   vtkGetVectorMacro( ImageInUseSize, int, 2 );
00182   vtkGetVectorMacro( ImageOrigin, int, 2 );
00183   vtkGetVectorMacro( ImageViewportSize, int , 2 );
00184 //ETX
00185   
00186 protected:
00187   vtkUnstructuredGridVolumeZSweepMapper();
00188   ~vtkUnstructuredGridVolumeZSweepMapper();
00189   
00191   void BuildUseSets();
00192   
00194 
00196   void ReorderTriangle(vtkIdType v[3],
00197                        vtkIdType w[3]);
00199 
00201 
00204   void ProjectAndSortVertices(vtkRenderer *ren,
00205                               vtkVolume *vol);
00207   
00209   void CreateAndCleanPixelList();
00210   
00213   void MainLoop(vtkRenderWindow *renWin);
00214   
00217   void CompositeFunction(double zTarget);
00218   
00220   unsigned char ColorComponentRealToByte(float color);
00221   
00223   void RasterizeFace(vtkIdType faceIds[3]);
00224   
00226 
00228   void RasterizeTriangle(vtkVertexEntry *ve0,vtkVertexEntry *ve1,
00229                          vtkVertexEntry *ve2);
00231   
00233 
00235   void RasterizeSpan(int y,
00236                      vtkScreenEdge *left,
00237                      vtkScreenEdge *right);
00239   
00241 
00244   void RasterizeLine(vtkVertexEntry *v0,
00245                      vtkVertexEntry *v1);
00247   
00248   void StoreRenderTime(vtkRenderer *ren,
00249                        vtkVolume *vol,
00250                        float t);
00251   
00252   float RetrieveRenderTime(vtkRenderer *ren,
00253                            vtkVolume *vol);
00254   
00256 
00257   double GetZBufferValue(int x,
00258                          int y);
00260   
00261   double GetMinimumBoundsDepth(vtkRenderer *ren,
00262                                vtkVolume *vol);
00263   
00266   void AllocateUseSet(vtkIdType size);
00267   
00270   void AllocateVertices(vtkIdType size);
00271   
00273   void SavePixelListFrame();
00274   
00275   int MaxPixelListSize;
00276   
00277   float ImageSampleDistance;
00278   float MinimumImageSampleDistance;
00279   float MaximumImageSampleDistance;
00280   int AutoAdjustSampleDistances;
00281   
00282   vtkRayCastImageDisplayHelper *ImageDisplayHelper;
00283   
00284   // This is how big the image would be if it covered the entire viewport
00285   int ImageViewportSize[2];
00286   
00287   // This is how big the allocated memory for image is. This may be bigger
00288   // or smaller than ImageFullSize - it will be bigger if necessary to 
00289   // ensure a power of 2, it will be smaller if the volume only covers a
00290   // small region of the viewport
00291   int ImageMemorySize[2];
00292   
00293   // This is the size of subregion in ImageSize image that we are using for
00294   // the current image. Since ImageSize is a power of 2, there is likely
00295   // wasted space in it. This number will be used for things such as clearing
00296   // the image if necessary.
00297   int ImageInUseSize[2];
00298   
00299   // This is the location in ImageFullSize image where our ImageSize image
00300   // is located.
00301   int ImageOrigin[2];
00302   
00303   // This is the allocated image
00304   unsigned char *Image;
00305   
00306   // This is the accumulating double RGBA image
00307   float *RealRGBAImage;
00308   
00309   float *RenderTimeTable;
00310   vtkVolume **RenderVolumeTable;
00311   vtkRenderer **RenderRendererTable;
00312   int RenderTableSize;
00313   int RenderTableEntries;
00314   
00315   int IntermixIntersectingGeometry;
00316 
00317   float *ZBuffer;
00318   int ZBufferSize[2];
00319   int ZBufferOrigin[2];
00320   
00321   int ScalarMode;
00322   char *ArrayName;
00323   int ArrayId;
00324   int ArrayAccessMode;
00325   
00326   vtkDataArray *Scalars;
00327   int CellScalars;
00328   
00329   vtkSpan *Span;
00330   vtkPixelListFrame *PixelListFrame;
00331   
00332   // Used by BuildUseSets().
00333   vtkGenericCell *Cell;
00334   
00335   vtkUseSet *UseSet;
00336   
00337   vtkPriorityQueue *EventList;
00338   vtkVertices *Vertices;
00339   
00340   vtkTransform *PerspectiveTransform;
00341   vtkMatrix4x4 *PerspectiveMatrix;
00342   
00343   // Used by the main loop
00344   int MaxPixelListSizeReached;
00345   int XBounds[2];
00346   int YBounds[2];
00347   
00348   vtkSimpleScreenEdge *SimpleEdge;
00349   vtkDoubleScreenEdge *DoubleEdge;
00350   
00351   vtkUnstructuredGridVolumeRayIntegrator *RayIntegrator;
00352   vtkUnstructuredGridVolumeRayIntegrator *RealRayIntegrator;
00353   
00354   vtkTimeStamp SavedTriangleListMTime;
00355   
00356   // Used during compositing
00357   vtkDoubleArray *IntersectionLengths;
00358   vtkDoubleArray *NearIntersections;
00359   vtkDoubleArray *FarIntersections;
00360   
00361   // Benchmark
00362   vtkIdType MaxRecordedPixelListSize;
00363   
00364   
00365   vtkPixelListEntryMemory *MemoryManager;
00366 private:
00367   vtkUnstructuredGridVolumeZSweepMapper(const vtkUnstructuredGridVolumeZSweepMapper&);  // Not implemented.
00368   void operator=(const vtkUnstructuredGridVolumeZSweepMapper&);  // Not implemented.
00369 };
00370 
00371 #endif

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