Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

What is drawn is measured as it is posed. The scene's bounds (what a free camera frames) were each mesh's own box placed by its own node, which says nothing of a skinned mesh: a rigged model under a scaled armature measured a fraction of what was drawn, and a camera framing it stood inside it. view::bounds now takes the vertices the frame draws (layer.rs drawn, the ones a pick's ray is cast against), so a skinned mesh is measured where its joints put it. Seen in raea.app 0.1.0-dev.1109.42 on a launch-film cat: the whole model in frame, its parts pointable.

shinyobjectz07e47b4ee14d
diff --git a/docs/preview.feature b/docs/preview.feature
index b1cbfc2c..36638ca1 100644
--- a/docs/preview.feature
+++ b/docs/preview.feature
@@ -125,6 +125,11 @@ Feature: Preview: anything in a project opens at once, in its space, with its pr
# frame the same bytes. What is left is the script's own pass (its solids are cut again there, through the
# /3d manifold calls: not kept yet) and the models' loading. A still for Source or a poster is drawn through
# raea play, one at a time at low priority, and not while a stage the person opened is still opening.
+ # 11-10, models from a real project (the launch film's): a rigged cat under a scaled armature opened with the
+ # camera inside it, and a strand of cheese that seven morph targets pull from 2 cm to 17 cm drew nothing. What
+ # is drawn is measured as posed (raea-sys-frame view bounds, from the same vertices a pick's ray meets), a
+ # model's box counts its morph targets, its view's near plane follows its size, and the page moves the camera
+ # out to what the stage draws. Fourteen of its models list under 3D; four were opened, a part clicked on each.
@done
Scenario: PV3b. The store is managed in one place
Then Settings lists the store by project and kind with sizes, and offers Clear and Rebuild; copies whose source
diff --git a/systems/frame/src/view.rs b/systems/frame/src/view.rs
index f16abb08..59bd4ff1 100644
--- a/systems/frame/src/view.rs
+++ b/systems/frame/src/view.rs
@@ -63,21 +63,16 @@ pub fn orbit_of(camera: &GlobalTransform, target: Vec3) -> Orbit {
Orbit { yaw: off.x.atan2(off.z), pitch: (off.y / distance).clamp(-1.0, 1.0).asin(), distance, target }
}
-/// The middle and radius of everything drawn (every shown mesh's place), for a camera to frame.
+/// The middle and radius of everything drawn, for a camera to frame: every shown mesh's vertices where the frame
+/// draws them (layer.rs drawn), so a skinned mesh is measured as its joints pose it. Its own box placed by its own
+/// node says nothing of that: a rigged model whose armature is scaled was framed from far inside it.
pub fn bounds(world: &mut World) -> Option<(Vec3, f32)> {
- let mut q = world.query::<(&GlobalTransform, &bevy::camera::primitives::Aabb, Option<&InheritedVisibility>)>();
let (mut lo, mut hi) = (Vec3::splat(f32::MAX), Vec3::splat(f32::MIN));
- for (g, a, shown) in q.iter(world) {
- if shown.is_some_and(|s| !s.get()) {
- continue;
+ crate::layer::drawn(world, |_, _, posed, _| {
+ for p in posed.iter().filter(|p| p.is_finite()) {
+ (lo, hi) = (lo.min(*p), hi.max(*p));
}
- let (c, h) = (Vec3::from(a.center), Vec3::from(a.half_extents));
- for k in 0..8 {
- let corner = c + h * Vec3::new(if k & 1 == 0 { -1.0 } else { 1.0 }, if k & 2 == 0 { -1.0 } else { 1.0 }, if k & 4 == 0 { -1.0 } else { 1.0 });
- let p = g.transform_point(corner);
- (lo, hi) = (lo.min(p), hi.max(p));
- }
- }
+ });
(lo.x <= hi.x).then(|| ((lo + hi) * 0.5, ((hi - lo) * 0.5).length()))
}