Use a custom stk mesh

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14997 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
vincentlj 2014-01-10 21:30:17 +00:00
parent 9b1853ef21
commit c3a4f7d8ce
5 changed files with 713 additions and 667 deletions

File diff suppressed because it is too large Load Diff

View File

@ -32,6 +32,7 @@
#include "graphics/referee.hpp"
#include "graphics/shaders.hpp"
#include "graphics/shadow_importance.hpp"
#include "graphics/stkmesh.hpp"
#include "graphics/sun.hpp"
#include "graphics/rtts.hpp"
#include "graphics/water.hpp"
@ -902,7 +903,16 @@ scene::IParticleSystemSceneNode *IrrDriver::addParticleNode(bool default_emitter
scene::IMeshSceneNode *IrrDriver::addMesh(scene::IMesh *mesh,
scene::ISceneNode *parent)
{
return m_scene_manager->addMeshSceneNode(mesh, parent);
if (!isGLSL())
return m_scene_manager->addMeshSceneNode(mesh, parent);
if (!parent)
parent = m_scene_manager->getRootSceneNode();
scene::IMeshSceneNode* node = new STKMesh(mesh, parent, m_scene_manager, -1);
node->drop();
return node;
} // addMesh
// ----------------------------------------------------------------------------

15
src/graphics/stkmesh.cpp Normal file
View File

@ -0,0 +1,15 @@
#include "stkmesh.hpp"
STKMesh::STKMesh(irr::scene::IMesh* mesh, ISceneNode* parent, irr::scene::ISceneManager* mgr, irr::s32 id,
const irr::core::vector3df& position,
const irr::core::vector3df& rotation,
const irr::core::vector3df& scale) :
CMeshSceneNode(mesh, parent, mgr, id, position, rotation, scale)
{
}
void STKMesh::render()
{
CMeshSceneNode::render();
}

19
src/graphics/stkmesh.hpp Normal file
View File

@ -0,0 +1,19 @@
#ifndef STKMESH_H
#define STKMESH_H
#include <IMeshSceneNode.h>
#include <IMesh.h>
#include "../lib/irrlicht/source/Irrlicht/CMeshSceneNode.h"
class STKMesh : public irr::scene::CMeshSceneNode
{
public:
STKMesh(irr::scene::IMesh* mesh, ISceneNode* parent, irr::scene::ISceneManager* mgr, irr::s32 id,
const irr::core::vector3df& position = irr::core::vector3df(0,0,0),
const irr::core::vector3df& rotation = irr::core::vector3df(0,0,0),
const irr::core::vector3df& scale = irr::core::vector3df(1.0f, 1.0f, 1.0f));
virtual void render();
};
#endif // STKMESH_H

View File

@ -818,8 +818,8 @@ bool Track::loadMainTrack(const XMLNode &root)
// The merged mesh is grabbed by the octtree, so we don't need
// to keep a reference to it.
//scene::ISceneNode *scene_node = irr_driver->addMesh(merged_mesh);
scene::IMeshSceneNode *scene_node = irr_driver->addOctTree(merged_mesh);
scene::ISceneNode *scene_node = irr_driver->addMesh(merged_mesh);
//scene::IMeshSceneNode *scene_node = irr_driver->addOctTree(merged_mesh);
// We should drop the merged mesh (since it's now referred to in the
// scene node), but then we need to grab it since it's in the
// m_all_cached_meshes.