feat: GPU scissor rect for paper-space viewport wires

Viewport-projected wires now clip at pixel level to their viewport boundary.

- WireModel.vp_scissor: Option<[f32; 4]> — paper-space bbox set on projection
- WireGpu.vp_scissor carries it through to the draw loop
- Pipeline.compute_wire_scissors() converts paper→NDC→pixel each frame
- render() calls set_scissor_rect() per wire, reset after viewport group
- INTEGRATION_GAPS.md: Viewport ⚠️ → ✅, all 51 gaps resolved

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-05-06 07:12:05 +03:00
commit 899b3f4796
38 changed files with 112 additions and 13 deletions

View file

@ -111,11 +111,16 @@ impl WireVertex {
pub struct WireGpu {
pub vertex_buffer: wgpu::Buffer,
pub vertex_count: u32,
/// Paper-space bbox [x0, y0, x1, y1] for GPU scissor clipping.
/// Set only for viewport-projected wires; None for regular wires.
pub vp_scissor: Option<[f32; 4]>,
}
impl WireGpu {
pub fn new(device: &wgpu::Device, wire: &WireModel) -> Self {
Self::build(device, wire, wire.color)
let mut g = Self::build(device, wire, wire.color);
g.vp_scissor = wire.vp_scissor;
g
}
/// Creates a ghost copy with `alpha` applied on top of the wire's own alpha.
@ -209,6 +214,7 @@ impl WireGpu {
Self {
vertex_buffer,
vertex_count: chunk.len() as u32,
vp_scissor: None,
}
})
.collect()
@ -310,6 +316,7 @@ impl WireGpu {
Self {
vertex_buffer,
vertex_count: vertices.len() as u32,
vp_scissor: None,
}
}
}