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.
This commit is contained in:
Yamagi 2020-02-22 15:43:46 +01:00
parent 340b32827f
commit 50d442c1e8

View file

@ -360,9 +360,18 @@ R_AliasSetUpTransform(const entity_t *currententity)
VectorInverse (viewmatrix[1]); VectorInverse (viewmatrix[1]);
VectorCopy (vpn, viewmatrix[2]); VectorCopy (vpn, viewmatrix[2]);
viewmatrix[0][3] = 0; if ( currententity->flags & RF_WEAPONMODEL )
viewmatrix[1][3] = 0; {
viewmatrix[2][3] = 0; 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 ) ); // memcpy( aliasworldtransform, rotationmatrix, sizeof( aliastransform ) );
@ -440,6 +449,7 @@ R_AliasTransformFinalVerts(const entity_t *currententity, int numpoints, finalve
R_AliasProjectAndClipTestFinalVert( fv ); R_AliasProjectAndClipTestFinalVert( fv );
} }
} }
} }
/* /*