2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-08-07 21:39:05 +00:00

Matrix fixes

This commit is contained in:
Phillip Stephens 2016-07-09 15:02:31 -07:00
parent 48bcecff9a
commit de43ef8100
4 changed files with 10 additions and 10 deletions

View File

@ -21,7 +21,7 @@ namespace urde
void ViewManager::BuildTestPART(urde::IObjectStore& objStore) void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
{ {
m_modelTest = objStore.GetObj("CMDL_InvPowerSuit3"); m_modelTest = objStore.GetObj("gun_cmdl");
//m_modelTest = objStore.GetObj("CMDL_GameCube"); //m_modelTest = objStore.GetObj("CMDL_GameCube");
m_modelTest.Lock(); m_modelTest.Lock();
@ -76,7 +76,7 @@ void ViewManager::ParticleView::draw(boo::IGraphicsCommandQueue *gfxQ)
m_theta += 0.01f; m_theta += 0.01f;
CGraphics::SetModelMatrix(zeus::CTransform::RotateZ(m_theta) * zeus::CTransform::Scale(10.f)); CGraphics::SetModelMatrix(zeus::CTransform::RotateZ(m_theta) * zeus::CTransform::Scale(10.f));
//CGraphics::SetModelMatrix(zeus::CTransform::Identity()); //CGraphics::SetModelMatrix(zeus::CTransform::Identity());
CGraphics::SetViewPointMatrix(zeus::lookAt(zeus::CVector3f{0.f, -30.f, 4.f}, {0.f, 0.f, 0.f})); CGraphics::SetViewPointMatrix(zeus::lookAt(zeus::CVector3f{0.f, -10.f, 4.f}, {0.f, 0.f, 0.f}));
boo::SWindowRect windowRect = m_vm.m_mainWindow->getWindowFrame(); boo::SWindowRect windowRect = m_vm.m_mainWindow->getWindowFrame();
float aspect = windowRect.size[0] / float(windowRect.size[1]); float aspect = windowRect.size[0] / float(windowRect.size[1]);
CGraphics::SetPerspective(55.0, aspect, 0.001f, 1000.f); CGraphics::SetPerspective(55.0, aspect, 0.001f, 1000.f);

View File

@ -329,7 +329,7 @@ void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const UVAnimati
{ {
case UVAnimation::Mode::MvInvNoTranslation: case UVAnimation::Mode::MvInvNoTranslation:
{ {
texMtxOut = CGraphics::g_ViewMatrix.inverse().multiplyIgnoreTranslation(CGraphics::g_GXModelMatrix).toMatrix4f(); texMtxOut = (CGraphics::g_ViewMatrix * CGraphics::g_GXModelMatrix).inverse().toMatrix4f();
texMtxOut.vec[3].zeroOut(); texMtxOut.vec[3].zeroOut();
postMtxOut.vec[0].x = 0.5f; postMtxOut.vec[0].x = 0.5f;
postMtxOut.vec[1].y = 0.0f; postMtxOut.vec[1].y = 0.0f;
@ -340,7 +340,7 @@ void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const UVAnimati
} }
case UVAnimation::Mode::MvInv: case UVAnimation::Mode::MvInv:
{ {
texMtxOut = (CGraphics::g_ViewMatrix.inverse() * CGraphics::g_GXModelMatrix).toMatrix4f(); texMtxOut = (CGraphics::g_ViewMatrix * CGraphics::g_GXModelMatrix).inverse().toMatrix4f();
postMtxOut.vec[0].x = 0.5f; postMtxOut.vec[0].x = 0.5f;
postMtxOut.vec[1].y = 0.0f; postMtxOut.vec[1].y = 0.0f;
postMtxOut.vec[2].y = 0.5f; postMtxOut.vec[2].y = 0.5f;
@ -363,20 +363,20 @@ void CBooModel::UVAnimationBuffer::ProcessAnimation(u8*& bufOut, const UVAnimati
texMtxOut.vec[0].y = asin; texMtxOut.vec[0].y = asin;
texMtxOut.vec[1].x = -asin; texMtxOut.vec[1].x = -asin;
texMtxOut.vec[1].y = acos; texMtxOut.vec[1].y = acos;
texMtxOut.vec[3].x = (1.0 - (acos - asin)) * 0.5; texMtxOut.vec[3].x = (1.0f - (acos - asin)) * 0.5f;
texMtxOut.vec[3].y = (1.0 - (asin + acos)) * 0.5; texMtxOut.vec[3].y = (1.0f - (asin + acos)) * 0.5f;
break; break;
} }
case UVAnimation::Mode::HStrip: case UVAnimation::Mode::HStrip:
{ {
float value = anim.vals[0] * anim.vals[2] * (anim.vals[3] + CGraphics::GetSecondsMod900()); float value = anim.vals[0] * anim.vals[2] * (anim.vals[3] + CGraphics::GetSecondsMod900());
texMtxOut.vec[3].x = anim.vals[1] * fmod(value, 1.0f) * anim.vals[2]; texMtxOut.vec[3].x = (float)(short)(float)(anim.vals[1] * fmod(value, 1.0f)) * anim.vals[2];
break; break;
} }
case UVAnimation::Mode::VStrip: case UVAnimation::Mode::VStrip:
{ {
float value = anim.vals[0] * anim.vals[2] * (anim.vals[3] + CGraphics::GetSecondsMod900()); float value = anim.vals[0] * anim.vals[2] * (anim.vals[3] + CGraphics::GetSecondsMod900());
texMtxOut.vec[3].y = anim.vals[1] * fmod(value, 1.0f) * anim.vals[2]; texMtxOut.vec[3].y = (float)(short)(float)(anim.vals[1] * fmod(value, 1.0f)) * anim.vals[2];
break; break;
} }
case UVAnimation::Mode::Model: case UVAnimation::Mode::Model:

2
hecl

@ -1 +1 @@
Subproject commit b0d95d4d2880bc170af3e3b488b2ad01b2da2e25 Subproject commit 551b7070708856c85d45580dece044779906209c

@ -1 +1 @@
Subproject commit 53432805c7e12472f3b66f10eeaf9415003bae1a Subproject commit 720ab3d9527946ad753433b5b73abeeb87b8efe1