| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
- #pragma once
- #include "BsCorePrerequisites.h"
- #include "BsIReflectable.h"
- #include "BsMatrix4.h"
- namespace BansheeEngine
- {
- /** @addtogroup Animation-Internal
- * @{
- */
- struct BONE_DESC
- {
- String name;
- UINT32 parent;
- Matrix4 invBindPose;
- };
- struct ANIMATION_STATE_DESC
- {
- const AnimationClip* clip;
- float weight;
- float speed;
- bool loop;
- UINT8 layer;
- };
- struct SkeletonPose
- {
- SkeletonPose(UINT32 numBones)
- :numBones(numBones), bonePoses(bs_newN<Matrix4>(numBones))
- {}
- ~SkeletonPose()
- {
- bs_deleteN(bonePoses, numBones);
- }
- Matrix4* bonePoses;
- UINT32 numBones;
- };
- struct SkeletonBoneInfo
- {
- String name;
- UINT32 parent;
- };
- class BS_CORE_EXPORT Skeleton : public IReflectable // Note: Must be immutable in order to be usable on multiple threads
- {
- public:
- ~Skeleton();
- void getPose(SkeletonPose& pose, const AnimationClip& clip, float time, bool loop = true);
- void getPose(SkeletonPose& pose, const ANIMATION_STATE_DESC* states, UINT32 numStates, float time);
- static SPtr<Skeleton> create(BONE_DESC* bones, UINT32 numBones);
- private:
- Skeleton();
- Skeleton(BONE_DESC* bones, UINT32 numBones);
- UINT32 mNumBones;
- Matrix4* mBindPoses;
- SkeletonBoneInfo* mBoneInfo;
- /************************************************************************/
- /* SERIALIZATION */
- /************************************************************************/
- public:
- friend class SkeletonRTTI;
- static RTTITypeBase* getRTTIStatic();
- RTTITypeBase* getRTTI() const override;
- /**
- * Creates a Skeleton with no data. You must populate its data manually.
- *
- * @note For serialization use only.
- */
- static SPtr<Skeleton> createEmpty();
- };
- /** @} */
- }
|