summaryrefslogtreecommitdiffstats
path: root/src/animation/AnimBlendSequence.h
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-12-18 23:46:51 +0100
committeraap <aap@papnet.eu>2020-12-18 23:46:51 +0100
commit9982f1f21bca3bb51ac7d31cede606beef5c0f67 (patch)
tree853255a2c6fb8765f8ec6f83cccf872b35d43a05 /src/animation/AnimBlendSequence.h
parentsilly mistake (diff)
downloadre3-9982f1f21bca3bb51ac7d31cede606beef5c0f67.tar
re3-9982f1f21bca3bb51ac7d31cede606beef5c0f67.tar.gz
re3-9982f1f21bca3bb51ac7d31cede606beef5c0f67.tar.bz2
re3-9982f1f21bca3bb51ac7d31cede606beef5c0f67.tar.lz
re3-9982f1f21bca3bb51ac7d31cede606beef5c0f67.tar.xz
re3-9982f1f21bca3bb51ac7d31cede606beef5c0f67.tar.zst
re3-9982f1f21bca3bb51ac7d31cede606beef5c0f67.zip
Diffstat (limited to '')
-rw-r--r--src/animation/AnimBlendSequence.h50
1 files changed, 43 insertions, 7 deletions
diff --git a/src/animation/AnimBlendSequence.h b/src/animation/AnimBlendSequence.h
index 4dce3b13..b370c5c6 100644
--- a/src/animation/AnimBlendSequence.h
+++ b/src/animation/AnimBlendSequence.h
@@ -12,6 +12,43 @@ struct KeyFrameTrans : KeyFrame {
CVector translation;
};
+struct KeyFrameCompressed {
+ int16 rot[4]; // 4096
+ int16 deltaTime; // 60
+
+ void GetRotation(CQuaternion *quat){
+ float scale = 1.0f/4096.0f;
+ quat->x = rot[0]*scale;
+ quat->y = rot[1]*scale;
+ quat->z = rot[2]*scale;
+ quat->w = rot[3]*scale;
+ }
+ void SetRotation(const CQuaternion &quat){
+ rot[0] = quat.x * 4096.0f;
+ rot[1] = quat.y * 4096.0f;
+ rot[2] = quat.z * 4096.0f;
+ rot[3] = quat.w * 4096.0f;
+ }
+ float GetDeltaTime(void) { return deltaTime/60.0f; }
+ void SetTime(float t) { deltaTime = t*60.0f + 0.5f; }
+};
+
+struct KeyFrameTransCompressed : KeyFrameCompressed {
+ int16 trans[3]; // 1024
+
+ void GetTranslation(CVector *vec) {
+ float scale = 1.0f/1024.0f;
+ vec->x = trans[0]*scale;
+ vec->y = trans[1]*scale;
+ vec->z = trans[2]*scale;
+ }
+ void SetTranslation(const CVector &vec){
+ trans[0] = vec.x*1024.0f;
+ trans[1] = vec.y*1024.0f;
+ trans[2] = vec.z*1024.0f;
+ }
+};
+
// The sequence of key frames of one animated node
class CAnimBlendSequence
@@ -38,16 +75,15 @@ public:
&((KeyFrameTrans*)keyFrames)[n] :
&((KeyFrame*)keyFrames)[n];
}
- KeyFrame *GetKeyFrameCompressed(int n) {
+ KeyFrameCompressed *GetKeyFrameCompressed(int n) {
return type & KF_TRANS ?
- &((KeyFrameTrans*)keyFramesCompressed)[n] :
- &((KeyFrame*)keyFramesCompressed)[n];
+ &((KeyFrameTransCompressed*)keyFramesCompressed)[n] :
+ &((KeyFrameCompressed*)keyFramesCompressed)[n];
}
bool HasTranslation(void) { return !!(type & KF_TRANS); }
- // TODO? these are unused
-// void Uncompress(void);
-// void CompressKeyframes(void);
-// void RemoveUncompressedData(void);
+ void Uncompress(void);
+ void CompressKeyframes(void);
+ void RemoveUncompressedData(void);
void SetBoneTag(int tag) { boneTag = tag; }
};