VTK-m  2.0
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;
123  vtkm::Int64 Raw;
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  vtkm::Float32 gradient = (dx == 0.0) ? 1.0f : (dy / dx);
238 
239  vtkm::Float32 xEnd = vtkm::Round(x1);
240  vtkm::Float32 yEnd = y1 + gradient * (xEnd - x1);
241  vtkm::Float32 xPxl1 = xEnd, yPxl1 = IntegerPart(yEnd);
242  vtkm::Float32 zPxl1 = vtkm::Lerp(z1, z2, (xPxl1 - x1) / dx);
243  vtkm::Float64 point1Field = fieldPortal.Get(point1Idx);
244  vtkm::Float64 point2Field;
245  if (AssocPoints)
246  {
247  point2Field = fieldPortal.Get(point2Idx);
248  }
249  else
250  {
251  // cell associated field has a solid line color
252  point2Field = point1Field;
253  }
254 
255  // Plot first endpoint
256  vtkm::Vec4f_32 color = GetColor(point1Field);
257  if (transposed)
258  {
259  Plot(yPxl1, xPxl1, zPxl1, color, 1.0f);
260  }
261  else
262  {
263  Plot(xPxl1, yPxl1, zPxl1, color, 1.0f);
264  }
265 
266  vtkm::Float32 interY = yEnd + gradient;
267  xEnd = vtkm::Round(x2);
268  yEnd = y2 + gradient * (xEnd - x2);
269  vtkm::Float32 xPxl2 = xEnd, yPxl2 = IntegerPart(yEnd);
270  vtkm::Float32 zPxl2 = vtkm::Lerp(z1, z2, (xPxl2 - x1) / dx);
271 
272  // Plot second endpoint
273  color = GetColor(point2Field);
274  if (transposed)
275  {
276  Plot(yPxl2, xPxl2, zPxl2, color, 1.0f);
277  }
278  else
279  {
280  Plot(xPxl2, yPxl2, zPxl2, color, 1.0f);
281  }
282 
283  // Plot rest of the line
284  if (transposed)
285  {
286  for (vtkm::Float32 x = xPxl1 + 1; x <= xPxl2 - 1; ++x)
287  {
288  vtkm::Float32 t = IntegerPart(interY);
289  vtkm::Float32 factor = (x - x1) / dx;
290  vtkm::Float32 depth = vtkm::Lerp(zPxl1, zPxl2, factor);
291  vtkm::Float64 fieldValue = vtkm::Lerp(point1Field, point2Field, factor);
292  color = GetColor(fieldValue);
293  Plot(t, x, depth, color, ReverseFractionalPart(interY));
294  Plot(t + 1, x, depth, color, FractionalPart(interY));
295  interY += gradient;
296  }
297  }
298  else
299  {
300  for (vtkm::Float32 x = xPxl1 + 1; x <= xPxl2 - 1; ++x)
301  {
302  vtkm::Float32 t = IntegerPart(interY);
303  vtkm::Float32 factor = (x - x1) / dx;
304  vtkm::Float32 depth = vtkm::Lerp(zPxl1, zPxl2, factor);
305  vtkm::Float64 fieldValue = vtkm::Lerp(point1Field, point2Field, factor);
306  color = GetColor(fieldValue);
307  Plot(x, t, depth, color, ReverseFractionalPart(interY));
308  Plot(x, t + 1, depth, color, FractionalPart(interY));
309  interY += gradient;
310  }
311  }
312  }
313 
314 private:
315  using ColorMapPortalConst = typename ColorMapHandle::ReadPortalType;
316 
317  VTKM_EXEC
318  void TransformWorldToViewport(vtkm::Vec3f_32& point) const
319  {
320  vtkm::Vec4f_32 temp(point[0], point[1], point[2], 1.0f);
322  for (vtkm::IdComponent i = 0; i < 3; ++i)
323  {
324  point[i] = temp[i] / temp[3];
325  }
326  // Scale to canvas width and height
327  point[0] = (point[0] * 0.5f + 0.5f) * vtkm::Float32(SubsetWidth) + vtkm::Float32(XOffset);
328  point[1] = (point[1] * 0.5f + 0.5f) * vtkm::Float32(SubsetHeight) + vtkm::Float32(YOffset);
329  // Convert from -1/+1 to 0/+1 range
330  point[2] = point[2] * 0.5f + 0.5f;
331  // Offset the point to a bit towards the camera. This is to ensure that the front faces of
332  // the wireframe wins the z-depth check against the surface render, and is in addition to the
333  // existing camera space offset.
334  point[2] -= Offset;
335  }
336 
337  VTKM_EXEC vtkm::Vec4f_32 GetColor(vtkm::Float64 fieldValue) const
338  {
339  vtkm::Int32 colorIdx = vtkm::Int32((vtkm::Float32(fieldValue) - FieldMin) * this->ColorMapSize *
340  this->InverseFieldDelta);
341  colorIdx =
342  vtkm::Min(vtkm::Int32(this->ColorMap.GetNumberOfValues() - 1), vtkm::Max(0, colorIdx));
343  return this->ColorMap.Get(colorIdx);
344  }
345 
346  VTKM_EXEC
347  void Plot(vtkm::Float32 x,
348  vtkm::Float32 y,
349  vtkm::Float32 depth,
350  const vtkm::Vec4f_32& color,
351  vtkm::Float32 intensity) const
352  {
353  vtkm::Id xi = static_cast<vtkm::Id>(x), yi = static_cast<vtkm::Id>(y);
354  if (xi < 0 || xi >= Width || yi < 0 || yi >= Height)
355  {
356  return;
357  }
358  vtkm::Id index = yi * Width + xi;
359  PackedValue current, next;
360  current.Raw = ClearValue;
361  next.Floats.Depth = depth;
362  vtkm::Vec4f_32 blendedColor;
363  vtkm::Vec4f_32 srcColor;
364  do
365  {
366  UnpackColor(current.Ints.Color, srcColor);
367  vtkm::Float32 inverseIntensity = (1.0f - intensity);
368  vtkm::Float32 alpha = srcColor[3] * inverseIntensity;
369  blendedColor[0] = color[0] * intensity + srcColor[0] * alpha;
370  blendedColor[1] = color[1] * intensity + srcColor[1] * alpha;
371  blendedColor[2] = color[2] * intensity + srcColor[2] * alpha;
372  blendedColor[3] = alpha + intensity;
373  next.Ints.Color = PackColor(blendedColor);
374  FrameBuffer.CompareExchange(index, &current.Raw, next.Raw);
375  } while (current.Floats.Depth > next.Floats.Depth);
376  }
377 
386  ColorMapPortalConst ColorMap;
388  AtomicPackedFrameBufferHandle FrameBuffer;
392 };
393 
394 struct BufferConverter : public vtkm::worklet::WorkletMapField
395 {
396 public:
397  VTKM_CONT
398  BufferConverter() {}
399 
400  using ControlSignature = void(FieldIn, WholeArrayOut, WholeArrayOut);
401  using ExecutionSignature = void(_1, _2, _3, WorkIndex);
402 
403  template <typename DepthBufferPortalType, typename ColorBufferPortalType>
404  VTKM_EXEC void operator()(const vtkm::Int64& packedValue,
405  DepthBufferPortalType& depthBuffer,
406  ColorBufferPortalType& colorBuffer,
407  const vtkm::Id& index) const
408  {
409  PackedValue packed;
410  packed.Raw = packedValue;
411  float depth = packed.Floats.Depth;
412  if (depth <= depthBuffer.Get(index))
413  {
414  vtkm::Vec4f_32 color;
415  UnpackColor(packed.Ints.Color, color);
416  colorBuffer.Set(index, color);
417  depthBuffer.Set(index, depth);
418  }
419  }
420 };
421 
422 } // namespace
423 
425 {
426 public:
427  VTKM_CONT
428  Wireframer(vtkm::rendering::Canvas* canvas, bool showInternalZones, bool isOverlay)
429  : Canvas(canvas)
430  , ShowInternalZones(showInternalZones)
431  , IsOverlay(isOverlay)
432  {
433  }
434 
435  VTKM_CONT
436  void SetCamera(const vtkm::rendering::Camera& camera) { this->Camera = camera; }
437 
438  VTKM_CONT
439  void SetColorMap(const ColorMapHandle& colorMap) { this->ColorMap = colorMap; }
440 
441  VTKM_CONT
443  {
444  this->SolidDepthBuffer = depthBuffer;
445  }
446 
447  VTKM_CONT
449  const IndicesHandle& endPointIndices,
450  const vtkm::cont::Field& field,
451  const vtkm::Range& fieldRange)
452  {
453  this->Bounds = coords.GetBounds();
454  this->Coordinates = coords;
455  this->PointIndices = endPointIndices;
456  this->ScalarField = field;
457  this->ScalarFieldRange = fieldRange;
458  }
459 
460  VTKM_CONT
461  void Render()
462  {
463  RenderWithDeviceFunctor functor(this);
464  vtkm::cont::TryExecute(functor);
465  }
466 
467 private:
468  template <typename DeviceTag>
469  VTKM_CONT void RenderWithDevice(DeviceTag)
470  {
471 
472  // The wireframe should appear on top of any prerendered data, and hide away the internal
473  // zones if `ShowInternalZones` is set to false. Since the prerendered data (or the solid
474  // depth buffer) could cause z-fighting with the wireframe, we will offset all the edges in Z
475  // by a small amount, proportional to distance between the near and far camera planes, in the
476  // camera space.
477  vtkm::Range clippingRange = Camera.GetClippingRange();
478  vtkm::Float64 offset1 = (clippingRange.Max - clippingRange.Min) / 1.0e4;
479  vtkm::Float64 offset2 = clippingRange.Min / 2.0;
480  vtkm::Float32 offset = static_cast<vtkm::Float32>(vtkm::Min(offset1, offset2));
482  vtkm::MatrixIdentity(modelMatrix);
483  modelMatrix[2][3] = offset;
484  vtkm::Matrix<vtkm::Float32, 4, 4> worldToCamera =
488 
489  vtkm::Id width = static_cast<vtkm::Id>(Canvas->GetWidth());
490  vtkm::Id height = static_cast<vtkm::Id>(Canvas->GetHeight());
491  vtkm::Id pixelCount = width * height;
492 
493  if (this->ShowInternalZones && !this->IsOverlay)
494  {
495  vtkm::cont::ArrayHandleConstant<vtkm::Int64> clear(ClearValue, pixelCount);
497  }
498  else
499  {
500  VTKM_ASSERT(this->SolidDepthBuffer.GetNumberOfValues() == pixelCount);
501  CopyIntoFrameBuffer bufferCopy;
503  .Invoke(this->Canvas->GetColorBuffer(), this->SolidDepthBuffer, this->FrameBuffer);
504  }
505  //
506  // detect a 2D camera and set the correct viewport.
507  // The View port specifies what the region of the screen
508  // to draw to which baiscally modifies the width and the
509  // height of the "canvas"
510  //
511  vtkm::Id xOffset = 0;
512  vtkm::Id yOffset = 0;
513  vtkm::Id subsetWidth = width;
514  vtkm::Id subsetHeight = height;
515 
517  if (ortho2d)
518  {
519  vtkm::Float32 vl, vr, vb, vt;
520  Camera.GetRealViewport(width, height, vl, vr, vb, vt);
521  vtkm::Float32 _x = static_cast<vtkm::Float32>(width) * (1.f + vl) / 2.f;
522  vtkm::Float32 _y = static_cast<vtkm::Float32>(height) * (1.f + vb) / 2.f;
523  vtkm::Float32 _w = static_cast<vtkm::Float32>(width) * (vr - vl) / 2.f;
524  vtkm::Float32 _h = static_cast<vtkm::Float32>(height) * (vt - vb) / 2.f;
525 
526  subsetWidth = static_cast<vtkm::Id>(_w);
527  subsetHeight = static_cast<vtkm::Id>(_h);
528  yOffset = static_cast<vtkm::Id>(_y);
529  xOffset = static_cast<vtkm::Id>(_x);
530  }
531 
532  const bool isSupportedField = ScalarField.IsCellField() || ScalarField.IsPointField();
533  if (!isSupportedField)
534  {
535  throw vtkm::cont::ErrorBadValue("Field not associated with cell set or points");
536  }
537  const bool isAssocPoints = ScalarField.IsPointField();
538 
539  {
540  vtkm::cont::Token token;
541  EdgePlotter<DeviceTag> plotter(WorldToProjection,
542  width,
543  height,
544  subsetWidth,
545  subsetHeight,
546  xOffset,
547  yOffset,
548  isAssocPoints,
550  ColorMap,
551  FrameBuffer,
553  token);
555  plotterDispatcher.SetDevice(DeviceTag());
556  plotterDispatcher.Invoke(
558  }
559 
560  BufferConverter converter;
561  vtkm::worklet::DispatcherMapField<BufferConverter> converterDispatcher(converter);
562  converterDispatcher.SetDevice(DeviceTag());
563  converterDispatcher.Invoke(FrameBuffer, Canvas->GetDepthBuffer(), Canvas->GetColorBuffer());
564  }
565 
566  VTKM_CONT
568  {
570 
572  : Renderer(renderer)
573  {
574  }
575 
576  template <typename DeviceTag>
577  VTKM_CONT bool operator()(DeviceTag)
578  {
579  VTKM_IS_DEVICE_ADAPTER_TAG(DeviceTag);
580  Renderer->RenderWithDevice(DeviceTag());
581  return true;
582  }
583  };
584 
589  bool IsOverlay;
590  ColorMapHandle ColorMap;
592  IndicesHandle PointIndices;
596  PackedFrameBufferHandle FrameBuffer;
597 }; // class Wireframer
598 }
599 } //namespace vtkm::rendering
600 
601 #endif //vtk_m_rendering_Wireframer_h
vtkm::rendering::Wireframer::Coordinates
vtkm::cont::CoordinateSystem Coordinates
Definition: Wireframer.h:591
vtkm::cont::ArrayHandle::GetNumberOfValues
VTKM_CONT vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:448
vtkm::cont::Field::IsPointField
VTKM_CONT bool IsPointField() const
Definition: cont/Field.h:67
vtkm::Swap
VTKM_EXEC_CONT void Swap(T &a, T &b)
Performs a swap operation. Safe to call from cuda code.
Definition: Swap.h:59
vtkm::rendering::Wireframer::ColorMap
ColorMapHandle ColorMap
Definition: Wireframer.h:590
vtkm::cont::ArrayHandle< vtkm::Vec4f_32 >
ArrayHandle.h
vtkm::rendering::Wireframer::Camera
vtkm::rendering::Camera Camera
Definition: Wireframer.h:586
vtkm::rendering::Camera::CreateViewMatrix
vtkm::Matrix< vtkm::Float32, 4, 4 > CreateViewMatrix() const
vtkm::rendering::Canvas::GetHeight
VTKM_CONT vtkm::Id GetHeight() const
FrameBuffer
AtomicPackedFrameBufferHandle FrameBuffer
Definition: Wireframer.h:388
XOffset
vtkm::Id XOffset
Definition: Wireframer.h:383
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm::rendering::Wireframer::FrameBuffer
PackedFrameBufferHandle FrameBuffer
Definition: Wireframer.h:596
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::rendering::Wireframer::SetColorMap
VTKM_CONT void SetColorMap(const ColorMapHandle &colorMap)
Definition: Wireframer.h:439
vtkm::Round
VTKM_EXEC_CONT vtkm::Float32 Round(vtkm::Float32 x)
Round x to the nearest integral value.
Definition: Math.h:2263
Types.h
Height
vtkm::Id Height
Definition: Wireframer.h:380
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:387
vtkm::exec::AtomicArrayExecutionObject::CompareExchange
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC bool CompareExchange(vtkm::Id index, ValueType *oldValue, const ValueType &newValue) const
Perform an atomic compare and exchange operation with sequentially consistent memory ordering.
Definition: AtomicArrayExecutionObject.h:223
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
vtkm::rendering::Camera::CreateProjectionMatrix
vtkm::Matrix< vtkm::Float32, 4, 4 > CreateProjectionMatrix(vtkm::Id screenWidth, vtkm::Id screenHeight) const
vtkm::rendering::Wireframer::RenderWithDeviceFunctor::operator()
VTKM_CONT bool operator()(DeviceTag)
Definition: Wireframer.h:577
Swap.h
vtkm::rendering::raytracing::GetScalarFieldArray
VTKM_CONT vtkm::cont::UncertainArrayHandle< ScalarRenderingTypes, VTKM_DEFAULT_STORAGE_LIST > GetScalarFieldArray(const vtkm::cont::Field &field)
Definition: RayTracingTypeDefs.h:143
vtkm::rendering::Camera::Mode::TwoD
@ TwoD
Assert.h
vtkm::cont::Algorithm::Copy
static VTKM_CONT bool Copy(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< U, COut > &output)
Definition: Algorithm.h:410
Floats
struct vtkm::rendering::@970::PackedValue::PackedFloats Floats
vtkm::rendering::Wireframer::ScalarFieldRange
vtkm::Range ScalarFieldRange
Definition: Wireframer.h:594
vtkm::MatrixIdentity
VTKM_EXEC_CONT vtkm::Matrix< T, Size, Size > MatrixIdentity()
Returns the identity matrix.
Definition: Matrix.h:209
vtkm::rendering::Wireframer::SetCamera
VTKM_CONT void SetCamera(const vtkm::rendering::Camera &camera)
Definition: Wireframer.h:436
vtkm::rendering::Wireframer::Render
VTKM_CONT void Render()
Definition: Wireframer.h:461
vtkm::rendering::Wireframer::SolidDepthBuffer
vtkm::cont::ArrayHandle< vtkm::Float32 > SolidDepthBuffer
Definition: Wireframer.h:595
vtkm::rendering::Canvas::GetColorBuffer
const VTKM_CONT ColorBufferType & GetColorBuffer() const
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
DispatcherMapField.h
vtkm::rendering::Wireframer::ScalarField
vtkm::cont::Field ScalarField
Definition: Wireframer.h:593
YOffset
vtkm::Id YOffset
Definition: Wireframer.h:384
FieldMin
vtkm::Float32 FieldMin
Definition: Wireframer.h:389
vtkm::cont::CoordinateSystem
Definition: CoordinateSystem.h:25
vtkm::rendering::Camera::GetClippingRange
VTKM_CONT vtkm::Range GetClippingRange() const
The clipping range of the camera.
Definition: Camera.h:154
VectorAnalysis.h
vtkm::Floor
VTKM_EXEC_CONT vtkm::Float32 Floor(vtkm::Float32 x)
Round x to the largest integer value not greater than x.
Definition: Math.h:2204
vtkm::Range::Length
VTKM_EXEC_CONT vtkm::Float64 Length() const
Returns the length of the range.
Definition: Range.h:87
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:588
vtkm::rendering::Canvas::GetWidth
VTKM_CONT vtkm::Id GetWidth() const
WorldToProjection
vtkm::Matrix< vtkm::Float32, 4, 4 > WorldToProjection
Definition: Wireframer.h:378
vtkm::rendering::Canvas
Definition: Canvas.h:34
AssocPoints
bool AssocPoints
Definition: Wireframer.h:385
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:589
Color
vtkm::Float32 Color
Definition: Wireframer.h:115
vtkm::MatrixMultiply
VTKM_EXEC_CONT 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:156
vtkm::rendering::Wireframer::RenderWithDeviceFunctor::RenderWithDeviceFunctor
RenderWithDeviceFunctor(Wireframer *renderer)
Definition: Wireframer.h:571
InverseFieldDelta
vtkm::Float32 InverseFieldDelta
Definition: Wireframer.h:390
Triangulator.h
vtkm::cont::Field
A Field encapsulates an array on some piece of the mesh, such as the points, a cell set,...
Definition: cont/Field.h:31
vtkm::cont::CoordinateSystem::GetBounds
VTKM_CONT vtkm::Bounds GetBounds() const
Definition: CoordinateSystem.h:123
vtkm::rendering::Wireframer::PointIndices
IndicesHandle PointIndices
Definition: Wireframer.h:592
SubsetHeight
vtkm::Id SubsetHeight
Definition: Wireframer.h:382
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
SubsetWidth
vtkm::Id SubsetWidth
Definition: Wireframer.h:381
vtkm::rendering::Canvas::GetDepthBuffer
const VTKM_CONT DepthBufferType & GetDepthBuffer() const
vtkm::cont::ArrayHandleConstant
An array handle with a constant value.
Definition: ArrayHandleConstant.h:63
vtkm::rendering::Wireframer
Definition: Wireframer.h:424
vtkm::Bounds
Represent an axis-aligned 3D bounds in space.
Definition: Bounds.h:29
vtkm::rendering::Camera::GetMode
VTKM_CONT vtkm::rendering::Camera::Mode GetMode() const
The mode of the camera (2D or 3D).
Definition: Camera.h:132
vtkm::Lerp
VTKM_EXEC_CONT 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::Wireframer
VTKM_CONT Wireframer(vtkm::rendering::Canvas *canvas, bool showInternalZones, bool isOverlay)
Definition: Wireframer.h:428
vtkm::rendering::Wireframer::RenderWithDeviceFunctor
Definition: Wireframer.h:567
vtkm::cont::Field::IsCellField
VTKM_CONT bool IsCellField() const
Definition: cont/Field.h:66
vtkm::Vec< vtkm::Float32, 4 >
vtkm::Matrix< vtkm::Float32, 4, 4 >
Depth
vtkm::Float32 Depth
Definition: Wireframer.h:116
Width
vtkm::Id Width
Definition: Wireframer.h:379
vtkm::UInt32
uint32_t UInt32
Definition: Types.h:161
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
Definition: Range.h:33
Raw
vtkm::Int64 Raw
Definition: Wireframer.h:123
vtkm::rendering::Wireframer::Canvas
vtkm::rendering::Canvas * Canvas
Definition: Wireframer.h:587
vtkm::Float32
float Float32
Definition: Types.h:154
vtkm::rendering::Wireframer::RenderWithDevice
VTKM_CONT void RenderWithDevice(DeviceTag)
Definition: Wireframer.h:469
vtkm::Int32
int32_t Int32
Definition: Types.h:160
vtkm::Float64
double Float64
Definition: Types.h:155
vtkm::rendering::Camera
Definition: Camera.h:28
Offset
vtkm::Float32 Offset
Definition: Wireframer.h:391
vtkm::Range::Max
vtkm::Float64 Max
Definition: Range.h:34
vtkm::exec::AtomicArrayExecutionObject
Definition: AtomicArrayExecutionObject.h:81
vtkm::cont::AtomicArray
A type list containing types that can be used with an AtomicArray.
Definition: AtomicArray.h:49
Ints
struct vtkm::rendering::@970::PackedValue::PackedInts Ints
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:386
vtkm::rendering::Wireframer::SetSolidDepthBuffer
VTKM_CONT void SetSolidDepthBuffer(const vtkm::cont::ArrayHandle< vtkm::Float32 > depthBuffer)
Definition: Wireframer.h:442
vtkm::rendering::Wireframer::SetData
VTKM_CONT void SetData(const vtkm::cont::CoordinateSystem &coords, const IndicesHandle &endPointIndices, const vtkm::cont::Field &field, const vtkm::Range &fieldRange)
Definition: Wireframer.h:448
vtkm::worklet::WorkletMapField
Base class for worklets that do a simple mapping of field arrays.
Definition: WorkletMapField.h:38
vtkm::rendering::Wireframer::Bounds
vtkm::Bounds Bounds
Definition: Wireframer.h:585
vtkm::rendering::Wireframer::RenderWithDeviceFunctor::Renderer
Wireframer * Renderer
Definition: Wireframer.h:569
AtomicArray.h
vtkm::cont::TryExecute
VTKM_CONT bool TryExecute(Functor &&functor, Args &&... args)
Try to execute a functor on a set of devices until one succeeds.
Definition: TryExecute.h:244
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:164
vtkm::Range
Represent a continuous scalar range of values.
Definition: Range.h:31