1) Added support for scaled objects (previously scaling was included in
the mesh in the b3d file). 2) Changed m_init_* variables from Vec3 to core::vector3df. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6394 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -59,7 +59,8 @@ PhysicalObject::PhysicalObject(const XMLNode &xml_node)
|
||||
else fprintf(stderr, "Unknown shape type : %s\n", shape.c_str());
|
||||
|
||||
m_init_pos.setIdentity();
|
||||
m_init_pos.setOrigin(m_init_xyz);
|
||||
Vec3 init_xyz(m_init_xyz);
|
||||
m_init_pos.setOrigin(init_xyz);
|
||||
|
||||
} // PhysicalObject
|
||||
|
||||
|
||||
@@ -75,18 +75,19 @@ TrackObject::TrackObject(const XMLNode &xml_node)
|
||||
if(!m_enabled)
|
||||
m_animated_node->setVisible(false);
|
||||
|
||||
m_init_xyz = Vec3(0,0,0);
|
||||
int result = xml_node.get("xyz", &m_init_xyz);
|
||||
m_init_hpr = Vec3(0,0,0);
|
||||
result = xml_node.get("hpr", &m_init_hpr);
|
||||
m_init_xyz = core::vector3df(0,0,0);
|
||||
int result = xml_node.get("xyz", &m_init_xyz);
|
||||
m_init_hpr = core::vector3df(0,0,0);
|
||||
result = xml_node.get("hpr", &m_init_hpr);
|
||||
m_init_scale = core::vector3df(1,1,1);
|
||||
result = xml_node.get("scale", &m_init_scale);
|
||||
if(!XMLNode::hasP(result) ||
|
||||
!XMLNode::hasR(result)) // Needs perhaps pitch and roll
|
||||
{
|
||||
}
|
||||
m_animated_node->setPosition(m_init_xyz.toIrrVector());
|
||||
// Note that toIrrHPR converts radians to degrees. Since the value
|
||||
// from the xml file is already in degrees, there is no need for that.
|
||||
m_animated_node->setRotation(m_init_hpr.toIrrVector() );
|
||||
m_animated_node->setPosition(m_init_xyz);
|
||||
m_animated_node->setRotation(m_init_hpr);
|
||||
m_animated_node->setScale(m_init_scale);
|
||||
m_animated_node->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
} // TrackObject
|
||||
|
||||
@@ -102,8 +103,9 @@ TrackObject::~TrackObject()
|
||||
*/
|
||||
void TrackObject::reset()
|
||||
{
|
||||
m_animated_node->setPosition(m_init_xyz.toIrrVector());
|
||||
m_animated_node->setRotation(m_init_hpr.toIrrHPR());
|
||||
m_animated_node->setPosition(m_init_xyz);
|
||||
m_animated_node->setRotation(m_init_hpr);
|
||||
m_animated_node->setScale(m_init_scale);
|
||||
m_animated_node->setLoopMode(false);
|
||||
|
||||
if(m_is_looped)
|
||||
|
||||
@@ -65,10 +65,13 @@ protected:
|
||||
scene::IAnimatedMeshSceneNode *m_animated_node;
|
||||
|
||||
/** The initial XYZ position of the object. */
|
||||
Vec3 m_init_xyz;
|
||||
core::vector3df m_init_xyz;
|
||||
|
||||
/** The initial hpr of the object. */
|
||||
Vec3 m_init_hpr;
|
||||
core::vector3df m_init_hpr;
|
||||
|
||||
/** The initial scale of the object. */
|
||||
core::vector3df m_init_scale;
|
||||
|
||||
public:
|
||||
TrackObject(const XMLNode &xml_node);
|
||||
|
||||
Reference in New Issue
Block a user