adding gfx and ui stuff

This commit is contained in:
Daniel Ledda
2026-06-04 18:22:30 +02:00
parent d676c50961
commit 4dfac3f82f
48 changed files with 26734 additions and 3 deletions

26
gfx/world/camera.c Normal file
View File

@@ -0,0 +1,26 @@
#include "camera.h"
#include "../../vendor/raymath.h"
Camera createCamera(int32 width, int32 height) {
return (Camera){
.view = (Matrix){0},
.proj = MatrixPerspective(DEG2RAD * 45.0f, (real32)width/(real32)height, 0.1f, 100.0f),
.pos = (Vec3){0},
.up = (Vec3){0,1,0},
};
}
void cameraSetAspect(Camera *c, int32 width, int32 height) {
real32 aspectRatio = (real32)width/(real32)height;
c->proj = MatrixPerspective(DEG2RAD * 45.0f, aspectRatio, 0.1f, 100.0f);
}
void cameraLookAt(Camera *c, float x, float y, float z) {
c->target = (Vec3){x, y, z};
c->view = MatrixLookAt(c->pos, c->target, c->up);
}
void cameraSetUp(Camera *c, real32 up_x, real32 up_y, real32 up_z) {
c->up = (Vec3){up_x, up_y, up_z};
}