Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_ANIMATION_BONE_H__
00009 #define __SP_ANIMATION_BONE_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013 #include "Base/spInputOutputString.hpp"
00014 #include "Base/spDimension.hpp"
00015 #include "Base/spMemoryManagement.hpp"
00016 #include "SceneGraph/spSceneMesh.hpp"
00017 #include "Base/spTransformation3D.hpp"
00018 #include "SceneGraph/Animation/spAnimationBaseStructures.hpp"
00019
00020 #include <vector>
00021
00022
00023 namespace sp
00024 {
00025 namespace scene
00026 {
00027
00028
00029 class AnimationSkeleton;
00030
00031
00037 class SP_EXPORT AnimationJoint : public BaseObject
00038 {
00039
00040 public:
00041
00042 AnimationJoint(
00043 const Transformation &OriginTransform, const io::stringc Name = ""
00044 );
00045 virtual ~AnimationJoint();
00046
00047
00048
00050 virtual dim::matrix4f getGlobalTransformation() const;
00052 virtual dim::matrix4f getVertexTransformation() const;
00053
00054
00055
00061 inline void setEnable(bool Enable)
00062 {
00063 isEnable_ = Enable;
00064 }
00065 inline bool getEnable() const
00066 {
00067 return isEnable_;
00068 }
00069
00071 inline AnimationJoint* getParent() const
00072 {
00073 return Parent_;
00074 }
00075
00077 inline void setVertexGroups(const std::vector<SVertexGroup> &VertexGroups)
00078 {
00079 VertexGroups_ = VertexGroups;
00080 }
00081
00082 inline const std::vector<SVertexGroup>& getVertexGroups() const
00083 {
00084 return VertexGroups_;
00085 }
00086 inline std::vector<SVertexGroup>& getVertexGroups()
00087 {
00088 return VertexGroups_;
00089 }
00090
00092 inline void setOriginTransformation(const Transformation &Transform)
00093 {
00094 OriginTransform_ = Transform;
00095 }
00096 inline Transformation getOriginTransformation() const
00097 {
00098 return OriginTransform_;
00099 }
00100
00102 inline void setTransformation(const Transformation &Transform)
00103 {
00104 Transform_ = Transform;
00105 }
00106 inline const Transformation& getTransformation() const
00107 {
00108 return Transform_;
00109 }
00110 inline Transformation& getTransformation()
00111 {
00112 return Transform_;
00113 }
00114
00116 inline dim::matrix4f getOriginMatrix() const
00117 {
00118 return OriginMatrix_;
00119 }
00120
00122 inline const std::vector<AnimationJoint*>& getChildren() const
00123 {
00124 return Children_;
00125 }
00126
00127 protected:
00128
00129 friend class AnimationSkeleton;
00130
00131
00132
00142 void transformVertices(scene::Mesh* MeshObj, dim::matrix4f BaseMatrix, bool useTangentSpace) const;
00143
00144 bool checkParentIncest(AnimationJoint* Joint) const;
00145
00146
00147
00148 inline void setParent(AnimationJoint* Parent)
00149 {
00150 Parent_ = Parent;
00151 }
00152
00153 inline void addChild(AnimationJoint* Child)
00154 {
00155 Children_.push_back(Child);
00156 }
00157 inline void removeChild(AnimationJoint* Child)
00158 {
00159 MemoryManager::removeElement(Children_, Child);
00160 }
00161
00162 private:
00163
00164
00165
00166 bool isEnable_;
00167
00168 AnimationJoint* Parent_;
00169 std::vector<AnimationJoint*> Children_;
00170
00171 Transformation OriginTransform_;
00172 Transformation Transform_;
00173
00174 dim::matrix4f OriginMatrix_;
00175
00176 std::vector<SVertexGroup> VertexGroups_;
00177
00178 };
00179
00180
00181 }
00182
00183 }
00184
00185
00186 #endif
00187
00188
00189
00190