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