Added new coputeActiveCooridnateSystemNodePath method

This commit is contained in:
Robert Osfield 2004-07-08 22:28:15 +00:00
parent 3248f885ec
commit 8d325c24ff
2 changed files with 15 additions and 5 deletions

View File

@ -104,6 +104,8 @@ class OSGPRODUCER_EXPORT Viewer : public OsgCameraGroup, public osgGA::GUIAction
typedef std::vector< osg::ref_ptr<osg::Node> > RefNodePath; typedef std::vector< osg::ref_ptr<osg::Node> > RefNodePath;
void computeActiveCoordindateSystemNodePath();
void setCoordindateSystemNodePath(const RefNodePath& nodePath) { _coordinateSystemNodePath = nodePath; } void setCoordindateSystemNodePath(const RefNodePath& nodePath) { _coordinateSystemNodePath = nodePath; }
void setCoordindateSystemNodePath(const osg::NodePath& nodePath); void setCoordindateSystemNodePath(const osg::NodePath& nodePath);

View File

@ -142,7 +142,7 @@ class CollectedCoordinateSystemNodesVisitor : public osg::NodeVisitor
public: public:
CollectedCoordinateSystemNodesVisitor(): CollectedCoordinateSystemNodesVisitor():
NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {} NodeVisitor(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN) {}
virtual void apply(osg::Node& node) virtual void apply(osg::Node& node)
@ -309,10 +309,8 @@ void Viewer::setCoordindateSystemNodePath(const osg::NodePath& nodePath)
std::back_inserter(_coordinateSystemNodePath)); std::back_inserter(_coordinateSystemNodePath));
} }
void Viewer::updatedSceneData() void Viewer::computeActiveCoordindateSystemNodePath()
{ {
OsgCameraGroup::updatedSceneData();
// now search for CoordinateSystemNode's for which we want to track. // now search for CoordinateSystemNode's for which we want to track.
osg::Node* subgraph = getTopMostSceneData(); osg::Node* subgraph = getTopMostSceneData();
@ -324,8 +322,18 @@ void Viewer::updatedSceneData()
if (!ccsnv._pathToCoordinateSystemNode.empty()) if (!ccsnv._pathToCoordinateSystemNode.empty())
{ {
setCoordindateSystemNodePath(ccsnv._pathToCoordinateSystemNode); setCoordindateSystemNodePath(ccsnv._pathToCoordinateSystemNode);
return;
} }
} }
// otherwise no node path found so reset to empty.
setCoordindateSystemNodePath(osg::NodePath());
}
void Viewer::updatedSceneData()
{
OsgCameraGroup::updatedSceneData();
computeActiveCoordindateSystemNodePath();
} }
void Viewer::setKeyboardMouse(Producer::KeyboardMouse* kbm) void Viewer::setKeyboardMouse(Producer::KeyboardMouse* kbm)