mirror of https://github.com/AxioDL/metaforce.git
ANIM3 Bitstream reader fixes
This commit is contained in:
parent
d8b141bcfa
commit
529223e311
|
@ -21,6 +21,7 @@ void CFBStreamedAnimReaderTotals::Allocate(u32 chanCount)
|
||||||
|
|
||||||
void CFBStreamedAnimReaderTotals::Initialize(const CFBStreamedCompression& source)
|
void CFBStreamedAnimReaderTotals::Initialize(const CFBStreamedCompression& source)
|
||||||
{
|
{
|
||||||
|
x1c_curKey = 0;
|
||||||
x20_calculated = false;
|
x20_calculated = false;
|
||||||
const u8* chans = source.GetPerChannelHeaders();
|
const u8* chans = source.GetPerChannelHeaders();
|
||||||
u32 boneChanCount = *reinterpret_cast<const u32*>(chans);
|
u32 boneChanCount = *reinterpret_cast<const u32*>(chans);
|
||||||
|
@ -245,6 +246,7 @@ void CFBStreamedPairOfTotals::SetTime(CBitLevelLoader& loader, const CCharAnimTi
|
||||||
if (prior != -1 && prior < Prior().x1c_curKey)
|
if (prior != -1 && prior < Prior().x1c_curKey)
|
||||||
{
|
{
|
||||||
Prior().Initialize(*x0_source);
|
Prior().Initialize(*x0_source);
|
||||||
|
Next().Initialize(*x0_source);
|
||||||
loader.Reset();
|
loader.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,8 +262,8 @@ void CFBStreamedPairOfTotals::SetTime(CBitLevelLoader& loader, const CCharAnimTi
|
||||||
|
|
||||||
void CFBStreamedPairOfTotals::DoIncrement(CBitLevelLoader& loader)
|
void CFBStreamedPairOfTotals::DoIncrement(CBitLevelLoader& loader)
|
||||||
{
|
{
|
||||||
Prior().IncrementInto(loader, *x0_source, Next());
|
|
||||||
x10_nextSel ^= 1;
|
x10_nextSel ^= 1;
|
||||||
|
Prior().IncrementInto(loader, *x0_source, Next());
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 CBitLevelLoader::LoadUnsigned(u8 q)
|
u32 CBitLevelLoader::LoadUnsigned(u8 q)
|
||||||
|
|
|
@ -80,6 +80,7 @@ public:
|
||||||
u32 LoadUnsigned(u8 q);
|
u32 LoadUnsigned(u8 q);
|
||||||
s32 LoadSigned(u8 q);
|
s32 LoadSigned(u8 q);
|
||||||
bool LoadBool();
|
bool LoadBool();
|
||||||
|
size_t GetCurBit() const { return m_bitIdx; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class CSegIdToIndexConverter
|
class CSegIdToIndexConverter
|
||||||
|
|
|
@ -182,6 +182,7 @@ u32 CFBStreamedCompression::ComputeBitstreamWords(const u8* chans)
|
||||||
for (u32 c=0 ; c<boneChanCount ; ++c)
|
for (u32 c=0 ; c<boneChanCount ; ++c)
|
||||||
{
|
{
|
||||||
chans += 0x8;
|
chans += 0x8;
|
||||||
|
totalBits += 1;
|
||||||
totalBits += *reinterpret_cast<const u32*>(chans) & 0xff;
|
totalBits += *reinterpret_cast<const u32*>(chans) & 0xff;
|
||||||
totalBits += *reinterpret_cast<const u32*>(chans + 0x4) & 0xff;
|
totalBits += *reinterpret_cast<const u32*>(chans + 0x4) & 0xff;
|
||||||
totalBits += *reinterpret_cast<const u32*>(chans + 0x8) & 0xff;
|
totalBits += *reinterpret_cast<const u32*>(chans + 0x8) & 0xff;
|
||||||
|
@ -202,6 +203,7 @@ u32 CFBStreamedCompression::ComputeBitstreamWords(const u8* chans)
|
||||||
for (u32 c=0 ; c<boneChanCount ; ++c)
|
for (u32 c=0 ; c<boneChanCount ; ++c)
|
||||||
{
|
{
|
||||||
chans += 0x6;
|
chans += 0x6;
|
||||||
|
totalBits += 1;
|
||||||
totalBits += *reinterpret_cast<const u8*>(chans + 0x2);
|
totalBits += *reinterpret_cast<const u8*>(chans + 0x2);
|
||||||
totalBits += *reinterpret_cast<const u8*>(chans + 0x5);
|
totalBits += *reinterpret_cast<const u8*>(chans + 0x5);
|
||||||
totalBits += *reinterpret_cast<const u8*>(chans + 0x8);
|
totalBits += *reinterpret_cast<const u8*>(chans + 0x8);
|
||||||
|
|
|
@ -87,14 +87,6 @@ class CModelData
|
||||||
std::unique_ptr<CBooModel> m_xrayModelInst;
|
std::unique_ptr<CBooModel> m_xrayModelInst;
|
||||||
std::unique_ptr<CBooModel> m_infraModelInst;
|
std::unique_ptr<CBooModel> m_infraModelInst;
|
||||||
|
|
||||||
struct WeakModelInsts
|
|
||||||
{
|
|
||||||
std::weak_ptr<CBooModel> m_normalModelInst;
|
|
||||||
std::weak_ptr<CBooModel> m_xrayModelInst;
|
|
||||||
std::weak_ptr<CBooModel> m_infraModelInst;
|
|
||||||
};
|
|
||||||
std::vector<WeakModelInsts> m_weakInsts;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class EWhichModel
|
enum class EWhichModel
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,8 +63,11 @@ void CPoseAsTransforms::Insert(const CSegId& id,
|
||||||
Transform& xfOut = xd0_transformArr[x0_nextId];
|
Transform& xfOut = xd0_transformArr[x0_nextId];
|
||||||
xfOut.m_originToAccum = zeus::CTransform(rotation, offset);
|
xfOut.m_originToAccum = zeus::CTransform(rotation, offset);
|
||||||
xfOut.m_restPoseToAccum = xfOut.m_originToAccum * zeus::CTransform::Translate(-restOffset);
|
xfOut.m_restPoseToAccum = xfOut.m_originToAccum * zeus::CTransform::Translate(-restOffset);
|
||||||
printf("INSBONE %d\n", int(id));
|
//if (id == 4)
|
||||||
xfOut.m_originToAccum.printMatrix();
|
//{
|
||||||
|
// printf("INSBONE %d\n", int(id));
|
||||||
|
// xfOut.m_originToAccum.printMatrix();
|
||||||
|
//}
|
||||||
|
|
||||||
std::pair<CSegId, CSegId>& link = x8_links[id];
|
std::pair<CSegId, CSegId>& link = x8_links[id];
|
||||||
link.first = xd4_lastInserted;
|
link.first = xd4_lastInserted;
|
||||||
|
|
Loading…
Reference in New Issue