From be60b32add846ffc17b24f93b36e679fa62a4e80 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 14 Aug 2006 19:42:22 +0000 Subject: [PATCH] Fixed texture optimization problem associated with mixing already compiled scene graphs - resulting in incorrect texture assignment. Solution was to a compareTextureObjects() test to the Texture*::compare(..) method that the osgUtil::Optimizer::StateSetVisitor uses to determine uniqueness. --- include/osg/Texture | 3 +++ src/osg/Texture.cpp | 11 +++++++++++ src/osg/Texture1D.cpp | 11 +++++++++++ src/osg/Texture2D.cpp | 11 +++++++++++ src/osg/Texture3D.cpp | 11 +++++++++++ src/osg/TextureCubeMap.cpp | 15 +++++++++++++++ src/osg/TextureRectangle.cpp | 11 +++++++++++ 7 files changed, 73 insertions(+) diff --git a/include/osg/Texture b/include/osg/Texture index 736548143..b380da6e5 100644 --- a/include/osg/Texture +++ b/include/osg/Texture @@ -599,6 +599,9 @@ class OSG_EXPORT Texture : public osg::StateAttribute /** Returns -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ int compareTexture(const Texture& rhs) const; + /** Returns -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */ + int compareTextureObjects(const Texture& rhs) const; + typedef buffered_value TexParameterDirtyList; mutable TexParameterDirtyList _texParametersDirtyList; diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index 69acd8aaa..63a36113b 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -417,6 +417,17 @@ int Texture::compareTexture(const Texture& rhs) const return 0; } +int Texture::compareTextureObjects(const Texture& rhs) const +{ + if (_textureObjectBuffer.size()