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 =========================================================================*/
37 #ifndef vtkUnstructuredGridVolumeZSweepMapper_h
38 #define vtkUnstructuredGridVolumeZSweepMapper_h
39 
40 #include "vtkRenderingVolumeModule.h" // For export macro
42 
43 class vtkRenderer;
44 class vtkVolume;
46 class vtkCell;
47 class vtkGenericCell;
48 class vtkIdList;
49 class vtkPriorityQueue;
50 class vtkTransform;
51 class vtkMatrix4x4;
52 class vtkVolumeProperty;
53 class vtkDoubleArray;
55 class vtkRenderWindow;
56 
57 //BTX
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 //ETX
72 
74 {
75 public:
77  void PrintSelf( ostream& os, vtkIndent indent );
78 
81 
83 
86  vtkSetClampMacro( ImageSampleDistance, float, 0.1f, 100.0f );
87  vtkGetMacro( ImageSampleDistance, float );
89 
91 
93  vtkSetClampMacro( MinimumImageSampleDistance, float, 0.1f, 100.0f );
94  vtkGetMacro( MinimumImageSampleDistance, float );
96 
98 
100  vtkSetClampMacro( MaximumImageSampleDistance, float, 0.1f, 100.0f );
101  vtkGetMacro( MaximumImageSampleDistance, float );
103 
105 
108  vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
109  vtkGetMacro( AutoAdjustSampleDistances, int );
110  vtkBooleanMacro( AutoAdjustSampleDistances, int );
112 
114 
116  vtkSetClampMacro( IntermixIntersectingGeometry, int, 0, 1 );
117  vtkGetMacro( IntermixIntersectingGeometry, int );
118  vtkBooleanMacro( IntermixIntersectingGeometry, int );
120 
125  int GetMaxPixelListSize();
126 
129  void SetMaxPixelListSize(int size);
130 
132 
134  virtual void SetRayIntegrator(vtkUnstructuredGridVolumeRayIntegrator *ri);
135  vtkGetObjectMacro(RayIntegrator, vtkUnstructuredGridVolumeRayIntegrator);
137 
138 //BTX
140 
142  void Render(vtkRenderer *ren,
143  vtkVolume *vol);
145 
146  vtkGetVectorMacro( ImageInUseSize, int, 2 );
147  vtkGetVectorMacro( ImageOrigin, int, 2 );
148  vtkGetVectorMacro( ImageViewportSize, int , 2 );
149 //ETX
150 
151 protected:
154 
156  void BuildUseSets();
157 
159 
161  int ReorderTriangle(vtkIdType v[3],
162  vtkIdType w[3]);
164 
166 
169  void ProjectAndSortVertices(vtkRenderer *ren,
170  vtkVolume *vol);
172 
174  void CreateAndCleanPixelList();
175 
178  void MainLoop(vtkRenderWindow *renWin);
179 
182  void CompositeFunction(double zTarget);
183 
185  unsigned char ColorComponentRealToByte(float color);
186 
188  void RasterizeFace(vtkIdType faceIds[3], int externalSide);
189 
190 //BTX
192 
194  void RasterizeTriangle(
195  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *ve0,
196  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *ve1,
197  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *ve2,
198  bool exitFace);
200 
202 
204  void RasterizeSpan(int y,
205  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkScreenEdge *left,
206  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkScreenEdge *right,
207  bool exitFace);
209 
211 
214  void RasterizeLine(
215  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *v0,
216  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *v1,
217  bool exitFace);
218 //ETX
220 
221  void StoreRenderTime(vtkRenderer *ren,
222  vtkVolume *vol,
223  float t);
224 
225  float RetrieveRenderTime(vtkRenderer *ren,
226  vtkVolume *vol);
227 
229 
230  double GetZBufferValue(int x,
231  int y);
233 
234  double GetMinimumBoundsDepth(vtkRenderer *ren,
235  vtkVolume *vol);
236 
239  void AllocateUseSet(vtkIdType size);
240 
243  void AllocateVertices(vtkIdType size);
244 
246  void SavePixelListFrame();
247 
249 
254 
256 
257  // This is how big the image would be if it covered the entire viewport
258  int ImageViewportSize[2];
259 
260  // This is how big the allocated memory for image is. This may be bigger
261  // or smaller than ImageFullSize - it will be bigger if necessary to
262  // ensure a power of 2, it will be smaller if the volume only covers a
263  // small region of the viewport
264  int ImageMemorySize[2];
265 
266  // This is the size of subregion in ImageSize image that we are using for
267  // the current image. Since ImageSize is a power of 2, there is likely
268  // wasted space in it. This number will be used for things such as clearing
269  // the image if necessary.
270  int ImageInUseSize[2];
271 
272  // This is the location in ImageFullSize image where our ImageSize image
273  // is located.
274  int ImageOrigin[2];
275 
276  // This is the allocated image
277  unsigned char *Image;
278 
279  // This is the accumulating double RGBA image
281 
287 
289 
290  float *ZBuffer;
291  int ZBufferSize[2];
292  int ZBufferOrigin[2];
293 
296 
297  // if use CellScalars, we need to keep track of the
298  // values on each side of the face and figure out
299  // if the face is used by two cells (twosided) or one cell.
300  double FaceScalars[2];
301  int FaceSide;
302 
303 //BTX
304  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSpan *Span;
305  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkPixelListFrame *PixelListFrame;
306 
307  // Used by BuildUseSets().
309 
310  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkUseSet *UseSet;
311 
313  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertices *Vertices;
314 
317 
318  // Used by the main loop
320  int XBounds[2];
321  int YBounds[2];
322 
323  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSimpleScreenEdge *SimpleEdge;
324  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkDoubleScreenEdge *DoubleEdge;
325 
328 
330 
331  // Used during compositing
335 
336  // Benchmark
338 
339 
340  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkPixelListEntryMemory *MemoryManager;
341 //ETX
342 private:
344  void operator=(const vtkUnstructuredGridVolumeZSweepMapper&); // Not implemented.
345 };
346 
347 #endif
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSpan * Span
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:49
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:38
virtual void Render(vtkRenderer *ren, vtkVolume *vol)=0
#define VTKRENDERINGVOLUME_EXPORT
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkPixelListEntryMemory * MemoryManager
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSimpleScreenEdge * SimpleEdge
record modification and/or execution time
Definition: vtkTimeStamp.h:34
abstract specification for renderers
Definition: vtkRenderer.h:63
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:59
int vtkIdType
Definition: vtkType.h:275
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:61
a simple class to control print indentation
Definition: vtkIndent.h:38
Abstract class for a unstructured grid volume mapper.
list of point or cell ids
Definition: vtkIdList.h:35
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()
Unstructured grid volume mapper based the ZSweep Algorithm.
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkDoubleScreenEdge * DoubleEdge
void PrintSelf(ostream &os, vtkIndent indent)
vtkUnstructuredGridVolumeRayIntegrator * RayIntegrator