diff --git a/plugins/3d/vrml/x3d/x3d_coords.cpp b/plugins/3d/vrml/x3d/x3d_coords.cpp index 5548e6c2c1..5737305233 100644 --- a/plugins/3d/vrml/x3d/x3d_coords.cpp +++ b/plugins/3d/vrml/x3d/x3d_coords.cpp @@ -96,18 +96,21 @@ bool X3DCOORDS::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict ) { if( plist.GetNextToken().ToDouble( &point ) ) { + // note: coordinates are multiplied by 2.54 to retain + // legacy behavior of 1 X3D unit = 0.1 inch; the SG* + // classes expect all units in mm. switch( i % 3 ) { case 0: - pt.x = point; + pt.x = point * 2.54; break; case 1: - pt.y = point; + pt.y = point * 2.54; break; case 2: - pt.z = point; + pt.z = point * 2.54; points.push_back( pt ); break; diff --git a/plugins/3d/vrml/x3d/x3d_transform.cpp b/plugins/3d/vrml/x3d/x3d_transform.cpp index b75b7f6f5c..91e7fa2204 100644 --- a/plugins/3d/vrml/x3d/x3d_transform.cpp +++ b/plugins/3d/vrml/x3d/x3d_transform.cpp @@ -107,6 +107,10 @@ void X3DTRANSFORM::readFields( wxXmlNode* aNode ) wxXmlAttribute* prop; + // note: center/translation are multiplied by 2.54 to retain + // legacy behavior of 1 X3D unit = 0.1 inch; the SG* + // classes expect all units in mm. + for( prop = aNode->GetAttributes(); prop != NULL; prop = prop->GetNext() ) @@ -119,11 +123,17 @@ void X3DTRANSFORM::readFields( wxXmlNode* aNode ) m_Dict->AddName( m_Name, this ); } else if( pname == "center" ) + { X3D::ParseSFVec3( prop->GetValue(), center ); + center *= 2.54; + } else if( pname == "scale" ) X3D::ParseSFVec3( prop->GetValue(), scale ); else if( pname == "translation" ) + { X3D::ParseSFVec3( prop->GetValue(), translation ); + translation *= 2.54; + } else if( pname == "rotation" ) X3D::ParseSFRotation( prop->GetValue(), rotation ); else if( pname == "scaleOrientation" )