Implement LegoAnim::CreateLocalTransform (#657)

* Implement LegoAnim::CreateLocalTransform

* Match Matrix4::Scale
This commit is contained in:
Christian Semmler
2024-03-11 15:15:18 -04:00
committed by GitHub
parent 6dfee432ea
commit 7659db49e7
4 changed files with 260 additions and 21 deletions

View File

@@ -15,10 +15,13 @@ public:
LegoAnimKey();
LegoResult Read(LegoStorage* p_storage);
LegoFloat GetTime() { return m_time; }
void SetTime(LegoFloat p_time) { m_time = p_time; }
LegoU32 TestBit1() { return m_flags & c_bit1; }
protected:
undefined m_unk0x00; // 0x00
float m_unk0x04; // 0x04
LegoU8 m_flags; // 0x00
LegoFloat m_time; // 0x04
};
// SIZE 0x14
@@ -26,6 +29,12 @@ class LegoTranslationKey : public LegoAnimKey {
public:
LegoTranslationKey();
LegoResult Read(LegoStorage* p_storage);
LegoFloat GetX() { return m_x; }
void SetX(LegoFloat p_x) { m_x = p_x; }
LegoFloat GetY() { return m_y; }
void SetY(LegoFloat p_y) { m_y = p_y; }
LegoFloat GetZ() { return m_z; }
void SetZ(LegoFloat p_z) { m_z = p_z; }
protected:
LegoFloat m_x; // 0x08
@@ -51,6 +60,12 @@ class LegoScaleKey : public LegoAnimKey {
public:
LegoScaleKey();
LegoResult Read(LegoStorage* p_storage);
LegoFloat GetX() { return m_x; }
void SetX(LegoFloat p_x) { m_x = p_x; }
LegoFloat GetY() { return m_y; }
void SetY(LegoFloat p_y) { m_y = p_y; }
LegoFloat GetZ() { return m_z; }
void SetZ(LegoFloat p_z) { m_z = p_z; }
protected:
LegoFloat m_x; // 0x08
@@ -87,14 +102,62 @@ public:
LegoResult Read(LegoStorage* p_storage) override; // vtable+0x04
LegoResult Write(LegoStorage* p_storage) override; // vtable+0x08
LegoResult FUN_100a03c0(LegoFloat p_time, Matrix4& p_matrix);
LegoResult CreateLocalTransform(LegoFloat p_time, Matrix4& p_matrix);
LegoBool FUN_100a0990(LegoFloat p_time);
const LegoChar* GetName() { return m_name; }
LegoU32 GetTranslationIndex() { return m_translationIndex; }
LegoU32 GetRotationIndex() { return m_rotationIndex; }
LegoU32 GetScaleIndex() { return m_scaleIndex; }
LegoResult FUN_100a03c0(LegoTime p_time, Matrix4& p_matrix) { return FUN_100a03c0((LegoFloat) p_time, p_matrix); }
void SetTranslationIndex(LegoU32 p_translationIndex) { m_translationIndex = p_translationIndex; }
void SetRotationIndex(LegoU32 p_rotationIndex) { m_rotationIndex = p_rotationIndex; }
void SetScaleIndex(LegoU32 p_scaleIndex) { m_scaleIndex = p_scaleIndex; }
LegoResult CreateLocalTransform(LegoTime p_time, Matrix4& p_matrix)
{
return CreateLocalTransform((LegoFloat) p_time, p_matrix);
}
LegoBool FUN_100a0990(LegoTime p_time) { return FUN_100a0990((LegoFloat) p_time); }
inline static void GetTranslation(
LegoU32 p_numTranslationKeys,
LegoTranslationKey* p_translationKeys,
LegoFloat p_time,
Matrix4& p_matrix,
LegoU32& p_old_index
);
/*inline*/ static void GetRotation(
LegoU32 p_numRotationKeys,
LegoRotationKey* p_rotationKeys,
LegoFloat p_time,
Matrix4& p_matrix,
LegoU32& p_old_index
);
inline static void GetScale(
LegoU32 p_numScaleKeys,
LegoScaleKey* p_scaleKeys,
LegoFloat p_time,
Matrix4& p_matrix,
LegoU32& p_old_index
);
inline static LegoFloat Interpolate(
LegoFloat p_time,
LegoAnimKey& p_key1,
LegoFloat p_value1,
LegoAnimKey& p_key2,
LegoFloat p_value2
);
static LegoU32 FindKeys(
LegoFloat p_time,
LegoU32 p_numKeys,
LegoAnimKey* p_keys,
LegoU32 p_size,
LegoU32& p_new_index,
LegoU32& p_old_index
);
// SYNTHETIC: LEGO1 0x1009fd80
// LegoAnimNodeData::`scalar deleting destructor'
@@ -110,9 +173,9 @@ protected:
LegoMorphKey* m_morphKeys; // 0x1c
undefined2 m_unk0x20; // 0x20
undefined2 m_unk0x22; // 0x22
undefined4 m_unk0x24; // 0x24
undefined4 m_unk0x28; // 0x28
undefined4 m_unk0x2c; // 0x2c
LegoU32 m_translationIndex; // 0x24
LegoU32 m_rotationIndex; // 0x28
LegoU32 m_scaleIndex; // 0x2c
undefined4 m_unk0x30; // 0x30
};