]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CBoneSceneNode.cpp
Drop obsolete configuration macros
[irrlicht.git] / source / Irrlicht / CBoneSceneNode.cpp
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #include "IrrCompileConfig.h"\r
6 #include "CBoneSceneNode.h"\r
7 \r
8 namespace irr\r
9 {\r
10 namespace scene\r
11 {\r
12 \r
13 //! constructor\r
14 CBoneSceneNode::CBoneSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,\r
15         u32 boneIndex, const c8* boneName)\r
16 : IBoneSceneNode(parent, mgr, id), BoneIndex(boneIndex),\r
17         AnimationMode(EBAM_AUTOMATIC), SkinningSpace(EBSS_LOCAL)\r
18 {\r
19         #ifdef _DEBUG\r
20         setDebugName("CBoneSceneNode");\r
21         #endif\r
22         setName(boneName);\r
23 }\r
24 \r
25 \r
26 //! Returns the index of the bone\r
27 u32 CBoneSceneNode::getBoneIndex() const\r
28 {\r
29         return BoneIndex;\r
30 }\r
31 \r
32 \r
33 //! Sets the animation mode of the bone. Returns true if successful.\r
34 bool CBoneSceneNode::setAnimationMode(E_BONE_ANIMATION_MODE mode)\r
35 {\r
36         AnimationMode = mode;\r
37         return true;\r
38 }\r
39 \r
40 \r
41 //! Gets the current animation mode of the bone\r
42 E_BONE_ANIMATION_MODE CBoneSceneNode::getAnimationMode() const\r
43 {\r
44         return AnimationMode;\r
45 }\r
46 \r
47 \r
48 //! returns the axis aligned bounding box of this node\r
49 const core::aabbox3d<f32>& CBoneSceneNode::getBoundingBox() const\r
50 {\r
51         return Box;\r
52 }\r
53 \r
54 \r
55 /*\r
56 //! Returns the relative transformation of the scene node.\r
57 core::matrix4 CBoneSceneNode::getRelativeTransformation() const\r
58 {\r
59         return core::matrix4(); // RelativeTransformation;\r
60 }\r
61 */\r
62 \r
63 \r
64 void CBoneSceneNode::OnAnimate(u32 timeMs)\r
65 {\r
66         if (IsVisible)\r
67         {\r
68                 // update absolute position\r
69                 //updateAbsolutePosition();\r
70 \r
71                 // perform the post render process on all children\r
72                 ISceneNodeList::iterator it = Children.begin();\r
73                 for (; it != Children.end(); ++it)\r
74                         (*it)->OnAnimate(timeMs);\r
75         }\r
76 }\r
77 \r
78 \r
79 void CBoneSceneNode::helper_updateAbsolutePositionOfAllChildren(ISceneNode *Node)\r
80 {\r
81         Node->updateAbsolutePosition();\r
82 \r
83         ISceneNodeList::const_iterator it = Node->getChildren().begin();\r
84         for (; it != Node->getChildren().end(); ++it)\r
85         {\r
86                 helper_updateAbsolutePositionOfAllChildren( (*it) );\r
87         }\r
88 }\r
89 \r
90 \r
91 void CBoneSceneNode::updateAbsolutePositionOfAllChildren()\r
92 {\r
93         helper_updateAbsolutePositionOfAllChildren( this );\r
94 }\r
95 \r
96 \r
97 } // namespace scene\r
98 } // namespace irr\r