Added unproject

Broken and buggy font stuff
Fixed some typos
Fixed draw rect not using dim properly
This commit is contained in:
2025-10-05 21:11:18 +01:00
parent 5cabf845b6
commit eb3c81cd04
11 changed files with 349 additions and 22 deletions

View File

@@ -18,6 +18,11 @@ R2f R2F(V2f min, V2f max) {
return result;
}
V2f V2f_Scale(V2f x, F32 s) {
V2f result = { x.x * s, x.y * s };
return result;
}
V3f V3f_Neg(V3f x) {
V3f result = { -x.x, -x.y, -x.z };
return result;
@@ -28,6 +33,11 @@ V3f V3f_Scale(V3f x, F32 s) {
return result;
}
V3f V3f_Sub(V3f a, V3f b) {
V3f result = { a.x - b.x, a.y - b.y, a.z - b.z };
return result;
}
F32 V3f_Dot(V3f a, V3f b) {
F32 result = (a.x * b.x) + (a.y * b.y) + (a.z * b.z);
return result;
@@ -140,7 +150,7 @@ Mat4x4FInv M4x4F_CameraView(V3f x, V3f y, V3f z, V3f p) {
//
V3f ix = V3f_Scale(x, 1.0f / V3f_Dot(x, x));
V3f iy = V3f_Scale(y, 1.0f / V3f_Dot(y, y));
V3f iz = V3f_Scale(z, 1.0f / V3f_Dot(z, y));
V3f iz = V3f_Scale(z, 1.0f / V3f_Dot(z, z));
// Calculate inverse position
//

View File

@@ -98,14 +98,23 @@ struct R2f {
V2f max;
};
typedef struct R3f R3f;
struct R3f {
V3f min;
V3f max;
};
function V2f V2F(F32 x, F32 y);
function V3f V3F(F32 x, F32 y, F32 z);
function V4f V4F(F32 x, F32 y, F32 z, F32 w);
function R2f R2F(V2f min, V2f max);
function V2f V2f_Scale(V2f x, F32 s);
function V3f V3f_Neg(V3f x);
function V3f V3f_Scale(V3f x, F32 s);
function V3f V3f_Sub(V3f a, V3f b);
function F32 V3f_Dot(V3f a, V3f b);
function F32 V4f_Dot(V4f a, V4f b);