chore(glam): use camera-module projection API for deprecated Mat4 rh ctors

glam 0.33.2 deprecated Mat4::{orthographic,perspective,look_at}_rh in
favour of the glam::camera::rh::* functions. Switch the 7 call sites in
camera.rs and viewcube.rs to the equivalent camera-module functions
(directx orthographic/perspective = same [0,1] depth range; look_at_mat4
= same view matrix), silencing the deprecation warnings. No behaviour
change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-17 01:49:26 +03:00
1 parent 48e6d0d553
commit 3e34da4ac6
2 files changed
+10 -7

No files matched your search

+5 -4
View File
@@ -10,6 +10,7 @@
// with arcball orbit at all angles.
use bytemuck::{Pod, Zeroable};
use glam::camera::rh::proj::directx::orthographic;
use glam::{Mat4, Vec3, Vec4};
use iced::wgpu;
use iced::{Rectangle, Size};
@@ -208,7 +209,7 @@ impl CubeUniforms {
let inset = cube_half * NAV_INSET_F;
let cx = hw - inset - VIEWCUBE_PAD;
let cy = hh - inset - VIEWCUBE_PAD;
let view_proj = Mat4::orthographic_rh(-hw, hw, -hh, hh, -2000.0, 2000.0)
let view_proj = orthographic(-hw, hw, -hh, hh, -2000.0, 2000.0)
* Mat4::from_translation(Vec3::new(cx, cy, 0.0))
* Mat4::from_scale(Vec3::splat(cube_px as f32 * VIEWCUBE_SCALE));
Self {
@@ -580,7 +581,7 @@ impl ViewCubeText {
let cube_half = cube_px as f32 * VIEWCUBE_SCALE;
let inset = cube_half * NAV_INSET_F;
let (hw, hh) = (vw * 0.5, vh * 0.5);
let view_proj = Mat4::orthographic_rh(-hw, hw, -hh, hh, -2000.0, 2000.0)
let view_proj = orthographic(-hw, hw, -hh, hh, -2000.0, 2000.0)
* Mat4::from_translation(Vec3::new(
hw - inset - VIEWCUBE_PAD,
hh - inset - VIEWCUBE_PAD,
@@ -1349,7 +1350,7 @@ pub fn hit_test(
}
let (hw, hh) = (vp_w * 0.5, vp_h * 0.5);
let vp = Mat4::orthographic_rh(-hw, hw, -hh, hh, -2000.0, 2000.0)
let vp = orthographic(-hw, hw, -hh, hh, -2000.0, 2000.0)
* Mat4::from_translation(Vec3::new(
hw - inset - VIEWCUBE_PAD,
hh - inset - VIEWCUBE_PAD,
@@ -1431,7 +1432,7 @@ pub fn hit_test_cardinal(
}
let (hw, hh) = (vp_w * 0.5, vp_h * 0.5);
let vp = Mat4::orthographic_rh(-hw, hw, -hh, hh, -2000.0, 2000.0)
let vp = orthographic(-hw, hw, -hh, hh, -2000.0, 2000.0)
* Mat4::from_translation(Vec3::new(
hw - inset - VIEWCUBE_PAD,
hh - inset - VIEWCUBE_PAD,