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