Merge pull request #22 from lioncash/anim2

CAnimation: Minor clean up
This commit is contained in:
LC 2020-06-11 10:52:59 -04:00 committed by GitHub
commit 8babcc13bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 24 deletions

View File

@ -6,16 +6,7 @@
CAnimation::CAnimation(CResourceEntry *pEntry /*= 0*/)
: CResource(pEntry)
, mDuration(0.f)
, mTickInterval(0.0333333f)
, mNumKeys(0)
{
for (uint32 iBone = 0; iBone < 100; iBone++)
{
mBoneInfo[iBone].TranslationChannelIdx = 0xFF;
mBoneInfo[iBone].RotationChannelIdx = 0xFF;
mBoneInfo[iBone].ScaleChannelIdx = 0xFF;
}
}
CDependencyTree* CAnimation::BuildDependencyTree() const

View File

@ -6,6 +6,7 @@
#include "Core/Resource/Animation/CAnimEventData.h"
#include <Common/Math/CQuaternion.h>
#include <Common/Math/CVector3f.h>
#include <array>
#include <vector>
class CAnimation : public CResource
@ -13,13 +14,13 @@ class CAnimation : public CResource
DECLARE_RESOURCE_TYPE(Animation)
friend class CAnimationLoader;
typedef std::vector<CVector3f> TScaleChannel;
typedef std::vector<CQuaternion> TRotationChannel;
typedef std::vector<CVector3f> TTranslationChannel;
using TScaleChannel = std::vector<CVector3f>;
using TRotationChannel = std::vector<CQuaternion>;
using TTranslationChannel = std::vector<CVector3f>;
float mDuration;
float mTickInterval;
uint32 mNumKeys;
float mDuration = 0.0f;
float mTickInterval = 0.0333333f;
uint32 mNumKeys = 0;
std::vector<TScaleChannel> mScaleChannels;
std::vector<TRotationChannel> mRotationChannels;
@ -27,24 +28,24 @@ class CAnimation : public CResource
struct SBoneChannelInfo
{
uint8 ScaleChannelIdx;
uint8 RotationChannelIdx;
uint8 TranslationChannelIdx;
uint8 ScaleChannelIdx = 0xFF;
uint8 RotationChannelIdx = 0xFF;
uint8 TranslationChannelIdx = 0xFF;
};
SBoneChannelInfo mBoneInfo[100];
std::array<SBoneChannelInfo, 100> mBoneInfo;
TResPtr<CAnimEventData> mpEventData;
public:
CAnimation(CResourceEntry *pEntry = 0);
CDependencyTree* BuildDependencyTree() const;
CDependencyTree* BuildDependencyTree() const override;
void EvaluateTransform(float Time, uint32 BoneID, CVector3f *pOutTranslation, CQuaternion *pOutRotation, CVector3f *pOutScale) const;
bool HasTranslation(uint32 BoneID) const;
inline float Duration() const { return mDuration; }
inline uint32 NumKeys() const { return mNumKeys; }
inline float TickInterval() const { return mTickInterval; }
inline CAnimEventData* EventData() const { return mpEventData; }
float Duration() const { return mDuration; }
uint32 NumKeys() const { return mNumKeys; }
float TickInterval() const { return mTickInterval; }
CAnimEventData* EventData() const { return mpEventData; }
};
#endif // CANIMATION_H