ANIM fixes

This commit is contained in:
Jack Andersen 2016-09-09 19:39:47 -10:00
parent 529223e311
commit a81f35f3e4
7 changed files with 27 additions and 24 deletions

View File

@ -420,9 +420,9 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
++it)
{
QuantizedRot qrCur = QuantizeRotation(*it, rotDivOut);
chan.q[0] = std::max(chan.q[0], atUint8(ceilf(log2f(qrCur.v[0] - last.v[0]))));
chan.q[1] = std::max(chan.q[1], atUint8(ceilf(log2f(qrCur.v[1] - last.v[1]))));
chan.q[2] = std::max(chan.q[2], atUint8(ceilf(log2f(qrCur.v[2] - last.v[2]))));
chan.q[0] = std::max(chan.q[0], atUint8(qrCur.v.qFrom(last, 0)));
chan.q[1] = std::max(chan.q[1], atUint8(qrCur.v.qFrom(last, 1)));
chan.q[2] = std::max(chan.q[2], atUint8(qrCur.v.qFrom(last, 2)));
last = qrCur.v;
}
break;
@ -436,9 +436,9 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
QuantizedValue cur = {atInt32(it->v3.vec[0] / transMultOut),
atInt32(it->v3.vec[1] / transMultOut),
atInt32(it->v3.vec[2] / transMultOut)};
chan.q[0] = std::max(chan.q[0], atUint8(ceilf(log2f(cur[0] - last[0]))));
chan.q[1] = std::max(chan.q[1], atUint8(ceilf(log2f(cur[1] - last[1]))));
chan.q[2] = std::max(chan.q[2], atUint8(ceilf(log2f(cur[2] - last[2]))));
chan.q[0] = std::max(chan.q[0], atUint8(cur.qFrom(last, 0)));
chan.q[1] = std::max(chan.q[1], atUint8(cur.qFrom(last, 1)));
chan.q[2] = std::max(chan.q[2], atUint8(cur.qFrom(last, 2)));
last = cur;
}
break;
@ -452,9 +452,9 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
QuantizedValue cur = {atInt32(it->v3.vec[0] / scaleMultOut),
atInt32(it->v3.vec[1] / scaleMultOut),
atInt32(it->v3.vec[2] / scaleMultOut)};
chan.q[0] = std::max(chan.q[0], atUint8(ceilf(log2f(cur[0] - last[0]))));
chan.q[1] = std::max(chan.q[1], atUint8(ceilf(log2f(cur[1] - last[1]))));
chan.q[2] = std::max(chan.q[2], atUint8(ceilf(log2f(cur[2] - last[2]))));
chan.q[0] = std::max(chan.q[0], atUint8(cur.qFrom(last, 0)));
chan.q[1] = std::max(chan.q[1], atUint8(cur.qFrom(last, 1)));
chan.q[2] = std::max(chan.q[2], atUint8(cur.qFrom(last, 2)));
last = cur;
}
break;
@ -468,7 +468,7 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
sizeOut = ComputeBitstreamSize(keyFrameCount, channels);
std::unique_ptr<atUint8[]> newData(new atUint8[sizeOut]);
memset(newData.get(), 0, sizeOut);
lastVals = initVals;
for (size_t f=0 ; f<keyFrameCount ; ++f)
{

View File

@ -36,6 +36,14 @@ struct QuantizedValue
{return v[idx];}
const atInt32& operator[] (size_t idx) const
{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
{

View File

@ -63,11 +63,6 @@ void CPoseAsTransforms::Insert(const CSegId& id,
Transform& xfOut = xd0_transformArr[x0_nextId];
xfOut.m_originToAccum = zeus::CTransform(rotation, offset);
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];
link.first = xd4_lastInserted;

View File

@ -18,8 +18,6 @@ void CSkinBank::GetBankTransforms(std::vector<const zeus::CTransform*>& out,
for (CSegId id : x0_segments)
{
const zeus::CTransform& xf = pose.GetRestToAccumTransform(id);
//printf("BONE %d\n", int(id));
//xf.printMatrix();
out.push_back(&xf);
}
}

View File

@ -441,8 +441,8 @@ void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const UVAnimati
float halfA = anim.vals[0] * 0.5f;
postMtxOut = zeus::CTransform(zeus::CMatrix3f(halfA, 0.0, 0.0,
0.0, 0.0, halfA,
0.0, 0.0, 0.0),
0.0, 0.0, halfA,
0.0, 0.0, 0.0),
zeus::CVector3f(xy, z, 1.0)).toMatrix4f();
break;
}
@ -500,11 +500,13 @@ void CBooModel::UpdateUniformData(const CModelFlags& flags,
{
const ModelInstance* inst;
if (m_instances.size() <= m_uniUpdateCount)
{
inst = const_cast<CBooModel*>(this)->PushNewModelInstance();
if (!inst)
return;
}
else
inst = &m_instances[m_uniUpdateCount];
if (!inst)
return;
++const_cast<CBooModel*>(this)->m_uniUpdateCount;
u8* dataOut = reinterpret_cast<u8*>(inst->m_uniformBuffer->map(m_uniformDataSize));

View File

@ -221,7 +221,7 @@ void CWorldTransManager::DrawSecondPass()
void CWorldTransManager::DrawEnabled()
{
float wsAspect = CWideScreenFilter::SetViewportToMatch(1.f);
g_Renderer->SetPerspective(CCameraManager::DefaultFirstPersonFOV(),
wsAspect,
CCameraManager::DefaultNearPlane(),
@ -318,7 +318,7 @@ void CWorldTransManager::TouchModels()
x4_modelData->x100_bgModelData[1].Touch(CModelData::EWhichModel::Normal, 0);
if (!x4_modelData->x100_bgModelData[2].IsNull())
x4_modelData->x100_bgModelData[2].Touch(CModelData::EWhichModel::Normal, 0);
if (!x4_modelData->x68_beamModelData.IsNull())
x4_modelData->x68_beamModelData.Touch(CModelData::EWhichModel::Normal, 0);
}

2
hecl

@ -1 +1 @@
Subproject commit 27c91a5bbc604a2d781624b75835307c1cd66940
Subproject commit 43015f5e696a75f8604ff535eeffb55c33c873e5