From ca2835943ca4327ad08b54af480e0c6333df201f Mon Sep 17 00:00:00 2001 From: talha Date: Mon, 22 Apr 2024 03:38:29 +0500 Subject: Completed main levels to progress to text-rendering and 2d development. - Only lessons left are geometry shaders and anti-aliasing - will get to those later on soon - need to do text rendering now --- source/math.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source/math.h') diff --git a/source/math.h b/source/math.h index 77a650d..fda6bf8 100644 --- a/source/math.h +++ b/source/math.h @@ -6,6 +6,10 @@ #define To_Radian(x) ((x) * PI / 180.0f) #define To_Degree(x) ((x) * 180.0f / PI) +// @notes: +// I dislike the mat4 discrepancy in the raw data. It's called buffer here while everywhere else it's called +// data. It's weird and I hate it. + r32 clampf(r32 x, r32 bottom, r32 top) { if (x < bottom) @@ -391,4 +395,19 @@ Mat4 lookat4m(Vec3 up, Vec3 forward, Vec3 right, Vec3 position) return res; } + +Mat4 to_col_major4m(Mat4 mat) +{ + Mat4 res = {0.0f}; + + res.data[0][0] = mat.data[0][0]; res.data[1][0] = mat.data[0][1]; res.data[2][0] = mat.data[0][2]; res.data[3][0] = mat.data[0][3]; + + res.data[0][1] = mat.data[1][0]; res.data[1][1] = mat.data[1][1]; res.data[2][1] = mat.data[1][2]; res.data[3][1] = mat.data[1][3]; + + res.data[0][2] = mat.data[2][0]; res.data[1][2] = mat.data[2][1]; res.data[2][2] = mat.data[2][2]; res.data[3][2] = mat.data[2][3]; + + res.data[0][3] = mat.data[3][0]; res.data[1][3] = mat.data[3][1]; res.data[2][3] = mat.data[3][2]; res.data[3][3] = mat.data[3][3]; + + return res; +} #endif -- cgit v1.2.3