2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-14 00:06:09 +00:00

Begin transitioning to new CModel/CCubeModel & friends

This commit is contained in:
2022-02-25 02:45:25 -05:00
parent c3c9f9d601
commit 832eb180bd
146 changed files with 2221 additions and 1582 deletions

View File

@@ -37,7 +37,7 @@ u32 CGraphics::g_FrameCounter = 0;
u32 CGraphics::g_Framerate = 0;
u32 CGraphics::g_FramesPast = 0;
frame_clock::time_point CGraphics::g_FrameStartTime = frame_clock::now();
//bool CGraphics::g_commitAsLazy = false;
// bool CGraphics::g_commitAsLazy = false;
const std::array<zeus::CMatrix3f, 6> CGraphics::skCubeBasisMats{{
/* Right */
@@ -100,13 +100,23 @@ void CGraphics::SetFog(ERglFogMode mode, float startz, float endz, const zeus::C
}
}
void CGraphics::SetDepthWriteMode(bool test, ERglEnum comp, bool write) {}
void CGraphics::SetDepthWriteMode(bool test, ERglEnum comp, bool write) {
g_depthFunc = comp;
aurora::gfx::set_depth_mode(test, comp, write);
}
void CGraphics::SetBlendMode(ERglBlendMode, ERglBlendFactor, ERglBlendFactor, ERglLogicOp) {}
void CGraphics::SetBlendMode(ERglBlendMode mode, ERglBlendFactor src, ERglBlendFactor dst, ERglLogicOp op) {
aurora::gfx::set_blend_mode(mode, src, dst, op);
}
void CGraphics::SetCullMode(ERglCullMode) {}
void CGraphics::SetCullMode(ERglCullMode mode) {
g_cullMode = mode;
aurora::gfx::set_cull_mode(mode);
}
void CGraphics::BeginScene() {}
void CGraphics::BeginScene() {
// ClearBackAndDepthBuffers();
}
void CGraphics::EndScene() {
/* Spinwait until g_NumBreakpointsWaiting is 0 */
@@ -127,7 +137,7 @@ void CGraphics::EndScene() {
CTextSupportShader::UpdateBuffers();
/* Same with line renderer */
// CLineRenderer::UpdateBuffers();
// CLineRenderer::UpdateBuffers();
++g_FrameCounter;
@@ -193,24 +203,25 @@ zeus::CMatrix4f CGraphics::CalculatePerspectiveMatrix(float fovy, float aspect,
0.f, 0.f, -fpn / fmn, -2.f * st.x18_far * st.x14_near / fmn, 0.f, 0.f, -1.f, 0.f);
}
// switch (g_BooPlatform) {
// case boo::IGraphicsDataFactory::Platform::OpenGL:
// default: {
// return zeus::CMatrix4f(2.f * st.x14_near / rml, 0.f, rpl / rml, 0.f, 0.f, 2.f * st.x14_near / tmb, tpb / tmb, 0.f,
// 0.f, 0.f, -fpn / fmn, -2.f * st.x18_far * st.x14_near / fmn, 0.f, 0.f, -1.f, 0.f);
// }
// case boo::IGraphicsDataFactory::Platform::D3D11:
// case boo::IGraphicsDataFactory::Platform::Metal: {
zeus::CMatrix4f mat2(2.f * st.x14_near / rml, 0.f, rpl / rml, 0.f, 0.f, 2.f * st.x14_near / tmb, tpb / tmb, 0.f,
0.f, 0.f, st.x18_far / fmn, st.x14_near * st.x18_far / fmn, 0.f, 0.f, -1.f, 0.f);
return PlusOneZ * mat2;
// }
// case boo::IGraphicsDataFactory::Platform::Vulkan: {
// zeus::CMatrix4f mat2(2.f * st.x14_near / rml, 0.f, rpl / rml, 0.f, 0.f, 2.f * st.x14_near / tmb, tpb / tmb, 0.f,
// 0.f, 0.f, -fpn / fmn, -2.f * st.x18_far * st.x14_near / fmn, 0.f, 0.f, -1.f, 0.f);
// return VulkanCorrect * mat2;
// }
// }
// switch (g_BooPlatform) {
// case boo::IGraphicsDataFactory::Platform::OpenGL:
// default: {
// return zeus::CMatrix4f(2.f * st.x14_near / rml, 0.f, rpl / rml, 0.f, 0.f, 2.f * st.x14_near / tmb, tpb / tmb,
// 0.f,
// 0.f, 0.f, -fpn / fmn, -2.f * st.x18_far * st.x14_near / fmn, 0.f, 0.f, -1.f, 0.f);
// }
// case boo::IGraphicsDataFactory::Platform::D3D11:
// case boo::IGraphicsDataFactory::Platform::Metal: {
zeus::CMatrix4f mat2(2.f * st.x14_near / rml, 0.f, rpl / rml, 0.f, 0.f, 2.f * st.x14_near / tmb, tpb / tmb, 0.f, 0.f,
0.f, st.x18_far / fmn, st.x14_near * st.x18_far / fmn, 0.f, 0.f, -1.f, 0.f);
return PlusOneZ * mat2;
// }
// case boo::IGraphicsDataFactory::Platform::Vulkan: {
// zeus::CMatrix4f mat2(2.f * st.x14_near / rml, 0.f, rpl / rml, 0.f, 0.f, 2.f * st.x14_near / tmb, tpb / tmb, 0.f,
// 0.f, 0.f, -fpn / fmn, -2.f * st.x18_far * st.x14_near / fmn, 0.f, 0.f, -1.f, 0.f);
// return VulkanCorrect * mat2;
// }
// }
}
zeus::CMatrix4f CGraphics::GetPerspectiveProjectionMatrix(bool forRenderer) {
@@ -228,27 +239,27 @@ zeus::CMatrix4f CGraphics::GetPerspectiveProjectionMatrix(bool forRenderer) {
0.f, -1.f, 0.f);
}
// switch (g_BooPlatform) {
// case boo::IGraphicsDataFactory::Platform::OpenGL:
// default: {
// return zeus::CMatrix4f(2.f * g_Proj.x14_near / rml, 0.f, rpl / rml, 0.f, 0.f, 2.f * g_Proj.x14_near / tmb,
// tpb / tmb, 0.f, 0.f, 0.f, -fpn / fmn, -2.f * g_Proj.x18_far * g_Proj.x14_near / fmn, 0.f,
// 0.f, -1.f, 0.f);
// }
// case boo::IGraphicsDataFactory::Platform::D3D11:
// case boo::IGraphicsDataFactory::Platform::Metal: {
zeus::CMatrix4f mat2(2.f * g_Proj.x14_near / rml, 0.f, rpl / rml, 0.f, 0.f, 2.f * g_Proj.x14_near / tmb,
tpb / tmb, 0.f, 0.f, 0.f, g_Proj.x18_far / fmn, g_Proj.x14_near * g_Proj.x18_far / fmn, 0.f,
0.f, -1.f, 0.f);
return PlusOneZ * mat2;
// }
// case boo::IGraphicsDataFactory::Platform::Vulkan: {
// zeus::CMatrix4f mat2(2.f * g_Proj.x14_near / rml, 0.f, rpl / rml, 0.f, 0.f, 2.f * g_Proj.x14_near / tmb,
// tpb / tmb, 0.f, 0.f, 0.f, -fpn / fmn, -2.f * g_Proj.x18_far * g_Proj.x14_near / fmn, 0.f,
// 0.f, -1.f, 0.f);
// return VulkanCorrect * mat2;
// }
// }
// switch (g_BooPlatform) {
// case boo::IGraphicsDataFactory::Platform::OpenGL:
// default: {
// return zeus::CMatrix4f(2.f * g_Proj.x14_near / rml, 0.f, rpl / rml, 0.f, 0.f, 2.f * g_Proj.x14_near / tmb,
// tpb / tmb, 0.f, 0.f, 0.f, -fpn / fmn, -2.f * g_Proj.x18_far * g_Proj.x14_near / fmn,
// 0.f, 0.f, -1.f, 0.f);
// }
// case boo::IGraphicsDataFactory::Platform::D3D11:
// case boo::IGraphicsDataFactory::Platform::Metal: {
zeus::CMatrix4f mat2(2.f * g_Proj.x14_near / rml, 0.f, rpl / rml, 0.f, 0.f, 2.f * g_Proj.x14_near / tmb, tpb / tmb,
0.f, 0.f, 0.f, g_Proj.x18_far / fmn, g_Proj.x14_near * g_Proj.x18_far / fmn, 0.f, 0.f, -1.f,
0.f);
return PlusOneZ * mat2;
// }
// case boo::IGraphicsDataFactory::Platform::Vulkan: {
// zeus::CMatrix4f mat2(2.f * g_Proj.x14_near / rml, 0.f, rpl / rml, 0.f, 0.f, 2.f * g_Proj.x14_near / tmb,
// tpb / tmb, 0.f, 0.f, 0.f, -fpn / fmn, -2.f * g_Proj.x18_far * g_Proj.x14_near / fmn,
// 0.f, 0.f, -1.f, 0.f);
// return VulkanCorrect * mat2;
// }
// }
} else {
float rml = g_Proj.x8_right - g_Proj.x4_left;
float rpl = g_Proj.x8_right + g_Proj.x4_left;
@@ -262,24 +273,25 @@ zeus::CMatrix4f CGraphics::GetPerspectiveProjectionMatrix(bool forRenderer) {
-fpn / fmn, 0.f, 0.f, 0.f, 1.f);
}
// switch (g_BooPlatform) {
// case boo::IGraphicsDataFactory::Platform::OpenGL:
// default: {
// return zeus::CMatrix4f(2.f / rml, 0.f, 0.f, -rpl / rml, 0.f, 2.f / tmb, 0.f, -tpb / tmb, 0.f, 0.f, -2.f / fmn,
// -fpn / fmn, 0.f, 0.f, 0.f, 1.f);
// }
// case boo::IGraphicsDataFactory::Platform::D3D11:
// case boo::IGraphicsDataFactory::Platform::Metal: {
zeus::CMatrix4f mat2(2.f / rml, 0.f, 0.f, -rpl / rml, 0.f, 2.f / tmb, 0.f, -tpb / tmb, 0.f, 0.f, 1.f / fmn,
g_Proj.x14_near / fmn, 0.f, 0.f, 0.f, 1.f);
return PlusOneZ * mat2;
// }
// case boo::IGraphicsDataFactory::Platform::Vulkan: {
// zeus::CMatrix4f mat2(2.f / rml, 0.f, 0.f, -rpl / rml, 0.f, 2.f / tmb, 0.f, -tpb / tmb, 0.f, 0.f, -2.f / fmn,
// -fpn / fmn, 0.f, 0.f, 0.f, 1.f);
// return VulkanCorrect * mat2;
// }
// }
// switch (g_BooPlatform) {
// case boo::IGraphicsDataFactory::Platform::OpenGL:
// default: {
// return zeus::CMatrix4f(2.f / rml, 0.f, 0.f, -rpl / rml, 0.f, 2.f / tmb, 0.f, -tpb / tmb, 0.f, 0.f, -2.f /
// fmn,
// -fpn / fmn, 0.f, 0.f, 0.f, 1.f);
// }
// case boo::IGraphicsDataFactory::Platform::D3D11:
// case boo::IGraphicsDataFactory::Platform::Metal: {
zeus::CMatrix4f mat2(2.f / rml, 0.f, 0.f, -rpl / rml, 0.f, 2.f / tmb, 0.f, -tpb / tmb, 0.f, 0.f, 1.f / fmn,
g_Proj.x14_near / fmn, 0.f, 0.f, 0.f, 1.f);
return PlusOneZ * mat2;
// }
// case boo::IGraphicsDataFactory::Platform::Vulkan: {
// zeus::CMatrix4f mat2(2.f / rml, 0.f, 0.f, -rpl / rml, 0.f, 2.f / tmb, 0.f, -tpb / tmb, 0.f, 0.f, -2.f / fmn,
// -fpn / fmn, 0.f, 0.f, 0.f, 1.f);
// return VulkanCorrect * mat2;
// }
// }
}
}
@@ -464,11 +476,11 @@ void CGraphics::UpdateFPSCounter() {
}
}
//boo::IGraphicsDataFactory::Platform CGraphics::g_BooPlatform = boo::IGraphicsDataFactory::Platform::Null;
//boo::IGraphicsDataFactory* CGraphics::g_BooFactory = nullptr;
//boo::IGraphicsCommandQueue* CGraphics::g_BooMainCommandQueue = nullptr;
//boo::ObjToken<boo::ITextureR> CGraphics::g_SpareTexture;
//const char* CGraphics::g_BooPlatformName = nullptr;
// boo::IGraphicsDataFactory::Platform CGraphics::g_BooPlatform = boo::IGraphicsDataFactory::Platform::Null;
// boo::IGraphicsDataFactory* CGraphics::g_BooFactory = nullptr;
// boo::IGraphicsCommandQueue* CGraphics::g_BooMainCommandQueue = nullptr;
// boo::ObjToken<boo::ITextureR> CGraphics::g_SpareTexture;
// const char* CGraphics::g_BooPlatformName = nullptr;
const CTevCombiners::CTevPass CGraphics::sTevPass805a564c({GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO,
GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC},