From: <axl...@us...> - 2008-12-04 01:53:02
|
Revision: 36 http://hgengine.svn.sourceforge.net/hgengine/?rev=36&view=rev Author: axlecrusher Date: 2008-12-04 01:52:54 +0000 (Thu, 04 Dec 2008) Log Message: ----------- load from xml Modified Paths: -------------- Mercury2/src/TransformNode.cpp Mercury2/src/TransformNode.h Modified: Mercury2/src/TransformNode.cpp =================================================================== --- Mercury2/src/TransformNode.cpp 2008-12-04 01:50:32 UTC (rev 35) +++ Mercury2/src/TransformNode.cpp 2008-12-04 01:52:54 UTC (rev 36) @@ -77,6 +77,45 @@ } } +void TransformNode::LoadFromXML(const XMLNode& node) +{ + MercuryPoint rot(m_rotation), pos(m_position), scale(m_scale); + + //only change the values that exist in the XML + if ( !node.Attribute("rotx").empty() ) + rot.SetX( StrToFloat( node.Attribute("rotx") ) ); + + if ( !node.Attribute("roty").empty() ) + rot.SetY( StrToFloat( node.Attribute("roty") ) ); + + if ( !node.Attribute("rotz").empty() ) + rot.SetZ( StrToFloat( node.Attribute("rotz") ) ); + + if ( !node.Attribute("scalex").empty() ) + scale.SetX( StrToFloat( node.Attribute("scalex") ) ); + + if ( !node.Attribute("scaley").empty() ) + scale.SetY( StrToFloat( node.Attribute("scaley") ) ); + + if ( !node.Attribute("scalez").empty() ) + scale.SetZ( StrToFloat( node.Attribute("scalez") ) ); + + if ( !node.Attribute("movx").empty() ) + pos.SetX( StrToFloat( node.Attribute("movx") ) ); + + if ( !node.Attribute("movy").empty() ) + pos.SetY( StrToFloat( node.Attribute("movy") ) ); + + if ( !node.Attribute("movz").empty() ) + pos.SetZ( StrToFloat( node.Attribute("movz") ) ); + + SetRotation(rot); + SetPosition(pos); + SetScale(scale); + + MercuryNode::LoadFromXML( node ); +} + /*************************************************************************** * Copyright (C) 2008 by Joshua Allen * * * Modified: Mercury2/src/TransformNode.h =================================================================== --- Mercury2/src/TransformNode.h 2008-12-04 01:50:32 UTC (rev 35) +++ Mercury2/src/TransformNode.h 2008-12-04 01:52:54 UTC (rev 36) @@ -26,6 +26,8 @@ void ComputeMatrix(); + virtual void LoadFromXML(const XMLNode& node); + GENRTTI(TransformNode); private: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |