From e7ed4d009636804d5dbe05aae9e7ab23b80fdd37 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 11 Jun 2019 08:59:28 +0200 Subject: added animation system (with skin support for now) --- src/animation/AnimBlendSequence.h | 55 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/animation/AnimBlendSequence.h (limited to 'src/animation/AnimBlendSequence.h') diff --git a/src/animation/AnimBlendSequence.h b/src/animation/AnimBlendSequence.h new file mode 100644 index 00000000..7538cf56 --- /dev/null +++ b/src/animation/AnimBlendSequence.h @@ -0,0 +1,55 @@ +#pragma once + +#include "math/Quaternion.h" + +// TODO: put them somewhere else? +struct KeyFrame { + CQuaternion rotation; + float deltaTime; // relative to previous key frame +}; + +struct KeyFrameTrans : KeyFrame { + CVector translation; +}; + + +// The sequence of key frames of one animated node +class CAnimBlendSequence +{ +public: + enum { + KF_ROT = 1, + KF_TRANS = 2 + }; + int32 type; + char name[24]; + int32 numFrames; +#ifdef PED_SKIN + int16 boneTag; +#endif + void *keyFrames; + void *keyFramesCompressed; + + CAnimBlendSequence(void); + virtual ~CAnimBlendSequence(void); + void SetName(char *name); + void SetNumFrames(int numFrames, bool translation); + void RemoveQuaternionFlips(void); + KeyFrame *GetKeyFrame(int n) { + return type & KF_TRANS ? + &((KeyFrameTrans*)keyFrames)[n] : + &((KeyFrame*)keyFrames)[n]; + } + bool HasTranslation(void) { return !!(type & KF_TRANS); } + // TODO? these are unused +// void Uncompress(void); +// void CompressKeyframes(void); +// void RemoveUncompressedData(void); + +#ifdef PED_SKIN + void SetBoneTag(int tag) { boneTag = tag; } +#endif +}; +#ifndef PED_SKIN +static_assert(sizeof(CAnimBlendSequence) == 0x2C, "CAnimBlendSequence: error"); +#endif -- cgit v1.2.3