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.
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -85,7 +85,7 @@ void Drawable::dirtyBound()
|
||||
}
|
||||
}
|
||||
|
||||
void Drawable::compile(State& state)
|
||||
void Drawable::compile(State& state) const
|
||||
{
|
||||
if (!_useDisplayList) return;
|
||||
|
||||
|
||||
@@ -36,12 +36,9 @@ void DisplayListVisitor::apply(osg::Geode& node)
|
||||
for(unsigned int i=0;i<node.getNumDrawables();++i)
|
||||
{
|
||||
Drawable* drawable = node.getDrawable(i);
|
||||
if (drawable->getUseDisplayList())
|
||||
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;i<node.getNumDrawables();++i)
|
||||
{
|
||||
if (node.getDrawable(i)->getUseDisplayList())
|
||||
{
|
||||
node.getDrawable(i)->compile(*_state);
|
||||
}
|
||||
node.getDrawable(i)->compile(*_state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user