Fixed bug: X3D models not scaled to conform to legacy expectation

This commit is contained in:
Cirilo Bernardo 2016-02-12 16:58:12 +11:00
parent 8e63862d7c
commit 7ffa20a668
2 changed files with 16 additions and 3 deletions

View File

@ -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;

View File

@ -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" )