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 =========================================================================*/
35 #ifndef vtkUnstructuredGridVolumeZSweepMapper_h
36 #define vtkUnstructuredGridVolumeZSweepMapper_h
37 
38 #include "vtkRenderingVolumeModule.h" // For export macro
40 
41 class vtkRenderer;
42 class vtkVolume;
44 class vtkCell;
45 class vtkGenericCell;
46 class vtkIdList;
47 class vtkPriorityQueue;
48 class vtkTransform;
49 class vtkMatrix4x4;
50 class vtkVolumeProperty;
51 class vtkDoubleArray;
53 class vtkRenderWindow;
54 
55 // Internal classes
57 {
58  class vtkScreenEdge;
59  class vtkSpan;
60  class vtkPixelListFrame;
61  class vtkUseSet;
62  class vtkVertices;
63  class vtkSimpleScreenEdge;
64  class vtkDoubleScreenEdge;
65  class vtkVertexEntry;
66  class vtkPixelListEntryMemory;
67 };
68 
70 {
71 public:
73  void PrintSelf( ostream& os, vtkIndent indent ) override;
74 
79 
81 
86  vtkSetClampMacro( ImageSampleDistance, float, 0.1f, 100.0f );
87  vtkGetMacro( ImageSampleDistance, float );
89 
91 
95  vtkSetClampMacro( MinimumImageSampleDistance, float, 0.1f, 100.0f );
96  vtkGetMacro( MinimumImageSampleDistance, float );
98 
100 
104  vtkSetClampMacro( MaximumImageSampleDistance, float, 0.1f, 100.0f );
105  vtkGetMacro( MaximumImageSampleDistance, float );
107 
109 
115  vtkSetClampMacro( AutoAdjustSampleDistances, vtkTypeBool, 0, 1 );
116  vtkGetMacro( AutoAdjustSampleDistances, vtkTypeBool );
117  vtkBooleanMacro( AutoAdjustSampleDistances, vtkTypeBool );
119 
121 
125  vtkSetClampMacro( IntermixIntersectingGeometry, vtkTypeBool, 0, 1 );
126  vtkGetMacro( IntermixIntersectingGeometry, vtkTypeBool );
127  vtkBooleanMacro( IntermixIntersectingGeometry, vtkTypeBool );
129 
137 
144 
146 
151  vtkGetObjectMacro(RayIntegrator, vtkUnstructuredGridVolumeRayIntegrator);
153 
159  void Render(vtkRenderer *ren,
160  vtkVolume *vol) override;
161 
162  vtkGetVectorMacro( ImageInUseSize, int, 2 );
163  vtkGetVectorMacro( ImageOrigin, int, 2 );
164  vtkGetVectorMacro( ImageViewportSize, int , 2 );
165 
166 protected:
169 
173  void BuildUseSets();
174 
180  vtkIdType w[3]);
181 
188  vtkVolume *vol);
189 
194 
199  void MainLoop(vtkRenderWindow *renWin);
200 
205  void CompositeFunction(double zTarget);
206 
210  unsigned char ColorComponentRealToByte(float color);
211 
215  void RasterizeFace(vtkIdType faceIds[3], int externalSide);
216 
224  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *ve0,
225  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *ve1,
226  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *ve2,
227  bool exitFace);
228 
235  void RasterizeSpan(int y,
236  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkScreenEdge *left,
237  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkScreenEdge *right,
238  bool exitFace);
239 
247  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *v0,
248  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *v1,
249  bool exitFace);
250 
252  vtkVolume *vol,
253  float t);
254 
256  vtkVolume *vol);
257 
261  double GetZBufferValue(int x,
262  int y);
263 
265  vtkVolume *vol);
266 
272 
278 
283 
285 
290 
292 
293  // This is how big the image would be if it covered the entire viewport
294  int ImageViewportSize[2];
295 
296  // This is how big the allocated memory for image is. This may be bigger
297  // or smaller than ImageFullSize - it will be bigger if necessary to
298  // ensure a power of 2, it will be smaller if the volume only covers a
299  // small region of the viewport
300  int ImageMemorySize[2];
301 
302  // This is the size of subregion in ImageSize image that we are using for
303  // the current image. Since ImageSize is a power of 2, there is likely
304  // wasted space in it. This number will be used for things such as clearing
305  // the image if necessary.
306  int ImageInUseSize[2];
307 
308  // This is the location in ImageFullSize image where our ImageSize image
309  // is located.
310  int ImageOrigin[2];
311 
312  // This is the allocated image
313  unsigned char *Image;
314 
315  // This is the accumulating double RGBA image
317 
323 
325 
326  float *ZBuffer;
327  int ZBufferSize[2];
328  int ZBufferOrigin[2];
329 
332 
333  // if use CellScalars, we need to keep track of the
334  // values on each side of the face and figure out
335  // if the face is used by two cells (twosided) or one cell.
336  double FaceScalars[2];
337  int FaceSide;
338 
339  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSpan *Span;
340  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkPixelListFrame *PixelListFrame;
341 
342  // Used by BuildUseSets().
344 
345  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkUseSet *UseSet;
346 
348  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertices *Vertices;
349 
352 
353  // Used by the main loop
355  int XBounds[2];
356  int YBounds[2];
357 
358  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSimpleScreenEdge *SimpleEdge;
359  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkDoubleScreenEdge *DoubleEdge;
360 
363 
365 
366  // Used during compositing
370 
371  // Benchmark
373 
374 
375  vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkPixelListEntryMemory *MemoryManager;
376 
377 private:
379  void operator=(const vtkUnstructuredGridVolumeZSweepMapper&) = delete;
380 };
381 
382 #endif
vtkUnstructuredGridVolumeZSweepMapper::PixelListFrame
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkPixelListFrame * PixelListFrame
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:340
vtkUnstructuredGridVolumeZSweepMapper::New
static vtkUnstructuredGridVolumeZSweepMapper * New()
Set MaxPixelListSize to 32.
vtkUnstructuredGridVolumeZSweepMapper::ProjectAndSortVertices
void ProjectAndSortVertices(vtkRenderer *ren, vtkVolume *vol)
Project and sort the vertices by z-coordinates in view space in the "event list" (an heap).
vtkUnstructuredGridVolumeRayIntegrator
a superclass for volume ray integration functions
Definition: vtkUnstructuredGridVolumeRayIntegrator.h:42
vtkUnstructuredGridVolumeZSweepMapper::RealRayIntegrator
vtkUnstructuredGridVolumeRayIntegrator * RealRayIntegrator
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:362
vtkUnstructuredGridVolumeZSweepMapper::MaxRecordedPixelListSize
vtkIdType MaxRecordedPixelListSize
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:372
vtkVolume
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:51
vtkUnstructuredGridVolumeZSweepMapper::DoubleEdge
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkDoubleScreenEdge * DoubleEdge
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:359
vtkRayCastImageDisplayHelper
helper class that draws the image to the screen
Definition: vtkRayCastImageDisplayHelper.h:40
vtkUnstructuredGridVolumeZSweepMapper::ImageSampleDistance
float ImageSampleDistance
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:286
vtkUnstructuredGridVolumeZSweepMapper::RenderVolumeTable
vtkVolume ** RenderVolumeTable
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:319
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkUnstructuredGridVolumeZSweepMapper::Vertices
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertices * Vertices
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:348
vtkUnstructuredGridVolumeZSweepMapper::Image
unsigned char * Image
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:313
vtkUnstructuredGridVolumeZSweepMapper::MaximumImageSampleDistance
float MaximumImageSampleDistance
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:288
vtkUnstructuredGridVolumeZSweepMapper::SavedTriangleListMTime
vtkTimeStamp SavedTriangleListMTime
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:364
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:36
vtkUnstructuredGridVolumeZSweepMapper::FarIntersections
vtkDoubleArray * FarIntersections
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:369
vtkUnstructuredGridVolumeZSweepMapper::MainLoop
void MainLoop(vtkRenderWindow *renWin)
MainLoop of the Zsweep algorithm.
vtkPriorityQueue
a list of ids arranged in priority order
Definition: vtkPriorityQueue.h:47
vtkUnstructuredGridVolumeZSweepMapper::EventList
vtkPriorityQueue * EventList
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:347
vtkUnstructuredGridVolumeZSweepMapper::RasterizeTriangle
void RasterizeTriangle(vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *ve0, vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *ve1, vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *ve2, bool exitFace)
Perform scan conversion of a triangle defined by its vertices.
vtkUnstructuredGridVolumeZSweepMapper::CreateAndCleanPixelList
void CreateAndCleanPixelList()
Create an empty "pixel list" for each pixel of the screen.
vtkUnstructuredGridVolumeZSweepMapper::ReorderTriangle
int ReorderTriangle(vtkIdType v[3], vtkIdType w[3])
Reorder vertices ‘v’ in increasing order in ‘w’.
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkUnstructuredGridVolumeZSweepMapper::AllocateVertices
void AllocateVertices(vtkIdType size)
Allocate a vertex array of size ‘size’ only if the current one is not large enough.
vtkUnstructuredGridVolumeZSweepMapper::vtkUnstructuredGridVolumeZSweepMapper
vtkUnstructuredGridVolumeZSweepMapper()
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
vtkUnstructuredGridVolumeZSweepMapper::IntersectionLengths
vtkDoubleArray * IntersectionLengths
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:367
vtkUnstructuredGridVolumeZSweepMapper::RenderTimeTable
float * RenderTimeTable
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:318
vtkUnstructuredGridVolumeZSweepMapper::MaxPixelListSize
int MaxPixelListSize
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:284
vtkUnstructuredGridVolumeZSweepMapper::Span
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSpan * Span
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:339
vtkUnstructuredGridVolumeZSweepMapper::GetMinimumBoundsDepth
double GetMinimumBoundsDepth(vtkRenderer *ren, vtkVolume *vol)
vtkX3D::color
@ color
Definition: vtkX3D.h:221
vtkUnstructuredGridVolumeZSweepMapper::MemoryManager
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkPixelListEntryMemory * MemoryManager
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:375
vtkUnstructuredGridVolumeZSweepMapper
Unstructured grid volume mapper based the ZSweep Algorithm.
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:70
vtkUnstructuredGridVolumeZSweepMapper::GetZBufferValue
double GetZBufferValue(int x, int y)
Return the value of the z-buffer at screen coordinates (x,y).
vtkUnstructuredGridVolumeZSweepMapper::RenderTableEntries
int RenderTableEntries
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:322
vtkUnstructuredGridVolumeZSweepMapperNamespace
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:57
vtkUnstructuredGridVolumeZSweepMapper::Render
void Render(vtkRenderer *ren, vtkVolume *vol) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkUnstructuredGridVolumeZSweepMapper::PerspectiveMatrix
vtkMatrix4x4 * PerspectiveMatrix
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:351
vtkUnstructuredGridVolumeZSweepMapper::RayIntegrator
vtkUnstructuredGridVolumeRayIntegrator * RayIntegrator
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:361
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:60
vtkUnstructuredGridVolumeZSweepMapper::IntermixIntersectingGeometry
vtkTypeBool IntermixIntersectingGeometry
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:324
vtkUnstructuredGridVolumeZSweepMapper::ImageDisplayHelper
vtkRayCastImageDisplayHelper * ImageDisplayHelper
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:291
vtkUnstructuredGridVolumeZSweepMapper::RasterizeFace
void RasterizeFace(vtkIdType faceIds[3], int externalSide)
Perform scan conversion of a triangle face.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:42
vtkUnstructuredGridVolumeZSweepMapper::Scalars
vtkDataArray * Scalars
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:330
vtkUnstructuredGridVolumeZSweepMapper::AllocateUseSet
void AllocateUseSet(vtkIdType size)
Allocate an array of usesets of size ‘size’ only if the current one is not large enough.
vtkUnstructuredGridVolumeZSweepMapper::UseSet
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkUseSet * UseSet
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:345
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:37
vtkUnstructuredGridVolumeZSweepMapper::SavePixelListFrame
void SavePixelListFrame()
For debugging purpose, save the pixel list frame as a dataset.
vtkX3D::size
@ size
Definition: vtkX3D.h:253
vtkUnstructuredGridVolumeZSweepMapper::RenderTableSize
int RenderTableSize
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:321
vtkUnstructuredGridVolumeZSweepMapper::Cell
vtkGenericCell * Cell
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:343
vtkUnstructuredGridVolumeZSweepMapper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkUnstructuredGridVolumeZSweepMapper::CompositeFunction
void CompositeFunction(double zTarget)
Do delayed compositing from back to front, stopping at zTarget for each pixel inside the bounding box...
vtkUnstructuredGridVolumeZSweepMapper::FaceSide
int FaceSide
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:337
vtkUnstructuredGridVolumeZSweepMapper::CellScalars
int CellScalars
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:331
vtkUnstructuredGridVolumeZSweepMapper::MaxPixelListSizeReached
int MaxPixelListSizeReached
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:354
vtkUnstructuredGridVolumeMapper
Abstract class for an unstructured grid volume mapper.
Definition: vtkUnstructuredGridVolumeMapper.h:41
vtkUnstructuredGridVolumeZSweepMapper::SetRayIntegrator
virtual void SetRayIntegrator(vtkUnstructuredGridVolumeRayIntegrator *ri)
Set/Get the helper class for integrating rays.
vtkUnstructuredGridVolumeZSweepMapper::RasterizeLine
void RasterizeLine(vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *v0, vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry *v1, bool exitFace)
Scan conversion of a straight line defined by endpoints v0 and v1.
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkUnstructuredGridVolumeZSweepMapper::SimpleEdge
vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSimpleScreenEdge * SimpleEdge
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:358
vtkUnstructuredGridVolumeZSweepMapper::ZBuffer
float * ZBuffer
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:326
vtkUnstructuredGridVolumeZSweepMapper::SetMaxPixelListSize
void SetMaxPixelListSize(int size)
Change the maximum size allowed for a pixel list.
vtkUnstructuredGridVolumeZSweepMapper::NearIntersections
vtkDoubleArray * NearIntersections
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:368
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:40
vtkUnstructuredGridVolumeZSweepMapper::~vtkUnstructuredGridVolumeZSweepMapper
~vtkUnstructuredGridVolumeZSweepMapper() override
vtkUnstructuredGridVolumeZSweepMapper::StoreRenderTime
void StoreRenderTime(vtkRenderer *ren, vtkVolume *vol, float t)
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:42
vtkUnstructuredGridVolumeZSweepMapper::RetrieveRenderTime
float RetrieveRenderTime(vtkRenderer *ren, vtkVolume *vol)
vtkUnstructuredGridVolumeZSweepMapper::RealRGBAImage
float * RealRGBAImage
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:316
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:88
vtkUnstructuredGridVolumeMapper.h
vtkUnstructuredGridVolumeZSweepMapper::PerspectiveTransform
vtkTransform * PerspectiveTransform
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:350
vtkUnstructuredGridVolumeZSweepMapper::BuildUseSets
void BuildUseSets()
For each vertex, find the list of incident faces.
vtkUnstructuredGridVolumeZSweepMapper::RasterizeSpan
void RasterizeSpan(int y, vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkScreenEdge *left, vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkScreenEdge *right, bool exitFace)
Perform scan conversion of an horizontal span from left ro right at line y.
vtkUnstructuredGridVolumeZSweepMapper::ColorComponentRealToByte
unsigned char ColorComponentRealToByte(float color)
Convert and clamp a float color component into a unsigned char.
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkUnstructuredGridVolumeZSweepMapper::MinimumImageSampleDistance
float MinimumImageSampleDistance
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:287
vtkUnstructuredGridVolumeZSweepMapper::AutoAdjustSampleDistances
vtkTypeBool AutoAdjustSampleDistances
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:289
vtkVolumeProperty
represents the common properties for rendering a volume.
Definition: vtkVolumeProperty.h:69
vtkUnstructuredGridVolumeZSweepMapper::RenderRendererTable
vtkRenderer ** RenderRendererTable
Definition: vtkUnstructuredGridVolumeZSweepMapper.h:320
vtkUnstructuredGridVolumeZSweepMapper::GetMaxPixelListSize
int GetMaxPixelListSize()
Maximum size allowed for a pixel list.