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

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