Make LOD objects visible to the physics

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7818 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2011-03-05 20:50:36 +00:00
parent 0d90cd7137
commit f00af38fc7
3 changed files with 28 additions and 2 deletions

View File

@@ -22,6 +22,13 @@
#include "irrlicht.h"
using namespace irr;
namespace irr
{
namespace scene
{
const int ESNT_LOD_NODE = MAKE_IRR_ID('l','o','d','n');
}
}
/**
* \brief manages smoke particle effects
@@ -54,10 +61,12 @@ public:
void add(int level, scene::ISceneNode* node, bool reparent);
scene::ISceneNode* getFirstNode() { return m_nodes[0]; }
virtual void OnRegisterSceneNode();
virtual void render();
virtual scene::ESCENE_NODE_TYPE getType() const { return scene::ESNT_DUMMY_TRANSFORMATION; }
virtual scene::ESCENE_NODE_TYPE getType() const { return (scene::ESCENE_NODE_TYPE)scene::ESNT_LOD_NODE; }
};

View File

@@ -23,6 +23,14 @@
using namespace irr;
namespace irr
{
namespace scene
{
const int ESNT_PER_CAMERA_NODE = MAKE_IRR_ID('p','c','a','m');
}
}
/**
* \brief manages smoke particle effects
* \ingroup graphics
@@ -58,7 +66,7 @@ public:
virtual void OnRegisterSceneNode();
virtual void render();
virtual scene::ESCENE_NODE_TYPE getType() const { return scene::ESNT_DUMMY_TRANSFORMATION; }
virtual scene::ESCENE_NODE_TYPE getType() const { return (scene::ESCENE_NODE_TYPE)scene::ESNT_PER_CAMERA_NODE; }
scene::ISceneNode* getChild() { return m_child; }
};

View File

@@ -364,6 +364,11 @@ void Track::createPhysicsModel(unsigned int main_track_count)
*/
void Track::convertTrackToBullet(scene::ISceneNode *node)
{
if (node->getType() == scene::ESNT_LOD_NODE)
{
node = ((LODNode*)node)->getFirstNode();
}
const core::vector3df &pos = node->getPosition();
const core::vector3df &hpr = node->getRotation();
const core::vector3df &scale = node->getScale();
@@ -374,6 +379,8 @@ void Track::convertTrackToBullet(scene::ISceneNode *node)
// water nodes, which only have the material defined in the node,
// but not in the mesh at all!
bool is_readonly_material=false;
switch(node->getType())
{
case scene::ESNT_MESH :
@@ -706,6 +713,8 @@ bool Track::loadMainTrack(const XMLNode &root)
{
full_path = m_root + "/" + group[m].second;
// TODO: check whether the mesh contains animations or not, and use a static
// mesh when there are no animations?
scene::IAnimatedMesh *a_mesh = irr_driver->getAnimatedMesh(full_path);
if(!a_mesh)
{