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

@@ -86,6 +86,21 @@ void Node::ascend(NodeVisitor& nv)
std::for_each(_parents.begin(),_parents.end(),NodeAcceptOp(nv));
}
void Node::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* Node::getOrCreateStateSet()
{
if (!_stateset) _stateset = new StateSet;