refactor(render): drop dead camera_pos from the shared uniform
No GPU pipeline reads camera_pos any more — lighting and all transforms moved to the relative-to-eye path (view_rot + eye_high/eye_low). Remove the field from the shared Uniforms and every shader struct, plus the now unused Camera::position_vec4. view_proj stays: the CPU frustum-cull / scissor / LOD passes still project offset-relative AABBs with it (it is no longer part of any GPU draw). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
ddf6344dbe
commit
65413a2c2a
8 changed files with 4 additions and 11 deletions
|
|
@ -4,8 +4,11 @@ use iced::Rectangle;
|
|||
#[derive(Copy, Clone, Debug, bytemuck::Pod, bytemuck::Zeroable)]
|
||||
#[repr(C)]
|
||||
pub struct Uniforms {
|
||||
/// Full view-projection (with translation) — GPU rendering no longer uses
|
||||
/// this; it remains for the CPU-side frustum-cull / scissor / LOD passes
|
||||
/// that project offset-relative AABBs to screen. The GPU draws via the
|
||||
/// relative-to-eye `view_rot` + `eye_high`/`eye_low` below.
|
||||
pub view_proj: glam::Mat4,
|
||||
pub camera_pos: glam::Vec4,
|
||||
pub viewport_size: [f32; 2],
|
||||
/// World units per screen pixel at the current zoom. Used by the
|
||||
/// hatch shader to substitute solid fill when pattern line spacing
|
||||
|
|
@ -52,7 +55,6 @@ impl Uniforms {
|
|||
let (eye_high, eye_low) = camera.eye_high_low();
|
||||
Self {
|
||||
view_proj: camera.view_proj(bounds),
|
||||
camera_pos: camera.position_vec4(),
|
||||
viewport_size: [bounds.width, bounds.height],
|
||||
world_per_pixel,
|
||||
lwdisplay_enable: if lwdisplay_enable { 1.0 } else { 0.0 },
|
||||
|
|
|
|||
|
|
@ -228,9 +228,6 @@ impl Camera {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn position_vec4(&self) -> glam::Vec4 {
|
||||
glam::Vec4::from((self.eye(), 0.0))
|
||||
}
|
||||
|
||||
// ── ViewCube rotation matrix ───────────────────────────────────────────
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
struct Uniforms {
|
||||
view_proj: mat4x4<f32>,
|
||||
camera_pos: vec4<f32>,
|
||||
viewport_size: vec2<f32>,
|
||||
world_per_pixel: f32,
|
||||
lwdisplay_enable: f32,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
struct Uniforms {
|
||||
view_proj: mat4x4<f32>,
|
||||
camera_pos: vec4<f32>,
|
||||
viewport_size: vec2<f32>,
|
||||
world_per_pixel: f32,
|
||||
lwdisplay_enable: f32,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
struct Uniforms {
|
||||
view_proj: mat4x4<f32>,
|
||||
camera_pos: vec4<f32>,
|
||||
viewport_size: vec2<f32>,
|
||||
world_per_pixel: f32,
|
||||
lwdisplay_enable: f32,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
// Must match the shared `Uniforms` struct (scene::pipeline::uniforms, 112 B).
|
||||
struct Uniforms {
|
||||
view_proj: mat4x4<f32>,
|
||||
camera_pos: vec4<f32>,
|
||||
viewport_size: vec2<f32>,
|
||||
world_per_pixel: f32,
|
||||
lwdisplay_enable: f32,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
struct Uniforms {
|
||||
view_proj: mat4x4<f32>,
|
||||
camera_pos: vec4<f32>,
|
||||
viewport_size: vec2<f32>,
|
||||
world_per_pixel: f32,
|
||||
lwdisplay_enable: f32,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
struct Uniforms {
|
||||
view_proj: mat4x4<f32>,
|
||||
camera_pos: vec4<f32>,
|
||||
viewport_size: vec2<f32>,
|
||||
world_per_pixel: f32,
|
||||
// LWDISPLAY toggle: 0.0 = force 1 px (half_width 0.5), 1.0 = use the
|
||||
|
|
|
|||
Loading…
Reference in a new issue