Added ParentList's into StateSet, Uniform and StateAttribute in preparation for
providing update and event handling.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user