diff --git a/lib/dolphin/gx/GXTransform.cpp b/lib/dolphin/gx/GXTransform.cpp index cad605a..5c69504 100644 --- a/lib/dolphin/gx/GXTransform.cpp +++ b/lib/dolphin/gx/GXTransform.cpp @@ -1,25 +1,18 @@ #include "gx.hpp" -#include - extern "C" { -constexpr aurora::Mat4x4 DepthCorrect{ - {1.f, 0.f, 0.f, 0.f}, - {0.f, 1.f, 0.f, 0.f}, - {0.f, 0.f, 1.f + FLT_EPSILON, 0.f}, - {0.f, 0.f, 1.f, 1.f}, -}; - void GXSetProjection(const void* mtx_, GXProjectionType type) { const auto& mtx = *reinterpret_cast*>(mtx_); g_gxState.origProj = mtx; g_gxState.projType = type; + update_gx_state(g_gxState.proj, #ifdef AURORA_NATIVE_MATRIX - update_gx_state(g_gxState.proj, DepthCorrect * mtx); + mtx #else - update_gx_state(g_gxState.proj, DepthCorrect * mtx.transpose()); + mtx.transpose() #endif + ); } // TODO GXSetProjectionv diff --git a/lib/gfx/gx_shader.cpp b/lib/gfx/gx_shader.cpp index e931549..e5e5302 100644 --- a/lib/gfx/gx_shader.cpp +++ b/lib/gfx/gx_shader.cpp @@ -803,7 +803,8 @@ wgpu::ShaderModule build_shader(const ShaderConfig& config, const ShaderInfo& in vtxXfrAttrsPre += fmt::format( "\n var mv_pos = mul4x3(ubuf.pos_mtx, vec4({}, 1.0));" "\n var mv_nrm = normalize(mul4x3(ubuf.nrm_mtx, vec4({}, 0.0)));" - "\n out.pos = mul4x4(ubuf.proj, vec4(mv_pos, 1.0));", + "\n out.pos = mul4x4(ubuf.proj, vec4(mv_pos, 1.0));" + "\n out.pos.z += out.pos.w;", vtx_attr(config, GX_VA_POS), vtx_attr(config, GX_VA_NRM)); if constexpr (EnableNormalVisualization) { vtxOutAttrs += fmt::format("\n @location({}) nrm: vec3,", vtxOutIdx++);