feat: separate 2d scenes viewports and explicit cameras
This commit is contained in:
@@ -154,6 +154,14 @@ impl RenderCache {
|
||||
});
|
||||
}
|
||||
}
|
||||
if let Some(camera) = data.camera {
|
||||
for name in ["x", "y", "zoom"] {
|
||||
dependencies.push(Dependency {
|
||||
object: camera,
|
||||
property: Some(name.into()),
|
||||
});
|
||||
}
|
||||
}
|
||||
if !finish {
|
||||
if !path.insert(data_ref) {
|
||||
return Err(VmError::InvalidArgument("cyclic Block composition"));
|
||||
@@ -259,6 +267,27 @@ impl RenderCache {
|
||||
children,
|
||||
},
|
||||
Kind::Spacer(size) => UiKind::Spacer(*size),
|
||||
Kind::CanvasViewport { width, height } => UiKind::CanvasViewport {
|
||||
width: *width,
|
||||
height: *height,
|
||||
camera: crate::viewport::camera(
|
||||
store,
|
||||
data.camera
|
||||
.ok_or(VmError::InvalidArgument("missing camera"))?,
|
||||
)?,
|
||||
children,
|
||||
},
|
||||
Kind::Scene2D => UiKind::Scene2D {
|
||||
positions: data
|
||||
.children
|
||||
.iter()
|
||||
.map(|child| {
|
||||
let (_, child) = block::resolve(store, child.block)?;
|
||||
Ok(block::visual_data(store, child)?.position)
|
||||
})
|
||||
.collect::<Result<Vec<_>, VmError>>()?,
|
||||
children,
|
||||
},
|
||||
Kind::Overlay => UiKind::Overlay {
|
||||
padding: data.padding,
|
||||
children,
|
||||
|
||||
Reference in New Issue
Block a user