--- Irrlicht/CAnimatedMeshSceneNode.cpp 2005-08-20 22:17:52.000000000 +0200 +++ Irr-Source/CAnimatedMeshSceneNode.cpp 2005-10-10 15:34:22.705695189 +0200 @@ -2,6 +2,8 @@ // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h +// 01.10.2005 - CustomBones - added by A. Buschhüter (Acki) A_Buschhueter@gmx.de + #include "CAnimatedMeshSceneNode.h" #include "IVideoDriver.h" #include "ISceneManager.h" @@ -27,7 +29,7 @@ const core::vector3df& position, const core::vector3df& rotation, const core::vector3df& scale) : IAnimatedMeshSceneNode(parent, mgr, id, position, rotation, scale), Mesh(mesh), BeginFrameTime(0), StartFrame(0), EndFrame(0), FramesPerSecond(100), - Shadow(0), Looping(true), LoopCallBack(0) + Shadow(0), Looping(true), LoopCallBack(0), useCBones(false) { #ifdef _DEBUG setDebugName("CAnimatedMeshSceneNode"); @@ -221,6 +223,8 @@ if (!Mesh || !driver) return; + ((IAnimatedMeshX*)Mesh)->useCMeshBones(&CBones, useCBones); + bool isTransparentPass = SceneManager->getSceneNodeRenderPass() == scene::ESNRP_TRANSPARENT; @@ -482,6 +486,20 @@ LoopCallBack->grab(); } +void CAnimatedMeshSceneNode::useCustomBones(bool use){ + useCBones = use; +} + +const core::array* CAnimatedMeshSceneNode::makeCustomBones(){ + CBones.clear(); + if(Mesh) + ((IAnimatedMeshX*)Mesh)->getBones(&CBones); + return &CBones; +} + +const core::array* CAnimatedMeshSceneNode::getCustomBones() const{ + return &CBones; +} } // end namespace scene } // end namespace irr --- Irrlicht/CAnimatedMeshSceneNode.h 2005-08-20 22:17:52.000000000 +0200 +++ Irr-Source/CAnimatedMeshSceneNode.h 2005-10-10 15:29:25.545585638 +0200 @@ -2,6 +2,8 @@ // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h +// 01.10.2005 - CustomBones - added by A. Buschhüter (Acki) A_Buschhueter@gmx.de + #ifndef __C_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__ #define __C_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__ @@ -90,6 +92,9 @@ //! Returns the current displayed frame number. virtual s32 getFrameNr(); + virtual const core::array* makeCustomBones(); + virtual const core::array* getCustomBones(); + virtual void useCustomBones(bool use); private: core::array Materials; @@ -105,6 +110,8 @@ IShadowVolumeSceneNode* Shadow; core::array JointChildSceneNodes; + bool useCBones; + core::array CBones; }; } // end namespace scene --- Irrlicht/CXAnimationPlayer.cpp 2005-08-20 22:17:52.000000000 +0200 +++ Irr-Source/CXAnimationPlayer.cpp 2005-10-10 15:29:30.545880790 +0200 @@ -2,6 +2,8 @@ // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h +// 01.10.2005 - CustomBones - added by A. Buschhüter (Acki) A_Buschhueter@gmx.de + #include "CXAnimationPlayer.h" #include "ISceneNode.h" #include "IVideoDriver.h" @@ -23,7 +25,7 @@ const c8* filename) : Reader(reader), Driver(driver), AnimatedMesh(0), Manipulator(manip), CurrentAnimationTime(0.0f), LastAnimationTime(1.0f), - CurrentAnimationSet(0), IsAnimatedSkinnedMesh(false), DebugSkeletonCrossSize(1.0f) + CurrentAnimationSet(0), IsAnimatedSkinnedMesh(false), DebugSkeletonCrossSize(1.0f), useCMBones(false) { FileName = filename; @@ -501,8 +503,17 @@ Joints[jii].WasAnimatedThisFrame = false; } + if(useCMBones){ + int cnt = Joints.size(); + for(int n = 0; n < cnt; n++){ + Joints[n].LocalAnimatedMatrix = (*CMBones)[n]; + Joints[n].WasAnimatedThisFrame = true; + } + } + SXAnimationSet& currentSet = AnimationSets[CurrentAnimationSet]; + if(!useCMBones) // go through all animation tracks for (i=0; i<(s32)currentSet.Animations.size(); ++i) { @@ -860,6 +871,18 @@ return false; } +void CXAnimationPlayer::getBones(core::array* lstBones){ + int cnt = Joints.size(); + lstBones->clear(); + for(int n = 0; n < cnt; n++){ + lstBones->push_back(Joints[n].LocalAnimatedMatrix); + } +} + +void CXAnimationPlayer::useCMeshBones(core::array* lstBones, bool use){ + useCMBones = use; + CMBones = lstBones; +} } // end namespace scene } // end namespace irr --- Irrlicht/CXAnimationPlayer.h 2005-08-20 22:17:52.000000000 +0200 +++ Irr-Source/CXAnimationPlayer.h 2005-10-10 15:29:35.316208358 +0200 @@ -2,6 +2,8 @@ // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h +// 01.10.2005 - CustomBones - added by A. Buschhüter (Acki) A_Buschhueter@gmx.de + #ifndef __C_X_ANIMATION_PLAYER_H_INCLUDED__ #define __C_X_ANIMATION_PLAYER_H_INCLUDED__ @@ -72,6 +74,8 @@ //! Sets an animation as animation to play back. virtual bool setCurrentAnimation(const c8* name); + virtual void useCMeshBones(core::array* lstBones, bool use); + virtual void getBones(core::array* lstBones); private: struct SWeightData @@ -210,6 +214,8 @@ }; core::array AnimationSets; + bool useCMBones; + core::array* CMBones; void addMatrix(core::matrix4& m1, core::matrix4& m2) { --- Irrlicht/include/IAnimatedMeshX.h 2005-08-20 22:17:44.000000000 +0200 +++ Irr-Source/Include/IAnimatedMeshX.h 2005-10-10 15:30:24.868223443 +0200 @@ -2,6 +2,8 @@ // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h +// 01.10.2005 - CustomBones - added by A. Buschhüter (Acki) A_Buschhueter@gmx.de + #ifndef __I_ANIMATED_MESH_X_H_INCLUDED__ #define __I_ANIMATED_MESH_X_H_INCLUDED__ @@ -70,6 +72,9 @@ //! \return Returns true if successful, and false if the specified animation //! does not exist. virtual bool setCurrentAnimation(const c8* name) = 0; + + virtual void useCMeshBones(core::array* lstBones, bool use); + virtual void getBones(core::array* lstBones); }; } // end namespace scene --- Irrlicht/include/IAnimatedMeshSceneNode.h 2005-08-20 22:17:44.000000000 +0200 +++ Irr-Source/Include/IAnimatedMeshSceneNode.h 2005-10-10 15:29:15.776962635 +0200 @@ -2,6 +2,8 @@ // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h +// 01.10.2005 - CustomBones - added by A. Buschhüter (Acki) A_Buschhueter@gmx.de + #ifndef __I_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__ #define __I_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__ @@ -137,6 +139,9 @@ //! Please note that this will only be called when in non looped mode, //! see IAnimatedMeshSceneNode::setLoopMode(). virtual void setAnimationEndCallback(IAnimationEndCallBack* callback=0) = 0; + virtual const core::array* makeCustomBones() = 0; + virtual const core::array* getCustomBones() = 0; + virtual const void useCustomBones(bool use) = 0; }; } // end namespace scene