From Sukender, "Factorized the depth loop ("while ( lastDepth >= _nodePath.size() )...") into a method called updateCurrentDaeNode(). Added missing calls into apply(osg::LightSource &) and daeWriter::apply(osg::Camera &) and daeWriter::apply(osg::CameraView &)"
This commit is contained in:
@@ -68,13 +68,7 @@ void daeWriter::writeNodeExtra(osg::Node &node)
|
||||
void daeWriter::apply( osg::Group &node )
|
||||
{
|
||||
debugPrint( node );
|
||||
|
||||
while ( lastDepth >= _nodePath.size() )
|
||||
{
|
||||
//We are not a child of previous node
|
||||
currentNode = daeSafeCast< domNode >( currentNode->getParentElement() );
|
||||
lastDepth--;
|
||||
}
|
||||
updateCurrentDaeNode();
|
||||
currentNode = daeSafeCast< domNode >(currentNode->add( COLLADA_ELEMENT_NODE ) );
|
||||
|
||||
// If a multiswitch node, store it's data as extra "MultiSwitch" data in the "OpenSceneGraph" technique
|
||||
@@ -144,13 +138,7 @@ void daeWriter::apply( osg::Group &node )
|
||||
void daeWriter::apply( osg::Switch &node )
|
||||
{
|
||||
debugPrint( node );
|
||||
|
||||
while ( lastDepth >= _nodePath.size() )
|
||||
{
|
||||
//We are not a child of previous node
|
||||
currentNode = daeSafeCast< domNode >( currentNode->getParentElement() );
|
||||
lastDepth--;
|
||||
}
|
||||
updateCurrentDaeNode();
|
||||
currentNode = daeSafeCast< domNode >(currentNode->add( COLLADA_ELEMENT_NODE ) );
|
||||
currentNode->setId(getNodeName(node,"switch").c_str());
|
||||
|
||||
@@ -197,13 +185,7 @@ void daeWriter::apply( osg::Switch &node )
|
||||
void daeWriter::apply( osg::Sequence &node )
|
||||
{
|
||||
debugPrint( node );
|
||||
|
||||
while ( lastDepth >= _nodePath.size() )
|
||||
{
|
||||
//We are not a child of previous node
|
||||
currentNode = daeSafeCast< domNode >( currentNode->getParentElement() );
|
||||
lastDepth--;
|
||||
}
|
||||
updateCurrentDaeNode();
|
||||
currentNode = daeSafeCast< domNode >(currentNode->add( COLLADA_ELEMENT_NODE ) );
|
||||
currentNode->setId(getNodeName(node,"sequence").c_str());
|
||||
|
||||
@@ -280,15 +262,9 @@ void daeWriter::apply( osg::Sequence &node )
|
||||
void daeWriter::apply( osg::LOD &node )
|
||||
{
|
||||
debugPrint( node );
|
||||
|
||||
while ( lastDepth >= _nodePath.size() )
|
||||
{
|
||||
//We are not a child of previous node
|
||||
currentNode = daeSafeCast< domNode >( currentNode->getParentElement() );
|
||||
lastDepth--;
|
||||
}
|
||||
currentNode = daeSafeCast< domNode >(currentNode->add( COLLADA_ELEMENT_NODE ) );
|
||||
updateCurrentDaeNode();
|
||||
lastDepth = _nodePath.size();
|
||||
currentNode = daeSafeCast< domNode >(currentNode->add( COLLADA_ELEMENT_NODE ) );
|
||||
currentNode->setId(getNodeName(node,"LOD").c_str());
|
||||
|
||||
if (writeExtras)
|
||||
@@ -354,6 +330,7 @@ void daeWriter::apply( osg::ProxyNode &node )
|
||||
void daeWriter::apply( osg::LightSource &node )
|
||||
{
|
||||
debugPrint( node );
|
||||
updateCurrentDaeNode();
|
||||
|
||||
domInstance_light *il = daeSafeCast< domInstance_light >( currentNode->add( COLLADA_ELEMENT_INSTANCE_LIGHT ) );
|
||||
std::string name = node.getName();
|
||||
@@ -486,6 +463,7 @@ void daeWriter::apply( osg::LightSource &node )
|
||||
void daeWriter::apply( osg::Camera &node )
|
||||
{
|
||||
debugPrint( node );
|
||||
updateCurrentDaeNode();
|
||||
|
||||
domInstance_camera *ic = daeSafeCast< domInstance_camera >( currentNode->add( COLLADA_ELEMENT_INSTANCE_CAMERA ) );
|
||||
std::string name = node.getName();
|
||||
@@ -509,6 +487,7 @@ void daeWriter::apply( osg::Camera &node )
|
||||
void daeWriter::apply( osg::CameraView &node)
|
||||
{
|
||||
debugPrint( node );
|
||||
updateCurrentDaeNode();
|
||||
|
||||
domInstance_camera *ic = daeSafeCast< domInstance_camera >( currentNode->add(COLLADA_ELEMENT_INSTANCE_CAMERA));
|
||||
std::string name = node.getName();
|
||||
|
||||
@@ -62,14 +62,7 @@ void daeWriter::apply( osg::MatrixTransform &node )
|
||||
#ifdef _DEBUG
|
||||
debugPrint( node );
|
||||
#endif
|
||||
|
||||
while ( lastDepth >= _nodePath.size() )
|
||||
{
|
||||
//We are not a child of previous node
|
||||
currentNode = daeSafeCast< domNode >( currentNode->getParentElement() );
|
||||
lastDepth--;
|
||||
}
|
||||
|
||||
updateCurrentDaeNode();
|
||||
currentNode = daeSafeCast< domNode >(currentNode->add( COLLADA_ELEMENT_NODE ) );
|
||||
std::string nodeName = getNodeName(node,"matrixTransform");
|
||||
currentNode->setId(nodeName.c_str());
|
||||
@@ -122,13 +115,7 @@ void daeWriter::apply( osg::PositionAttitudeTransform &node )
|
||||
#ifdef _DEBUG
|
||||
debugPrint( node );
|
||||
#endif
|
||||
|
||||
while ( lastDepth >= _nodePath.size() )
|
||||
{
|
||||
//We are not a child of previous node
|
||||
currentNode = daeSafeCast< domNode >( currentNode->getParentElement() );
|
||||
lastDepth--;
|
||||
}
|
||||
updateCurrentDaeNode();
|
||||
currentNode = daeSafeCast< domNode >(currentNode->add( COLLADA_ELEMENT_NODE ) );
|
||||
std::string nodeName = getNodeName(node,"positionAttitudeTransform");
|
||||
currentNode->setId(nodeName.c_str());
|
||||
@@ -192,13 +179,7 @@ void daeWriter::apply( osg::PositionAttitudeTransform &node )
|
||||
void daeWriter::apply( osg::Transform &node )
|
||||
{
|
||||
debugPrint( node );
|
||||
|
||||
while ( lastDepth >= _nodePath.size() )
|
||||
{
|
||||
// We are not a child of previous node
|
||||
currentNode = daeSafeCast< domNode >( currentNode->getParentElement() );
|
||||
lastDepth--;
|
||||
}
|
||||
updateCurrentDaeNode();
|
||||
currentNode = daeSafeCast< domNode >(currentNode->add( COLLADA_ELEMENT_NODE ) );
|
||||
|
||||
// If a DOFTransform node store it's data as extra "DOFTransform" data in the "OpenSceneGraph" technique
|
||||
|
||||
@@ -141,6 +141,15 @@ void daeWriter::apply( osg::Node &node )
|
||||
traverse( node );
|
||||
}
|
||||
|
||||
void daeWriter::updateCurrentDaeNode()
|
||||
{
|
||||
while ( lastDepth >= _nodePath.size() )
|
||||
{
|
||||
//We are not a child of previous node
|
||||
currentNode = daeSafeCast< domNode >( currentNode->getParentElement() );
|
||||
--lastDepth;
|
||||
}
|
||||
}
|
||||
|
||||
std::string daeWriter::uniquify( const std::string &name )
|
||||
{
|
||||
|
||||
@@ -248,15 +248,17 @@ protected: //members
|
||||
|
||||
osg::StateSet* CleanStateSet(osg::StateSet* pStateSet) const;
|
||||
|
||||
void updateCurrentDaeNode();
|
||||
|
||||
protected: //inner classes
|
||||
class ArrayNIndices
|
||||
{
|
||||
public:
|
||||
enum Mode { NONE = 0, VEC2 = 2, VEC3 = 3, VEC4 = 4 };
|
||||
osg::Vec2Array *vec2;
|
||||
osg::Vec3Array *vec3;
|
||||
osg::Vec4Array *vec4;
|
||||
osg::IndexArray *inds;
|
||||
osg::Vec2Array* vec2;
|
||||
osg::Vec3Array* vec3;
|
||||
osg::Vec4Array* vec4;
|
||||
osg::IndexArray* inds;
|
||||
Mode mode;
|
||||
|
||||
ArrayNIndices( osg::Array *array, osg::IndexArray *ind ) : vec2(0), vec3(0), vec4(0), inds( ind ), mode(NONE)
|
||||
|
||||
Reference in New Issue
Block a user