VTK
vtkUnstructuredGridVolumeZSweepMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkUnstructuredGridVolumeZSweepMapper.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
38 #ifndef vtkUnstructuredGridVolumeZSweepMapper_h
39 #define vtkUnstructuredGridVolumeZSweepMapper_h
40 
41 #include "vtkRenderingVolumeModule.h" // For export macro
43 
44 class vtkRenderer;
45 class vtkVolume;
47 class vtkCell;
48 class vtkGenericCell;
49 class vtkIdList;
50 class vtkPriorityQueue;
51 class vtkTransform;
52 class vtkMatrix4x4;
53 class vtkVolumeProperty;
54 class vtkDoubleArray;
56 class vtkRenderWindow;
57 
58 // Internal classes
60 {
61  class vtkScreenEdge;
62  class vtkSpan;
63  class vtkPixelListFrame;
64  class vtkUseSet;
65  class vtkVertices;
66  class vtkSimpleScreenEdge;
67  class vtkDoubleScreenEdge;
68  class vtkVertexEntry;
69  class vtkPixelListEntryMemory;
70 };
71 
73 {
74 public:
76  void PrintSelf( ostream& os, vtkIndent indent );
77 
82 
84 
89  vtkSetClampMacro( ImageSampleDistance, float, 0.1f, 100.0f );
90  vtkGetMacro( ImageSampleDistance, float );
92 
94 
98  vtkSetClampMacro( MinimumImageSampleDistance, float, 0.1f, 100.0f );
99  vtkGetMacro( MinimumImageSampleDistance, float );
101 
103 
107  vtkSetClampMacro( MaximumImageSampleDistance, float, 0.1f, 100.0f );
108  vtkGetMacro( MaximumImageSampleDistance, float );
110 
112 
118  vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
119  vtkGetMacro( AutoAdjustSampleDistances, int );
120  vtkBooleanMacro( AutoAdjustSampleDistances, int );
122 
124 
128  vtkSetClampMacro( IntermixIntersectingGeometry, int, 0, 1 );
129  vtkGetMacro( IntermixIntersectingGeometry, int );
130  vtkBooleanMacro( IntermixIntersectingGeometry, int );
132 
139  int GetMaxPixelListSize();
140 
146  void SetMaxPixelListSize(int size);
147 
149 
153  virtual void SetRayIntegrator(vtkUnstructuredGridVolumeRayIntegrator *ri);
154  vtkGetObjectMacro(RayIntegrator, vtkUnstructuredGridVolumeRayIntegrator);
156 
162  void Render(vtkRenderer *ren,
163  vtkVolume *vol);
164 
165  vtkGetVectorMacro( ImageInUseSize, int, 2 );
166  vtkGetVectorMacro( ImageOrigin, int, 2 );
167  vtkGetVectorMacro( ImageViewportSize, int , 2 );
168 
169 protected:
172 
176  void BuildUseSets();
177 
182  int ReorderTriangle(vtkIdType v[3],
183  vtkIdType w[3]);
184 
190  void ProjectAndSortVertices(vtkRenderer *ren,
191  vtkVolume *vol);
192 
196  void CreateAndCleanPixelList();
197 
202  void MainLoop(vtkRenderWindow *renWin);
203 
208  void CompositeFunction(double zTarget);
209 
213  unsigned char ColorComponentRealToByte(float color);
214 
218  void RasterizeFace(vtkIdType faceIds[3], int externalSide);
219 
226  void RasterizeTriangle(
227  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *ve0,
228  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *ve1,
229  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *ve2,
230  bool exitFace);
231 
238  void RasterizeSpan(int y,
239  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkScreenEdge *left,
240  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkScreenEdge *right,
241  bool exitFace);
242 
249  void RasterizeLine(
250  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *v0,
251  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *v1,
252  bool exitFace);
253 
254  void StoreRenderTime(vtkRenderer *ren,
255  vtkVolume *vol,
256  float t);
257 
258  float RetrieveRenderTime(vtkRenderer *ren,
259  vtkVolume *vol);
260 
264  double GetZBufferValue(int x,
265  int y);
266 
267  double GetMinimumBoundsDepth(vtkRenderer *ren,
268  vtkVolume *vol);
269 
274  void AllocateUseSet(vtkIdType size);
275 
280  void AllocateVertices(vtkIdType size);
281 
285  void SavePixelListFrame();
286 
288 
293 
295 
296  // This is how big the image would be if it covered the entire viewport
297  int ImageViewportSize[2];
298 
299  // This is how big the allocated memory for image is. This may be bigger
300  // or smaller than ImageFullSize - it will be bigger if necessary to
301  // ensure a power of 2, it will be smaller if the volume only covers a
302  // small region of the viewport
303  int ImageMemorySize[2];
304 
305  // This is the size of subregion in ImageSize image that we are using for
306  // the current image. Since ImageSize is a power of 2, there is likely
307  // wasted space in it. This number will be used for things such as clearing
308  // the image if necessary.
309  int ImageInUseSize[2];
310 
311  // This is the location in ImageFullSize image where our ImageSize image
312  // is located.
313  int ImageOrigin[2];
314 
315  // This is the allocated image
316  unsigned char *Image;
317 
318  // This is the accumulating double RGBA image
320 
326 
328 
329  float *ZBuffer;
330  int ZBufferSize[2];
331  int ZBufferOrigin[2];
332 
335 
336  // if use CellScalars, we need to keep track of the
337  // values on each side of the face and figure out
338  // if the face is used by two cells (twosided) or one cell.
339  double FaceScalars[2];
340  int FaceSide;
341 
342  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSpan *Span;
343  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkPixelListFrame *PixelListFrame;
344 
345  // Used by BuildUseSets().
347 
348  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkUseSet *UseSet;
349 
351  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertices *Vertices;
352 
355 
356  // Used by the main loop
358  int XBounds[2];
359  int YBounds[2];
360 
361  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSimpleScreenEdge *SimpleEdge;
362  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkDoubleScreenEdge *DoubleEdge;
363 
366 
368 
369  // Used during compositing
373 
374  // Benchmark
376 
377 
378  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkPixelListEntryMemory *MemoryManager;
379 
380 private:
382  void operator=(const vtkUnstructuredGridVolumeZSweepMapper&) VTK_DELETE_FUNCTION;
383 };
384 
385 #endif
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSpan * Span
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:50
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
virtual void Render(vtkRenderer *ren, vtkVolume *vol)=0
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkPixelListEntryMemory * MemoryManager
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSimpleScreenEdge * SimpleEdge
record modification and/or execution time
Definition: vtkTimeStamp.h:35
abstract specification for renderers
Definition: vtkRenderer.h:63
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
int vtkIdType
Definition: vtkType.h:287
provides thread-safe access to cells
vtkUnstructuredGridVolumeRayIntegrator * RealRayIntegrator
helper class that draws the image to the screen
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertices * Vertices
dynamic, self-adjusting array of double
a list of ids arranged in priority order
a superclass for volume ray integration functions
abstract class to specify cell behavior
Definition: vtkCell.h:59
a simple class to control print indentation
Definition: vtkIndent.h:39
Abstract class for a unstructured grid volume mapper.
list of point or cell ids
Definition: vtkIdList.h:36
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
represents the common properties for rendering a volume.
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkPixelListFrame * PixelListFrame
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkUseSet * UseSet
create a window for renderers to draw into
static vtkAlgorithm * New()
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
Unstructured grid volume mapper based the ZSweep Algorithm.
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkDoubleScreenEdge * DoubleEdge
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkUnstructuredGridVolumeRayIntegrator * RayIntegrator