mirror of https://github.com/AxioDL/metaforce.git
ANIM fixes
This commit is contained in:
parent
529223e311
commit
a81f35f3e4
|
@ -420,9 +420,9 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
|
||||||
++it)
|
++it)
|
||||||
{
|
{
|
||||||
QuantizedRot qrCur = QuantizeRotation(*it, rotDivOut);
|
QuantizedRot qrCur = QuantizeRotation(*it, rotDivOut);
|
||||||
chan.q[0] = std::max(chan.q[0], atUint8(ceilf(log2f(qrCur.v[0] - last.v[0]))));
|
chan.q[0] = std::max(chan.q[0], atUint8(qrCur.v.qFrom(last, 0)));
|
||||||
chan.q[1] = std::max(chan.q[1], atUint8(ceilf(log2f(qrCur.v[1] - last.v[1]))));
|
chan.q[1] = std::max(chan.q[1], atUint8(qrCur.v.qFrom(last, 1)));
|
||||||
chan.q[2] = std::max(chan.q[2], atUint8(ceilf(log2f(qrCur.v[2] - last.v[2]))));
|
chan.q[2] = std::max(chan.q[2], atUint8(qrCur.v.qFrom(last, 2)));
|
||||||
last = qrCur.v;
|
last = qrCur.v;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -436,9 +436,9 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
|
||||||
QuantizedValue cur = {atInt32(it->v3.vec[0] / transMultOut),
|
QuantizedValue cur = {atInt32(it->v3.vec[0] / transMultOut),
|
||||||
atInt32(it->v3.vec[1] / transMultOut),
|
atInt32(it->v3.vec[1] / transMultOut),
|
||||||
atInt32(it->v3.vec[2] / transMultOut)};
|
atInt32(it->v3.vec[2] / transMultOut)};
|
||||||
chan.q[0] = std::max(chan.q[0], atUint8(ceilf(log2f(cur[0] - last[0]))));
|
chan.q[0] = std::max(chan.q[0], atUint8(cur.qFrom(last, 0)));
|
||||||
chan.q[1] = std::max(chan.q[1], atUint8(ceilf(log2f(cur[1] - last[1]))));
|
chan.q[1] = std::max(chan.q[1], atUint8(cur.qFrom(last, 1)));
|
||||||
chan.q[2] = std::max(chan.q[2], atUint8(ceilf(log2f(cur[2] - last[2]))));
|
chan.q[2] = std::max(chan.q[2], atUint8(cur.qFrom(last, 2)));
|
||||||
last = cur;
|
last = cur;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -452,9 +452,9 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
|
||||||
QuantizedValue cur = {atInt32(it->v3.vec[0] / scaleMultOut),
|
QuantizedValue cur = {atInt32(it->v3.vec[0] / scaleMultOut),
|
||||||
atInt32(it->v3.vec[1] / scaleMultOut),
|
atInt32(it->v3.vec[1] / scaleMultOut),
|
||||||
atInt32(it->v3.vec[2] / scaleMultOut)};
|
atInt32(it->v3.vec[2] / scaleMultOut)};
|
||||||
chan.q[0] = std::max(chan.q[0], atUint8(ceilf(log2f(cur[0] - last[0]))));
|
chan.q[0] = std::max(chan.q[0], atUint8(cur.qFrom(last, 0)));
|
||||||
chan.q[1] = std::max(chan.q[1], atUint8(ceilf(log2f(cur[1] - last[1]))));
|
chan.q[1] = std::max(chan.q[1], atUint8(cur.qFrom(last, 1)));
|
||||||
chan.q[2] = std::max(chan.q[2], atUint8(ceilf(log2f(cur[2] - last[2]))));
|
chan.q[2] = std::max(chan.q[2], atUint8(cur.qFrom(last, 2)));
|
||||||
last = cur;
|
last = cur;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -36,6 +36,14 @@ struct QuantizedValue
|
||||||
{return v[idx];}
|
{return v[idx];}
|
||||||
const atInt32& operator[] (size_t idx) const
|
const atInt32& operator[] (size_t idx) const
|
||||||
{return v[idx];}
|
{return v[idx];}
|
||||||
|
|
||||||
|
int qFrom(const QuantizedValue& other, size_t idx) const
|
||||||
|
{
|
||||||
|
atInt32 delta = std::abs(v[idx] - other.v[idx]);
|
||||||
|
if (delta == 0)
|
||||||
|
return 1;
|
||||||
|
return int(ceilf(log2f(delta))) + 1;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
struct QuantizedRot
|
struct QuantizedRot
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,11 +63,6 @@ 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);
|
||||||
//if (id == 4)
|
|
||||||
//{
|
|
||||||
// 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;
|
||||||
|
|
|
@ -18,8 +18,6 @@ void CSkinBank::GetBankTransforms(std::vector<const zeus::CTransform*>& out,
|
||||||
for (CSegId id : x0_segments)
|
for (CSegId id : x0_segments)
|
||||||
{
|
{
|
||||||
const zeus::CTransform& xf = pose.GetRestToAccumTransform(id);
|
const zeus::CTransform& xf = pose.GetRestToAccumTransform(id);
|
||||||
//printf("BONE %d\n", int(id));
|
|
||||||
//xf.printMatrix();
|
|
||||||
out.push_back(&xf);
|
out.push_back(&xf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -500,11 +500,13 @@ void CBooModel::UpdateUniformData(const CModelFlags& flags,
|
||||||
{
|
{
|
||||||
const ModelInstance* inst;
|
const ModelInstance* inst;
|
||||||
if (m_instances.size() <= m_uniUpdateCount)
|
if (m_instances.size() <= m_uniUpdateCount)
|
||||||
|
{
|
||||||
inst = const_cast<CBooModel*>(this)->PushNewModelInstance();
|
inst = const_cast<CBooModel*>(this)->PushNewModelInstance();
|
||||||
else
|
|
||||||
inst = &m_instances[m_uniUpdateCount];
|
|
||||||
if (!inst)
|
if (!inst)
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
inst = &m_instances[m_uniUpdateCount];
|
||||||
++const_cast<CBooModel*>(this)->m_uniUpdateCount;
|
++const_cast<CBooModel*>(this)->m_uniUpdateCount;
|
||||||
|
|
||||||
u8* dataOut = reinterpret_cast<u8*>(inst->m_uniformBuffer->map(m_uniformDataSize));
|
u8* dataOut = reinterpret_cast<u8*>(inst->m_uniformBuffer->map(m_uniformDataSize));
|
||||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit 27c91a5bbc604a2d781624b75835307c1cd66940
|
Subproject commit 43015f5e696a75f8604ff535eeffb55c33c873e5
|
Loading…
Reference in New Issue