diff options
author | talha <talha@talhaamir.xyz> | 2024-04-22 03:38:29 +0500 |
---|---|---|
committer | talha <talha@talhaamir.xyz> | 2024-04-22 03:38:29 +0500 |
commit | ca2835943ca4327ad08b54af480e0c6333df201f (patch) | |
tree | 1cac87ca6d6ceee89f91d8735f319805d4bad38e /source/math.h | |
parent | 9900ffe840ee0e9f914b0e7956a4e80ffb553e9e (diff) |
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
Diffstat (limited to 'source/math.h')
-rw-r--r-- | source/math.h | 19 |
1 files changed, 19 insertions, 0 deletions
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 |