From 5733cc1470d6e162858454abac7c4b00e6b3c038 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 12 Sep 2002 13:23:15 +0000 Subject: [PATCH] From Brede Johansen - Fixes to osg::Plane::valid and added a new set method. From Stephan Huber - Compilation fix to Texture.cpp for OSX. From Don Tidrow - added dirtyBound() to osgText::Text::setPosition --- include/osg/Plane | 11 +++++++++-- src/osg/Texture.cpp | 4 ++-- src/osgText/Text.cpp | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/osg/Plane b/include/osg/Plane index 452bee7d8..2316fee21 100644 --- a/include/osg/Plane +++ b/include/osg/Plane @@ -52,6 +52,13 @@ class SG_EXPORT Plane calculateUpperLowerBBCorners(); } + inline void set(const Vec3& norm, const Vec3& point) + { + float d = -norm[0]*point[0] - norm[1]*point[1] - norm[2]*point[2]; + _fv.set(norm[0],norm[1],norm[2],d); + calculateUpperLowerBBCorners(); + } + /** flip/reverse the orientation of the plane.*/ inline void flip() { @@ -78,7 +85,7 @@ class SG_EXPORT Plane } - inline bool valid() const { return _fv[0]==0.0f && _fv[1]==0.0f && _fv[2]==0.0f; } + inline bool valid() const { return _fv.valid(); } inline Vec4& asVec4() { return _fv; } @@ -88,7 +95,7 @@ class SG_EXPORT Plane inline float operator [] (unsigned int i) const { return _fv[i]; } - inline osg::Vec3 getNormal() { return osg::Vec3(_fv[0],_fv[1],_fv[2]); } + inline osg::Vec3 getNormal() const { return osg::Vec3(_fv[0],_fv[1],_fv[2]); } /** calculate the distance between a point and the plane.*/ inline float distance(const osg::Vec3& v) const diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index 15dd1a383..6d83b877f 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -460,8 +460,8 @@ void Texture::flushDeletedTextureObjects(uint contextID) DeletedTextureObjectCache::iterator citr = s_deletedTextureObjectCache.find(contextID); if (citr!=s_deletedTextureObjectCache.end()) { - std::set& textureObjectSet = citr->second; - for(std::set::iterator titr=textureObjectSet.begin(); + std::set& textureObjectSet = citr->second; + for(std::set::iterator titr=textureObjectSet.begin(); titr!=textureObjectSet.end(); ++titr) { diff --git a/src/osgText/Text.cpp b/src/osgText/Text.cpp index c16553ac8..deb55dbd8 100644 --- a/src/osgText/Text.cpp +++ b/src/osgText/Text.cpp @@ -268,6 +268,7 @@ void Text:: setPosition(const Vec3& pos) { _pos=pos; + dirtyBound(); } void Text::