2001-01-11 00:32:10 +08:00
|
|
|
#include "osg/Node"
|
|
|
|
#include "osg/Group"
|
|
|
|
#include "osg/NodeVisitor"
|
|
|
|
|
|
|
|
#include "osg/Notify"
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
using namespace osg;
|
|
|
|
|
|
|
|
Node::Node()
|
|
|
|
{
|
|
|
|
_bsphere_computed = false;
|
|
|
|
_userData = NULL;
|
|
|
|
_nodeMask = 0xffffffff;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Node::~Node()
|
|
|
|
{
|
2001-09-20 05:08:56 +08:00
|
|
|
if (_userData && _memoryAdapter.valid()) _memoryAdapter->unref_data(_userData);
|
2001-01-11 00:32:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Node::accept(NodeVisitor& nv)
|
|
|
|
{
|
|
|
|
nv.apply(*this);
|
|
|
|
}
|
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
|
2001-01-11 00:32:10 +08:00
|
|
|
void Node::ascend(NodeVisitor& nv)
|
|
|
|
{
|
|
|
|
std::for_each(_parents.begin(),_parents.end(),NodeAcceptOp(nv));
|
|
|
|
}
|
|
|
|
|
2001-09-20 05:08:56 +08:00
|
|
|
const bool Node::computeBound() const
|
2001-01-11 00:32:10 +08:00
|
|
|
{
|
|
|
|
_bsphere.init();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Node::dirtyBound()
|
|
|
|
{
|
|
|
|
if (_bsphere_computed)
|
|
|
|
{
|
|
|
|
_bsphere_computed = false;
|
|
|
|
|
|
|
|
// dirty parent bounding sphere's to ensure that all are valid.
|
|
|
|
for(ParentList::iterator itr=_parents.begin();
|
2001-09-20 05:08:56 +08:00
|
|
|
itr!=_parents.end();
|
|
|
|
++itr)
|
2001-01-11 00:32:10 +08:00
|
|
|
{
|
|
|
|
(*itr)->dirtyBound();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|