From 0f69a4c3ae8c8e53be93866a19df93d405425f85 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 20 Jan 2003 20:40:06 +0000 Subject: [PATCH] Made the drawable::compile(State&) method const and the DisplayListVisitor to compile even when dislay list is off. This has been done to allow subclasses of Drawable handle their own compile implementation, such as used by text. --- include/osg/Drawable | 6 +++--- src/osg/Drawable.cpp | 2 +- src/osgUtil/DisplayListVisitor.cpp | 12 +++--------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/include/osg/Drawable b/include/osg/Drawable index 062b8d665..6268a9347 100644 --- a/include/osg/Drawable +++ b/include/osg/Drawable @@ -164,12 +164,12 @@ class SG_EXPORT Drawable : public Object * Note, draw method should *not* be overridden in subclasses as it * manages the optional display list. */ - inline void draw(State& state); + inline void draw(State& state) const; /** Immediately compile this drawable into an OpenGL Display List. Note I, operation is ignored if _useDisplayList to false. Note II, compile is not intended to be overridden in subclasses.*/ - void compile(State& state); + virtual void compile(State& state) const; struct UpdateCallback : public virtual osg::Referenced @@ -403,7 +403,7 @@ class SG_EXPORT Drawable : public Object }; -inline void Drawable::draw(State& state) +inline void Drawable::draw(State& state) const { if (_useDisplayList) { diff --git a/src/osg/Drawable.cpp b/src/osg/Drawable.cpp index 3ac6418e9..bb25256f2 100644 --- a/src/osg/Drawable.cpp +++ b/src/osg/Drawable.cpp @@ -85,7 +85,7 @@ void Drawable::dirtyBound() } } -void Drawable::compile(State& state) +void Drawable::compile(State& state) const { if (!_useDisplayList) return; diff --git a/src/osgUtil/DisplayListVisitor.cpp b/src/osgUtil/DisplayListVisitor.cpp index e07803019..dc95a52d7 100644 --- a/src/osgUtil/DisplayListVisitor.cpp +++ b/src/osgUtil/DisplayListVisitor.cpp @@ -36,12 +36,9 @@ void DisplayListVisitor::apply(osg::Geode& node) for(unsigned int i=0;igetUseDisplayList()) + if (drawable->getStateSet()) { - if (drawable->getStateSet()) - { - drawable->getStateSet()->compile(*_state); - } + drawable->getStateSet()->compile(*_state); } } } @@ -65,10 +62,7 @@ void DisplayListVisitor::apply(osg::Geode& node) { for(unsigned int i=0;igetUseDisplayList()) - { - node.getDrawable(i)->compile(*_state); - } + node.getDrawable(i)->compile(*_state); } } }