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