From 1289528770a75f05c77d100213070f82b6a72ca1 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 9 Jan 2009 12:21:36 +0000 Subject: [PATCH] From Roland Smeenk, "Attached is a fix for the Collada plugin. A PositionAttitudeTransform wrote its place elements in the wrong order." --- src/osgPlugins/dae/daeWTransforms.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/osgPlugins/dae/daeWTransforms.cpp b/src/osgPlugins/dae/daeWTransforms.cpp index 5ec2e25ae..8c1234a6a 100644 --- a/src/osgPlugins/dae/daeWTransforms.cpp +++ b/src/osgPlugins/dae/daeWTransforms.cpp @@ -90,13 +90,13 @@ void daeWriter::apply( osg::PositionAttitudeTransform &node ) const osg::Quat &q = node.getAttitude(); const osg::Vec3 &s = node.getScale(); - if ( s.x() != 1 || s.y() != 1 || s.z() != 1 ) + if ( pos.x() != 0 || pos.y() != 0 || pos.z() != 0 ) { - //make a scale - domScale *scale = daeSafeCast< domScale >( currentNode->add( COLLADA_ELEMENT_SCALE ) ); - scale->getValue().append( s.x() ); - scale->getValue().append( s.y() ); - scale->getValue().append( s.z() ); + //make a translate + domTranslate *trans = daeSafeCast< domTranslate >( currentNode->add( COLLADA_ELEMENT_TRANSLATE ) ); + trans->getValue().append( pos.x() ); + trans->getValue().append( pos.y() ); + trans->getValue().append( pos.z() ); } double angle; @@ -112,13 +112,13 @@ void daeWriter::apply( osg::PositionAttitudeTransform &node ) rot->getValue().append( osg::RadiansToDegrees(angle) ); } - if ( pos.x() != 0 || pos.y() != 0 || pos.z() != 0 ) + if ( s.x() != 1 || s.y() != 1 || s.z() != 1 ) { - //make a translate - domTranslate *trans = daeSafeCast< domTranslate >( currentNode->add( COLLADA_ELEMENT_TRANSLATE ) ); - trans->getValue().append( pos.x() ); - trans->getValue().append( pos.y() ); - trans->getValue().append( pos.z() ); + //make a scale + domScale *scale = daeSafeCast< domScale >( currentNode->add( COLLADA_ELEMENT_SCALE ) ); + scale->getValue().append( s.x() ); + scale->getValue().append( s.y() ); + scale->getValue().append( s.z() ); } writeNodeExtra(node);