Renamed v2 camera ray procs and added auto normalization of screen coords

This commit is contained in:
2025-07-03 22:54:10 +02:00
parent 2408c03579
commit eb5121802f
3 changed files with 8 additions and 36 deletions

View File

@@ -220,7 +220,7 @@ update_transform_gizmo :: (ray: Ray, mouse_position: Vector2) -> bool {
r1.origin = selected_entity.transform.position;
r1.direction = rotate(axis_vec, engine.editor.transform_gizmo.transform.orientation);
r2 := normalized_screen_to_ray_v2(*engine.editor.camera, mouse_position);
r2 := normalized_screen_to_ray(*engine.editor.camera, mouse_position);
d, t1, t2 := closest_distance_between_rays(r1, r2);
@@ -376,11 +376,7 @@ update_transform_gizmo :: (ray: Ray, mouse_position: Vector2) -> bool {
mouse_position.x = xx engine.input.mouse.x;
mouse_position.y = xx engine.input.mouse.y;
screen_size : Vector2;
screen_size.x = cast(float)engine.window.width;
screen_size.y = cast(float)engine.window.height;
r2 := screen_to_ray_v2(*engine.editor.camera, mouse_position, screen_size);
r2 := screen_to_ray(*engine.editor.camera, mouse_position);
d, t1, t2 := closest_distance_between_rays(r1, r2);
new_position := r1.origin + r1.direction * t1;