feat: separate 2d scenes viewports and explicit cameras

This commit is contained in:
2026-11-10 22:42:56 +08:00
parent 32d7ada3ab
commit 040b779f5f
29 changed files with 1309 additions and 70 deletions
+11
View File
@@ -96,6 +96,8 @@ pub fn project(vm: &mut Vm, table: &MountTable, root: &UiNode, frame: &mut Frame
let mut contexts = HashMap::<u64, (f32, f32, Option<[f32; 4]>)>::new();
frame.commands.clear();
frame.command_clips.clear();
frame.command_mounts.clear();
frame.command_views.clear();
for (i, m) in frame.mounts.iter_mut().enumerate() {
let (dx, dy, clip) = m
.parent
@@ -176,6 +178,7 @@ pub fn project(vm: &mut Vm, table: &MountTable, root: &UiNode, frame: &mut Frame
) {
frame.commands.push(command);
frame.command_clips.push(m.clip);
frame.command_mounts.push(m.id);
}
}
if frame.commands.len() > 10_000 {
@@ -256,6 +259,14 @@ pub fn into_view(
};
let mount = cx.store().payload::<Mount>(owner, "Mount")?.clone();
parent = mount.parent;
if mount.geometry.canvas_viewport {
rect = [
mount.geometry.x,
mount.geometry.y,
mount.geometry.width,
mount.geometry.height,
];
}
if let Some(offset) = mount.geometry.scroll {
let delta = |start: f32, length: f32, viewport: f32, size: f32| {
if start < viewport {