VTK  9.5.2
vtkUnstructuredGridVolumeZSweepMapper.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
22
23#ifndef vtkUnstructuredGridVolumeZSweepMapper_h
24#define vtkUnstructuredGridVolumeZSweepMapper_h
25
26#include "vtkRenderingVolumeModule.h" // For export macro
28
29VTK_ABI_NAMESPACE_BEGIN
30class vtkRenderer;
31class vtkVolume;
33class vtkCell;
34class vtkGenericCell;
35class vtkIdList;
37class vtkTransform;
38class vtkMatrix4x4;
40class vtkDoubleArray;
42class vtkRenderWindow;
43VTK_ABI_NAMESPACE_END
44
45// Internal classes
47{
48VTK_ABI_NAMESPACE_BEGIN
49class vtkScreenEdge;
50class vtkSpan;
51class vtkPixelListFrame;
52class vtkUseSet;
53class vtkVertices;
54class vtkSimpleScreenEdge;
55class vtkDoubleScreenEdge;
56class vtkVertexEntry;
57class vtkPixelListEntryMemory;
58VTK_ABI_NAMESPACE_END
59}
60
61VTK_ABI_NAMESPACE_BEGIN
62class VTKRENDERINGVOLUME_EXPORT vtkUnstructuredGridVolumeZSweepMapper
64{
65public:
67 void PrintSelf(ostream& os, vtkIndent indent) override;
68
73
75
80 vtkSetClampMacro(ImageSampleDistance, float, 0.1f, 100.0f);
81 vtkGetMacro(ImageSampleDistance, float);
83
85
89 vtkSetClampMacro(MinimumImageSampleDistance, float, 0.1f, 100.0f);
90 vtkGetMacro(MinimumImageSampleDistance, float);
92
94
98 vtkSetClampMacro(MaximumImageSampleDistance, float, 0.1f, 100.0f);
99 vtkGetMacro(MaximumImageSampleDistance, float);
101
103
109 vtkSetClampMacro(AutoAdjustSampleDistances, vtkTypeBool, 0, 1);
113
115
123
131
137 void SetMaxPixelListSize(int size);
138
140
147
153 void Render(vtkRenderer* ren, vtkVolume* vol) override;
154
155 vtkGetVectorMacro(ImageInUseSize, int, 2);
156 vtkGetVectorMacro(ImageOrigin, int, 2);
157 vtkGetVectorMacro(ImageViewportSize, int, 2);
158
159protected:
162
167
173
180
185
191
196 void CompositeFunction(double zTarget);
197
201 unsigned char ColorComponentRealToByte(float color);
202
206 void RasterizeFace(vtkIdType faceIds[3], int externalSide);
207
214 void RasterizeTriangle(vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry* ve0,
215 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry* ve1,
216 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry* ve2, bool externalFace);
217
224 void RasterizeSpan(int y, vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkScreenEdge* left,
225 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkScreenEdge* right, bool exitFace);
226
233 void RasterizeLine(vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry* v0,
234 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertexEntry* v1, bool exitFace);
235
236 void StoreRenderTime(vtkRenderer* ren, vtkVolume* vol, float t);
237
239
243 double GetZBufferValue(int x, int y);
244
246
251 void AllocateUseSet(vtkIdType size);
252
257 void AllocateVertices(vtkIdType size);
258
263
265
270
272
273 // This is how big the image would be if it covered the entire viewport
275
276 // This is how big the allocated memory for image is. This may be bigger
277 // or smaller than ImageFullSize - it will be bigger if necessary to
278 // ensure a power of 2, it will be smaller if the volume only covers a
279 // small region of the viewport
281
282 // This is the size of subregion in ImageSize image that we are using for
283 // the current image. Since ImageSize is a power of 2, there is likely
284 // wasted space in it. This number will be used for things such as clearing
285 // the image if necessary.
287
288 // This is the location in ImageFullSize image where our ImageSize image
289 // is located.
291
292 // This is the allocated image
293 unsigned char* Image;
294
295 // This is the accumulating double RGBA image
297
303
305
306 float* ZBuffer;
309
312
313 // if use CellScalars, we need to keep track of the
314 // values on each side of the face and figure out
315 // if the face is used by two cells (twosided) or one cell.
316 double FaceScalars[2];
318
319 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSpan* Span;
320 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkPixelListFrame* PixelListFrame;
321
322 // Used by BuildUseSets().
324
325 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkUseSet* UseSet;
326
328 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkVertices* Vertices;
329
332
333 // Used by the main loop
335 int XBounds[2];
336 int YBounds[2];
337
338 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkSimpleScreenEdge* SimpleEdge;
339 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkDoubleScreenEdge* DoubleEdge;
340
343
345
346 // Used during compositing
350
351 // Benchmark
353
354 vtkUnstructuredGridVolumeZSweepMapperNamespace::vtkPixelListEntryMemory* MemoryManager;
355
356private:
357