paint: add point_in_aabb
This commit is contained in:
@@ -492,7 +492,8 @@ void util_render_make_node_preview(ui_node_canvas_t *canvas, ui_node_t *nod
|
||||
void util_render_pick_pos_nor_tex();
|
||||
mat4_t util_render_get_decal_mat();
|
||||
void util_brush_update();
|
||||
vec4_t raycast_aabb(object_t *object, f32 mouse_x, f32 mouse_y);
|
||||
vec4_t raycast_aabb_mouse(object_t *object);
|
||||
bool point_in_aabb(object_t *object, vec4_t point);
|
||||
void util_resize_borders();
|
||||
void util_select_update();
|
||||
void util_shortcut_brush();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user