From 60753528681bb0b80d49d6231af71040a410bb5a Mon Sep 17 00:00:00 2001 From: Ian Curtis Date: Tue, 27 Nov 2018 20:43:27 +0000 Subject: [PATCH] Optimise depth calculation for quad shader. --- Src/Graphics/New3D/R3DShaderQuads.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Src/Graphics/New3D/R3DShaderQuads.h b/Src/Graphics/New3D/R3DShaderQuads.h index bffef3d..ce4e615 100644 --- a/Src/Graphics/New3D/R3DShaderQuads.h +++ b/Src/Graphics/New3D/R3DShaderQuads.h @@ -315,7 +315,7 @@ void QuadraticInterpolation() depth = ((vertex.z / vertex.w) + 1.0) / 2.0; } else { - vertex = projMat * vec4(fsViewVertex,1.0); + vertex.z = (projMat[2][2] * fsViewVertex.z) + projMat[3][2]; // standard projMat * vertex - but just using Z components depth = ((vertex.z * interp_oneOverW) + 1.0) / 2.0; }