More animation support (still not complete) - animated objects in

blender will now be exported with local coordinates, and the
right location is exported in the .scene file and used in STK.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3682 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2009-07-01 02:14:30 +00:00
parent f4c08a75bf
commit d1807bf4c4
3 changed files with 22 additions and 8 deletions

View File

@@ -21,8 +21,9 @@
#include "io/xml_node.hpp"
//static std::string Ipo::m_all_names[2] = {std::string("a"), std::string("b")};
const std::string Ipo::m_all_channel_names[IPO_MAX] =
{std::string("LocX"), std::string("LocY"), std::string("LocZ"),
std::string("RotX"), "RotY", "RotZ"};
Ipo::Ipo(const XMLNode &curve, float fps)
{
@@ -32,11 +33,21 @@ Ipo::Ipo(const XMLNode &curve, float fps)
curve.getName().c_str());
return;
}
std::string type; curve.get("type", &type );
if(type=="RotX") m_channel=IPO_ROTX;
else if(type=="RotY") m_channel=IPO_ROTY;
else if(type=="RotZ") m_channel=IPO_ROTZ;
std::string interp; curve.get("interpolation", &interp);
std::string channel;
curve.get("channel", &channel);
m_channel=IPO_MAX;
for(unsigned int i=IPO_LOCX; i<IPO_MAX; i++)
{
if(m_all_channel_names[i]==channel) m_channel=(IpoChannelType)i;
}
if(m_channel==IPO_MAX)
{
fprintf(stderr, "Unknown animation channel: '%s' - aborting.\n", channel.c_str());
exit(-1);
}
std::string interp;
curve.get("interpolation", &interp);
if (interp=="const" ) m_interpolation = IP_CONST;
else if(interp=="linear") m_interpolation = IP_LINEAR;
else m_interpolation = IP_BEZIER;

View File

@@ -35,7 +35,7 @@ public:
enum IpoChannelType {IPO_LOCX, IPO_LOCY, IPO_LOCZ,
IPO_ROTX, IPO_ROTY, IPO_ROTZ,
IPO_MAX};
static std::string m_all_names[IPO_MAX];
static const std::string m_all_channel_names[IPO_MAX];
private:
/** The type of this IPO. */
IpoChannelType m_channel;

View File

@@ -43,6 +43,9 @@ ThreeDAnimation::ThreeDAnimation(const std::string &track_name,
exit(-1);
}
m_animated_node = irr_driver->addAnimatedMesh(m_mesh);
core::vector3df xyz;
node.get("xyz", &xyz);
m_animated_node->setPosition(xyz);
setInitialTransform(m_animated_node->getPosition(), m_animated_node->getRotation());
} // ThreeDAnimation