VTK-m  2.2
Wireframer.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 
11 #ifndef vtk_m_rendering_Wireframer_h
12 #define vtk_m_rendering_Wireframer_h
13 
14 #include <vtkm/Assert.h>
15 #include <vtkm/Math.h>
16 #include <vtkm/Swap.h>
17 #include <vtkm/Types.h>
18 #include <vtkm/VectorAnalysis.h>
19 #include <vtkm/cont/ArrayHandle.h>
20 #include <vtkm/cont/AtomicArray.h>
25 
26 namespace vtkm
27 {
28 namespace rendering
29 {
30 namespace
31 {
32 
33 using ColorMapHandle = vtkm::cont::ArrayHandle<vtkm::Vec4f_32>;
34 using IndicesHandle = vtkm::cont::ArrayHandle<vtkm::Id2>;
35 using PackedFrameBufferHandle = vtkm::cont::ArrayHandle<vtkm::Int64>;
36 
37 // Depth value of 1.0f
38 const vtkm::Int64 ClearDepth = 0x3F800000;
39 // Packed frame buffer value with color set as black and depth as 1.0f
40 const vtkm::Int64 ClearValue = 0x3F800000000000FF;
41 
43 vtkm::Float32 IntegerPart(vtkm::Float32 x)
44 {
45  return vtkm::Floor(x);
46 }
47 
49 vtkm::Float32 FractionalPart(vtkm::Float32 x)
50 {
51  return x - vtkm::Floor(x);
52 }
53 
55 vtkm::Float32 ReverseFractionalPart(vtkm::Float32 x)
56 {
57  return 1.0f - FractionalPart(x);
58 }
59 
61 vtkm::UInt32 ScaleColorComponent(vtkm::Float32 c)
62 {
63  vtkm::Int32 t = vtkm::Int32(c * 256.0f);
64  return vtkm::UInt32(t < 0 ? 0 : (t > 255 ? 255 : t));
65 }
66 
69 
71 vtkm::UInt32 PackColor(const vtkm::Vec4f_32& color)
72 {
73  return PackColor(color[0], color[1], color[2], color[3]);
74 }
75 
78 {
79  vtkm::UInt32 packed = (ScaleColorComponent(r) << 24);
80  packed |= (ScaleColorComponent(g) << 16);
81  packed |= (ScaleColorComponent(b) << 8);
82  packed |= ScaleColorComponent(a);
83  return packed;
84 }
85 
87 void UnpackColor(vtkm::UInt32 color,
88  vtkm::Float32& r,
89  vtkm::Float32& g,
90  vtkm::Float32& b,
91  vtkm::Float32& a);
92 
94 void UnpackColor(vtkm::UInt32 packedColor, vtkm::Vec4f_32& color)
95 {
96  UnpackColor(packedColor, color[0], color[1], color[2], color[3]);
97 }
98 
100 void UnpackColor(vtkm::UInt32 color,
101  vtkm::Float32& r,
102  vtkm::Float32& g,
103  vtkm::Float32& b,
104  vtkm::Float32& a)
105 {
106  r = vtkm::Float32((color & 0xFF000000) >> 24) / 255.0f;
107  g = vtkm::Float32((color & 0x00FF0000) >> 16) / 255.0f;
108  b = vtkm::Float32((color & 0x0000FF00) >> 8) / 255.0f;
109  a = vtkm::Float32((color & 0x000000FF)) / 255.0f;
110 }
111 
112 union PackedValue {
113  struct PackedFloats
114  {
117  } Floats;
118  struct PackedInts
119  {
122  } Ints;
124 }; // union PackedValue
125 
126 struct CopyIntoFrameBuffer : public vtkm::worklet::WorkletMapField
127 {
128  using ControlSignature = void(FieldIn, FieldIn, FieldOut);
129  using ExecutionSignature = void(_1, _2, _3);
130 
131  VTKM_CONT
132  CopyIntoFrameBuffer() {}
133 
134  VTKM_EXEC
135  void operator()(const vtkm::Vec4f_32& color,
136  const vtkm::Float32& depth,
137  vtkm::Int64& outValue) const
138  {
139  PackedValue packed;
140  packed.Ints.Color = PackColor(color);
141  packed.Floats.Depth = depth;
142  outValue = packed.Raw;
143  }
144 }; //struct CopyIntoFrameBuffer
145 
146 template <typename DeviceTag>
147 class EdgePlotter : public vtkm::worklet::WorkletMapField
148 {
149 public:
150  using AtomicPackedFrameBufferHandle = vtkm::exec::AtomicArrayExecutionObject<vtkm::Int64>;
151  using AtomicPackedFrameBuffer = vtkm::cont::AtomicArray<vtkm::Int64>;
152 
153  using ControlSignature = void(FieldIn, WholeArrayIn, WholeArrayIn);
154  using ExecutionSignature = void(_1, _2, _3);
155  using InputDomain = _1;
156 
157  VTKM_CONT
158  EdgePlotter(const vtkm::Matrix<vtkm::Float32, 4, 4>& worldToProjection,
159  vtkm::Id width,
160  vtkm::Id height,
161  vtkm::Id subsetWidth,
162  vtkm::Id subsetHeight,
163  vtkm::Id xOffset,
164  vtkm::Id yOffset,
165  bool assocPoints,
166  const vtkm::Range& fieldRange,
167  const ColorMapHandle& colorMap,
168  const AtomicPackedFrameBuffer& frameBuffer,
169  const vtkm::Range& clippingRange,
170  vtkm::cont::Token& token)
171  : WorldToProjection(worldToProjection)
172  , Width(width)
173  , Height(height)
174  , SubsetWidth(subsetWidth)
175  , SubsetHeight(subsetHeight)
176  , XOffset(xOffset)
177  , YOffset(yOffset)
178  , AssocPoints(assocPoints)
179  , ColorMap(colorMap.PrepareForInput(DeviceTag(), token))
180  , ColorMapSize(vtkm::Float32(colorMap.GetNumberOfValues() - 1))
181  , FrameBuffer(frameBuffer.PrepareForExecution(DeviceTag(), token))
182  , FieldMin(vtkm::Float32(fieldRange.Min))
183  {
184  vtkm::Float32 fieldLength = vtkm::Float32(fieldRange.Length());
185  if (fieldLength == 0.f)
186  {
187  // constant color
188  this->InverseFieldDelta = 0.f;
189  }
190  else
191  {
192  this->InverseFieldDelta = 1.0f / fieldLength;
193  }
194  this->Offset = vtkm::Max(0.03f / vtkm::Float32(clippingRange.Length()), 0.0001f);
195  }
196 
197  template <typename CoordinatesPortalType, typename ScalarFieldPortalType>
198  VTKM_EXEC void operator()(const vtkm::Id2& edgeIndices,
199  const CoordinatesPortalType& coordsPortal,
200  const ScalarFieldPortalType& fieldPortal) const
201  {
202  vtkm::Id point1Idx = edgeIndices[0];
203  vtkm::Id point2Idx = edgeIndices[1];
204 
205  vtkm::Vec3f_32 point1 = coordsPortal.Get(edgeIndices[0]);
206  vtkm::Vec3f_32 point2 = coordsPortal.Get(edgeIndices[1]);
207 
208  TransformWorldToViewport(point1);
209  TransformWorldToViewport(point2);
210 
211  vtkm::Float32 x1 = vtkm::Round(point1[0]);
212  vtkm::Float32 y1 = vtkm::Round(point1[1]);
213  vtkm::Float32 z1 = point1[2];
214  vtkm::Float32 x2 = vtkm::Round(point2[0]);
215  vtkm::Float32 y2 = vtkm::Round(point2[1]);
216  vtkm::Float32 z2 = point2[2];
217  // If the line is steep, i.e., the height is greater than the width, then
218  // transpose the co-ordinates to prevent "holes" in the line. This ensures
219  // that we pick the co-ordinate which grows at a lesser rate than the other.
220  bool transposed = vtkm::Abs(y2 - y1) > vtkm::Abs(x2 - x1);
221  if (transposed)
222  {
223  vtkm::Swap(x1, y1);
224  vtkm::Swap(x2, y2);
225  }
226 
227  // Ensure we are always going from left to right
228  if (x1 > x2)
229  {
230  vtkm::Swap(x1, x2);
231  vtkm::Swap(y1, y2);
232  vtkm::Swap(z1, z2);
233  }
234 
235  vtkm::Float32 dx = x2 - x1;
236  vtkm::Float32 dy = y2 - y1;
237  if (dx == 0.0)
238  dx = vtkm::Epsilon32(); // Avoid FPE
239  vtkm::Float32 gradient = dy / dx;
240 
241  vtkm::Float32 xEnd = vtkm::Round(x1);
242  vtkm::Float32 yEnd = y1 + gradient * (xEnd - x1);
243  vtkm::Float32 xPxl1 = xEnd, yPxl1 = IntegerPart(yEnd);
244  vtkm::Float32 zPxl1 = vtkm::Lerp(z1, z2, (xPxl1 - x1) / dx);
245  vtkm::Float64 point1Field = fieldPortal.Get(point1Idx);
246  vtkm::Float64 point2Field;
247  if (AssocPoints)
248  {
249  point2Field = fieldPortal.Get(point2Idx);
250  }
251  else
252  {
253  // cell associated field has a solid line color
254  point2Field = point1Field;
255  }
256 
257  // Plot first endpoint
258  vtkm::Vec4f_32 color = GetColor(point1Field);
259  if (transposed)
260  {
261  Plot(yPxl1, xPxl1, zPxl1, color, 1.0f);
262  }
263  else
264  {
265  Plot(xPxl1, yPxl1, zPxl1, color, 1.0f);
266  }
267 
268  vtkm::Float32 interY = yEnd + gradient;
269  xEnd = vtkm::Round(x2);
270  yEnd = y2 + gradient * (xEnd - x2);
271  vtkm::Float32 xPxl2 = xEnd, yPxl2 = IntegerPart(yEnd);
272  vtkm::Float32 zPxl2 = vtkm::Lerp(z1, z2, (xPxl2 - x1) / dx);
273 
274  // Plot second endpoint
275  color = GetColor(point2Field);
276  if (transposed)
277  {
278  Plot(yPxl2, xPxl2, zPxl2, color, 1.0f);
279  }
280  else
281  {
282  Plot(xPxl2, yPxl2, zPxl2, color, 1.0f);
283  }
284 
285  // Plot rest of the line
286  if (transposed)
287  {
288  for (vtkm::Float32 x = xPxl1 + 1; x <= xPxl2 - 1; ++x)
289  {
290  vtkm::Float32 t = IntegerPart(interY);
291  vtkm::Float32 factor = (x - x1) / dx;
292  vtkm::Float32 depth = vtkm::Lerp(zPxl1, zPxl2, factor);
293  vtkm::Float64 fieldValue = vtkm::Lerp(point1Field, point2Field, factor);
294  color = GetColor(fieldValue);
295  Plot(t, x, depth, color, ReverseFractionalPart(interY));
296  Plot(t + 1, x, depth, color, FractionalPart(interY));
297  interY += gradient;
298  }
299  }
300  else
301  {
302  for (vtkm::Float32 x = xPxl1 + 1; x <= xPxl2 - 1; ++x)
303  {
304  vtkm::Float32 t = IntegerPart(interY);
305  vtkm::Float32 factor = (x - x1) / dx;
306  vtkm::Float32 depth = vtkm::Lerp(zPxl1, zPxl2, factor);
307  vtkm::Float64 fieldValue = vtkm::Lerp(point1Field, point2Field, factor);
308  color = GetColor(fieldValue);
309  Plot(x, t, depth, color, ReverseFractionalPart(interY));
310  Plot(x, t + 1, depth, color, FractionalPart(interY));
311  interY += gradient;
312  }
313  }
314  }
315 
316 private:
317  using ColorMapPortalConst = typename ColorMapHandle::ReadPortalType;
318 
319  VTKM_EXEC
320  void TransformWorldToViewport(vtkm::Vec3f_32& point) const
321  {
322  vtkm::Vec4f_32 temp(point[0], point[1], point[2], 1.0f);
324  for (vtkm::IdComponent i = 0; i < 3; ++i)
325  {
326  point[i] = temp[i] / temp[3];
327  }
328  // Scale to canvas width and height
329  point[0] = (point[0] * 0.5f + 0.5f) * vtkm::Float32(SubsetWidth) + vtkm::Float32(XOffset);
330  point[1] = (point[1] * 0.5f + 0.5f) * vtkm::Float32(SubsetHeight) + vtkm::Float32(YOffset);
331  // Convert from -1/+1 to 0/+1 range
332  point[2] = point[2] * 0.5f + 0.5f;
333  // Offset the point to a bit towards the camera. This is to ensure that the front faces of
334  // the wireframe wins the z-depth check against the surface render, and is in addition to the
335  // existing camera space offset.
336  point[2] -= Offset;
337  }
338 
339  VTKM_EXEC vtkm::Vec4f_32 GetColor(vtkm::Float64 fieldValue) const
340  {
341  vtkm::Int32 colorIdx = vtkm::Int32((vtkm::Float32(fieldValue) - FieldMin) * this->ColorMapSize *
342  this->InverseFieldDelta);
343  colorIdx =
344  vtkm::Min(vtkm::Int32(this->ColorMap.GetNumberOfValues() - 1), vtkm::Max(0, colorIdx));
345  return this->ColorMap.Get(colorIdx);
346  }
347 
348  VTKM_EXEC
349  void Plot(vtkm::Float32 x,
350  vtkm::Float32 y,
351  vtkm::Float32 depth,
352  const vtkm::Vec4f_32& color,
353  vtkm::Float32 intensity) const
354  {
355  vtkm::Id xi = static_cast<vtkm::Id>(x), yi = static_cast<vtkm::Id>(y);
356  if (xi < 0 || xi >= Width || yi < 0 || yi >= Height)
357  {
358  return;
359  }
360  vtkm::Id index = yi * Width + xi;
361  PackedValue current, next;
362  current.Raw = ClearValue;
363  next.Floats.Depth = depth;
364  vtkm::Vec4f_32 blendedColor;
365  vtkm::Vec4f_32 srcColor;
366  do
367  {
368  UnpackColor(current.Ints.Color, srcColor);
369  vtkm::Float32 inverseIntensity = (1.0f - intensity);
370  vtkm::Float32 alpha = srcColor[3] * inverseIntensity;
371  blendedColor[0] = color[0] * intensity + srcColor[0] * alpha;
372  blendedColor[1] = color[1] * intensity + srcColor[1] * alpha;
373  blendedColor[2] = color[2] * intensity + srcColor[2] * alpha;
374  blendedColor[3] = alpha + intensity;
375  next.Ints.Color = PackColor(blendedColor);
376  FrameBuffer.CompareExchange(index, &current.Raw, next.Raw);
377  } while (current.Floats.Depth > next.Floats.Depth);
378  }
379 
388  ColorMapPortalConst ColorMap;
390  AtomicPackedFrameBufferHandle FrameBuffer;
394 };
395 
396 struct BufferConverter : public vtkm::worklet::WorkletMapField
397 {
398 public:
399  VTKM_CONT
400  BufferConverter() {}
401 
402  using ControlSignature = void(FieldIn, WholeArrayOut, WholeArrayOut);
403  using ExecutionSignature = void(_1, _2, _3, WorkIndex);
404 
405  template <typename DepthBufferPortalType, typename ColorBufferPortalType>
406  VTKM_EXEC void operator()(const vtkm::Int64& packedValue,
407  DepthBufferPortalType& depthBuffer,
408  ColorBufferPortalType& colorBuffer,
409  const vtkm::Id& index) const
410  {
411  PackedValue packed;
412  packed.Raw = packedValue;
413  float depth = packed.Floats.Depth;
414  if (depth <= depthBuffer.Get(index))
415  {
416  vtkm::Vec4f_32 color;
417  UnpackColor(packed.Ints.Color, color);
418  colorBuffer.Set(index, color);
419  depthBuffer.Set(index, depth);
420  }
421  }
422 };
423 
424 } // namespace
425 
427 {
428 public:
429  VTKM_CONT
430  Wireframer(vtkm::rendering::Canvas* canvas, bool showInternalZones, bool isOverlay)
431  : Canvas(canvas)
432  , ShowInternalZones(showInternalZones)
433  , IsOverlay(isOverlay)
434  {
435  }
436 
437  VTKM_CONT
438  void SetCamera(const vtkm::rendering::Camera& camera) { this->Camera = camera; }
439 
440  VTKM_CONT
441  void SetColorMap(const ColorMapHandle& colorMap) { this->ColorMap = colorMap; }
442 
443  VTKM_CONT
445  {
446  this->SolidDepthBuffer = depthBuffer;
447  }
448 
449  VTKM_CONT
451  const IndicesHandle& endPointIndices,
452  const vtkm::cont::Field& field,
453  const vtkm::Range& fieldRange)
454  {
455  this->Bounds = coords.GetBounds();
456  this->Coordinates = coords;
457  this->PointIndices = endPointIndices;
458  this->ScalarField = field;
459  this->ScalarFieldRange = fieldRange;
460  }
461 
462  VTKM_CONT
463  void Render()
464  {
465  RenderWithDeviceFunctor functor(this);
466  vtkm::cont::TryExecute(functor);
467  }
468 
469 private:
470  template <typename DeviceTag>
471  VTKM_CONT void RenderWithDevice(DeviceTag)
472  {
473 
474  // The wireframe should appear on top of any prerendered data, and hide away the internal
475  // zones if `ShowInternalZones` is set to false. Since the prerendered data (or the solid
476  // depth buffer) could cause z-fighting with the wireframe, we will offset all the edges in Z
477  // by a small amount, proportional to distance between the near and far camera planes, in the
478  // camera space.
479  vtkm::Range clippingRange = Camera.GetClippingRange();
480  vtkm::Float64 offset1 = (clippingRange.Max - clippingRange.Min) / 1.0e4;
481  vtkm::Float64 offset2 = clippingRange.Min / 2.0;
482  vtkm::Float32 offset = static_cast<vtkm::Float32>(vtkm::Min(offset1, offset2));
484  vtkm::MatrixIdentity(modelMatrix);
485  modelMatrix[2][3] = offset;
486  vtkm::Matrix<vtkm::Float32, 4, 4> worldToCamera =
490 
491  vtkm::Id width = static_cast<vtkm::Id>(Canvas->GetWidth());
492  vtkm::Id height = static_cast<vtkm::Id>(Canvas->GetHeight());
493  vtkm::Id pixelCount = width * height;
494 
495  if (this->ShowInternalZones && !this->IsOverlay)
496  {
497  vtkm::cont::ArrayHandleConstant<vtkm::Int64> clear(ClearValue, pixelCount);
499  }
500  else
501  {
502  VTKM_ASSERT(this->SolidDepthBuffer.GetNumberOfValues() == pixelCount);
503  CopyIntoFrameBuffer bufferCopy;
505  .Invoke(this->Canvas->GetColorBuffer(), this->SolidDepthBuffer, this->FrameBuffer);
506  }
507  //
508  // detect a 2D camera and set the correct viewport.
509  // The View port specifies what the region of the screen
510  // to draw to which baiscally modifies the width and the
511  // height of the "canvas"
512  //
513  vtkm::Id xOffset = 0;
514  vtkm::Id yOffset = 0;
515  vtkm::Id subsetWidth = width;
516  vtkm::Id subsetHeight = height;
517 
519  if (ortho2d)
520  {
521  vtkm::Float32 vl, vr, vb, vt;
522  Camera.GetRealViewport(width, height, vl, vr, vb, vt);
523  vtkm::Float32 _x = static_cast<vtkm::Float32>(width) * (1.f + vl) / 2.f;
524  vtkm::Float32 _y = static_cast<vtkm::Float32>(height) * (1.f + vb) / 2.f;
525  vtkm::Float32 _w = static_cast<vtkm::Float32>(width) * (vr - vl) / 2.f;
526  vtkm::Float32 _h = static_cast<vtkm::Float32>(height) * (vt - vb) / 2.f;
527 
528  subsetWidth = static_cast<vtkm::Id>(_w);
529  subsetHeight = static_cast<vtkm::Id>(_h);
530  yOffset = static_cast<vtkm::Id>(_y);
531  xOffset = static_cast<vtkm::Id>(_x);
532  }
533 
534  const bool isSupportedField = ScalarField.IsCellField() || ScalarField.IsPointField();
535  if (!isSupportedField)
536  {
537  throw vtkm::cont::ErrorBadValue("Field not associated with cell set or points");
538  }
539  const bool isAssocPoints = ScalarField.IsPointField();
540 
541  {
542  vtkm::cont::Token token;
543  EdgePlotter<DeviceTag> plotter(WorldToProjection,
544  width,
545  height,
546  subsetWidth,
547  subsetHeight,
548  xOffset,
549  yOffset,
550  isAssocPoints,
552  ColorMap,
553  FrameBuffer,
555  token);
557  plotterDispatcher.SetDevice(DeviceTag());
558  plotterDispatcher.Invoke(
559  PointIndices, Coordinates, vtkm::rendering::raytracing::GetScalarFieldArray(ScalarField));
560  }
561 
562  BufferConverter converter;
563  vtkm::worklet::DispatcherMapField<BufferConverter> converterDispatcher(converter);
564  converterDispatcher.SetDevice(DeviceTag());
565  converterDispatcher.Invoke(FrameBuffer, Canvas->GetDepthBuffer(), Canvas->GetColorBuffer());
566  }
567 
568  VTKM_CONT
570  {
572 
574  : Renderer(renderer)
575  {
576  }
577 
578  template <typename DeviceTag>
579  VTKM_CONT bool operator()(DeviceTag)
580  {
581  VTKM_IS_DEVICE_ADAPTER_TAG(DeviceTag);
582  Renderer->RenderWithDevice(DeviceTag());
583  return true;
584  }
585  };
586 
591  bool IsOverlay;
592  ColorMapHandle ColorMap;
594  IndicesHandle PointIndices;
598  PackedFrameBufferHandle FrameBuffer;
599 }; // class Wireframer
600 }
601 } //namespace vtkm::rendering
602 
603 #endif //vtk_m_rendering_Wireframer_h
vtkm::rendering::Wireframer::Coordinates
vtkm::cont::CoordinateSystem Coordinates
Definition: Wireframer.h:593
vtkm::rendering::Wireframer::ColorMap
ColorMapHandle ColorMap
Definition: Wireframer.h:592
vtkm::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:300
ArrayHandle.h
vtkm::rendering::Wireframer::Camera
vtkm::rendering::Camera Camera
Definition: Wireframer.h:588
vtkm::rendering::Camera::CreateViewMatrix
vtkm::Matrix< vtkm::Float32, 4, 4 > CreateViewMatrix() const
FrameBuffer
AtomicPackedFrameBufferHandle FrameBuffer
Definition: Wireframer.h:390
XOffset
vtkm::Id XOffset
Definition: Wireframer.h:385
vtkm::rendering::Canvas::GetDepthBuffer
const DepthBufferType & GetDepthBuffer() const
Get the depth channel of the image.
vtkm::rendering::Wireframer::Render
void Render()
Definition: Wireframer.h:463
vtkm::Floor
vtkm::Float32 Floor(vtkm::Float32 x)
Definition: Math.h:2230
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm::rendering::Wireframer::FrameBuffer
PackedFrameBufferHandle FrameBuffer
Definition: Wireframer.h:598
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::rendering::Wireframer::SetSolidDepthBuffer
void SetSolidDepthBuffer(const vtkm::cont::ArrayHandle< vtkm::Float32 > depthBuffer)
Definition: Wireframer.h:444
vtkm::cont::Field::IsCellField
bool IsCellField() const
Return true if this field is associated with cells.
Definition: Field.h:117
Types.h
Height
vtkm::Id Height
Definition: Wireframer.h:382
WorkletMapField.h
VTKM_ASSERT
#define VTKM_ASSERT(condition)
Definition: Assert.h:43
MatrixHelpers.h
VTKM_EXEC_CONT
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
ColorMapSize
vtkm::Float32 ColorMapSize
Definition: Wireframer.h:389
vtkm::rendering::Camera::GetClippingRange
vtkm::Range GetClippingRange() const
The clipping range of the camera.
Definition: Camera.h:166
vtkm::IdComponent
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
vtkm::rendering::Camera::CreateProjectionMatrix
vtkm::Matrix< vtkm::Float32, 4, 4 > CreateProjectionMatrix(vtkm::Id screenWidth, vtkm::Id screenHeight) const
vtkm::Range::Length
vtkm::Float64 Length() const
Returns the length of the range.
Definition: Range.h:91
Ints
struct vtkm::rendering::@567::PackedValue::PackedInts Ints
vtkm::rendering::Wireframer::SetData
void SetData(const vtkm::cont::CoordinateSystem &coords, const IndicesHandle &endPointIndices, const vtkm::cont::Field &field, const vtkm::Range &fieldRange)
Definition: Wireframer.h:450
vtkm::rendering::Wireframer::RenderWithDeviceFunctor::operator()
bool operator()(DeviceTag)
Definition: Wireframer.h:579
vtkm::cont::ArrayHandle::GetNumberOfValues
vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:468
Swap.h
vtkm::rendering::Camera::Mode::TwoD
@ TwoD
Assert.h
vtkm::Lerp
ValueType Lerp(const ValueType &value0, const ValueType &value1, const WeightType &weight)
Returns the linear interpolation of two values based on weight.
Definition: VectorAnalysis.h:32
vtkm::rendering::Wireframer::ScalarFieldRange
vtkm::Range ScalarFieldRange
Definition: Wireframer.h:596
vtkm::rendering::Wireframer::RenderWithDevice
void RenderWithDevice(DeviceTag)
Definition: Wireframer.h:471
vtkm::rendering::Wireframer::SolidDepthBuffer
vtkm::cont::ArrayHandle< vtkm::Float32 > SolidDepthBuffer
Definition: Wireframer.h:597
DispatcherMapField.h
vtkm::rendering::Wireframer::ScalarField
vtkm::cont::Field ScalarField
Definition: Wireframer.h:595
YOffset
vtkm::Id YOffset
Definition: Wireframer.h:386
FieldMin
vtkm::Float32 FieldMin
Definition: Wireframer.h:391
vtkm::cont::CoordinateSystem
Manages a coordinate system for a DataSet.
Definition: CoordinateSystem.h:30
VectorAnalysis.h
vtkm::MatrixIdentity
vtkm::Matrix< T, Size, Size > MatrixIdentity()
Returns the identity matrix.
Definition: Matrix.h:211
vtkm::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
vtkm::rendering::Wireframer::ShowInternalZones
bool ShowInternalZones
Definition: Wireframer.h:590
WorldToProjection
vtkm::Matrix< vtkm::Float32, 4, 4 > WorldToProjection
Definition: Wireframer.h:380
vtkm::rendering::Canvas
Represents the image space that is the target of rendering.
Definition: Canvas.h:35
AssocPoints
bool AssocPoints
Definition: Wireframer.h:387
vtkm::worklet::DispatcherMapField
Dispatcher for worklets that inherit from WorkletMapField.
Definition: DispatcherMapField.h:25
Math.h
vtkm::rendering::Wireframer::IsOverlay
bool IsOverlay
Definition: Wireframer.h:591
Color
vtkm::Float32 Color
Definition: Wireframer.h:115
vtkm::rendering::Wireframer::RenderWithDeviceFunctor::RenderWithDeviceFunctor
RenderWithDeviceFunctor(Wireframer *renderer)
Definition: Wireframer.h:573
InverseFieldDelta
vtkm::Float32 InverseFieldDelta
Definition: Wireframer.h:392
Triangulator.h
vtkm::cont::Field
A Field encapsulates an array on some piece of the mesh, such as the points, a cell set,...
Definition: Field.h:31
vtkm::rendering::Wireframer::Wireframer
Wireframer(vtkm::rendering::Canvas *canvas, bool showInternalZones, bool isOverlay)
Definition: Wireframer.h:430
vtkm::rendering::Wireframer::PointIndices
IndicesHandle PointIndices
Definition: Wireframer.h:594
vtkm::Round
vtkm::Float32 Round(vtkm::Float32 x)
Definition: Math.h:2291
Floats
struct vtkm::rendering::@567::PackedValue::PackedFloats Floats
vtkm::rendering::Canvas::GetWidth
vtkm::Id GetWidth() const
The width of the image.
SubsetHeight
vtkm::Id SubsetHeight
Definition: Wireframer.h:384
vtkm::rendering::Wireframer::SetColorMap
void SetColorMap(const ColorMapHandle &colorMap)
Definition: Wireframer.h:441
vtkm::cont::TryExecute
bool TryExecute(Functor &&functor, Args &&... args)
Try to execute a functor on a set of devices until one succeeds.
Definition: TryExecute.h:244
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
SubsetWidth
vtkm::Id SubsetWidth
Definition: Wireframer.h:383
vtkm::MatrixMultiply
vtkm::Matrix< T, NumRow, NumCol > MatrixMultiply(const vtkm::Matrix< T, NumRow, NumInternal > &leftFactor, const vtkm::Matrix< T, NumInternal, NumCol > &rightFactor)
Standard matrix multiplication.
Definition: Matrix.h:158
vtkm::Id
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
vtkm::Int64
signed long long Int64
Base type to use for 64-bit signed integer numbers.
Definition: Types.h:204
vtkm::cont::ArrayHandleConstant
An array handle with a constant value.
Definition: ArrayHandleConstant.h:70
vtkm::rendering::Wireframer
Definition: Wireframer.h:426
vtkm::Bounds
Represent an axis-aligned 3D bounds in space.
Definition: Bounds.h:29
vtkm::cont::Algorithm::Copy
static bool Copy(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< U, COut > &output)
Definition: Algorithm.h:411
vtkm::rendering::Camera::GetMode
vtkm::rendering::Camera::Mode GetMode() const
The mode of the camera (2D or 3D).
Definition: Camera.h:141
vtkm::rendering::Wireframer::RenderWithDeviceFunctor
Definition: Wireframer.h:569
vtkm::cont::Field::IsPointField
bool IsPointField() const
Return true if this field is associated with points.
Definition: Field.h:119
vtkm::Vec< vtkm::Float32, 4 >
vtkm::exec::AtomicArrayExecutionObject::CompareExchange
bool CompareExchange(vtkm::Id index, ValueType *oldValue, const ValueType &newValue, vtkm::MemoryOrder order=vtkm::MemoryOrder::SequentiallyConsistent) const
Perform an atomic compare and exchange operation with sequentially consistent memory ordering.
Definition: AtomicArrayExecutionObject.h:240
vtkm::Matrix< vtkm::Float32, 4, 4 >
Depth
vtkm::Float32 Depth
Definition: Wireframer.h:116
Width
vtkm::Id Width
Definition: Wireframer.h:381
vtkm::UInt32
uint32_t UInt32
Base type to use for 32-bit unsigned integer numbers.
Definition: Types.h:185
vtkm::cont::ErrorBadValue
This class is thrown when a VTKm function or method encounters an invalid value that inhibits progres...
Definition: ErrorBadValue.h:25
vtkm::Range::Min
vtkm::Float64 Min
The minumum value of the range (inclusive).
Definition: Range.h:34
Raw
vtkm::Int64 Raw
Definition: Wireframer.h:123
vtkm::rendering::Wireframer::Canvas
vtkm::rendering::Canvas * Canvas
Definition: Wireframer.h:589
vtkm::Float32
float Float32
Base type to use for 32-bit floating-point numbers.
Definition: Types.h:157
vtkm::Int32
int32_t Int32
Base type to use for 32-bit signed integer numbers.
Definition: Types.h:181
vtkm::Float64
double Float64
Base type to use for 64-bit floating-point numbers.
Definition: Types.h:161
vtkm::cont::CoordinateSystem::GetBounds
vtkm::Bounds GetBounds() const
Definition: CoordinateSystem.h:128
vtkm::rendering::Camera
Specifies the viewport for a rendering.
Definition: Camera.h:37
Offset
vtkm::Float32 Offset
Definition: Wireframer.h:393
vtkm::Range::Max
vtkm::Float64 Max
Tha maximum value of the range (inclusive).
Definition: Range.h:36
vtkm::rendering::Canvas::GetColorBuffer
const ColorBufferType & GetColorBuffer() const
Get the color channels of the image.
vtkm::exec::AtomicArrayExecutionObject
An object passed to a worklet when accessing an atomic array.
Definition: AtomicArrayExecutionObject.h:88
vtkm::cont::AtomicArray
A type list containing types that can be used with an AtomicArray.
Definition: AtomicArray.h:49
vtkm::rendering::Wireframer::SetCamera
void SetCamera(const vtkm::rendering::Camera &camera)
Definition: Wireframer.h:438
vtkm::rendering::Camera::GetRealViewport
void GetRealViewport(vtkm::Id screenWidth, vtkm::Id screenHeight, vtkm::Float32 &left, vtkm::Float32 &right, vtkm::Float32 &bottom, vtkm::Float32 &top) const
ColorMap
ColorMapPortalConst ColorMap
Definition: Wireframer.h:388
vtkm::worklet::WorkletMapField
Base class for worklets that do a simple mapping of field arrays.
Definition: WorkletMapField.h:39
vtkm::rendering::Wireframer::Bounds
vtkm::Bounds Bounds
Definition: Wireframer.h:587
vtkm::rendering::Wireframer::RenderWithDeviceFunctor::Renderer
Wireframer * Renderer
Definition: Wireframer.h:571
AtomicArray.h
vtkm::Swap
void Swap(T &a, T &b)
Performs a swap operation. Safe to call from cuda code.
Definition: Swap.h:59
VTKM_IS_DEVICE_ADAPTER_TAG
#define VTKM_IS_DEVICE_ADAPTER_TAG(tag)
Checks that the argument is a proper device adapter tag.
Definition: DeviceAdapterTag.h:194
vtkm::rendering::Canvas::GetHeight
vtkm::Id GetHeight() const
The height of the image.
vtkm::Range
Represent a continuous scalar range of values.
Definition: Range.h:31