Skip to content

Instantly share code, notes, and snippets.

@Centrinia
Created March 23, 2021 22:53
Show Gist options
  • Save Centrinia/509f273767bc1a428387b976abbf00ec to your computer and use it in GitHub Desktop.
Save Centrinia/509f273767bc1a428387b976abbf00ec to your computer and use it in GitHub Desktop.
diff --git a/Quake/gl_rmain.c b/Quake/gl_rmain.c
index 7095aa3..b36cc34 100644
--- a/Quake/gl_rmain.c
+++ b/Quake/gl_rmain.c
@@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// r_main.c
#include "quakedef.h"
+#define YSHEAR 1
qboolean r_cache_thrash; // compatability
@@ -292,8 +293,6 @@ void R_SetupMatrix (void)
MatrixMultiply(vulkan_globals.view_matrix, rotation_matrix);
RotationMatrix(rotation_matrix, DEG2RAD(-r_refdef.viewangles[2]), 1.0f, 0.0f, 0.0f);
MatrixMultiply(vulkan_globals.view_matrix, rotation_matrix);
- RotationMatrix(rotation_matrix, DEG2RAD(-r_refdef.viewangles[0]), 0.0f, 1.0f, 0.0f);
- MatrixMultiply(vulkan_globals.view_matrix, rotation_matrix);
RotationMatrix(rotation_matrix, DEG2RAD(-r_refdef.viewangles[1]), 0.0f, 0.0f, 1.0f);
MatrixMultiply(vulkan_globals.view_matrix, rotation_matrix);
@@ -301,6 +300,15 @@ void R_SetupMatrix (void)
TranslationMatrix(translation_matrix, -r_refdef.vieworg[0], -r_refdef.vieworg[1], -r_refdef.vieworg[2]);
MatrixMultiply(vulkan_globals.view_matrix, translation_matrix);
+#if YSHEAR
+ TranslationMatrix(rotation_matrix, 0, 0, 0);
+ rotation_matrix[1 + 4 * 2] = tanf(DEG2RAD(-r_refdef.viewangles[0]));
+#else
+ RotationMatrix(rotation_matrix, DEG2RAD(r_refdef.viewangles[0]), 1.0f, 0.0f, 0.0f);
+#endif
+ MatrixMultiply(rotation_matrix, vulkan_globals.view_matrix);
+ memcpy(vulkan_globals.view_matrix, rotation_matrix, 16*sizeof(float));
+
// View projection matrix
memcpy(vulkan_globals.view_projection_matrix, vulkan_globals.projection_matrix, 16 * sizeof(float));
MatrixMultiply(vulkan_globals.view_projection_matrix, vulkan_globals.view_matrix);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment