Fixed for compiler version 0.2.012

This commit is contained in:
2025-05-22 22:13:14 +02:00
parent 721c6079bb
commit 69bafff6e9
7 changed files with 21 additions and 20 deletions

View File

@@ -140,7 +140,7 @@ screen_to_world :: (camera: Camera, screen_position: Vector2, distance: float) -
pos.z = 0.0;
pos.w = 1.0;
result := inverse(camera.projection_matrix * camera.view_matrix) * pos;
success :, result := inverse(camera.projection_matrix * camera.view_matrix) * pos;
result.x /= result.w;
result.y /= result.w;
result.z /= result.w;
@@ -178,7 +178,7 @@ normalized_screen_to_ray_v2 :: (camera: Camera, screen_position: Vector2) -> Ray
far.z = 1.0;
far.w = 1.0;
inverse_view_proj := inverse(camera.projection_matrix * camera.view_matrix);
success :, inverse_view_proj := inverse(camera.projection_matrix * camera.view_matrix);
ray_origin := inverse_view_proj * origin;
ray_end := inverse_view_proj * far;
@@ -211,7 +211,7 @@ screen_to_ray_v2 :: (camera: Camera, screen_position: Vector2, screen_size: Vect
far.z = 1.0;
far.w = 1.0;
inverse_view_proj := inverse(camera.projection_matrix * camera.view_matrix);
success :, inverse_view_proj := inverse(camera.projection_matrix * camera.view_matrix);
ray_origin := inverse_view_proj * origin;
ray_end := inverse_view_proj * far;
@@ -241,11 +241,12 @@ screen_to_ray :: (camera: *Camera, screen_position: Vector2, screen_size: Vector
ray_clip.z = -1.0;
ray_clip.w = 1.0;
ray_eye := inverse(camera.projection_matrix) * ray_clip;
success :, ray_eye := inverse(camera.projection_matrix) * ray_clip;
ray_eye.z = 1.0;
ray_eye.w = 0.0;
ray_world := to_v3(inverse(camera.view_matrix) * ray_eye);
success2 :, inv_cam_matrix := inverse(camera.view_matrix);
ray_world := to_v3(inv_cam_matrix * ray_eye);
ray.direction = normalize(ray_world);
return ray;