From e51fd3d4fa66817c2488927d0f9a2cc35afc06df Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 21 Nov 2014 17:22:30 +0000 Subject: [PATCH] Implemented a clamp to edge policy for the Image::g/setColor(color, texcoord). git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14519 16af8721-9629-0410-8352-f15c8da7e697 --- src/osg/Image.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/osg/Image.cpp b/src/osg/Image.cpp index 6e21a7991..ad0424586 100644 --- a/src/osg/Image.cpp +++ b/src/osg/Image.cpp @@ -1919,9 +1919,9 @@ Vec4 Image::getColor(unsigned int s,unsigned t,unsigned r) const Vec4 Image::getColor(const Vec3& texcoord) const { - int s = int(texcoord.x()*float(_s-1)) % _s; - int t = int(texcoord.y()*float(_t-1)) % _t; - int r = int(texcoord.z()*float(_r-1)) % _r; + unsigned int s = osg::clampTo(int(texcoord.x()*float(_s-1)), 0, _s-1); + unsigned int t = osg::clampTo(int(texcoord.y()*float(_t-1)), 0, _t-1); + unsigned int r = osg::clampTo(int(texcoord.z()*float(_r-1)), 0, _r-1); //OSG_NOTICE<<"getColor("<