paint: add point_in_aabb

This commit is contained in:
luboslenco
2026-06-29 19:26:21 +02:00
parent 8e956881c2
commit 51c43fffed
2 changed files with 14 additions and 2 deletions
+12 -1
View File
@@ -1,6 +1,17 @@
#include "../global.h"
vec4_t raycast_aabb(object_t *object, f32 mouse_x, f32 mouse_y) {
vec4_t raycast_aabb_mouse(object_t *object) {
return raycast_box_intersect(object->transform, mouse_x, mouse_y, scene_camera);
}
bool point_in_aabb(object_t *object, vec4_t point) {
transform_t *t = object->transform;
f32 cx = transform_world_x(t);
f32 cy = transform_world_y(t);
f32 cz = transform_world_z(t);
f32 hx = t->dim.x / 2;
f32 hy = t->dim.y / 2;
f32 hz = t->dim.z / 2;
return point.x >= cx - hx && point.x <= cx + hx && point.y >= cy - hy && point.y <= cy + hy && point.z >= cz - hz && point.z <= cz + hz;
}