Steamlined the handling of osg::Geometry
This commit is contained in:
parent
9c30e99b83
commit
cb2b0a5fe8
@ -545,27 +545,27 @@ void OBJWriterNodeVisitor::processGeometry(osg::Geometry* geo, osg::Matrix& m) {
|
||||
|
||||
}
|
||||
|
||||
void OBJWriterNodeVisitor::apply(osg::Geometry& geometry)
|
||||
{
|
||||
osg::Matrix m = osg::computeLocalToWorld(getNodePath());
|
||||
|
||||
pushStateSet(geometry.getStateSet());
|
||||
|
||||
processGeometry(&geometry,m);
|
||||
|
||||
popStateSet(geometry.getStateSet());
|
||||
}
|
||||
|
||||
void OBJWriterNodeVisitor::apply( osg::Geode &node )
|
||||
{
|
||||
|
||||
pushStateSet(node.getStateSet());
|
||||
_nameStack.push_back(node.getName());
|
||||
osg::Matrix m = osg::computeLocalToWorld(getNodePath());
|
||||
unsigned int count = node.getNumDrawables();
|
||||
for ( unsigned int i = 0; i < count; i++ )
|
||||
{
|
||||
osg::Geometry *g = node.getDrawable( i )->asGeometry();
|
||||
if ( g != NULL )
|
||||
{
|
||||
pushStateSet(g->getStateSet());
|
||||
|
||||
processGeometry(g,m);
|
||||
|
||||
popStateSet(g->getStateSet());
|
||||
}
|
||||
node.getDrawable( i )->accept(*this);
|
||||
}
|
||||
|
||||
|
||||
popStateSet(node.getStateSet());
|
||||
_nameStack.pop_back();
|
||||
}
|
||||
|
@ -65,23 +65,20 @@ class OBJWriterNodeVisitor: public osg::NodeVisitor {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void apply(osg::Geode &node);
|
||||
virtual void apply(osg::Geometry & geometry);
|
||||
virtual void apply(osg::Geode & node);
|
||||
|
||||
virtual void apply(osg::Group &node)
|
||||
virtual void apply(osg::Group & node)
|
||||
{
|
||||
pushStateSet(node.getStateSet());
|
||||
|
||||
_nameStack.push_back( node.getName().empty() ? node.className() : node.getName() );
|
||||
_fout << std::endl;
|
||||
_fout << "g " << getUniqueName() << std::endl;
|
||||
|
||||
osg::NodeVisitor::traverse( node );
|
||||
|
||||
_nameStack.pop_back();
|
||||
}
|
||||
|
||||
void traverse (osg::Node &node)
|
||||
{
|
||||
pushStateSet(node.getStateSet());
|
||||
|
||||
osg::NodeVisitor::traverse( node );
|
||||
|
||||
popStateSet(node.getStateSet());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user