11 #ifndef vtk_m_rendering_Wireframer_h
12 #define vtk_m_rendering_Wireframer_h
38 const vtkm::Int64 ClearDepth = 0x3F800000;
40 const vtkm::Int64 ClearValue = 0x3F800000000000FF;
57 return 1.0f - FractionalPart(x);
73 return PackColor(color[0], color[1], color[2], color[3]);
80 packed |= (ScaleColorComponent(g) << 16);
81 packed |= (ScaleColorComponent(b) << 8);
82 packed |= ScaleColorComponent(a);
96 UnpackColor(packedColor, color[0], color[1], color[2], color[3]);
128 using ControlSignature = void(FieldIn, FieldIn, FieldOut);
129 using ExecutionSignature = void(_1, _2, _3);
132 CopyIntoFrameBuffer() {}
137 vtkm::Int64& outValue)
const
140 packed.Ints.Color = PackColor(color);
141 packed.Floats.Depth = depth;
142 outValue = packed.Raw;
146 template <
typename DeviceTag>
153 using ControlSignature = void(FieldIn, WholeArrayIn, WholeArrayIn);
154 using ExecutionSignature = void(_1, _2, _3);
155 using InputDomain = _1;
167 const ColorMapHandle& colorMap,
168 const AtomicPackedFrameBuffer& frameBuffer,
179 ,
ColorMap(colorMap.PrepareForInput(DeviceTag(), token))
181 ,
FrameBuffer(frameBuffer.PrepareForExecution(DeviceTag(), token))
185 if (fieldLength == 0.f)
197 template <
typename CoordinatesPortalType,
typename ScalarFieldPortalType>
199 const CoordinatesPortalType& coordsPortal,
200 const ScalarFieldPortalType& fieldPortal)
const
202 vtkm::Id point1Idx = edgeIndices[0];
203 vtkm::Id point2Idx = edgeIndices[1];
208 TransformWorldToViewport(point1);
209 TransformWorldToViewport(point2);
220 bool transposed = vtkm::Abs(y2 - y1) > vtkm::Abs(x2 - x1);
247 point2Field = fieldPortal.Get(point2Idx);
252 point2Field = point1Field;
259 Plot(yPxl1, xPxl1, zPxl1, color, 1.0f);
263 Plot(xPxl1, yPxl1, zPxl1, color, 1.0f);
268 yEnd = y2 + gradient * (xEnd - x2);
273 color = GetColor(point2Field);
276 Plot(yPxl2, xPxl2, zPxl2, color, 1.0f);
280 Plot(xPxl2, yPxl2, zPxl2, color, 1.0f);
292 color = GetColor(fieldValue);
293 Plot(t, x, depth, color, ReverseFractionalPart(interY));
294 Plot(t + 1, x, depth, color, FractionalPart(interY));
306 color = GetColor(fieldValue);
307 Plot(x, t, depth, color, ReverseFractionalPart(interY));
308 Plot(x, t + 1, depth, color, FractionalPart(interY));
315 using ColorMapPortalConst =
typename ColorMapHandle::ReadPortalType;
324 point[i] = temp[i] / temp[3];
330 point[2] = point[2] * 0.5f + 0.5f;
343 return this->
ColorMap.Get(colorIdx);
354 if (xi < 0 || xi >=
Width || yi < 0 || yi >=
Height)
359 PackedValue current, next;
360 current.Raw = ClearValue;
361 next.Floats.Depth = depth;
366 UnpackColor(current.Ints.Color, srcColor);
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);
375 }
while (current.Floats.Depth > next.Floats.Depth);
400 using ControlSignature = void(FieldIn, WholeArrayOut, WholeArrayOut);
401 using ExecutionSignature = void(_1, _2, _3, WorkIndex);
403 template <
typename DepthBufferPortalType,
typename ColorBufferPortalType>
404 VTKM_EXEC void operator()(
const vtkm::Int64& packedValue,
405 DepthBufferPortalType& depthBuffer,
406 ColorBufferPortalType& colorBuffer,
410 packed.Raw = packedValue;
411 float depth = packed.Floats.Depth;
412 if (depth <= depthBuffer.Get(index))
415 UnpackColor(packed.Ints.Color, color);
416 colorBuffer.Set(index, color);
417 depthBuffer.Set(index, depth);
449 const IndicesHandle& endPointIndices,
468 template <
typename DeviceTag>
483 modelMatrix[2][3] = offset;
491 vtkm::Id pixelCount = width * height;
501 CopyIntoFrameBuffer bufferCopy;
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);
533 if (!isSupportedField)
555 plotterDispatcher.SetDevice(DeviceTag());
556 plotterDispatcher.Invoke(
560 BufferConverter converter;
562 converterDispatcher.SetDevice(DeviceTag());
576 template <
typename DeviceTag>
601 #endif //vtk_m_rendering_Wireframer_h