Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_ANIMATION_SKELETON_H__
00009 #define __SP_ANIMATION_SKELETON_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013 #include "SceneGraph/spSceneMesh.hpp"
00014 #include "SceneGraph/Animation/spAnimationJoint.hpp"
00015 #include "SceneGraph/Animation/spAnimationBaseStructures.hpp"
00016
00017 #include <vector>
00018
00019
00020 namespace sp
00021 {
00022 namespace scene
00023 {
00024
00025
00030 class SP_EXPORT AnimationSkeleton
00031 {
00032
00033 public:
00034
00035 AnimationSkeleton();
00036 virtual ~AnimationSkeleton();
00037
00038
00039
00047 AnimationJoint* createJoint(
00048 const Transformation &OriginTransform, const io::stringc &Name = "", AnimationJoint* Parent = 0
00049 );
00050
00052 void deleteJoint(AnimationJoint* Joint);
00053
00055 AnimationJoint* findJoint(const io::stringc &Name);
00056
00063 void setJointParent(AnimationJoint* Joint, AnimationJoint* Parent);
00064
00069 void updateSkeleton();
00070
00078 void transformVertices(Mesh* MeshObj) const;
00079
00090 void fillJointTransformations(std::vector<dim::matrix4f> &JointMatrices, bool KeepJointOrder = true) const;
00091
00133 bool setupVertexBufferAttributes(
00134 Mesh* MeshObj,
00135 const std::vector<video::SVertexAttribute> &IndexAttributes,
00136 const std::vector<video::SVertexAttribute> &WeightAttributes
00137 ) const;
00138
00145 virtual void render(const dim::matrix4f &BaseMatrix, const video::color &Color = video::color(255, 255, 0));
00146
00147
00148
00150 inline const std::list<AnimationJoint*>& getJointList() const
00151 {
00152 return Joints_;
00153 }
00155 inline u32 getJointCount() const
00156 {
00157 return Joints_.size();
00158 }
00159
00161 inline const std::vector<AnimationJoint*>& getRootJointList() const
00162 {
00163 return RootJoints_;
00164 }
00166 inline u32 getRootJointCount() const
00167 {
00168 return RootJoints_.size();
00169 }
00170
00171 protected:
00172
00173
00174
00175 virtual void drawJointConnections(
00176 AnimationJoint* Joint, dim::matrix4f BaseMatrix, const video::color &Color
00177 );
00178 virtual void drawJointConnector(const dim::matrix4f &Matrix, const video::color &Color);
00179
00180 private:
00181
00182
00183
00184 bool checkAttributeListForHWAnim(
00185 const std::vector<video::SVertexAttribute> &Attributes, const io::stringc &Name
00186 ) const;
00187
00188 void fillSubJointTransformations(
00189 AnimationJoint* Joint, dim::matrix4f BaseMatrix,
00190 std::vector<dim::matrix4f> &JointMatrices, u32 &Index
00191 ) const;
00192
00193
00194
00195 std::vector<AnimationJoint*> RootJoints_;
00196 std::list<AnimationJoint*> Joints_;
00197
00198
00199
00200 };
00201
00202
00203 }
00204
00205 }
00206
00207
00208 #endif
00209
00210
00211
00212