From 00b57f6a1640aa8ffed840487c11d016d7d920cd Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 16 Jan 2016 00:17:27 -0800 Subject: [PATCH] Correct clamped depth offset. Oops, forgot to fix this when I fixed the scale. It's already for a [-1, 1] range, and needs to be corrected for accordingly. Fixes #8425, other depth issues in Phantasy Star Portable 2. --- GPU/Directx9/ShaderManagerDX9.cpp | 2 +- GPU/GLES/ShaderManager.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/GPU/Directx9/ShaderManagerDX9.cpp b/GPU/Directx9/ShaderManagerDX9.cpp index fe60271b5c..b7c988a75c 100644 --- a/GPU/Directx9/ShaderManagerDX9.cpp +++ b/GPU/Directx9/ShaderManagerDX9.cpp @@ -260,7 +260,7 @@ static void ConvertProjMatrixToD3D(Matrix4x4 &in, bool invertedX, bool invertedY if (invertedY) yoff = -yoff; - const Vec3 trans(xoff, yoff, gstate_c.vpZOffset + 0.5f); + const Vec3 trans(xoff, yoff, gstate_c.vpZOffset * 0.5f + 0.5f); const Vec3 scale(gstate_c.vpWidthScale, gstate_c.vpHeightScale, gstate_c.vpDepthScale * 0.5f); in.translateAndScale(trans, scale); } diff --git a/GPU/GLES/ShaderManager.cpp b/GPU/GLES/ShaderManager.cpp index 7b327932a0..6e8c1dc3d7 100644 --- a/GPU/GLES/ShaderManager.cpp +++ b/GPU/GLES/ShaderManager.cpp @@ -378,7 +378,7 @@ static inline void ScaleProjMatrix(Matrix4x4 &in) { // GL upside down is a pain as usual. yOffset = -yOffset; } - const Vec3 trans(gstate_c.vpXOffset, yOffset, gstate_c.vpZOffset * 2.0f); + const Vec3 trans(gstate_c.vpXOffset, yOffset, gstate_c.vpZOffset); const Vec3 scale(gstate_c.vpWidthScale, gstate_c.vpHeightScale, gstate_c.vpDepthScale); in.translateAndScale(trans, scale); }