fix: restore paper-space viewport rendering as single full-canvas widget

Iced 0.14 batches all shader prepare() calls before any render() calls.
Multiple ViewportPane widgets sharing the same Pipeline type overwrite
each other's GPU buffers, causing the PaperSheet layer (full-canvas) to
render the last viewport's model content — appearing full-screen.

Fix: paper_canvas_view() now renders a single full-canvas PaperSheet
widget. build_paper_sheet_primitive() is updated to include model-space
content projected through each viewport's view matrix (via
viewport_content_wires()), restoring the original working behaviour.

ViewportPane::Paper mode and viewport_screen_rect() are kept with
#[allow(dead_code)] — a per-viewport wgpu sub-renderer that accumulates
data across frames could revive them in the future.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Sonnet 4.6 committed 2026-04-23 03:02:01 +03:00
1 parent 592e3da6ac
commit d1d4bb3d02
4 files changed
+33 -62

No files matched your search

+12 -3
View File
@@ -9,10 +9,17 @@ use iced::{mouse, Event, Rectangle};
pub enum ViewportPaneMode {
/// Full model space — fills whatever bounds Iced assigns.
Model,
/// Paper-space entities only (title blocks, frames, borders) using the
/// paper-space camera. No viewport content projection.
/// Paper-space entities plus model content projected through viewports.
/// Used for the full paper canvas (single widget, no per-viewport widgets).
PaperSheet,
/// Model-space content seen through a specific paper-space Viewport entity.
/// Model-space content rendered through a specific viewport's 3-D camera.
///
/// NOTE: Currently unused because Iced 0.14 batches all shader `prepare()`
/// calls before any `render()` calls. Multiple widgets sharing the same
/// `Pipeline` type overwrite each other's GPU buffers. A per-viewport
/// wgpu sub-renderer that accumulates data across frames would be needed to
/// revive this path.
#[allow(dead_code)]
Paper { handle: Handle },
}
@@ -34,6 +41,8 @@ impl<'a> ViewportPane<'a> {
}
/// One paper-space viewport: model content rendered through its own camera.
/// See [`ViewportPaneMode::Paper`] for why this is currently unused.
#[allow(dead_code)]
pub fn paper(scene: &'a Scene, handle: Handle) -> Self {
Self { scene, mode: ViewportPaneMode::Paper { handle } }
}