Merge pull request #294 from lioncash/cseg

CSegStatementSet: Minor changes
This commit is contained in:
Luke Street 2020-04-02 02:32:00 -04:00 committed by GitHub
commit ca6b3dd3f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 6 deletions

View File

@ -18,7 +18,7 @@ void CAdditiveAnimPlayback::AddToSegStatementSet(const CSegIdList& list, const C
CSegStatementSet stackSet;
x8_anim->VGetSegStatementSet(list, stackSet);
for (const CSegId& id : list.GetList()) {
CAnimPerSegmentData& data = stackSet.x4_segData[id];
CAnimPerSegmentData& data = stackSet[id];
data.x10_offset = layout.GetFromParentUnrotated(id);
data.x1c_hasOffset = true;
}

View File

@ -133,7 +133,7 @@ void CAnimSource::GetSegStatementSet(const CSegIdList& list, CSegStatementSet& s
zeus::CQuaternion quatA(frameDataA[0], frameDataA[1], frameDataA[2], frameDataA[3]);
zeus::CQuaternion quatB(frameDataB[0], frameDataB[1], frameDataB[2], frameDataB[3]);
set.x4_segData[id].x0_rotation = zeus::CQuaternion::slerp(quatA, quatB, t);
set[id].x0_rotation = zeus::CQuaternion::slerp(quatA, quatB, t);
u8 transIdx = x30_translationChannels[rotIdx];
if (transIdx != 0xff) {
@ -142,8 +142,8 @@ void CAnimSource::GetSegStatementSet(const CSegIdList& list, CSegStatementSet& s
&x40_data.x0_storage[(frameIdx - 1) * floatsPerFrame + rotFloatsPerFrame + transIdx * 3];
zeus::CVector3f vecA(frameDataA[0], frameDataA[1], frameDataA[2]);
zeus::CVector3f vecB(frameDataB[0], frameDataB[1], frameDataB[2]);
set.x4_segData[id].x10_offset = zeus::CVector3f::lerp(vecA, vecB, t);
set.x4_segData[id].x1c_hasOffset = true;
set[id].x10_offset = zeus::CVector3f::lerp(vecA, vecB, t);
set[id].x1c_hasOffset = true;
}
}
}

View File

@ -1,5 +1,7 @@
#pragma once
#include <array>
#include "Runtime/Character/CAnimPerSegmentData.hpp"
#include "Runtime/Character/CSegId.hpp"
@ -8,10 +10,12 @@ class CCharLayoutInfo;
class CSegIdList;
class CSegStatementSet {
public:
private:
/* Used to be a pointer to arbitrary subclass-provided storage,
* now it's a self-stored array */
CAnimPerSegmentData x4_segData[100];
std::array<CAnimPerSegmentData, 100> x4_segData;
public:
void Add(const CSegIdList& list, const CCharLayoutInfo& layout, const CSegStatementSet& other, float weight);
CAnimPerSegmentData& operator[](const CSegId& idx) { return x4_segData[idx]; }