diff --git a/vtkm/rendering/raytracing/ConnectivityTracer.cxx b/vtkm/rendering/raytracing/ConnectivityTracer.cxx index c3fa22306..488de626f 100644 --- a/vtkm/rendering/raytracing/ConnectivityTracer.cxx +++ b/vtkm/rendering/raytracing/ConnectivityTracer.cxx @@ -905,8 +905,9 @@ public: FieldInOut, FieldInOut, WholeArrayIn, - WholeArrayInOut); - using ExecutionSignature = void(_1, _2, _3, _4, _5, _6, _7, _8, WorkIndex); + WholeArrayInOut, + FieldIn); + using ExecutionSignature = void(_1, _2, _3, _4, _5, _6, _7, _8, WorkIndex, _9); template VTKM_EXEC inline void operator()(const vtkm::Id& currentCell, @@ -917,7 +918,8 @@ public: vtkm::UInt8& rayStatus, const ColorMapType& colorMap, FrameBufferType& frameBuffer, - const vtkm::Id& pixelIndex) const + const vtkm::Id& pixelIndex, + const FloatType& maxDistance) const { if (rayStatus != RAY_ACTIVE) @@ -965,12 +967,12 @@ public: color[2] = color[2] + sampleColor[2] * alpha; color[3] = alpha + color[3]; - if (color[3] > 1.) + currentDistance += SampleDistance; + if (color[3] >= 1.f || currentDistance > maxDistance) { rayStatus = RAY_TERMINATED; break; } - currentDistance += SampleDistance; } BOUNDS_CHECK(frameBuffer, pixelIndex * 4 + 0); @@ -1015,8 +1017,10 @@ public: FieldIn, ExecObject meshConnectivity, WholeArrayIn, - WholeArrayInOut); - using ExecutionSignature = void(_1, _2, _3, _4, _5, _6, _7, _8, WorkIndex, _9, _10, _11, _12); + WholeArrayInOut, + FieldIn); + using ExecutionSignature = + void(_1, _2, _3, _4, _5, _6, _7, _8, WorkIndex, _9, _10, _11, _12, _13); template & origin, MeshWrapper& meshConn, const ColorMapType& colorMap, - FrameBufferType& frameBuffer) const + FrameBufferType& frameBuffer, + const FloatType& maxDistance) const { if (rayStatus != RAY_ACTIVE) @@ -1118,12 +1123,12 @@ public: color[2] = color[2] + sampleColor[2] * sampleColor[3]; color[3] = sampleColor[3] + color[3]; - if (color[3] >= 1.0) + currentDistance += SampleDistance; + if (color[3] >= 1.0 || currentDistance >= maxDistance) { rayStatus = RAY_TERMINATED; break; } - currentDistance += SampleDistance; } BOUNDS_CHECK(frameBuffer, pixelIndex * 4 + 0); @@ -1216,7 +1221,8 @@ void ConnectivityTracer::SampleCells(Ray& rays, detail::RayTrackingColorMap, - rays.Buffers.at(0).Buffer); + rays.Buffers.at(0).Buffer, + rays.MaxDistance); } else { @@ -1232,7 +1238,8 @@ void ConnectivityTracer::SampleCells(Ray& rays, detail::RayTrackingColorMap, - rays.Buffers.at(0).Buffer); + rays.Buffers.at(0).Buffer, + rays.MaxDistance); } this->SampleTime += timer.GetElapsedTime();