diff --git a/sources.cmake b/sources.cmake index 1fbf3d65d..e479a3074 100644 --- a/sources.cmake +++ b/sources.cmake @@ -60,6 +60,7 @@ src/graphics/show_curve.cpp src/graphics/skid_marks.cpp src/graphics/slip_stream.cpp src/graphics/stars.cpp +src/graphics/stkanimatedmesh.cpp src/graphics/stkmesh.cpp src/graphics/sun.cpp src/graphics/water.cpp @@ -387,6 +388,7 @@ src/graphics/show_curve.hpp src/graphics/skid_marks.hpp src/graphics/slip_stream.hpp src/graphics/stars.hpp +src/graphics/stkanimatedmesh.hpp src/graphics/stkmesh.hpp src/graphics/sun.hpp src/graphics/water.hpp diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index 1c5e69a8c..0a2bfa760 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -32,6 +32,7 @@ #include "graphics/referee.hpp" #include "graphics/shaders.hpp" #include "graphics/shadow_importance.hpp" +#include "graphics/stkanimatedmesh.hpp" #include "graphics/stkmesh.hpp" #include "graphics/sun.hpp" #include "graphics/rtts.hpp" @@ -1111,11 +1112,19 @@ void IrrDriver::removeTexture(video::ITexture *t) */ scene::IAnimatedMeshSceneNode *IrrDriver::addAnimatedMesh(scene::IAnimatedMesh *mesh, scene::ISceneNode* parent) { - return m_scene_manager->addAnimatedMeshSceneNode(mesh, parent, -1, + if (!isGLSL()) + return m_scene_manager->addAnimatedMeshSceneNode(mesh, parent, -1, core::vector3df(0,0,0), core::vector3df(0,0,0), core::vector3df(1,1,1), /*addIfMeshIsZero*/true); + + if (!parent) + parent = m_scene_manager->getRootSceneNode(); + scene::IAnimatedMeshSceneNode* node = + new STKAnimatedMesh(mesh, parent, m_scene_manager, -1, core::vector3df(0,0,0), core::vector3df(0,0,0), core::vector3df(1,1,1)); + node->drop(); + return node; } // addAnimatedMesh // ---------------------------------------------------------------------------- diff --git a/src/graphics/stkanimatedmesh.cpp b/src/graphics/stkanimatedmesh.cpp new file mode 100644 index 000000000..574bcf358 --- /dev/null +++ b/src/graphics/stkanimatedmesh.cpp @@ -0,0 +1,17 @@ +#include "graphics/stkanimatedmesh.hpp" + +using namespace irr; + +STKAnimatedMesh::STKAnimatedMesh(irr::scene::IAnimatedMesh* mesh, irr::scene::ISceneNode* parent, +irr::scene::ISceneManager* mgr, s32 id, +const core::vector3df& position, +const core::vector3df& rotation, +const core::vector3df& scale) : + CAnimatedMeshSceneNode(mesh, parent, mgr, id, position, rotation, scale) +{ +} + +void STKAnimatedMesh::render() +{ + CAnimatedMeshSceneNode::render(); +} diff --git a/src/graphics/stkanimatedmesh.hpp b/src/graphics/stkanimatedmesh.hpp new file mode 100644 index 000000000..116dc22c2 --- /dev/null +++ b/src/graphics/stkanimatedmesh.hpp @@ -0,0 +1,19 @@ +#ifndef STKANIMATEDMESH_HPP +#define STKANIMATEDMESH_HPP + +#include "../lib/irrlicht/source/Irrlicht/CAnimatedMeshSceneNode.h" +#include +#include + +class STKAnimatedMesh : public irr::scene::CAnimatedMeshSceneNode +{ +public: + STKAnimatedMesh(irr::scene::IAnimatedMesh* mesh, irr::scene::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 // STKANIMATEDMESH_HPP