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 
41 
42 class vtkRenderer;
43 class vtkVolume;
45 class vtkCell;
46 class vtkGenericCell;
47 class vtkIdList;
48 class vtkPriorityQueue;
49 class vtkTransform;
50 class vtkMatrix4x4;
51 class vtkVolumeProperty;
52 class vtkDoubleArray;
54 class vtkRenderWindow;
55 
56 //BTX
57 // Internal classes
59 {
60  class vtkScreenEdge;
61  class vtkSpan;
62  class vtkPixelListFrame;
63  class vtkUseSet;
64  class vtkVertices;
65  class vtkSimpleScreenEdge;
66  class vtkDoubleScreenEdge;
67  class vtkVertexEntry;
68  class vtkPixelListEntryMemory;
69 };
70 //ETX
71 
73 {
74 public:
76  void PrintSelf( ostream& os, vtkIndent indent );
77 
80 
82 
85  vtkSetClampMacro( ImageSampleDistance, float, 0.1f, 100.0f );
86  vtkGetMacro( ImageSampleDistance, float );
88 
90 
92  vtkSetClampMacro( MinimumImageSampleDistance, float, 0.1f, 100.0f );
93  vtkGetMacro( MinimumImageSampleDistance, float );
95 
97 
99  vtkSetClampMacro( MaximumImageSampleDistance, float, 0.1f, 100.0f );
100  vtkGetMacro( MaximumImageSampleDistance, float );
102 
104 
107  vtkSetClampMacro( AutoAdjustSampleDistances, int, 0, 1 );
108  vtkGetMacro( AutoAdjustSampleDistances, int );
109  vtkBooleanMacro( AutoAdjustSampleDistances, int );
111 
113 
115  vtkSetClampMacro( IntermixIntersectingGeometry, int, 0, 1 );
116  vtkGetMacro( IntermixIntersectingGeometry, int );
117  vtkBooleanMacro( IntermixIntersectingGeometry, int );
119 
124  int GetMaxPixelListSize();
125 
128  void SetMaxPixelListSize(int size);
129 
131 
133  virtual void SetRayIntegrator(vtkUnstructuredGridVolumeRayIntegrator *ri);
134  vtkGetObjectMacro(RayIntegrator, vtkUnstructuredGridVolumeRayIntegrator);
136 
137 //BTX
139 
141  void Render(vtkRenderer *ren,
142  vtkVolume *vol);
144 
145  vtkGetVectorMacro( ImageInUseSize, int, 2 );
146  vtkGetVectorMacro( ImageOrigin, int, 2 );
147  vtkGetVectorMacro( ImageViewportSize, int , 2 );
148 //ETX
149 
150 protected:
153 
155  void BuildUseSets();
156 
158 
160  int ReorderTriangle(vtkIdType v[3],
161  vtkIdType w[3]);
163 
165 
168  void ProjectAndSortVertices(vtkRenderer *ren,
169  vtkVolume *vol);
171 
173  void CreateAndCleanPixelList();
174 
177  void MainLoop(vtkRenderWindow *renWin);
178 
181  void CompositeFunction(double zTarget);
182 
184  unsigned char ColorComponentRealToByte(float color);
185 
187  void RasterizeFace(vtkIdType faceIds[3], int externalSide);
188 
189 //BTX
191 
193  void RasterizeTriangle(
194  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *ve0,
195  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *ve1,
196  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *ve2,
197  bool exitFace);
199 
201 
203  void RasterizeSpan(int y,
204  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkScreenEdge *left,
205  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkScreenEdge *right,
206  bool exitFace);
208 
210 
213  void RasterizeLine(
214  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *v0,
215  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *v1,
216  bool exitFace);
217 //ETX
219 
220  void StoreRenderTime(vtkRenderer *ren,
221  vtkVolume *vol,
222  float t);
223 
224  float RetrieveRenderTime(vtkRenderer *ren,
225  vtkVolume *vol);
226 
228 
229  double GetZBufferValue(int x,
230  int y);
232 
233  double GetMinimumBoundsDepth(vtkRenderer *ren,
234  vtkVolume *vol);
235 
238  void AllocateUseSet(vtkIdType size);
239 
242  void AllocateVertices(vtkIdType size);
243 
245  void SavePixelListFrame();
246 
248 
253 
255 
256  // This is how big the image would be if it covered the entire viewport
257  int ImageViewportSize[2];
258 
259  // This is how big the allocated memory for image is. This may be bigger
260  // or smaller than ImageFullSize - it will be bigger if necessary to
261  // ensure a power of 2, it will be smaller if the volume only covers a
262  // small region of the viewport
263  int ImageMemorySize[2];
264 
265  // This is the size of subregion in ImageSize image that we are using for
266  // the current image. Since ImageSize is a power of 2, there is likely
267  // wasted space in it. This number will be used for things such as clearing
268  // the image if necessary.
269  int ImageInUseSize[2];
270 
271  // This is the location in ImageFullSize image where our ImageSize image
272  // is located.
273  int ImageOrigin[2];
274 
275  // This is the allocated image
276  unsigned char *Image;
277 
278  // This is the accumulating double RGBA image
280 
286 
288 
289  float *ZBuffer;
290  int ZBufferSize[2];
291  int ZBufferOrigin[2];
292 
295 
296  // if use CellScalars, we need to keep track of the
297  // values on each side of the face and figure out
298  // if the face is used by two cells (twosided) or one cell.
299  double FaceScalars[2];
300  int FaceSide;
301 
302 //BTX
303  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSpan *Span;
304  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkPixelListFrame *PixelListFrame;
305 
306  // Used by BuildUseSets().
308 
309  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkUseSet *UseSet;
310 
312  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertices *Vertices;
313 
316 
317  // Used by the main loop
319  int XBounds[2];
320  int YBounds[2];
321 
322  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSimpleScreenEdge *SimpleEdge;
323  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkDoubleScreenEdge *DoubleEdge;
324 
327 
329 
330  // Used during compositing
334 
335  // Benchmark
337 
338 
339  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkPixelListEntryMemory *MemoryManager;
340 //ETX
341 private:
343  void operator=(const vtkUnstructuredGridVolumeZSweepMapper&); // Not implemented.
344 };
345 
346 #endif
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSpan * Span
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:48
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:37
virtual void Render(vtkRenderer *ren, vtkVolume *vol)=0
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkPixelListEntryMemory * MemoryManager
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSimpleScreenEdge * SimpleEdge
record modification and/or execution time
Definition: vtkTimeStamp.h:33
#define VTK_VOLUMERENDERING_EXPORT
abstract specification for renderers
Definition: vtkRenderer.h:69
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:58
int vtkIdType
Definition: vtkType.h:255
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
an list of ids arranged in priority order
a superclass for volume ray integration functions
abstract class to specify cell behavior
Definition: vtkCell.h:57
a simple class to control print indentation
Definition: vtkIndent.h:37
Abstract class for a unstructured grid volume mapper.
list of point or cell ids
Definition: vtkIdList.h:34
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:53
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