Skip to content

Update to Bevy 0.19 - #78

Open
aevyrie wants to merge 6 commits into
mainfrom
bevy-0.19
Open

Update to Bevy 0.19#78
aevyrie wants to merge 6 commits into
mainfrom
bevy-0.19

Conversation

@aevyrie

@aevyrie aevyrie commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

Bevy 0.19 update itself:

  • Updates all bevy_* pins from 0.18.0 to 0.19.0 and adapts to the renamed/moved APIs (SceneRoot -> WorldAssetRoot, FontSize::Px, TextLayout::justify, shadow_maps_enabled, Skybox::image now optional, Hdr in bevy::camera, fallible SystemState::get_mut).
  • Adds a multi_threaded feature that passes through to bevy_ecs, bevy_tasks, and bevy_transform, since 0.19 no longer implies parallel transform propagation via std.
  • Derives Clone on BigSpace and Default + Clone + Copy + Debug on FloatingOrigin so both are usable in 0.19's bsn! scene templates. Grid and CellCoord were already compatible.
  • Fixes Rust 1.97 clippy lints (while_let_loop, some_filter) that would fail -D warnings on the current stable.
  • Fixes first_frame_spawn_waits_for_fixed_update by pausing Time<Virtual> so FixedUpdate cannot tick between Frame 0 and Frame 1 on a loaded machine.
  • Bumps big_space to 0.13.0 and adds a compat row to the README.

Also included (pre-existing issues surfaced while manually validating each example):

  • Adds a run_examples binary. cargo run --bin run_examples walks every examples/*.rs sequentially, waiting for each window to close before launching the next. Discovers examples at runtime; new ones show up automatically. Cross-platform, no shell.
  • Adds a BigSpaceDebugPlugins group. BigSpaceDefaultPlugins no longer auto-adds BigSpaceDebugPlugin; instead the new group bundles CellHashingPlugin::<()>, PartitionPlugin::<()>, and BigSpaceDebugPlugin::default(). Debug visualization is now a single explicit opt-in that arrives complete, avoiding the hidden auto-add that caused startup warnings for filtered-hashing setups and duplicate-plugin panics for callers who added the debug plugin explicitly. BigSpaceDebugPlugin also warns at startup if CellHashingPlugin<F> or PartitionPlugin<F> are missing, as a safety net for callers who add the raw plugin without the group.
  • nearest_via_partitions now walks CellCoord descendants (depth-first, considering every Aabb-bearing node, pruning at nested CellCoord boundaries), so scenes loaded via WorldAssetRoot participate in the search. Previously the camera failed to slow near GLTF objects because the mesh sits on a descendant of the CellCoord root. Also fixes a related issue where entity_nearest_distance scaled the Aabb by the entity's local Transform and missed ancestor scale, so a mesh under a scaled WorldAssetRoot reported the wrong size (uses GlobalTransform::scale() now). Brute-force and partition paths share a single candidate-filter helper so they can't drift.

Closes #73 and closes #77 with credit to @m-edlund and @rozgo (co-authored on the first commit). The Bevy 0.19 update itself is deliberately scoped narrower than #77. It leaves out the bundle removals, new required components, debug cell labels, BSN example, and additional plugin installations. Those changes from #77 are worth discussing on their own merit in follow-up PRs rather than folded into a version bump.

aevyrie and others added 6 commits July 15, 2026 23:38
Version pins bumped from 0.18.0 to 0.19.0. API adaptations:
- SceneRoot -> WorldAssetRoot
- TextFont: font_size: f32 -> FontSize::Px
- TextLayout::new_with_justify -> TextLayout::justify
- DirectionalLight: shadows_enabled -> shadow_maps_enabled
- Skybox::image is now Option<Handle<Image>>
- Hdr moved from bevy::render::view to bevy::camera
- SystemState::get_mut is now fallible; tests unwrap

Add a multi_threaded feature that passes through to bevy_ecs, bevy_tasks,
and bevy_transform, since Bevy 0.19 no longer implies parallel transform
propagation via std.

Derive Clone on BigSpace and Default + Clone + Copy + Debug on FloatingOrigin
so both are usable in bsn! scene templates (blanket-implemented for
Default + Clone components). Grid and CellCoord were already compatible.

Fix Rust 1.97 clippy lints: while_let_loop in stationary::mark_ancestor_grids
and some_filter in BigSpace::validate_floating_origin.

Fix first_frame_spawn_waits_for_fixed_update by pausing Time<Virtual> so
FixedUpdate cannot tick between Frame 0 and Frame 1 on a loaded machine.

Bump big_space to 0.13.0, add compat row to README.

Co-authored-by: Martin Edlund <edlund@netzwerkplan.de>
Co-authored-by: Alex Rozgo <alex.rozgo@gmail.com>
Runs each example in alphabetical order, waiting for its window to close
before launching the next. Discovers examples at runtime by scanning
examples/*.rs, so new examples are picked up automatically.

Uses env!("CARGO") + std::process::Command, so it works on any host
without a shell. Run with: cargo run --bin run_examples
BigSpaceDebugPlugin's cell visualization reads PartitionLookup<F>, which
comes from PartitionPlugin<F> backed by CellHashingPlugin<F>. Those are
deliberately not added here because spatial hashing has runtime cost that
should stay an explicit opt-in.

Previously, a caller who added BigSpaceDebugPlugin without also adding
the two hashing plugins silently got no cell visualization. This adds a
Plugin::finish check that logs a warning naming the missing plugin(s)
with their exact SpatialHashFilter parameterization.

Every example that uses BigSpaceDefaultPlugins now installs the two
plugins explicitly so the warning does not fire for shipped examples.
…arch

nearest_via_partitions iterates entities tracked by CellHashingPlugin,
which only tracks entities with CellCoord. Scenes loaded via
WorldAssetRoot put the mesh on a descendant of the CellCoord root, so
the mesh's Aabb was invisible to the search and the camera failed to
slow down near GLTF-loaded objects (the planets example spaceship).

When a partition entity has no Aabb of its own, walk its descendants
and stop at the first Aabb-carrying one. Under the existing invariant
that objects fit inside their cell, that first hit is a valid proxy for
the whole object. When the partition entity does have its own Aabb (the
inline-mesh case), the walk is skipped, so this costs one extra
Query::contains check on entities that had a match anyway.

The brute-force fallback path already handled this because it iterates
every entity matching the objects query directly.
Fixes several defects in the descendant walk of the partition-accelerated
nearest-object search:

- It stopped at the first Aabb-carrying descendant even when that descendant
  was rejected by the candidate filters (render layer, visibility, camera's
  own children), hiding valid sibling meshes of the same scene. Replaced
  with a depth-first walk that considers every Aabb-bearing node.
- The walk was unbounded for a partition entity whose subtree had no Aabb.
  It now prunes nested CellCoord subtrees, since each is a distinct spatial
  object visited through its own cell entry; this bounds the walk to one
  object's hierarchy and avoids considering an entity twice.
- entity_nearest_distance scaled the Aabb by the entity's local Transform,
  ignoring ancestor scale, so a mesh under a scaled WorldAssetRoot reported
  the wrong size. It now uses the world scale from GlobalTransform.
- The partition path did a redundant contains() then get() per entity, and
  duplicated the candidate-filter logic already in the brute-force path.
  Both paths now share candidate_distance() and a NearestCtx context, and
  the unused Transform is dropped from the objects query.

Also replace Unicode arrows and dashes in code comments with ASCII.
BigSpaceDefaultPlugins previously auto-added BigSpaceDebugPlugin::<()>
under the debug feature. That was invisible to the caller and caused two
friction points: users with a filtered hashing setup saw a startup
warning about the ()-parameterized dependencies they never asked for,
and users who followed the debug plugin's docs and added it explicitly
alongside the default group panicked on Bevy's duplicate-plugin check.

Remove the auto-add and introduce BigSpaceDebugPlugins, a group that
bundles CellHashingPlugin::<()>, PartitionPlugin::<()>, and
BigSpaceDebugPlugin::default(). Debug visualization is now a single
explicit opt-in that arrives complete, and the debug plugin's docstring
points at the group as the recommended path.

Every example that used to hand-roll the three plugins now uses the
group. spatial_hash keeps its explicit composition because it uses the
hashing infrastructure for its own demonstration rather than for gizmos.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant