From 6a4609c28f9a7646652d76884cffaaa2414f9782 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 27 Feb 2018 19:09:18 +0000 Subject: [PATCH] Fixed precision issue with filling in the last element of the TransferFunction1D's osg::Image. --- src/osg/TransferFunction.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/osg/TransferFunction.cpp b/src/osg/TransferFunction.cpp index 4e5763e91..56c5a32d4 100644 --- a/src/osg/TransferFunction.cpp +++ b/src/osg/TransferFunction.cpp @@ -87,6 +87,10 @@ void TransferFunction1D::assignToImage(float lower_v, const osg::Vec4& lower_c, if (end_iPos < 0) return; if (end_iPos > endPos) end_iPos = endPos; + // clamp to ends to avoid any precision issues + if (lower_v == minimum) start_iPos = 0; + if (upper_v == maximum) end_iPos = endPos; + //OSG_NOTICE<<"TransferFunction1D::assignToImage[lower_v="<