1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
2 // This file is part of the "Irrlicht Engine".
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
4 
5 #ifndef __I_BONE_SCENE_NODE_H_INCLUDED__
6 #define __I_BONE_SCENE_NODE_H_INCLUDED__
7 
8 #include "ISceneNode.h"
9 
10 namespace irr
11 {
12 namespace scene
13 {
14 
15 	//! Enumeration for different bone animation modes
16 	enum E_BONE_ANIMATION_MODE
17 	{
18 		//! The bone is usually animated, unless it's parent is not animated
19 		EBAM_AUTOMATIC=0,
20 
21 		//! The bone is animated by the skin, if it's parent is not animated then animation will resume from this bone onward
22 		EBAM_ANIMATED,
23 
24 		//! The bone is not animated by the skin
25 		EBAM_UNANIMATED,
26 
27 		//! Not an animation mode, just here to count the available modes
28 		EBAM_COUNT
29 
30 	};
31 
32 	enum E_BONE_SKINNING_SPACE
33 	{
34 		//! local skinning, standard
35 		EBSS_LOCAL=0,
36 
37 		//! global skinning
38 		EBSS_GLOBAL,
39 
40 		EBSS_COUNT
41 	};
42 
43 	//! Names for bone animation modes
44 	const c8* const BoneAnimationModeNames[] =
45 	{
46 		"automatic",
47 		"animated",
48 		"unanimated",
49 		0,
50 	};
51 
52 
53 	//! Interface for bones used for skeletal animation.
54 	/** Used with ISkinnedMesh and IAnimatedMeshSceneNode. */
55 	class IBoneSceneNode : public ISceneNode
56 	{
57 	public:
58 
59 		IBoneSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id=-1) :
ISceneNode(parent,mgr,id)60 			ISceneNode(parent, mgr, id),positionHint(-1),scaleHint(-1),rotationHint(-1) { }
61 
62 		//! Get the name of the bone
63 		/** \deprecated Use getName instead. This method may be removed by Irrlicht 1.9 */
getBoneName()64 		_IRR_DEPRECATED_ virtual const c8* getBoneName() const { return getName(); }
65 
66 		//! Get the index of the bone
67 		virtual u32 getBoneIndex() const = 0;
68 
69 		//! Sets the animation mode of the bone.
70 		/** \return True if successful. (Unused) */
71 		virtual bool setAnimationMode(E_BONE_ANIMATION_MODE mode) = 0;
72 
73 		//! Gets the current animation mode of the bone
74 		virtual E_BONE_ANIMATION_MODE getAnimationMode() const = 0;
75 
76 		//! Get the axis aligned bounding box of this node
77 		virtual const core::aabbox3d<f32>& getBoundingBox() const = 0;
78 
79 		//! Returns the relative transformation of the scene node.
80 		//virtual core::matrix4 getRelativeTransformation() const = 0;
81 
82 		//! The animation method.
83 		virtual void OnAnimate(u32 timeMs) =0;
84 
85 		//! The render method.
86 		/** Does nothing as bones are not visible. */
render()87 		virtual void render() { }
88 
89 		//! How the relative transformation of the bone is used
90 		virtual void setSkinningSpace( E_BONE_SKINNING_SPACE space ) =0;
91 
92 		//! How the relative transformation of the bone is used
93 		virtual E_BONE_SKINNING_SPACE getSkinningSpace() const =0;
94 
95 		//! Updates the absolute position based on the relative and the parents position
96 		virtual void updateAbsolutePositionOfAllChildren()=0;
97 
98 		s32 positionHint;
99 		s32 scaleHint;
100 		s32 rotationHint;
101 	};
102 
103 
104 } // end namespace scene
105 } // end namespace irr
106 
107 #endif
108 
109