forked from 1b-agent/opencadstudio-upstream
perf(scene): extend viewport scissor to hatch / image / wipeout passes (Phase 1.4)
Wire pass already uses `WireModel.vp_scissor` to clip viewport-projected geometry to its paper-space viewport rect; hatch / image / wipeout passes drew across the whole canvas. When a future paper-space path projects fills/images into a viewport, they would bleed past the viewport frame. Add `vp_scissor: Option<[f32; 4]>` to HatchModel and ImageModel (mirroring WireModel), forward it through HatchGpu / ImageGpu, and add per-pass `compute_*_scissors` / `set_scissor_rect` machinery. Factored the wire-side scissor-projection math into a shared `project_scissor` helper. Field defaults to None at every constructor site — no producer sets it yet, so this is plumbing for the paper-viewport fill projection that Phase 1.4 unblocks without changing current visual output. Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
1 parent
9a4531bd8e
commit
fbbac423d4
8 files changed
+145
-24
No files matched your search
@@ -23,6 +23,10 @@ pub struct ImageModel {
|
||||
/// [2] origin + U*W + V*H (top-right)
|
||||
/// [3] origin + V*H (top-left)
|
||||
pub corners: [[f32; 3]; 4],
|
||||
/// Optional world-space XY rect [x0, y0, x1, y1] for paper-space
|
||||
/// viewport clipping. Mirrors `WireModel.vp_scissor` /
|
||||
/// `HatchModel.vp_scissor`.
|
||||
pub vp_scissor: Option<[f32; 4]>,
|
||||
}
|
||||
|
||||
impl ImageModel {
|
||||
@@ -56,6 +60,7 @@ impl ImageModel {
|
||||
height,
|
||||
opacity,
|
||||
corners,
|
||||
vp_scissor: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user