forked from 1b-agent/opencadstudio-upstream
refactor: remove the legacy full view_proj (CPU cull now relative-to-eye)
The GPU draws exclusively via the rotation-only `view_rot` + eye double- single; the full view-projection survived only to project AABBs in the CPU frustum-cull / scissor / LOD passes. Migrate those to the same relative-to-eye math (project `point - eye` through `view_rot`) — pixel- equivalent but precise at UTM scale — then drop the dead uniform: - pipeline cull/scissor/LOD helpers take (view_rot, eye) instead of the full view_proj; render.rs reconstructs eye from the uniform's eye_high/eye_low and passes the cropped view_rot. - Remove the `view_proj` field from the shared Uniforms struct and all six shader structs that only declared it for layout (none read it), and delete Camera::view_proj(). The struct shrinks by one mat4 on both sides, keeping the Rust / WGSL layouts in lock-step. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
5a8ec35f4f
commit
04c93df2c4
10 files changed
+57
-80
No files matched your search
@@ -91,28 +91,6 @@ impl Camera {
|
||||
|
||||
// ── Projection matrices ────────────────────────────────────────────────
|
||||
|
||||
pub fn view_proj(&self, bounds: Rectangle) -> Mat4 {
|
||||
let aspect = bounds.width / bounds.height;
|
||||
|
||||
// Up vector: use the rotation to find which world direction is "up"
|
||||
// in the current camera frame.
|
||||
let up_dir = self.rotation * Vec3::Y;
|
||||
|
||||
let view = Mat4::look_at_rh(self.eye(), self.target.as_vec3(), up_dir);
|
||||
let proj = match self.projection {
|
||||
Projection::Perspective => {
|
||||
Mat4::perspective_rh(self.fov_y, aspect, self.distance * 0.001, self.distance * 1000.0)
|
||||
}
|
||||
Projection::Orthographic => {
|
||||
let h = self.ortho_size();
|
||||
let w = h * aspect;
|
||||
let (near, far) = self.ortho_depth_range();
|
||||
Mat4::orthographic_rh(-w, w, -h, h, near, far)
|
||||
}
|
||||
};
|
||||
OPENGL_TO_WGPU * proj * view
|
||||
}
|
||||
|
||||
/// Orthographic near/far that CENTRE the target plane at ndc-z ≈ 0.5.
|
||||
///
|
||||
/// The draw-order depth bias shifts clip-z by ±`DRAW_ORDER_BIAS` (0.001).
|
||||
|
||||
Reference in new issue
Block a user