Create orthographic projection function

This commit is contained in:
Camden Dixie O'Brien committed 2025-10-05 13:51:13 +01:00
1 parent 6e37b45f28
commit a73975a766
3 files changed
+14 -1

No files matched your search

+10
View File
@@ -100,6 +100,16 @@ mat4_t mat4_perspective(float aspect, float fov, float near, float far)
};
}
mat4_t mat4_orthographic(float width, float height, float near, float far)
{
return (mat4_t) {
{ 1 / width, 0, 0, 0 },
{ 0, -1 / height, 0, 0 },
{ 0, 0, 1 / (far - near), 0 },
{ 0, 0, -near / (far - near), 1 },
};
}
mat4_t mat4_translate_vec3(vec3_t v)
{
return (mat4_t) {