feat: render programmable 3d scenes cameras and picking
This commit is contained in:
+15
-1
@@ -432,7 +432,9 @@ fn shape(node: &UiNode, children: Vec<Size>, constraints: [f32; 4]) -> Result<Sh
|
||||
size.height + padding.vertical(),
|
||||
)
|
||||
}
|
||||
UiKind::CanvasViewport { width, height, .. } => Shape::Rect(*width, *height),
|
||||
UiKind::CanvasViewport { width, height, .. } | UiKind::Viewport3D { width, height, .. } => {
|
||||
Shape::Rect(*width, *height)
|
||||
}
|
||||
UiKind::Canvas { positions, .. } | UiKind::Scene2D { positions, .. } => {
|
||||
let mut size = Size::default();
|
||||
for (position, child) in positions.iter().zip(children) {
|
||||
@@ -490,6 +492,13 @@ pub fn paint_native(node: &UiNode, x: f32, y: f32, size: Size) -> Option<RenderC
|
||||
let size_for_text = size;
|
||||
let inset = insets(node);
|
||||
match &node.kind {
|
||||
UiKind::Viewport3D { view, .. } => Some(RenderCommand::Scene3D {
|
||||
x: x + inset.left,
|
||||
y: y + inset.top,
|
||||
width: (size.width - inset.horizontal()).max(0.),
|
||||
height: (size.height - inset.vertical()).max(0.),
|
||||
view: view.clone(),
|
||||
}),
|
||||
UiKind::Text { value, size, color } => Some(RenderCommand::Text {
|
||||
x: x + inset.left,
|
||||
y: y + inset.top,
|
||||
@@ -1009,6 +1018,11 @@ impl LayoutRuntime {
|
||||
coordinate(y + size.height)?;
|
||||
mounts.push(MountGeometry {
|
||||
canvas_viewport: matches!(item.node.kind, UiKind::CanvasViewport { .. }),
|
||||
scene3d_viewport: matches!(item.node.kind, UiKind::Viewport3D { .. }),
|
||||
camera_controls: matches!(
|
||||
item.node.kind,
|
||||
UiKind::CanvasViewport { .. } | UiKind::Viewport3D { controls: true, .. }
|
||||
),
|
||||
viewport_clip: None,
|
||||
view: None,
|
||||
id: item.id,
|
||||
|
||||
Reference in New Issue
Block a user