From 74acd92d918485ae8c01d493505aac5b350ed5e0 Mon Sep 17 00:00:00 2001 From: myT Date: Tue, 18 Oct 2022 19:09:14 +0200 Subject: [PATCH] fixed the D3D projection transform not matching GL --- changelog.txt | 2 ++ code/renderer/tr_main.cpp | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 67e0880..731e67c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -70,6 +70,8 @@ chg: with r_backend GL3, depth fade with MSAA now requires GLSL 4.00 at a minimu chg: with r_backend GL3, alpha to coverage now requires GLSL 4.00 at a minimum +fix: the Direct3D projection transform didn't perfectly match the OpenGL version + fix: /video was writing incorrect audio stream lengths to the .avi file headers fix: /systeminfo /serverinfo /clientinfo /dumpuser would crash when tokens were too long diff --git a/code/renderer/tr_main.cpp b/code/renderer/tr_main.cpp index 0e8ad6e..4496c4b 100644 --- a/code/renderer/tr_main.cpp +++ b/code/renderer/tr_main.cpp @@ -438,8 +438,13 @@ static void R_SetupProjection() tr.viewParms.projectionMatrix[2] = 0; tr.viewParms.projectionMatrix[6] = 0; - tr.viewParms.projectionMatrix[10] = -( zFar + zNear ) / depth; - tr.viewParms.projectionMatrix[14] = -2 * zFar * zNear / depth; + if ( gal.id == GAL_D3D11 ) { + tr.viewParms.projectionMatrix[10] = -zFar / depth; + tr.viewParms.projectionMatrix[14] = -zFar * zNear / depth; + } else { + tr.viewParms.projectionMatrix[10] = -( zFar + zNear ) / depth; + tr.viewParms.projectionMatrix[14] = -2 * zFar * zNear / depth; + } tr.viewParms.projectionMatrix[3] = 0; tr.viewParms.projectionMatrix[7] = 0;