Added ParentList's into StateSet, Uniform and StateAttribute in preparation for

providing update and event handling.
This commit is contained in:
Robert Osfield
2005-04-24 21:04:54 +00:00
parent 4262366f62
commit 193c83cb9c
12 changed files with 345 additions and 35 deletions

View File

@@ -306,6 +306,22 @@ void Drawable::removeParent(osg::Node* node)
if (pitr!=_parents.end()) _parents.erase(pitr);
}
void Drawable::setStateSet(osg::StateSet* stateset)
{
// do nothing if nothing changed.
if (_stateset==stateset) return;
// remove this node from the current statesets parent list
if (_stateset.valid()) _stateset->removeParent(this);
// set the stateset.
_stateset = stateset;
// add this node to the new stateset to the parent list.
if (_stateset.valid()) _stateset->addParent(this);
}
osg::StateSet* Drawable::getOrCreateStateSet()
{
if (!_stateset) _stateset = new StateSet;