From 50d442c1e87fbc4b4175a1345070a884b8c42d70 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Sat, 22 Feb 2020 15:43:46 +0100 Subject: [PATCH] Add `sw_gunzposition` to alter the guns Z offset. An option like this was often requested since I fixed the gun field of view in e466554. Since the software renderer is missing the ability to alter the persepective matrix (e.g. something like glFrustrum()) this fix fakes the offset by manipulating the guns transformation marix. That's not perfect, the gun distorts if `sw_gunzposition` is set to anything but `0`. Values up to `8` are more or less okay. Defaults to `8` which matches the GL renderer default. --- src/client/refresh/soft/sw_alias.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/client/refresh/soft/sw_alias.c b/src/client/refresh/soft/sw_alias.c index 092c0c7d..5c411066 100644 --- a/src/client/refresh/soft/sw_alias.c +++ b/src/client/refresh/soft/sw_alias.c @@ -360,9 +360,18 @@ R_AliasSetUpTransform(const entity_t *currententity) VectorInverse (viewmatrix[1]); VectorCopy (vpn, viewmatrix[2]); - viewmatrix[0][3] = 0; - viewmatrix[1][3] = 0; - viewmatrix[2][3] = 0; + if ( currententity->flags & RF_WEAPONMODEL ) + { + viewmatrix[0][3] = 0; + viewmatrix[1][3] = 0; + viewmatrix[2][3] = 8; + } + else + { + viewmatrix[0][3] = 0; + viewmatrix[1][3] = 0; + viewmatrix[2][3] = 0; + } // memcpy( aliasworldtransform, rotationmatrix, sizeof( aliastransform ) ); @@ -440,6 +449,7 @@ R_AliasTransformFinalVerts(const entity_t *currententity, int numpoints, finalve R_AliasProjectAndClipTestFinalVert( fv ); } } + } /*