Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 3D Gizmo webgpu rendering #14652

Closed
wants to merge 130 commits into from

Commits on Jun 6, 2024

  1. Configuration menu
    Copy the full SHA
    2d11d9a View commit details
    Browse the repository at this point in the history
  2. Allow mix of hdr and non-hdr cameras to same render target (bevyengin…

    …e#13419)
    
    Changes:
    - Track whether an output texture has been written to yet and only clear
    it on the first write.
    - Use `ClearColorConfig` on `CameraOutputMode` instead of a raw
    `LoadOp`.
    - Track whether a output texture has been seen when specializing the
    upscaling pipeline and use alpha blending for extra cameras rendering to
    that texture that do not specify an explicit blend mode.
    
    Fixes bevyengine#6754
    
    ## Testing
    
    Tested against provided test case in issue:
    
    ![image](https://github.com/bevyengine/bevy/assets/10366310/d066f069-87fb-4249-a4d9-b6cb1751971b)
    
    ---
    
    ## Changelog
    
    - Allow cameras rendering to the same output texture with mixed hdr to
    work correctly.
    
    ## Migration Guide
    
    - - Change `CameraOutputMode` to use `ClearColorConfig` instead of
    `LoadOp`.
    tychedelia authored and mockersf committed Jun 6, 2024
    Configuration menu
    Copy the full SHA
    4320444 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5f2e927 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    79a93de View commit details
    Browse the repository at this point in the history

Commits on Jun 8, 2024

  1. Update crate metadata for bevy state (bevyengine#13722)

    - crate metadata for bevy_state has been copied from bevy_ecs
    
    - Update it
    mockersf committed Jun 8, 2024
    Configuration menu
    Copy the full SHA
    ce19b0f View commit details
    Browse the repository at this point in the history
  2. Document the Release Candidate process (bevyengine#13718)

    # Objective
    
    - Document how to release a RC
    
    ## Solution
    
    - Also allow CI to trigger on release branches
    mockersf committed Jun 8, 2024
    Configuration menu
    Copy the full SHA
    25306e7 View commit details
    Browse the repository at this point in the history
  3. rename the crate bevy_state_macros_official back to its original name (

    …bevyengine#13732)
    
    - Thanks to the original author we can now use the original name
    
    - Use it
    mockersf committed Jun 8, 2024
    Configuration menu
    Copy the full SHA
    c71fa76 View commit details
    Browse the repository at this point in the history
  4. Make the component types of the new animation players clonable. (bevy…

    …engine#13736)
    
    # Objective
    
    Some use cases might require holding onto the previous state of the
    animation player for change detection.
    
    ## Solution
    
    Added `clone` and `copy` implementation to most animation types. 
    Added optimized `clone_from` implementations for the specific use case
    of holding a `PreviousAnimationPlayer` component.
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    2 people authored and mockersf committed Jun 8, 2024
    Configuration menu
    Copy the full SHA
    4df9538 View commit details
    Browse the repository at this point in the history
  5. 13743 app exit hang (bevyengine#13744)

    Fixes bevyengine#13743.
    
    ---------
    
    Co-authored-by: Brezak <bezak.adam@proton.me>
    2 people authored and mockersf committed Jun 8, 2024
    Configuration menu
    Copy the full SHA
    971723e View commit details
    Browse the repository at this point in the history

Commits on Jun 9, 2024

  1. Clear messed up feature flag on AppExitStates impl (bevyengine#13737)

    # Objective
    
    - In bevyengine#13649 additional method had been added to AppExitStates, but there
    feature gate left for method in implementation for App at refactoring
    stage.
    - Fixes bevyengine#13733 .
    
    ## Solution
    
    - Removed the feature gate.
    
    ## Testing
    
    - Ran reproducing example from bevyengine#13733 with no compilation errors
    bugsweeper authored and mockersf committed Jun 9, 2024
    Configuration menu
    Copy the full SHA
    b14684e View commit details
    Browse the repository at this point in the history
  2. view.inverse_clip_from_world should be world_from_clip (bevyengine#13756

    )
    
    As per the other changes in
    bevyengine#13489
    `view.inverse_clip_from_world` should be `world_from_clip`.
    
    
    
    # Objective
    
    fixes bevyengine#13749
    
    ## Solution
    
    Modified lines.wgsl to use the right name as the current name does not
    exist.
    
    ## Testing
    
    I ran the 3d_gizmos example and pressed "p".
    
    ![screenshot-2024-06-08-at-13 21
    22@2x](https://github.com/bevyengine/bevy/assets/551247/b8bfd3db-8273-4606-9dae-040764339883)
    
    ![screenshot-2024-06-08-at-13 21
    26@2x](https://github.com/bevyengine/bevy/assets/551247/2619f1ae-ce83-44d7-a9fc-07e686950887)
    ChristopherBiscardi authored and mockersf committed Jun 9, 2024
    Configuration menu
    Copy the full SHA
    7ae3c94 View commit details
    Browse the repository at this point in the history
  3. Fix EntityCommands::despawn docs (bevyengine#13774)

    # Objective
    
    The `EntityCommands::despawn` method was previously changed from
    panicking behavior to a warning, but the docs continue to state that it
    panics.
    
    ## Solution
    
    - Removed panic section, copied warning blurb from `World::despawn`
    - Adds a similar warning blurb to
    `DespawnRecursiveExt::despawn_recursive` and
    `DespawnRecursiveExt::despawn_descendants`
    thebluefish authored and mockersf committed Jun 9, 2024
    Configuration menu
    Copy the full SHA
    621cd23 View commit details
    Browse the repository at this point in the history

Commits on Jun 10, 2024

  1. Let init_non_send_resource require FromWorld instead of Default (bevy…

    …engine#13779)
    
    # Objective
    
    - Let `init_non_send_resource` take `FromWorld` values again, not only
    `Default`
    - This reverts an unintended breaking change introduced in bevyengine#9202
    
    ## Solution
    
    - The resource initialized with `init_non_send_resource` requires
    `FromWorld` again
    NiklasEi authored and mockersf committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    91db570 View commit details
    Browse the repository at this point in the history
  2. 2D top-down camera example (bevyengine#12720)

    # Objective
    
    This PR addresses the 2D part of bevyengine#12658. I plan to separate the examples
    and make one PR per camera example.
    
    ## Solution
    
    Added a new top-down example composed of:
    
    - [x] Player keyboard movements
    - [x] UI for keyboard instructions
    - [x] Colors and bloom effect to see the movement of the player
    - [x] Camera smooth movement towards the player (lerp)
    
    ## Testing
    
    ```bash
    cargo run --features="wayland,bevy/dynamic_linking" --example 2d_top_down_camera
    ```
    
    
    
    https://github.com/bevyengine/bevy/assets/10638479/95db0587-e5e0-4f55-be11-97444b795793
    theredfish authored and mockersf committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    be65fbb View commit details
    Browse the repository at this point in the history
  3. Add segments to ExtrusionBuilder (bevyengine#13719)

    # Objective
    
    - Add support for `segments` for extrusion-meshes, akin to what is
    possible with cylinders
    
    ## Solution
    
    - Added a `.segments(segments: usize)` function to `ExtrusionBuilder`.
    - Implemented support for segments in the meshing algorithm.
    - If you set `.segments(0)`, the meshing will fail, just like it does
    with cylinders.
    
    ## Additional information
    
    Here is a wireframe of some extrusions with 1, 2, 3, etc. segments:
    
    ![image_2024-06-06_233205114](https://github.com/bevyengine/bevy/assets/62256001/358081e2-172d-407b-8bdb-9cda88eb4664)
    
    ---------
    
    Co-authored-by: Lynn Büttgenbach <62256001+solis-lumine-vorago@users.noreply.github.com>
    2 people authored and mockersf committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    a2c5b0d View commit details
    Browse the repository at this point in the history
  4. Improve error handling for AssetServer::add_async (bevyengine#13745)

    # Objective
    
    The method `AssetServer::add_async` (added in
    bevyengine#13700) requires a future that
    returns an `AssetLoadError` error, which was a bit of an oversight on my
    part, as that type of error only really makes sense in the context of
    bevy's own asset loader -- returning it from user-defined futures isn't
    very useful.
    
    ## Solution
    
    Allow passing custom error types to `add_async`, which get cast into a
    trait object matching the form of `AssetLoader::load`. If merged before
    the next release this will not be a breaking change
    JoJoJet authored and mockersf committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    1ae616f View commit details
    Browse the repository at this point in the history
  5. Remove unused mip_bias parameter from apply_normal_mapping (bevyengin…

    …e#13752)
    
    Mip bias is no longer used here
    JMS55 authored and mockersf committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    8c5769a View commit details
    Browse the repository at this point in the history
  6. Adds back in way to convert color to u8 array, implemented for the tw…

    …o RGB color types, also renames Color::linear to Color::to_linear. (bevyengine#13759)
    
    # Objective
    
    One thing missing from the new Color implementation in 0.14 is the
    ability to easily convert to a u8 representation of the rgb color.
    
    (note this is a redo of PR bevyengine#13739
    as I needed to move the source branch
    
    ## Solution
    
    I have added to_u8_array and to_u8_array_no_alpha to a new trait called
    ColorToPacked to mirror the f32 conversions in ColorToComponents and
    implemented the new trait for Srgba and LinearRgba.
    To go with those I also added matching from_u8... functions and
    converted a couple of cases that used ad-hoc implementations of that
    conversion to use these.
    After discussion on Discord of the experience of using the API I renamed
    Color::linear to Color::to_linear, as without that it looks like a
    constructor (like Color::rgb).
    I also added to_srgba which is the other commonly converted to type of
    color (for UI and 2D) to match to_linear.
    Removed a redundant extra implementation of to_f32_array for LinearColor
    as it is also supplied in ColorToComponents (I'm surprised that's
    allowed?)
    
    ## Testing
    
    Ran all tests and manually tested.
    Added to_and_from_u8 to linear_rgba::tests
    
    ## Changelog
    
    visible change is Color::linear becomes Color::to_linear.
    
    ---------
    
    Co-authored-by: John Payne <20407779+johngpayne@users.noreply.github.com>
    2 people authored and mockersf committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    cbebcb0 View commit details
    Browse the repository at this point in the history
  7. Meshlet misc (bevyengine#13761)

    - Copy module docs so that they show up in the re-export
    - Change meshlet_id to cluster_id in the debug visualization
    - Small doc tweaks
    JMS55 authored and mockersf committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    a944598 View commit details
    Browse the repository at this point in the history
  8. Add more granular system sets for state transition schedule ordering (b…

    …evyengine#13763)
    
    # Objective
    
    Fixes bevyengine#13711 
    
    ## Solution
    
    Introduce smaller, generic system sets for each schedule variant, which
    are ordered against other generic variants:
    - `ExitSchedules<S>` - For `OnExit` schedules, runs from leaf states to
    root states.
    - `TransitionSchedules<S>` - For `OnTransition` schedules, runs in
    arbitrary order.
    - `EnterSchedules<S>` - For `OnEnter` schedules, runs from root states
    to leaf states.
    
    Also unified `ApplyStateTransition<S>` schedule which works in basically
    the same way, just for internals.
    
    ## Testing
    
    - One test that tests schedule execution order
    
    ---------
    
    Co-authored-by: Lee-Orr <lee-orr@users.noreply.github.com>
    2 people authored and mockersf committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    854983d View commit details
    Browse the repository at this point in the history
  9. Clarify error message due to missing shader file (bevyengine#13766)

    # Objective
    
    The error printed-out due to a missing shader file was confusing; This
    PR changes the error message.
    
    Fixes bevyengine#13644 
    
    ## Solution
    
    I replaced the confusing wording (`... shader is not loaded yet`) with a
    clear explanation (`... shader could not be loaded`)
    
    ## Testing
    
    > Did you test these changes? If so, how?
    
    removing `assets/shaders/game_of_life.wgsl` & running its associated
    example now produces the following error:
    
    ```
    thread '<unnamed>' panicked at examples/shader/compute_shader_game_of_life.rs:233:25:
    Initializing assets/shaders/game_of_life.wgsl:
    Pipeline could not be compiled because the following shader could not be loaded: AssetId<bevy_render::render_resource::shader::Shader>{ index: 0, generation: 0}
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    Encountered a panic in system `bevy_render::renderer::render_system`!
    ```
    
    I don't think there are any tests expecting the previous error message,
    so this change should not break anything.
    
    > Are there any parts that need more testing?
    
    If there was an intent behind the original message, this might need more
    attention.
    
    > How can other people (reviewers) test your changes? Is there anything
    specific they need to know?
    
    One should be able to preview the changes by running any example after
    deleting/renaming their associated shader(s).
    
    > If relevant, what platforms did you test these changes on, and are
    there any important ones you can't test?
    
    N/A
    imrn99 authored and mockersf committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    c060e3e View commit details
    Browse the repository at this point in the history
  10. fix docs around StateTransition and remove references to `apply_sta… (

    bevyengine#13772)
    
    The documentation for the `State` resource still referenced the use of
    `apply_state_transition` to manually force a state transition to occur,
    and the question around how to force transitions had come up a few times
    on discord.
    
    This is a docs-only change, that does the following:
    - Properly references `StateTransition` in the `MainSchedule` docs
    - replace the explanations for applying `NextState` with ones that
    explain the `StateTransition` schedule, and mentions the possibility of
    calling it manually
    - Add an example of calling `StateTransition` manually in the docs for
    the state transition schedule itself.
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    2 people authored and mockersf committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    a3916b4 View commit details
    Browse the repository at this point in the history
  11. Make FOG_ENABLED a shader_def instead of material flag (bevyengine#13783

    )
    
    # Objective
    
    - If the fog is disabled it still generates a useless branch which can
    hurt performance
    
    ## Solution
    
    - Make the flag a shader_def instead
    
    ## Testing
    
    - I tested enabling/disabling fog works as expected per-material in the
    fog example
    - I also tested that scenes that don't add the FogSettings resource
    still work correctly
    
    ## Review notes
    
    I'm not sure how to handle the removed material flag. Right now I just
    commented it out and added a not to reuse it instead of creating a new
    one.
    IceSentry authored and mockersf committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    3ced49f View commit details
    Browse the repository at this point in the history
  12. Update serialize flag for bevy_ecs (bevyengine#13740)

    # Objective
    
    There were some issues with the `serialize` feature:
    - `bevy_app` had a `serialize` feature and a dependency on `serde` even
    there is no usage of serde at all inside `bevy_app`
    - the `bevy_app/serialize` feature enabled `bevy_ecs/serde`, which is
    strange
    - `bevy_internal/serialize` did not enable `bevy_app/serialize` so there
    was no way of serializing an Entity in bevy 0.14
    
    ## Solution
    
    - Remove `serde` and `bevy_app/serialize` 
    - Add a `serialize` flag on `bevy_ecs` that enables `serde`
    - ` bevy_internal/serialize` now enables `bevy_ecs/serialize`
    cBournhonesque authored and mockersf committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    effbcdf View commit details
    Browse the repository at this point in the history
  13. Remove extra call to clear_trackers (bevyengine#13762)

    Fixes bevyengine#13758.
    
    # Objective
    
    Calling `update` on the main app already calls `clear_trackers`. Calling
    it again in `SubApps::update` caused RemovedCompenet Events to be
    cleared earlier than they should be.
    
    ## Solution
    
    - Don't call clear_trackers an extra time.
    
    ## Testing
    
    I manually tested the fix with this unit test: 
    ```
    #[cfg(test)]
    mod test {
        use crate::core::{FrameCount, FrameCountPlugin};
        use crate::prelude::*;
    
        #[test]
        fn test_next_frame_removal() {
            #[derive(Component)]
            struct Foo;
    
            #[derive(Resource)]
            struct RemovedCount(usize);
    
            let mut app = App::new();
            app.add_plugins(FrameCountPlugin);
            app.add_systems(Startup, |mut commands: Commands| {
                for _ in 0..100 {
                    commands.spawn(Foo);
                }
                commands.insert_resource(RemovedCount(0));
            });
    
            app.add_systems(First, |counter: Res<FrameCount>| {
                println!("Frame {}:", counter.0)
            });
    
            fn detector_system(
                mut removals: RemovedComponents<Foo>,
                foos: Query<Entity, With<Foo>>,
                mut removed_c: ResMut<RemovedCount>,
            ) {
                for e in removals.read() {
                    println!("  Detected removed Foo component for {e:?}");
                    removed_c.0 += 1;
                }
                let c = foos.iter().count();
                println!("  Total Foos: {}", c);
                assert_eq!(c + removed_c.0, 100);
            }
            fn deleter_system(foos: Query<Entity, With<Foo>>, mut commands: Commands) {
                foos.iter().next().map(|e| {
                    commands.entity(e).remove::<Foo>();
                });
            }
            app.add_systems(Update, (detector_system, deleter_system).chain());
    
            app.update();
            app.update();
            app.update();
            app.update();
        }
    }
    ```
    chrisjuchem authored and mockersf committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    65dbfe2 View commit details
    Browse the repository at this point in the history
  14. Poll system information in separate tasks (bevyengine#13693)

    Reading system information severely slows down the update loop.
    Fixes bevyengine#12848.
    
    Read system info in a separate thread.
    
    - Open the scene 3d example
    - Add `FrameTimeDiagnosticsPlugin`, `SystemInformationDiagnosticsPlugin`
    and `LogDiagnosticsPlugin` to the app.
    - Add this system to the update schedule to disable Vsync on the main
    window
    ```rust
    fn change_window_mode(mut windows: Query<&mut Window, Added<Window>>) {
        for mut window in &mut windows {
            window.present_mode = PresentMode::AutoNoVsync;
        }
    }
    ```
    - Read the fps values in the console before and after this PR.
    
    On my PC I went from around 50 fps to around 1150 fps.
    
    ---
    
    - The `SystemInformationDiagnosticsPlugin` now reads system data
    separate of the update cycle.
    
    - The `EXPECTED_SYSTEM_INFORMATION_INTERVAL` constant which defines how
    often we read system diagnostic data.
    
    ---------
    
    Co-authored-by: IceSentry <IceSentry@users.noreply.github.com>
    2 people authored and mockersf committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    7cd9099 View commit details
    Browse the repository at this point in the history
  15. Fix meshlet vertex attribute interpolation (bevyengine#13775)

    # Objective
    
    - Mikktspace requires that we normalize world normals/tangents _before_
    interpolation across vertices, and then do _not_ normalize after. I had
    it backwards.
    - We do not (am not supposed to?) need a second set of barycentrics for
    motion vectors. If you think about the typical raster pipeline, in the
    vertex shader we calculate previous_world_position, and then it gets
    interpolated using the current triangle's barycentrics.
    
    ## Solution
    
    - Fix normal/tangent processing 
    - Reuse barycentrics for motion vector calculations
    - Not implementing this for 0.14, but long term I aim to remove explicit
    vertex tangents and calculate them in the shader on the fly.
    
    ## Testing
    
    - I tested out some of the normal maps we have in repo. Didn't seem to
    make a difference, but mikktspace is all about correctness across
    various baking tools. I probably just didn't have any of the ones that
    would cause it to break.
    - Didn't test motion vectors as there's a known bug with the depth
    buffer and meshlets that I'm waiting on the render graph rewrite to fix.
    JMS55 authored and mockersf committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    93f48ed View commit details
    Browse the repository at this point in the history

Commits on Jun 11, 2024

  1. Custom primitives example (bevyengine#13795)

    # Objective
    
    - Add a new example showcasing how to add custom primitives and what you
    can do with them.
    
    ## Solution
    
    - Added a new example `custom_primitives` with a 2D heart shape
    primitive highlighting
      - `Bounded2d` by implementing and visualising bounding shapes,
      - `Measured2d` by implementing it,
      - `Meshable` to show the shape on the screen
    - The example also includes an `Extrusion<Heart>` implementing
      - `Measured3d`,
      - `Bounded3d` using the `BoundedExtrusion` trait and
      - meshing using the `Extrudable` trait.
    
    ## Additional information
    
    Here are two images of the heart and its extrusion:
    
    ![image_2024-06-10_194631194](https://github.com/bevyengine/bevy/assets/62256001/53f1836c-df74-4ba6-85e9-fabdafa94c66)
    ![Screenshot 2024-06-10
    194609](https://github.com/bevyengine/bevy/assets/62256001/b1630e71-6e94-4293-b7b5-da8d9cc98faf)
    
    ---------
    
    Co-authored-by: Jakub Marcowski <37378746+Chubercik@users.noreply.github.com>
    2 people authored and mockersf committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    9a82ecf View commit details
    Browse the repository at this point in the history
  2. Add from_color to StandardMaterial and ColorMaterial (bevyengin…

    …e#13791)
    
    # Objective
    
    Closes bevyengine#13738
    
    ## Solution
    
    Added `from_color` to materials that would support it. Didn't add
    `from_color` to `WireframeMaterial` as it doesn't seem we expect users
    to be constructing them themselves.
    
    ## Testing
    
    None
    
    ---
    
    ## Changelog
    
    ### Added
    
    - `from_color` to `StandardMaterial` so you can construct this material
    from any color type.
    - `from_color` to `ColorMaterial` so you can construct this material
    from any color type.
    Brezak authored and mockersf committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    e14f3ba View commit details
    Browse the repository at this point in the history
  3. Revert "Make FOG_ENABLED a shader_def instead of material flag (bevye…

    …ngine#13783)" (bevyengine#13803)
    
    This reverts commit 3ced49f.
    
    Relevant to bevyengine#13802. This wasn't
    done quite right and partially broke fog.
    
    Co-authored-by: Alice Cecile <alice.i.cecil@gmail.com>
    2 people authored and mockersf committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    92176ce View commit details
    Browse the repository at this point in the history
  4. Revert "constrain WorldQuery::init_state argument to ComponentInitial… (

    bevyengine#13804)
    
    …izer (bevyengine#13442)"
    
    This reverts commit 5cfb063.
    
    - This PR broke bevy-trait-query, which needs to be able to write a
    resource in init_state. See bevyengine#13798 for more details.
    - Note this doesn't fix everything as transmutes for bevy-trait-query
    will still be broken,. But the current usage in that crate is UB, so we
    need to find another solution.
    hymm authored and mockersf committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    cdd1f71 View commit details
    Browse the repository at this point in the history
  5. Fix minor typos in query join docs (bevyengine#13812)

    # Objective
    
    - Correct typos in docs for `Query::join`'s docs
    
    ## Solution
    
    - Fix them
    
    Co-authored-by: François Mockers <mockersf@gmail.com>
    CatThingy and mockersf committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    eca7e87 View commit details
    Browse the repository at this point in the history

Commits on Jun 14, 2024

  1. Ensure that events are updated even when using a bare-bones Bevy App (b…

    …evyengine#13808) (bevyengine#13842)
    
    # Objective
    
    - Related to bevyengine#13825
    
    ## Solution
    
    - Cherry picked the merged PR and performed the necessary changes to
    adapt it to the 0.14 release branch.
    
    ---------
    
    As discovered in
    Leafwing-Studios/leafwing-input-manager#538,
    there appears to be some real weirdness going on in how event updates
    are processed between Bevy 0.13 and Bevy 0.14.
    
    To identify the cause and prevent regression, I've added tests to
    validate the intended behavior.
    My initial suspicion was that this would be fixed by
    bevyengine#13762, but that doesn't seem to
    be the case.
    
    Instead, events appear to never be updated at all when using `bevy_app`
    by itself. This is part of the problem resolved by
    bevyengine#11528, and introduced by
    bevyengine#10077.
    
    After some investigation, it appears that `signal_event_update_system`
    is never added using a bare-bones `App`, and so event updates are always
    skipped.
    
    This can be worked around by adding your own copy to a
    later-in-the-frame schedule, but that's not a very good fix.
    
    Ensure that if we're not using a `FixedUpdate` schedule, events are
    always updated every frame.
    
    To do this, I've modified the logic of `event_update_condition` and
    `event_update_system` to clearly and correctly differentiate between the
    two cases: where we're waiting for a "you should update now" signal and
    where we simply don't care.
    
    To encode this, I've added the `ShouldUpdateEvents` enum, replacing a
    simple `bool` in `EventRegistry`'s `needs_update` field.
    
    Now, both tests pass as expected, without having to manually add a
    system!
    
    I've written two parallel unit tests to cover the intended behavior:
    
    1. Test that `iter_current_update_events` works as expected in
    `bevy_ecs`.
    2. Test that `iter_current_update_events` works as expected in
    `bevy_app`
    
    I've also added a test to verify that event updating works correctly in
    the presence of a fixed main schedule, and a second test to verify that
    fixed updating works at all to help future authors narrow down failures.
    
    - [x] figure out why the `bevy_app` version of this test fails but the
    `bevy_ecs` version does not
    - [x] figure out why `EventRegistry::run_updates` isn't working properly
    - [x] figure out why `EventRegistry::run_updates` is never getting
    called
    - [x] figure out why `event_update_condition` is always returning false
    - [x] figure out why `EventRegistry::needs_update` is always false
    - [x] verify that the problem is a missing `signal_events_update_system`
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    Co-authored-by: Mike <mike.hsu@gmail.com>
    3 people authored Jun 14, 2024
    Configuration menu
    Copy the full SHA
    84be2b3 View commit details
    Browse the repository at this point in the history
  2. Add missing plugins to doc of DefaultPlugins (bevyengine#13833)

    StatesPlugin and GizmoPlugin were missing from the doc comment of
    DefaultPlugins. I am not sure whether this was for a reason, but i just
    stumbled over it and it seemed off...
    
    ## Testing
    
    I'm not sure how to test these changes?
    MonaMayrhofer authored and mockersf committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    7c0b1b9 View commit details
    Browse the repository at this point in the history
  3. Use dynamic uniform buffer in post processing example (bevyengine#13540)

    # Objective
    
    While learning about shaders and pipelines, I found this example to be
    misleading; it wasn't clear to me how the node knew what the correct
    "instance" of `PostProcessSettings` we should send to the shader (as the
    combination of `ExtractComponentPlugin` and `UniformComponentPlugin`
    extracts + sends _all_ of our `PostProcessSetting` components to the
    GPU).
    
    The goal of this PR is to clarify how to target the view specific
    `PostProcessSettings` in the shader when there are multiple cameras.
    
    ## Solution
    
    To accomplish this, we can use a dynamic uniform buffer for
    `PostProcessSettings`, querying for the relevant `DynamicUniformIndex`
    in the `PostProcessNode` to get the relevant index to use with the bind
    group.
    
    While the example in its current state is _correct_, I believe that fact
    that it's intended to showcase a per camera post processing effect
    warrants a dynamic uniform buffer (even though in the context of this
    example we have only one camera, and therefore no adverse behaviour).
    
    ## Testing
    
    - Run the `post_processing` example before and after this change,
    verifying they behave the same.
    
    ## Reviewer notes
    
    This is my first PR to Bevy, and I'm by no means an expert in the world
    of rendering (though I'm trying to learn all I can). If there's a better
    way to do this / a reason not to take this route, I'd love to hear it!
    
    Thanks in advance.
    jgayfer authored and mockersf committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    727b0f6 View commit details
    Browse the repository at this point in the history
  4. reduce the antialias strength (bevyengine#13814)

    # Objective
    
    - Fixes bevyengine#13807
    
    ## Solution
    
    - Before this pr we antialiased between 0.5 and -0.5. This pr changes
    things to antialias between 0.25 and -0.25. I tried slightly larger
    ranges, but the edge between the boxes still showed. I'm not 100% sure
    this is the correct solution, but from what I could find the range you
    use is more art than science.
    
    ## Testing
    
    - Ran rounded_borders example, the code in the linked issue, and the
    testing example from bevyengine#12702.
    
    ---
    
    ## Changelog
    
    - reduce antialiasing in ui shader.
    hymm authored and mockersf committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    ac50539 View commit details
    Browse the repository at this point in the history
  5. Wgpu 0.20 (bevyengine#13186)

    Currently blocked on gfx-rs/wgpu#5774
    
    # Objective
    
    Update to wgpu 0.20
    
    ## Solution
    
    Update to wgpu 0.20 and naga_oil 0.14.
    
    ## Testing
    
    Tested a few different examples on linux (vulkan, webgl2, webgpu) and
    windows (dx12 + vulkan) and they worked.
    
    ---
    
    ## Changelog
    
    - Updated to wgpu 0.20. Note that we don't currently support wgpu's new
    pipeline overridable constants, as they don't work on web currently and
    need some more changes to naga_oil (and are somewhat redundant with
    naga_oil's shader defs). See wgpu's changelog for more
    https://github.com/gfx-rs/wgpu/blob/trunk/CHANGELOG.md#v0200-2024-04-28
    
    ## Migration Guide
    
    TODO
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    Co-authored-by: François Mockers <mockersf@gmail.com>
    3 people committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    1ea1b76 View commit details
    Browse the repository at this point in the history
  6. fix non-exact text h-alignment (bevyengine#13846)

    # Objective
    
    when a parent container is auto-sized, text alignments `Center` and
    `Right` don't align to the center and right properly. fix it
    
    ## Solution
    
    ab_glyph positions return +/- values from an anchor point. we currently
    transform them to positive values from the min-x of the glyphs, and then
    offset from the left of the bounds. instead, we can keep the negative
    values as ab_glyph intended and offset from the left/middle/right of the
    bounds as appropriate.
    
    ## Testing
    
    texts with align left, center, right, all contained in the purple boxes:
    before (0.14.0-rc.2):
    ![Screenshot 2024-06-14
    165456](https://github.com/bevyengine/bevy/assets/50659922/90fb73b0-d8bd-4ae8-abf3-7106eafc93ba)
    
    after:
    
    ![Screenshot 2024-06-14
    164449](https://github.com/bevyengine/bevy/assets/50659922/0a75ff09-b51d-4fbe-a491-b655a145c08b)
    
    code:
    ```rs
    use bevy::prelude::*;
    
    fn main() {
        App::new()
            .add_plugins(DefaultPlugins)
            .add_systems(Startup, setup)
            .run();
    }
    
    fn setup(mut commands: Commands) {
        commands.spawn(Camera2dBundle::default());
    
        for (left, justify) in [
            (100.0, JustifyText::Left),
            (500.0, JustifyText::Center),
            (900.0, JustifyText::Right),
        ] {
            commands
            // container
            .spawn(NodeBundle {
                style: Style {
                    flex_direction: FlexDirection::Column,
                    position_type: PositionType::Absolute,
                    left: Val::Px(left),
                    top: Val::Px(100.0),
                    width: Val::Px(300.0),
                    ..Default::default()
                },
                ..Default::default()
            })
            .with_children(|commands| {
                commands.spawn(NodeBundle{
                    style: Style {
                        flex_direction: FlexDirection::Row,
                        height: Val::Px(75.0),
                        ..Default::default()
                    },
                    background_color: Color::srgb(1.0, 0.0, 1.0).into(),
                    ..Default::default()
                }).with_children(|commands| {
                    // a div that reduces the available size
                    commands.spawn(NodeBundle {
                        style: Style {
                            width: Val::Px(75.0),
                            ..Default::default()
                        },
                        background_color: Color::srgb(0.0, 1.0, 0.0).into(),
                        ..Default::default()
                    });
    
                    // text with width=auto, but actual size will not be what it expcets due to the sibling div above
                    commands.spawn(TextBundle {
                        text: Text::from_section("Some text that wraps onto a second line", Default::default()).with_justify(justify),
                        style: Style {
                            align_self: AlignSelf::Center,
                            ..Default::default()
                        },
                        ..Default::default()
                    });
                });
            });
        }
    }
    ```
    robtfm authored and mockersf committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    ccfae7e View commit details
    Browse the repository at this point in the history
  7. Fix is_plugin_added::<Self>() being true during build (bevyengine#13817)

    # Objective
    
    Fixes bevyengine#13815 
    
    ## Solution
    
    Move insertion of the plugin name to after build is called.
    
    ## Testing
    
    I added a regression test
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    Co-authored-by: François Mockers <mockersf@gmail.com>
    Co-authored-by: François Mockers <francois.mockers@vleue.com>
    4 people committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    cc4681f View commit details
    Browse the repository at this point in the history

Commits on Jun 15, 2024

  1. Restore overwrite capabilities of insert_state (bevyengine#13848)

    # Objective
    
    - Fixes bevyengine#13844
    - Warn user when initializing state multiple times
    
    ## Solution
    
    - `insert_state` will overwrite previously initialized state value,
    reset transition events and re-insert it's own transition event.
    - `init_state`, `add_sub_state`, `add_computed_state` are idempotent, so
    calling them multiple times will emit a warning.
    
    ## Testing
    
    - 2 tests confirming overwrite works.
    - Given the example from bevyengine#13844
    ```rs
    use bevy::prelude::*;
    
    fn main() {
        App::new()
            .add_plugins(DefaultPlugins)
            .insert_state(AppState::A)
            .insert_state(AppState::B)
            .add_systems(OnEnter(AppState::A), setup_a)
            .add_systems(OnEnter(AppState::B), setup_b)
            .add_systems(OnExit(AppState::A), cleanup_a)
            .add_systems(OnExit(AppState::B), cleanup_b)
            .run();
    }
    
    #[derive(States, Debug, Clone, PartialEq, Eq, Hash)]
    enum AppState {
        A,
        B,
    }
    
    fn setup_a() {
        info!("setting up A");
    }
    
    fn setup_b() {
        info!("setting up B");
    }
    
    fn cleanup_a() {
        info!("cleaning up A");
    }
    
    fn cleanup_b() {
        info!("cleaning up B");
    }
    ```
    
    We get the following result:
    ```
    INFO states: setting up B
    ```
    which matches our expectations.
    MiniaczQ authored and mockersf committed Jun 15, 2024
    Configuration menu
    Copy the full SHA
    5ed296f View commit details
    Browse the repository at this point in the history

Commits on Jun 16, 2024

  1. Generalised ECS reactivity with Observers (bevyengine#10839) (bevyeng…

    …ine#13873)
    
    # Objective
    
    - Fixes bevyengine#13825 
    
    ## Solution
    
    - Cherry picked and fixed non-trivial conflicts to be able to merge
    bevyengine#10839 into the 0.14 release branch.
    
    Link to PR: bevyengine#10839
    
    Co-authored-by: James O'Brien <james.obrien@drafly.net>
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    Co-authored-by: MiniaczQ <xnetroidpl@gmail.com>
    Co-authored-by: Carter Anderson <mcanders1@gmail.com>
    5 people authored Jun 16, 2024
    Configuration menu
    Copy the full SHA
    eca8220 View commit details
    Browse the repository at this point in the history
  2. text position: use size instead of bounds (bevyengine#13858)

    # Objective
    
    - bevyengine#13846 introduced a bug where text not bound was not displayed
    
    ## Solution
    
    - bounds are infinite
    - use computed size instead, that already should be using the available
    bounds
    mockersf committed Jun 16, 2024
    Configuration menu
    Copy the full SHA
    55ee49b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    03f63e7 View commit details
    Browse the repository at this point in the history

Commits on Jun 19, 2024

  1. remove inaccurate warning from in_state (bevyengine#13862)

    # Objective
    Fixes bevyengine#13854
    
    ## Solution
    Removed the inaccurate warning. This was done for a few reasons:
    
    - States not existing is now a valid "state" (for lack of a better term)
    - Other run conditions don't provide an equivalent warning
    lee-orr authored and mockersf committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    1c838ff View commit details
    Browse the repository at this point in the history
  2. Warn about missing StatesPlugin when installing states (bevyengine#…

    …13877)
    
    # Objective
    
    - Fixes bevyengine#13874
    
    ## Solution
    
    - Confirm that the `StatesPlugin` is installed when trying to add
    states.
    - Skipped for state scoped entities, since those will warn about missing
    states.
    MiniaczQ authored and mockersf committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    6cf04c2 View commit details
    Browse the repository at this point in the history
  3. Make time_system public (bevyengine#13879)

    # Objective
    
    If `time_system` isn't public you cannot order systems relative to it in
    the `TimeSystem` set.
    
    ## Solution
    
    Make it public
    kristoff3r authored and mockersf committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    165f399 View commit details
    Browse the repository at this point in the history
  4. observers example doesn't follow standards (bevyengine#13884)

    # Objective
    
    - Observers example is using an unseeded random, prints text to console
    and doesn't display text as other examples
    
    ## Solution
    
    - use seeded random
    - log instead of printing
    - use common settings for UI text
    mockersf committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    f2e6672 View commit details
    Browse the repository at this point in the history
  5. Fix phantom key presses in winit on focus change (bevyengine#13299) (b…

    …evyengine#13696)
    
    # Objective
    
    Fixes bevyengine#13299
    
    On Linux/X11, changing focus into a winit window will produce winit
    KeyboardInput events with a "is_synthetic=true" flag that are not
    intended to be used. Bevy erroneously passes them on to the user,
    resulting in phantom key presses.
    
    ## Solution
    
    This patch properly filters out winit KeyboardInput events with
    "is_synthetic=true".
    
    For example, pressing Alt+Tab to focus a bevy winit window results in a
    permanently stuck Tab key until the user presses Tab once again to
    produce a winit KeyboardInput release event. The Tab key press event
    that causes this problem is "synthetic", should not be used according to
    the winit devs, and simply ignoring it fixes this problem.
    
    Synthetic key **releases** are still evaluated though, as they are
    essential for correct release key handling. For example, if the user
    binds the key combination Alt+1 to the action "move the window to
    workspace 1", places the bevy game in workspace 2, focuses the game and
    presses Alt+1, then the key release event for the "1" key will be
    synthetic. If we would filter out all synthetic keys, the bevy game
    would think that the 1 key remains pressed forever, until the user
    manually presses+releases the key again inside bevy.
    
    Reference:
    https://docs.rs/winit/0.30.0/winit/event/enum.WindowEvent.html#variant.KeyboardInput.field.is_synthetic
    Relevant discussion: rust-windowing/winit#3543
    
    ## Testing
    
    Tested with the "keyboard_input_events" example. Entering/exiting the
    window with various keys, as well as changing its workspace, produces
    the correct press/release events.
    hut authored and mockersf committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    4608708 View commit details
    Browse the repository at this point in the history
  6. Add first person view model example (bevyengine#13828)

    # Objective
    
    A very common way to organize a first-person view is to split it into
    two kinds of models:
    
     - The *view model* is the model that represents the player's body.
     - The *world model* is everything else.
    
    The reason for this distinction is that these two models should be
    rendered with different FOVs.
    The view model is typically designed and animated with a very specific
    FOV in mind, so it is
    generally *fixed* and cannot be changed by a player. The world model, on
    the other hand, should
    be able to change its FOV to accommodate the player's preferences for
    the following reasons:
    - *Accessibility*: How prone is the player to motion sickness? A wider
    FOV can help.
    - *Tactical preference*: Does the player want to see more of the
    battlefield?
     Or have a more zoomed-in view for precision aiming?
    - *Physical considerations*: How well does the in-game FOV match the
    player's real-world FOV?
    Are they sitting in front of a monitor or playing on a TV in the living
    room? How big is the screen?
    
    ## Solution
    
    I've added an example implementing the described setup as follows.
    
    The `Player` is an entity holding two cameras, one for each model. The
    view model camera has a fixed
    FOV of 70 degrees, while the world model camera has a variable FOV that
    can be changed by the player.
    
     I use different `RenderLayers` to select what to render.
    
    - The world model camera has no explicit `RenderLayers` component, so it
    uses the layer 0.
    All static objects in the scene are also on layer 0 for the same reason.
    - The view model camera has a `RenderLayers` component with layer 1, so
    it only renders objects
    explicitly assigned to layer 1. The arm of the player is one such
    object.
    The order of the view model camera is additionally bumped to 1 to ensure
    it renders on top of the world model.
    - The light source in the scene must illuminate both the view model and
    the world model, so it is
     assigned to both layers 0 and 1.
    
    To better see the effect, the player can move the camera by dragging
    their mouse and change the world model's FOV with the arrow keys. The
    arrow up key maps to "decrease FOV" and the arrow down key maps to
    "increase FOV". This sounds backwards on paper, but is more intuitive
    when actually changing the FOV in-game since a decrease in FOV looks
    like a zoom-in.
    I intentionally do not allow changing the view model's FOV even though
    it would be illustrative because that would be an anti-pattern and bloat
    the code a bit.
    
    The example is called `first_person_view_model` and not just
    `first_person` because I want to highlight that this is not a simple
    flycam, but actually renders the player.
    
    ## Testing
    
    Default FOV:
    <img width="1392" alt="image"
    src="https://github.com/bevyengine/bevy/assets/9047632/8c2e804f-fac2-48c7-8a22-d85af999dfb2">
    
    Decreased FOV:
    <img width="1392" alt="image"
    src="https://github.com/bevyengine/bevy/assets/9047632/1733b3e5-f583-4214-a454-3554e3cbd066">
    
    Increased FOV:
    <img width="1392" alt="image"
    src="https://github.com/bevyengine/bevy/assets/9047632/0b0640e6-5743-46f6-a79a-7181ba9678e8">
    
    Note that the white bar on the right represents the player's arm, which
    is more obvious in-game because you can move the camera around.
    The box on top is there to make sure that the view model is receiving
    shadows.
    
    I tested only on macOS.
    
    ---
    
    ## Changelog
    
    I don't think new examples go in here, do they?
    
    ## Caveat
    
    The solution used here was implemented with help by @robtfm on
    [Discord](https://discord.com/channels/691052431525675048/866787577687310356/1241019224491561000):
    > shadow maps are specific to lights, not to layers
    > if you want shadows from some meshes that are not visible, you could
    have light on layer 1+2, meshes on layer 2, camera on layer 1 (for
    example)
    > but this might change in future, it's not exactly an intended feature
    
    In other words, the example code as-is is not guaranteed to work in the
    future. I want to bring this up because the use-case presented here is
    extremely common in first-person games and important for accessibility.
    It would be good to have a blessed and easy way of how to achieve it.
    
    I'm also not happy about how I get the `perspective` variable in
    `change_fov`. Very open to suggestions :)
    
    ## Related issues
    
    - Addresses parts of bevyengine#12658
    - Addresses parts of bevyengine#12588
    
    ---------
    
    Co-authored-by: Pascal Hertleif <killercup@gmail.com>
    2 people authored and mockersf committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    b74b3b2 View commit details
    Browse the repository at this point in the history
  7. Update observer archetype flags for sparse components (bevyengine#13886)

    # Objective
    
    - Fixes bevyengine#13885 
    
    ## Solution
    
    - Update the flags correctly on archetype creation
    
    ## Testing
    
    - Added `observer_order_insert_remove_sparse` to catch regressions.
    james-j-obrien authored and mockersf committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    5d5e67f View commit details
    Browse the repository at this point in the history
  8. Shader code paths (bevyengine#13908)

    # Objective
    
    Add extra metadata for the shader examples that contains the location of
    their associated shader file(s). This is to be used for the bevy website
    shader examples so that the shader code is underneath the rust code.
    
    ## Solution
    
    Parse the example rust files for mentions of `.wgsl`, `.frag`, and
    `.vert`, then append the found paths to a field called
    `shader_code_paths` in the generated `index.md`s for each shader
    example.
    AndrewDanial authored and mockersf committed Jun 19, 2024
    Configuration menu
    Copy the full SHA
    472a6e8 View commit details
    Browse the repository at this point in the history

Commits on Jun 21, 2024

  1. bug: Fix 9-slice textures with asymmetric borders. (bevyengine#13921)

    # Objective
    
    Fix a 9-slice asymmetric border issue that
    [QueenOfSquiggles](https://blobfox.coffee/@queenofsquiggles/112639035165575222)
    found. Here's the behavior before:
    
    <img width="340" alt="the-bug"
    src="https://github.com/bevyengine/bevy/assets/54390/81ff1847-b2ea-4578-9fd0-af6ee96c5438">
    
    ## Solution
    
    Here's the behavior with the fix.
    
    <img width="327" alt="the-fix"
    src="https://github.com/bevyengine/bevy/assets/54390/33a4e3f0-b6a8-448e-9654-1197218ea11d">
    
    
    ## Testing
    
    I used QueenOfSquiggles
    [repo](https://github.com/QueenOfSquiggles/my-bevy-learning-project) to
    exercise the code. I manually went through a number of variations of the
    border and caught a few other issues after the first pass. I added some
    code to create random borders and though they often looked funny there
    weren't any gaps like before.
    
    ### Unit Tests
    
    I did add some tests to `slicer.rs` mostly as an exploratory programming
    exercise. So they currently act as a limited, incomplete,
    "golden-file"-ish approach. Perhaps they're not worth keeping.
    
    In order to write the tests, I did add a `PartialEq` derive for
    `TextureSlice`.
    
    I only tested these changes on macOS.
    
    ---
    
    ## Changelog
    
    Make 9-slice textures work with asymmetric borders.
    shanecelis authored and mockersf committed Jun 21, 2024
    Configuration menu
    Copy the full SHA
    47ad37e View commit details
    Browse the repository at this point in the history
  2. Move StateTransitionSteps registration to states plugin (bevyengine…

    …#13939)
    
    # Objective
    
    Fixes bevyengine#13920
    
    ## Solution
    
    As described in the issue.
    
    ## Testing
    
    Moved a custom transition plugin in example before any of the app-state
    methods.
    MiniaczQ authored and mockersf committed Jun 21, 2024
    Configuration menu
    Copy the full SHA
    783fc29 View commit details
    Browse the repository at this point in the history
  3. Use a ship in Transform::align example (bevyengine#13935)

    # Objective
    
    The documentation for
    [`Transform::align`](https://docs.rs/bevy/0.14.0-rc.3/bevy/transform/components/struct.Transform.html#method.align)
    mentions a hypothetical ship model. Showing this concretely would be a
    nice improvement over using a cube.
    
    > For example, if a spaceship model has its nose pointing in the
    X-direction in its own local coordinates and its dorsal fin pointing in
    the Y-direction, then align(Dir3::X, v, Dir3::Y, w) will make the
    spaceship’s nose point in the direction of v, while the dorsal fin does
    its best to point in the direction w.
    
    
    ## Solution
    
    This commit makes the ship less hypothetical by using a kenney ship
    model in the example.
    
    The local axes for the ship needed to change to accommodate the gltf, so
    the hypothetical in the documentation and this example's local axes
    don't necessarily match. Docs use `align(Dir3::X, v, Dir3::Y, w)` and
    this example now uses `(Vec3::NEG_Z, *first, Vec3::X, *second)`.
    
    I manually modified the `craft_speederD` Node's `translation` to be
    0,0,0 in the gltf file, which means it now differs from kenney's
    original model.
    
    Original ship from: https://kenney.nl/assets/space-kit
    
    ## Testing
    
    ```
    cargo run --example align
    ```
    
    ![screenshot-2024-06-19-at-14 27
    05@2x](https://github.com/bevyengine/bevy/assets/551247/ab1afc8f-76b2-42b6-b455-f0d1c77cfed7)
    ![screenshot-2024-06-19-at-14 27
    12@2x](https://github.com/bevyengine/bevy/assets/551247/4a01031c-4ea1-43ab-8078-3656db67efe0)
    ![screenshot-2024-06-19-at-14 27
    20@2x](https://github.com/bevyengine/bevy/assets/551247/06830f38-ba2b-4e3a-a265-2d10f9ea9de9)
    ChristopherBiscardi authored and mockersf committed Jun 21, 2024
    Configuration menu
    Copy the full SHA
    cf66df1 View commit details
    Browse the repository at this point in the history
  4. Correctly check physical size when updating winit (bevyengine#13942)

    Fixes bevyengine#13701
    
    After `winit` upgrade to `0.31`, windows were no longer correctly
    resizing. This appears to just have been a simple mistake, where the new
    physical size was being sourced from the `winit` window rather than on
    the incoming `Window` component.
    
    ## Testing
    
    Tested on macOS, but I'm curious whether this was also broken on other
    platforms.
    tychedelia authored and mockersf committed Jun 21, 2024
    Configuration menu
    Copy the full SHA
    e73063e View commit details
    Browse the repository at this point in the history
  5. apply window scale to window size when creating it (bevyengine#13967)

    # Objective
    
    - Fixes bevyengine#13702
    - When creating a new window, its scale was changed to match the one
    returned by winit, but its size was not which resulted in an incorrect
    size until the event with the correct size was received, at least 1
    frame later
    
    ## Solution
    
    - Apply the window scale to its size when creating it
    mockersf committed Jun 21, 2024
    Configuration menu
    Copy the full SHA
    8af12c8 View commit details
    Browse the repository at this point in the history
  6. Make Observer::with_event (and other variants) unsafe (bevyengine#13954)

    # Objective
    
    `with_event` will result in unsafe casting of event data of the given
    type to the type expected by the Observer system. This is inherently
    unsafe.
    
    ## Solution
    
    Flag `Observer::with_event` and `ObserverDescriptor::with_events` as
    unsafe. This will not affect normal workflows as `with_event` is
    intended for very specific (largely internal) use cases.
    
    This _should_ be backported to 0.14 before release.
    
    ---
    
    ## Changelog
    
    - `Observer::with_event` is now unsafe.
    - Rename `ObserverDescriptor::with_triggers` to
    `ObserverDescriptor::with_events` and make it unsafe.
    cart authored and mockersf committed Jun 21, 2024
    Configuration menu
    Copy the full SHA
    073db8c View commit details
    Browse the repository at this point in the history
  7. Fix meshlet interactions with regular shading passes (bevyengine#13816)

    * Fixes bevyengine#13813
    * Fixes bevyengine#13810
    
    Tested a combined scene with both regular meshes and meshlet meshes
    with:
    * Regular forward setup
    * Forward + normal/motion vector prepasses
    * Deferred (with depth prepass since that's required) 
    * Deferred + depth/normal/motion vector prepasses
    
    Still broken:
    * Using meshlet meshes rendering in deferred and regular meshes
    rendering in forward + depth/normal prepass. I don't know how to fix
    this at the moment, so for now I've just add instructions to not mix
    them.
    JMS55 authored and mockersf committed Jun 21, 2024
    Configuration menu
    Copy the full SHA
    b56a693 View commit details
    Browse the repository at this point in the history

Commits on Jun 25, 2024

  1. Fixing par_read targetting 0.14 branch (bevyengine#14014)

    Fix for par_read bugs retargetting 0.14.
    
    Remakes bevyengine#13836.
    BobG1983 authored Jun 25, 2024
    Configuration menu
    Copy the full SHA
    a41ed78 View commit details
    Browse the repository at this point in the history
  2. fix panic: invalid SlotMap key used (bevyengine#13990)

    # Objective
    
    Tight, in-frame generation, re-parenting, despawning, etc., UI
    operations could sometime lead taffy to panic (invalid SlotMap key used)
    when an entity with an invalid state later despawned.
    
    Fixes bevyengine#12403 
    
    ## Solution
    
    Move the `remove_entities` call after children updates.
    
    ## Testing
    
    `sickle_ui` had a case that always caused the panic. Tested before this
    change, after this change, and before the change again to make sure the
    error is there without the fix. The fix worked. Test steps and used
    commit described in issue bevyengine#12403.
    
    I have also ran every bevy UI example, though none of them deal with
    entity re-parenting or removal. No regression detected on them.
    
    Tested on Windows only.
    eidloi authored and mockersf committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    a0e7429 View commit details
    Browse the repository at this point in the history
  3. feat(bevy_app): expose an API to perform updates for a specific sub-a…

    …pp. (bevyengine#14009)
    
    # Objective
    
    - Fixes bevyengine#14003
    
    ## Solution
    
    - Expose an API to perform updates for a specific sub-app, so we can
    avoid mutable borrow the app twice.
    
    ## Testing
    
    - I have tested the API by modifying the code in the `many_lights`
    example with the following changes:
    ```rust
    impl Plugin for LogVisibleLights {
        fn build(&self, app: &mut App) {
            let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
                return;
            };
    
            render_app.add_systems(Render, print_visible_light_count.in_set(RenderSet::Prepare));
        }
    
        fn finish(&self, app: &mut App) {
            app.update_sub_app_by_label(RenderApp);
        }
    }
    ```
    
    ---
    
    ## Changelog
    - add the `update_sub_app_by_label` API to `App` and `SubApps`.
    
    ---------
    
    Co-authored-by: Jan Hohenheim <jan@hohenheim.ch>
    2 people authored and mockersf committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    8c1b9a6 View commit details
    Browse the repository at this point in the history
  4. Don't show .to_bits in Display impl for Entity (bevyengine#14011)

    accurate for debugging. To ensure that its can still be readily logged
    in error messages and inspectors, this PR added a more concise and
    human-friendly `Display` impl.
    
    However, users found this form too verbose: the `to_bits` information
    was unhelpful and too long. Fixes bevyengine#13980.
    
    - Don't include `Entity::to_bits` in the `Display` implementation for
    `Entity`. This information can readily be accessed and logged for users
    who need it.
    - Also clean up the implementation of `Display` for `DebugName`,
    introduced in bevyengine#13760, to simply
    use the new `Display` impl (since this was the desired format there).
    
    I've updated an existing test to verify the output of `Entity::display`.
    
    ---------
    
    Co-authored-by: Kristoffer Søholm <k.soeholm@gmail.com>
    2 people authored and mockersf committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    9eb547e View commit details
    Browse the repository at this point in the history
  5. Fix MeshletMesh material system ordering (bevyengine#14016)

    # Objective
    - Fixes bevyengine#13811 (probably, I lost my test code...)
    
    ## Solution
    - Turns out that Queue and PrepareAssets are _not_ ordered. We should
    probably either rethink our system sets (again), or improve the
    documentation here. For reference, I've included the current ordering
    below.
    - The `prepare_meshlet_meshes_X` systems need to run after
    `prepare_assets::<PreparedMaterial<M>>`, and have also been moved to
    QueueMeshes.
    
    ```rust
    schedule.configure_sets(
        (
            ExtractCommands,
            ManageViews,
            Queue,
            PhaseSort,
            Prepare,
            Render,
            Cleanup,
        )
            .chain(),
    );
    
    schedule.configure_sets((ExtractCommands, PrepareAssets, Prepare).chain());
    schedule.configure_sets(QueueMeshes.in_set(Queue).after(prepare_assets::<GpuMesh>));
    schedule.configure_sets(
        (PrepareResources, PrepareResourcesFlush, PrepareBindGroups)
            .chain()
            .in_set(Prepare),
    );
    ```
    
    ## Testing
    - Ambiguity checker to make sure I don't have ambiguous system ordering
    JMS55 authored and mockersf committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    65daab8 View commit details
    Browse the repository at this point in the history
  6. Make default behavior for BackgroundColor and BorderColor more in…

    …tuitive (bevyengine#14017)
    
    # Objective
    
    In Bevy 0.13, `BackgroundColor` simply tinted the image of any
    `UiImage`. This was confusing: in every other case (e.g. Text), this
    added a solid square behind the element. bevyengine#11165 changed this, but
    removed `BackgroundColor` from `ImageBundle` to avoid confusion, since
    the semantic meaning had changed.
    
    However, this resulted in a serious UX downgrade / inconsistency, as
    this behavior was no longer part of the bundle (unlike for `TextBundle`
    or `NodeBundle`), leaving users with a relatively frustrating upgrade
    path.
    
    Additionally, adding both `BackgroundColor` and `UiImage` resulted in a
    bizarre effect, where the background color was seemingly ignored as it
    was covered by a solid white placeholder image.
    
    Fixes bevyengine#13969.
    
    ## Solution
    
    Per @viridia's design:
    
    > - if you don't specify a background color, it's transparent.
    > - if you don't specify an image color, it's white (because it's a
    multiplier).
    > - if you don't specify an image, no image is drawn.
    > - if you specify both a background color and an image color, they are
    independent.
    > - the background color is drawn behind the image (in whatever pixels
    are transparent)
    
    As laid out by @benfrankel, this involves:
    
    1. Changing the default `UiImage` to use a transparent texture but a
    pure white tint.
    2. Adding `UiImage::solid_color` to quickly set placeholder images.
    3. Changing the default `BorderColor` and `BackgroundColor` to
    transparent.
    4. Removing the default overrides for these values in the other assorted
    UI bundles.
    5. Adding `BackgroundColor` back to `ImageBundle` and `ButtonBundle`.
    6. Adding a 1x1 `Image::transparent`, which can be accessed from
    `Assets<Image>` via the `TRANSPARENT_IMAGE_HANDLE` constant.
    
    Huge thanks to everyone who helped out with the design in the linked
    issue and [the Discord
    thread](https://discord.com/channels/691052431525675048/1255209923890118697/1255209999278280844):
    this was very much a joint design.
    
    @cart helped me figure out how to set the UiImage's default texture to a
    transparent 1x1 image, which is a much nicer fix.
    
    ## Testing
    
    I've checked the examples modified by this PR, and the `ui` example as
    well just to be sure.
    
    ## Migration Guide
    
    - `BackgroundColor` no longer tints the color of images in `ImageBundle`
    or `ButtonBundle`. Set `UiImage::color` to tint images instead.
    - The default texture for `UiImage` is now a transparent white square.
    Use `UiImage::solid_color` to quickly draw debug images.
    - The default value for `BackgroundColor` and `BorderColor` is now
    transparent. Set the color to white manually to return to previous
    behavior.
    alice-i-cecile authored and mockersf committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    82f0156 View commit details
    Browse the repository at this point in the history

Commits on Jun 26, 2024

  1. AnyOf soundness fix (bevyengine#14013)

    # Objective
    Fixes bevyengine#13993 
    PR inspired by bevyengine#14007 to
    accomplish the same thing, but maybe in a clearer fashion.
    
    @Gingeh feel free to take my changes and add them to your PR, I don't
    want to steal any credit
    
    ---------
    
    Co-authored-by: Gingeh <39150378+Gingeh@users.noreply.github.com>
    Co-authored-by: Bob Gardner <rgardner@inworld.ai>
    Co-authored-by: Martín Maita <47983254+mnmaita@users.noreply.github.com>
    4 people authored and mockersf committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    f89f7f3 View commit details
    Browse the repository at this point in the history
  2. don't crash without features bevy_pbr, ktx2, zstd (bevyengine#1…

    …4020)
    
    # Objective
    
    - Fixes bevyengine#13728 
    
    ## Solution
    
    - add a new feature `smaa_luts`. if enables, it also enables `ktx2` and
    `zstd`. if not, it doesn't load the files but use placeholders instead
    - adds all the resources needed in the same places that system that uses
    them are added.
    mockersf committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    4736fe0 View commit details
    Browse the repository at this point in the history
  3. Print warning when using llvmpipe (bevyengine#13780)

    # Objective
    
    Numerous people have been confused that Bevy runs slowly, when the
    reason is that the `llvmpipe` software rendered is being used.
    
    ## Solution
    
    Printing a warning could reduce the confusion.
    msvbg authored and mockersf committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    f8e165b View commit details
    Browse the repository at this point in the history
  4. example showcase: keep the order of the shaders imported (bevyengine#…

    …14035)
    
    # Objective
    
    - After bevyengine#13908, shaders imported are collected
    - this is done with a hashset, so order is random between executions
    
    ## Solution
    
    - Don't use a hashset, and keep the order they were found in the example
    mockersf committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    27aa9d2 View commit details
    Browse the repository at this point in the history
  5. fix examples color_grading and mobile after BackgroundColor changes (b…

    …evyengine#14033)
    
    # Objective
    
    - bevyengine#14017 changed how `UiImage` and `BackgroundColor` work
    - one change was missed in example `color_grading`, another in the
    mobile example
    
    ## Solution
    
    - Change it in the examples
    mockersf committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    e65e4be View commit details
    Browse the repository at this point in the history
  6. Emit a warning if the result of EntityCommand::with_entity is not u…

    …sed (bevyengine#14028)
    
    When using combinators such as `EntityCommand::with_entity` to build
    commands, it can be easy to forget to apply that command, leading to
    dead code. In many cases this doesn't even lead to an unused variable
    warning, which can make these mistakes difficult to track down
    
    Annotate the method with `#[must_use]`
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    2 people authored and mockersf committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    a6feb5b View commit details
    Browse the repository at this point in the history
  7. Fix typo in CPU adapter warning (bevyengine#14037)

    An annoying typo slipped through in bevyengine#13780
    msvbg authored and mockersf committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    9a4de9c View commit details
    Browse the repository at this point in the history
  8. Have WindowPosition::Centered take scale_factor_override into account (

    …bevyengine#13949)
    
    # Objective
    
    Fixes bevyengine#8916 
    
    My game has a low resolution pixel art style, and I use
    `.with_scale_factor_override()` to make the window larger.
    `WindowPosition::Centered` doesn't work for me.
    
    ## Solution
    
    If `scale_factor_override` is set, use that over `monitor.scale_factor`
    
    ## Testing
    
    Tested on Windows 11 with an Nvidia GPU:
    
    ### Main
    
    ![image](https://github.com/bevyengine/bevy/assets/3324533/5f9ae90e-b65a-48d9-b601-117df8f08a28)
    
    ### This PR
    
    ![image](https://github.com/bevyengine/bevy/assets/3324533/cd860611-7b6a-4ae5-b690-28d9ba8ea6ad)
    MScottMcBee authored and mockersf committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    99db59c View commit details
    Browse the repository at this point in the history

Commits on Jun 27, 2024

  1. Improve MeshletMesh::from_mesh performance (bevyengine#13904)

    This change reworks `find_connected_meshlets` to scale more linearly
    with the mesh size, which significantly reduces the cost of building
    meshlet representations. As a small extra complexity reduction, it moves
    `simplify_scale` call out of the loop so that it's called once (it only
    depends on the vertex data => is safe to cache).
    
    The new implementation of connectivity analysis builds edge=>meshlet
    list data structure, which allows us to only iterate through
    `tuple_combinations` of a (usually) small list. There is still some
    redundancy as if two meshlets share two edges, they will be represented
    in the meshlet lists twice, but it's overall much faster.
    
    Since the hash traversal is non-deterministic, to keep this part of the
    algorithm deterministic for reproducible results we sort the output
    adjacency lists.
    
    Overall this reduces the time to process bunny mesh from ~4.2s to ~1.7s
    when using release; in unoptimized builds the delta is even more
    significant.
    
    This was tested by using bevyengine#13431
    and:
    
    a) comparing the result of `find_connected_meshlets` using old and new
    code; they are equal in all steps of the clustering process
    b) comparing the rendered result of the old code vs new code *after*
    making the rest of the algorithm deterministic: right now the loop that
    iterates through the result of `group_meshlets()` call executes in
    different order between program runs. This is orthogonal to this change
    and can be fixed separately.
    
    Note: a future change can shrink the processing time further from ~1.7s
    to ~0.4s with a small diff but that requires an update to meshopt crate
    which is pending in gwihlidal/meshopt-rs#42.
    This change is independent.
    zeux authored and mockersf committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    cc17647 View commit details
    Browse the repository at this point in the history
  2. Make meshlet processing deterministic (bevyengine#13913)

    This is a followup to bevyengine#13904
    based on the discussion there, and switches two HashMaps that used
    meshlet ids as keys to Vec.
    
    In addition to a small further performance boost for `from_mesh` (1.66s
    => 1.60s), this makes processing deterministic modulo threading issues
    wrt CRT rand described in the linked PR. This is valuable for debugging,
    as you can visually or programmatically inspect the meshlet distribution
    before/after making changes that should not change the output, whereas
    previously every asset rebuild would change the meshlet structure.
    
    Tested with bevyengine#13431; after this
    change, the visual output of meshlets is consistent between asset
    rebuilds, and the MD5 of the output GLB file does not change either,
    which was not the case before.
    zeux authored and mockersf committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    4f0b0e0 View commit details
    Browse the repository at this point in the history
  3. Improve MeshletMesh::from_mesh performance further (bevyengine#14038)

    This change updates meshopt-rs to 0.3 to take advantage of the newly
    added sparse simplification mode: by default, simplifier assumes that
    the entire mesh is simplified and runs a set of calculations that are
    O(vertex count), but in our case we simplify many small mesh subsets
    which is inefficient.
    
    Sparse mode instead assumes that the simplified subset is only using a
    portion of the vertex buffer, and optimizes accordingly. This changes
    the meaning of the error (as it becomes relative to the subset, in our
    case a meshlet group); to ensure consistent error selection, we also use
    the ErrorAbsolute mode which allows us to operate in mesh coordinate
    space.
    
    Additionally, meshopt 0.3 runs optimizeMeshlet automatically as part of
    `build_meshlets` so we no longer need to call it ourselves.
    
    This reduces the time to build meshlet representation for Stanford Bunny
    mesh from ~1.65s to ~0.45s (3.7x) in optimized builds.
    zeux authored and mockersf committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    5d7da82 View commit details
    Browse the repository at this point in the history
  4. Fix incorrect computation of mips for cluster occlusion lookup (bevye…

    …ngine#14042)
    
    The comment was incorrect - we are already looking at the pyramid
    texture so we do not need to transform the size in any way. Doing that
    resulted in a mip that was too fine to be selected in certain cases,
    which resulted in a 2x2 pixel footprint not actually fully covering the
    cluster sphere - sometimes this could lead to a non-conservative depth
    value being computed which resulted in the cluster being marked as
    invisible incorrectly.
    zeux authored and mockersf committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    7c60387 View commit details
    Browse the repository at this point in the history
  5. add missing sort_unstable_by_key to QueryIter (bevyengine#14040)

    # Objective
    
    `QueryIter::sort_unstable_by_key` is missing.
    
    ## Solution
    
    Add `QueryIter::sort_unstable_by_key`.
    
    ## Testing
    
    Added the new method to existing test.
    
    ## Changelog
    
    Added `QueryIter::sort_unstable_by_key`.
    Victoronz authored and mockersf committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    7b98db6 View commit details
    Browse the repository at this point in the history
  6. Add missing StaticSystemParam::queue implementation. (bevyengine#14051)

    # Objective
    
    `StaticSystemParam` should delegate all `SystemParam` methods to the
    inner param, but it looks like it was missed when the new `queue()`
    method was added in bevyengine#10839.
    
    ## Solution
    
    Implement `StaticSystemParam::queue()` to delegate to the inner param.
    chescock authored and mockersf committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    bea8823 View commit details
    Browse the repository at this point in the history
  7. Allow phase items not associated with meshes to be binned. (bevyengin…

    …e#14029)
    
    As reported in bevyengine#14004, many third-party plugins, such as Hanabi, enqueue
    entities that don't have meshes into render phases. However, the
    introduction of indirect mode added a dependency on mesh-specific data,
    breaking this workflow. This is because GPU preprocessing requires that
    the render phases manage indirect draw parameters, which don't apply to
    objects that aren't meshes. The existing code skips over binned entities
    that don't have indirect draw parameters, which causes the rendering to
    be skipped for such objects.
    
    To support this workflow, this commit adds a new field,
    `non_mesh_items`, to `BinnedRenderPhase`. This field contains a simple
    list of (bin key, entity) pairs. After drawing batchable and unbatchable
    objects, the non-mesh items are drawn one after another. Bevy itself
    doesn't enqueue any items into this list; it exists solely for the
    application and/or plugins to use.
    
    Additionally, this commit switches the asset ID in the standard bin keys
    to be an untyped asset ID rather than that of a mesh. This allows more
    flexibility, allowing bins to be keyed off any type of asset.
    
    This patch adds a new example, `custom_phase_item`, which simultaneously
    serves to demonstrate how to use this new feature and to act as a
    regression test so this doesn't break again.
    
    Fixes bevyengine#14004.
    
    ## Changelog
    
    ### Added
    
    * `BinnedRenderPhase` now contains a `non_mesh_items` field for plugins
    to add custom items to.
    pcwalton authored and mockersf committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    26f7313 View commit details
    Browse the repository at this point in the history
  8. add PartialEq to Outline (bevyengine#14055)

    # Objective
    
    `sickle_ui` needs `PartialEq` on components to turn them into animatable
    style attributes.
    
    ## Solution
    
    All properties of Outline is already `PartialEq`, add derive on
    `Outline` as well.
    
    ## Testing
    
    - used `sickle_ui` to test if it can be made animatable
    eidloi authored and mockersf committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    20638f3 View commit details
    Browse the repository at this point in the history
  9. Fix error in AnyOf (bevyengine#14027)

    # Objective
    
    - Fixes a correctness error introduced in
    bevyengine#14013 ...
    
    ## Solution
    
    I've been playing around a lot of with the access code and I realized
    that I introduced a soundness error when trying to simplify the code.
    When we have a `Or<(With<A>, With<B>)>` filter, we cannot call
    ```
      let mut intermediate = FilteredAccess::default();
      $name::update_component_access($name, &mut intermediate);
      _new_access.append_or(&intermediate);
    ```
    because that's just equivalent to adding the new components as `Or`
    clauses.
    For example if the existing `filter_sets` was `vec![With<C>]`, we would
    then get `vec![With<C>, With<A>, With<B>]` which translates to `A or B
    or C`.
    Instead what we want is `(A and B) or (A and C)`, so we need to have
    each new OR clause compose with the existing access like so:
    ```
    let mut intermediate = _access.clone();
    // if we previously had a With<C> in the filter_set, this will become `With<C> AND With<A>`
    $name::update_component_access($name, &mut intermediate);
    _new_access.append_or(&intermediate);
    ```
    
    ## Testing
    
    - Added a unit test that is broken in main, but passes in this PR
    cBournhonesque authored and mockersf committed Jun 27, 2024
    Configuration menu
    Copy the full SHA
    73b43aa View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    036d002 View commit details
    Browse the repository at this point in the history

Commits on Jun 29, 2024

  1. don't put previous skin/morph in the morphed_skinned_mesh_layout (bev…

    …yengine#14065)
    
    # Objective
    
    - Fixes bevyengine#14059
    - `morphed_skinned_mesh_layout` is the same as
    `morphed_skinned_motion_mesh_layout` but shouldn't have the skin / morph
    from previous frame, as they're used for motion
    
    ## Solution
    
    - Remove the extra entries
    
    ## Testing
    
    - Run with the glTF file reproducing bevyengine#14059, it works
    mockersf committed Jun 29, 2024
    Configuration menu
    Copy the full SHA
    4a05c73 View commit details
    Browse the repository at this point in the history

Commits on Jun 30, 2024

  1. only run one update per frame drawn (bevyengine#14023)

    # Objective
    
    - Fixes bevyengine#13965 
    
    ## Solution
    
    - Don't run multiple updates for a single frame
    mockersf committed Jun 30, 2024
    Configuration menu
    Copy the full SHA
    dc56614 View commit details
    Browse the repository at this point in the history

Commits on Jul 2, 2024

  1. Fix compile failure in WASM without wgpu backend (bevyengine#14081)

    # Objective
    
    - When no wgpu backend is selected, there should be a clear explanation.
    - Fix a regression in 0.14 when not using default features. I hit this
    compile failure when trying to build bevy_framepace for 0.14.0-rc.4
    ```
    error[E0432]: unresolved import `crate::core_3d::DEPTH_TEXTURE_SAMPLING_SUPPORTED`
      --> /Users/aevyrie/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_core_pipeline-0.14.0-rc.4/src/dof/mod.rs:59:19
       |
    59 |         Camera3d, DEPTH_TEXTURE_SAMPLING_SUPPORTED,
       |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `DEPTH_TEXTURE_SAMPLING_SUPPORTED` in `core_3d`
       |
    note: found an item that was configured out
      --> /Users/aevyrie/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_core_pipeline-0.14.0-rc.4/src/core_3d/mod.rs:53:11
       |
    53 | pub const DEPTH_TEXTURE_SAMPLING_SUPPORTED: bool = false;
       |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    note: found an item that was configured out
      --> /Users/aevyrie/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_core_pipeline-0.14.0-rc.4/src/core_3d/mod.rs:63:11
       |
    63 | pub const DEPTH_TEXTURE_SAMPLING_SUPPORTED: bool = true;
       |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ```
    
    ## Solution
    
    - Ensure that `DEPTH_TEXTURE_SAMPLING_SUPPORTED` is either `true` or
    `false`, it shouldn't be completely missing.
    
    ## Testing
    
    - Building on WASM without default features, which now seemingly no
    longer includes webgl, will panic on startup with a message saying that
    no wgpu backend was selected. This is much more helpful than the compile
    time failure:
    ```
    No wgpu backend feature that is implemented for the target platform was enabled
    ```
    - I can see an argument for making this a compile time failure, however
    the current failure mode is very confusing for novice users, and
    provides no clues for how to fix it. If we want this to fail at compile
    time, we should do it in a way that fails with a helpful message,
    similar to what this PR acheives.
    aevyrie authored and mockersf committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    fda2e4b View commit details
    Browse the repository at this point in the history
  2. Support operations for render layers and fix equality comparisons (be…

    …vyengine#13310)
    
    # Objective
    
    Allow combining render layers with a more-ergonomic syntax than
    `RenderLayers::from_iter(a.iter().chain(b.iter()))`.
    
    ## Solution
    
    Add the `or` operation (and corresponding `const` method) to allow
    computing the union of a set of render layers. While we're here, also
    added `and` and `xor` operations. Someone might find them useful
    
    ## Testing
    
    Added a simple unit test.
    JoJoJet authored and mockersf committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    d7a0cc6 View commit details
    Browse the repository at this point in the history
  3. Clarify the difference between default render layers and none rende…

    …r layers (bevyengine#14075)
    
    # Objective
    
    It's not always obvious what the default value for `RenderLayers`
    represents. It is documented, but since it's an implementation of a
    trait method the documentation may or may not be shown depending on the
    IDE.
    
    ## Solution
    
    Add documentation to the `none` method that explicitly calls out the
    difference.
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    2 people authored and mockersf committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    99c465d View commit details
    Browse the repository at this point in the history
  4. Backport bevyengine#14083 (deregister events) to 0.14 branch (bevyeng…

    …ine#14114)
    
    Changes by @lee-orr. Fixes bevyengine#14113.
    
    Co-authored-by: Alice Cecile <alice.i.cecil@gmail.com>
    alice-i-cecile and Alice Cecile authored Jul 2, 2024
    Configuration menu
    Copy the full SHA
    31b8614 View commit details
    Browse the repository at this point in the history
  5. Fix push_children inserting a Children component even when no chi…

    …ldren are supplied (bevyengine#14109)
    
    # Objective
    
    The Bevy API around manipulating hierarchies removes `Children` if the
    operation results in an entity having no children. This means that
    `Children` is guaranteed to hold actual children. However, the following
    code unexpectedly inserts empty `Children`:
    
    ```rust
    commands.entity(entity).with_children(|_| {});
    ```
    
    This was discovered by @Jondolf:
    https://discord.com/channels/691052431525675048/1124043933886976171/1257660865625325800
    
    ## Solution
    
    - `with_children` is now a noop when no children were passed
    
    ## Testing
    
    - Added a regression test
    janhohenheim authored and mockersf committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    e733351 View commit details
    Browse the repository at this point in the history
  6. add missing mention of sort_unstable_by_key in QuerySortedIter docs (b…

    …evyengine#14108)
    
    # Objective
    
    There is a missing mention of `sort_unstable_by_key` in the
    `QuerySortedIter` docs.
    
    ## Solution
    
    Add it.
    Victoronz authored and mockersf committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    24fdad3 View commit details
    Browse the repository at this point in the history
  7. Added get_main_animation for AnimationTransitions (bevyengine#14104)

    # Objective
    
    Added a getter for the main animation of `AnimationTransitions`.
    
    ## Solution
    
    Added `get_main_animation` for `AnimationTransitions`.
    mintlu8 authored and mockersf committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    309c224 View commit details
    Browse the repository at this point in the history
  8. Added feature switch to default Standard Material's new anisotropy te…

    …xture to off (bevyengine#14048)
    
    # Objective
    
    - Standard Material is starting to run out of samplers (currently uses
    13 with no additional features off, I think in 0.13 it was 12).
    - This change adds a new feature switch, modelled on the other ones
    which add features to Standard Material, to turn off the new anisotropy
    feature by default.
    
    ## Solution
    
    - feature + texture define
    
    ## Testing
    
    - Anisotropy example still works fine
    - Other samples work fine
    - Standard Material now takes 12 samplers by default on my Mac instead
    of 13
    
    ## Migration Guide
    
    - Add feature pbr_anisotropy_texture if you are using that texture in
    any standard materials.
    
    ---------
    
    Co-authored-by: John Payne <20407779+johngpayne@users.noreply.github.com>
    2 people authored and mockersf committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    1db0214 View commit details
    Browse the repository at this point in the history

Commits on Jul 3, 2024

  1. fix remaining issues with background color in examples (bevyengine#14115

    )
    
    # Objective
    
    - Fixes bevyengine#14097
    
    ## Solution
    
    - Switching the uses of `UiImage` in examples to `BackgroundColor` when
    needed
    mockersf committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    ff070da View commit details
    Browse the repository at this point in the history
  2. Fix border color in ui_texture_slice and ui_texture_atlas_slice e…

    …xamples. (bevyengine#14121)
    
    # Objective
    
    Fixes bevyengine#14120
    
    `ui_texture_slice` and `ui_texture_atlas_slice` were working as
    intended, so undo the changes.
    
    ## Solution
    
    Partially revert bevyengine#14115 for
    `ui_texture_slice` and `ui_texture_atlas_slice`.
    
    ## Testing
    
    Ran those two examples, confirmed the border color is the thing that
    changes when buttons are hovered.
    rparrett authored and mockersf committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    201dd62 View commit details
    Browse the repository at this point in the history

Commits on Jul 4, 2024

  1. Release 0.14.0 version bump (bevyengine#14126)

    # Objective
    
    - Bump the version before the release
    
    - This should not be merged until ready for the release to have prettier
    git history and tags
    mockersf authored Jul 4, 2024
    Configuration menu
    Copy the full SHA
    b231ebb View commit details
    Browse the repository at this point in the history

Commits on Aug 2, 2024

  1. EmptyPathStream is only used in android/wasm32 (bevyengine#14200)

    # Objective
    
    - `EmptyPathStream` is only used in android and wasm32
    - This now makes rust nightly warn
    
    ## Solution
    
    - flag the struct to only be present when needed
    - also change how `MorphTargetNames` is used because that makes rust
    happier?
    mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    a6fde10 View commit details
    Browse the repository at this point in the history
  2. impl Reflect + Clone for StateScoped (bevyengine#14156)

    # Objective
    
    - Expand the flexibilty of StateScoped by adding Reflect and Clone
    - This lets StateScoped be used in Clone Bundles, for example
    
    ```rust
    #[derive(Component, Reflect, Clone)]
    pub struct StateScoped<S: States>(pub S);
    ```
    
    Notes:
    - States are already Clone.
    - Type registration is up to the user, but this is commonly the case
    with reflected generic types.
    
    ## Testing
    
    - Ran the examples.
    brandon-reinhart authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    4275669 View commit details
    Browse the repository at this point in the history
  3. add entity to error message (bevyengine#14163)

    # Objective
    
    - There was a new warning added about having an unstyled child in the ui
    hierarchy. Debugging the new error is pretty hard without any info about
    which entity is.
    
    ## Solution
    
    - Add the entity id to the warning.
    
    ```text
    // Before
    2024-07-05T19:40:59.904014Z  WARN bevy_ui::layout::ui_surface: Unstyled child in a UI entity hierarchy. You are using an entity without UI components as a child of an entity with UI components, results may be unexpected.
    
    //After
    2024-07-05T19:40:59.904014Z  WARN bevy_ui::layout::ui_surface: Unstyled child `3v1` in a UI entity hierarchy. You are using an entity without UI components as a child of an entity with UI components, results may be unexpected.
    ```
    
    ## Changelog
    
    - add entity id to ui surface warning
    hymm authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    c6b80c5 View commit details
    Browse the repository at this point in the history
  4. use Display for entity id in log_components (bevyengine#14164)

    # Objective
    
    - Cleanup a doubled `Entity` in log components
    
    ```
    // Before
    2024-07-05T19:54:09.082773Z  INFO bevy_ecs::system::commands: Entity Entity { index: 2, generation: 1 }: ["bevy_transform::components::transform::Transform"]
    
    // After
    2024-07-05T19:54:09.082773Z  INFO bevy_ecs::system::commands: Entity 2v1: ["bevy_transform::components::transform::Transform"]
    ```
    
    ---------
    
    Co-authored-by: Jan Hohenheim <jan@hohenheim.ch>
    2 people authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    7ed1f6a View commit details
    Browse the repository at this point in the history
  5. Optimize unnecessary normalizations for Transform::local_{xyz} (bev…

    …yengine#14171)
    
    Note that `GlobalTransform` already does it like this for `right`,
    `left`, etc. so I didn't have to touch that one
    janhohenheim authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    e941264 View commit details
    Browse the repository at this point in the history
  6. disable gpu preprocessing on android with Adreno 730 GPU and earilier (

    …bevyengine#14176)
    
    # Objective
    
    Fix bevyengine#14146 
    
    ## Solution
    
    Expansion of bevyengine#13323 , excluded Adreno 730 and earlier.
    
    ## Testing
    
    Tested on android device(Adreno 730) that used to crash
    Litttlefish authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    5d9e44b View commit details
    Browse the repository at this point in the history
  7. bevy_input: allow use without bevy_reflect (bevyengine#14167)

    Allow use of `bevy_input` types without needing `bevy_reflect`.
    
    Make `bevy_reflect` within `bevy_input` optional. It's compiled in by
    default.
    Turn on reflect in dependencies as well when this feature is on.
    
    - Did you test these changes? If so, how?
    
    I did a `cargo hack -p bevy_input --each-feature build`.
    
    Signed-off-by: Torstein Grindvik <torstein.grindvik@muybridge.com>
    Co-authored-by: Torstein Grindvik <torstein.grindvik@muybridge.com>
    2 people authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    1bc5ecd View commit details
    Browse the repository at this point in the history
  8. fix: Possible NaN due to denormalised quaternions in AABB implementat…

    …ions for round shapes. (bevyengine#14240)
    
    # Objective
    
    With an unlucky denormalised quaternion (or just a regular very
    denormalised quaternion), it's possible to obtain NaN values for AABB's
    in shapes which rely on an AABB for a disk.
    
    ## Solution
    
    Add an additional `.max(Vec3::ZERO)` clamp to get rid of negative values
    arising due to numerical errors.
    Fixup some unnecessary calculations and improve variable names in
    relevant code, aiming for consistency.
    
    ## Discussion
    
    These two (nontrivial) lines of code are repeated at least 5 times,
    maybe they could be their own method.
    IQuick143 authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    0e1858b View commit details
    Browse the repository at this point in the history
  9. Dirty fix for App hanging when windows are invisible on WindowsOS (be…

    …vyengine#14155)
    
    # Objective
    
    - Fixes bevyengine#14135 
    
    ## Solution
    
    - If no windows are visible, app updates will run regardless of redraw
    call result.
    
    This a relatively dirty fix, a more robust solution is desired in the
    long run:
    bevyengine#1343 (comment)
    
    https://discord.com/channels/691052431525675048/1253771396832821270/1258805997011730472
    The solution would disconnect rendering from app updates.
    
    ## Testing
    
    - `window_settings` now works
    
    ## Other platforms
    
    Not a problem on Linux:
    https://discord.com/channels/691052431525675048/692572690833473578/1259526650622640160
    Not a problem on MacOS:
    https://discord.com/channels/691052431525675048/692572690833473578/1259563986148659272
    MiniaczQ authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    4bd56b6 View commit details
    Browse the repository at this point in the history
  10. Fix swapped docs for Rot2::rotation_to/from_y (bevyengine#14307)

    # Objective
    
    Fixes bevyengine#14301 
    
    ## Solution
    
    Swap them so that they are no longer swapped.
    mweatherley authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    d0583c8 View commit details
    Browse the repository at this point in the history
  11. Allow observer systems to have outputs (bevyengine#14159)

    Fixes bevyengine#14157
    
    - Update the ObserverSystem traits to accept an `Out` parameter
    
    - Added a test where an observer system has a non-empty output which is
    piped into another system
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    2 people authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    7f3fea9 View commit details
    Browse the repository at this point in the history
  12. Make initial StateTransition run before PreStartup (bevyengine#14208

    )
    
    # Objective
    
    - Fixes bevyengine#14206 
    
    ## Solution
    
    - Run initial `StateTransition` as a startup schedule before
    `PreStartup`, instead of running it inside `Startup` as an exclusive
    system.
    
    Related discord discussion:
    
    https://discord.com/channels/691052431525675048/692572690833473578/1259543775668207678
    
    ## Testing
    
    Reproduction now works correctly:
    
    ```rs
    use bevy::prelude::*;
    
    #[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Hash, States)]
    enum AppState {
        #[default]
        Menu,
        InGame,
    }
    
    fn main() {
        App::new()
            .add_plugins(DefaultPlugins)
            .init_state::<AppState>()
            .add_systems(Startup, setup)
            .add_systems(OnEnter(AppState::Menu), enter_menu_state)
            .run();
    }
    
    fn setup(mut next_state: ResMut<NextState<AppState>>) {
        next_state.set(AppState::Menu);
    }
    
    fn enter_menu_state() {
        println!("Entered menu state");
    }
    ```
    
    
    ![image](https://github.com/bevyengine/bevy/assets/13040204/96d7a533-c439-4c0b-8f15-49f620903ce1)
    
    
    ---
    
    ## Changelog
    
    - Initial `StateTransition` runs before `PreStartup` instead of inside
    `Startup`.
    MiniaczQ authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    524fb01 View commit details
    Browse the repository at this point in the history
  13. Fix overflow in RenderLayers::iter_layers (bevyengine#14264)

    # Objective
    
    - Fixes overflow when calling `RenderLayers::iter_layers` on layers of
    the form `k * 64 - 1`
    - Causes a panic in debug mode, and an infinite iterator in release mode
    
    ## Solution
    
    - Use `u64::checked_shr` instead of `>>=`
    
    ## Testing
    
    - Added a test case for this: `render_layer_iter_no_overflow`
    Azorlogh authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    728c5b9 View commit details
    Browse the repository at this point in the history
  14. Fix bevy_window failing with serialize feature (bevyengine#14298)

    # Objective
    
    - [`flag-frenzy`](https://github.com/TheBevyFlock/flag-frenzy) found an
    issue where `bevy_window` would fail to build when its `serialize`
    feature is enabled.
    - See
    [here](https://github.com/TheBevyFlock/flag-frenzy/actions/runs/9924187577/job/27415224405)
    for the specific log.
    
    ## Solution
    
    - Turns out it was failing because the `bevy_ecs/serialize` feature was
    not enabled. This error can be fixed by adding the flag as a dependency.
    
    ## Testing
    
    ```bash
    cargo check -p bevy_window -F serialize
    # Or if you're very cool...
    flag-frenzy --manifest-path path/to/bevy/Cargo.toml --config config -p bevy_window
    ```
    BD103 authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    70a0c21 View commit details
    Browse the repository at this point in the history
  15. Fix error/typo in SMAA shader (bevyengine#14338)

    # Objective
    
    - Actually use the value assigned to `d_xz`, like in [the original SMAA
    implementation](https://github.com/iryoku/smaa/blob/master/SMAA.hlsl#L960).
    This not already being the case was likely a mistake when converting
    from HLSL to WGSL
    
    ## Solution
    
    - Use `d_xz.x` and `d_xz.y` instead of `d.x` and `d.z`
    
    ## Testing
    
    - Quickly tested on Windows 11, `x86_64-pc-windows-gnu` `1.79.0` with
    the latest NVIDIA drivers. App runs with SMAA enabled and everything
    seems to work as intended
    - I didn't observe any major visual difference between this and the
    previous version, though this should be more correct as it matches the
    original SMAA implementation
    Luracasmus authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    42412f3 View commit details
    Browse the repository at this point in the history
  16. Make Viewport::default() return a 1x1 viewport (bevyengine#14372)

    # Objective
    
    - The current default viewport crashes bevy due to a wgpu validation
    error, this PR fixes that
    - Fixes bevyengine#14355
    
    ## Solution
    
    - `Viewport::default()` now returns a 1x1 viewport
    
    ## Testing
    
    - I modified the `3d_viewport_to_world` example to use
    `Viewport::default()`, and it works as expected (only the top-left pixel
    is rendered)
    SludgePhD authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    420ca6c View commit details
    Browse the repository at this point in the history
  17. fix building cargo_gltf with feature dds (bevyengine#14360)

    # Objective
    
    - Building bevy_gltf with feature dds fails:
    ```
    > cargo build -p bevy_gltf --features dds
       Compiling bevy_core_pipeline v0.15.0-dev (crates/bevy_core_pipeline)
    error[E0061]: this function takes 7 arguments but 6 arguments were supplied
       --> crates/bevy_core_pipeline/src/tonemapping/mod.rs:442:5
        |
    442 |     Image::from_buffer(
        |     ^^^^^^^^^^^^^^^^^^
    ...
    445 |         bytes,
        |         ----- an argument of type `std::string::String` is missing
        |
    note: associated function defined here
       --> crates/bevy_render/src/texture/image.rs:709:12
        |
    709 |     pub fn from_buffer(
        |            ^^^^^^^^^^^
    help: provide the argument
        |
    442 |     Image::from_buffer(/* std::string::String */, bytes, image_type, CompressedImageFormats::NONE, false, image_sampler, RenderAssetUsages::RENDER_WORLD)
        |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    For more information about this error, try `rustc --explain E0061`.
    error: could not compile `bevy_core_pipeline` (lib) due to 1 previous error
    ```
    - If you're fixing a specific issue, say "Fixes #X".
    
    ## Solution
    
    - enable dds feature in bevy_core_pipeline
    
    ## Testing
    
    - `cargo build -p bevy_gltf --features dds`
    mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    295ed1f View commit details
    Browse the repository at this point in the history
  18. Fix incorrect function calls to hsv_to_rgb in render debug code. (bev…

    …yengine#14260)
    
    # Objective
    
    - Fixes bevyengine#14139
    
    ## Solution
    
    - correct the input parameters at these call sites.
    
    ## Testing
    
    1. Use a 3D scene example with PBR lighting and shadows enabled, such as
    the `shadow_caster_receiver` and `load_gltf` example, for testing.
    2. Enable relevant shader defines in crates/bevy_pbr/src/pbr_material.rs
    for the StandardMaterial.
    ```rust
    impl Material for StandardMaterial {
        // ...
        fn specialize(
                _pipeline: &MaterialPipeline<Self>,
                descriptor: &mut RenderPipelineDescriptor,
                _layout: &MeshVertexBufferLayoutRef,
                key: MaterialPipelineKey<Self>,
            ) -> Result<(), SpecializedMeshPipelineError> {
                // ...
                // shader_defs.push("CLUSTERED_FORWARD_DEBUG_Z_SLICES".into());
                // shader_defs.push("CLUSTERED_FORWARD_DEBUG_CLUSTER_COHERENCY".into());
                shader_defs.push("DIRECTIONAL_LIGHT_SHADOW_MAP_DEBUG_CASCADES".into());
                // ...
        }
    }
    ``` 
    
    ## Showcase
    ### CLUSTERED_FORWARD_DEBUG_Z_SLICES
    - example: examples/3d/shadow_caster_receiver.rs
    
    ![Screenshot2024_07_10_143150](https://github.com/bevyengine/bevy/assets/6300263/fbd12712-5cb9-489d-a7d1-ed55f72fb234)
    
    ### CLUSTERED_FORWARD_DEBUG_CLUSTER_COHERENCY
    - example: examples/3d/shadow_caster_receiver.rs
    
    ![Screenshot2024_07_10_143312](https://github.com/bevyengine/bevy/assets/6300263/8eca5d7a-27b6-4ff5-9f8d-d10b49b3f990)
    
    ### DIRECTIONAL_LIGHT_SHADOW_MAP_DEBUG_CASCADES
    For this one, we need to use a large scene and modity the
    `CascadeShadowConfigBuilder`, here is a simple patch for the `load_gltf`
    example:
    ```
    diff --git a/examples/3d/load_gltf.rs b/examples/3d/load_gltf.rs
    index 358446238..9403aa288 100644
    --- a/examples/3d/load_gltf.rs
    +++ b/examples/3d/load_gltf.rs
    @@ -18,7 +18,7 @@ fn main() {
     fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
         commands.spawn((
             Camera3dBundle {
    -            transform: Transform::from_xyz(0.7, 0.7, 1.0)
    +            transform: Transform::from_xyz(0.7, 0.7, 2.0)
                     .looking_at(Vec3::new(0.0, 0.3, 0.0), Vec3::Y),
                 ..default()
             },
    @@ -39,30 +39,40 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
             // We also adjusted the shadow map to be larger since we're
             // only using a single cascade.
             cascade_shadow_config: CascadeShadowConfigBuilder {
    -            num_cascades: 1,
    -            maximum_distance: 1.6,
    +            num_cascades: 5,
    +            maximum_distance: 20.0,
                 ..default()
             }
             .into(),
             ..default()
         });
    +
         commands.spawn(SceneBundle {
             scene: asset_server
                 .load(GltfAssetLabel::Scene(0).from_asset("models/FlightHelmet/FlightHelmet.gltf")),
             ..default()
         });
    +
    +    for i in 1..=10 {
    +        commands.spawn(SceneBundle {
    +            scene: asset_server
    +                .load(GltfAssetLabel::Scene(0).from_asset("models/FlightHelmet/FlightHelmet.gltf")),
    +            transform: Transform::from_xyz(i as f32 * 0.5, 0.0, i as f32 * -2.0),
    +            ..default()
    +        });
    +    }
     }
     
     fn animate_light_direction(
         time: Res<Time>,
         mut query: Query<&mut Transform, With<DirectionalLight>>,
     ) {
    -    for mut transform in &mut query {
    -        transform.rotation = Quat::from_euler(
    -            EulerRot::ZYX,
    -            0.0,
    -            time.elapsed_seconds() * PI / 5.0,
    -            -FRAC_PI_4,
    -        );
    -    }
    +    // for mut transform in &mut query {
    +    //     transform.rotation = Quat::from_euler(
    +    //         EulerRot::ZYX,
    +    //         0.0,
    +    //         time.elapsed_seconds() * PI / 5.0,
    +    //         -FRAC_PI_4,
    +    //     );
    +    // }
     }
    ``` 
    
    ![Screenshot2024_07_10_145737](https://github.com/bevyengine/bevy/assets/6300263/c5c71894-f9f7-45fa-9b4f-598e324b42d0)
    
    ---------
    
    Co-authored-by: ickshonpe <david.curthoys@googlemail.com>
    2 people authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    df3fcbd View commit details
    Browse the repository at this point in the history
  19. Add some missing reflect attributes (bevyengine#14259)

    # Objective
    
    - Some types are missing reflection attributes, which means we can't use
    them in scene serialization etc.
    - Effected types
       - `BorderRadius`
       - `AnimationTransitions`
       - `OnAdd`
       - `OnInsert`
       - `OnRemove`
    - My use-case for `OnAdd` etc to derive reflect is 'Serializable
    Observer Components'. Add the component, save the scene, then the
    observer is re-added on scene load.
    
    ```rust
    #[derive(Reflect)]
    struct MySerializeableObserver<T: Event>(#[reflect(ignore)]PhantomData<T>);
    
    impl<T: Event> Component for MySerializeableObserver<T> {
      const STORAGE_TYPE: StorageType  = StorageType::Table;
        fn register_component_hooks(hooks: &mut ComponentHooks) {
          hooks.on_add(|mut world, entity, _| {
            world
              .commands()
              .entity(entity)
              .observe(|_trigger: Trigger<T>| {
                println!("it triggered etc.");
              });
        });
      }
    }
    ```
    
    ## Solution
    
    - Add the missing traits
    
    ---
    mrchantey authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    6882420 View commit details
    Browse the repository at this point in the history
  20. Fix single keyframe animations. (bevyengine#14344)

    # Objective
    
    For clips with more than one curve, only the first was being applied if
    there is only one keyframe in it.
    
    ## Solution
    
    Continue!
    yrns authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    2e577bc View commit details
    Browse the repository at this point in the history
  21. Fix bevy_gltf PBR features not enabling corresponding bevy_pbr fl…

    …ags (bevyengine#14486)
    
    # Objective
    
    - `bevy_gltf` does not build with only the
    `pbr_multi_layer_material_textures` or `pbr_anisotropy_texture`
    features.
    - Caught by [`flag-frenzy`](https://github.com/TheBevyFlock/flag-frenzy)
    in [this
    run](https://github.com/TheBevyFlock/flag-frenzy/actions/runs/10087486444/job/27891723948).
    
    ## Solution
    
    - This error was due to the feature not enabling the corresponding
    feature in `bevy_pbr`. Adding these flags as a dependency fixes this
    error.
    
    ## Testing
    
    The following commands fail on `main`, but pass with this PR:
    
    ```bash
    cargo check -p bevy_gltf --no-default-features -F pbr_multi_layer_material_textures
    cargo check -p bevy_gltf --no-default-features -F pbr_anisotropy_texture
    ```
    BD103 authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    2870d89 View commit details
    Browse the repository at this point in the history
  22. Handle 0 height in prepare_bloom_textures (bevyengine#14423)

    # Objective
    
    - Fix a confusing panic when the viewport width is non-zero and the
    height is 0, `prepare_bloom_textures` tries to create a `4294967295x1`
    texture.
    
    ## Solution
    
    - Avoid dividing by zero
    - Apps still crash after this, but now on a more reasonable error about
    the zero-size viewport
    
    ## Testing
    
    - I isolated and tested the math. A height of 0 sets `mip_height_ratio`
    to `inf`, causing the width to explode if it isn't also 0
    NiseVoid authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    9daf16b View commit details
    Browse the repository at this point in the history
  23. Fix bevy_winit not building with serialize feature (bevyengine#14469

    )
    
    # Objective
    
    - `bevy_winit` fails to build with just the `serialize` feature.
    - Caught by [`flag-frenzy`](https://github.com/TheBevyFlock/flag-frenzy)
    in [this
    run](https://github.com/TheBevyFlock/flag-frenzy/actions/runs/10087486444/job/27891723948),
    using the new, nuanced configuration system!
    
    ## Solution
    
    - It was failing because `bevy_winit` did not pass the `serialize` flag
    to two of its dependencies: `bevy_input` and `bevy_window`.
    - To fix this, add these crates to the feature flag.
    
    ## Testing
    
    ```bash
    # On Linux, you must also specify a backend: `x11` or `wayland`.
    # You can do this with `-F serialize,x11`, etc.
    cargo check -p bevy_winit --no-default-features -F serialize
    ```
    BD103 authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    c4ea477 View commit details
    Browse the repository at this point in the history
  24. Fix TextureCache memory leak and add is_empty() method (bevyengine#14480

    )
    
    # Objective
    
    Fix a memory leak in `TextureCache` caused by the internal HashMap never
    having unused entries cleared.
    
    This isn't a giant memory leak, given the unused entries are simply
    empty vectors. Though, if someone goes and resizes a window a bunch, it
    can lead to hundreds/thousands of TextureDescriptor keys adding up in
    the hashmap – which isn't ideal.
    
    ## Solution
    
    - Only retain hashmap entries that still have textures.
    - I also added an `is_empty()` method to `TextureCache`, which is useful
    for 3rd-party higher-level caches that might have individual caches by
    view entity or texture type, for example.
    
    ## Testing
    
    - Verified the examples still work (this is a trivial change)
    brianreavis authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    680c994 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    27cafda View commit details
    Browse the repository at this point in the history
  26. Fix bevy_render's image dependency version (bevyengine#14505)

    # Objective
    
    - `bevy_render` depends on `image 0.25` but uses `image::ImageReader`
    which was added only in `image 0.25.2`
    - users that have `image 0.25` in their `Cargo.lock` and update to the
    latest `bevy_render` may thus get a compilation due to this (at least I
    did)
    
    ## Solution
    
    - Properly set the correct minimum version of `image` that `bevy_render`
    depends on.
    SkiFire13 authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    587cffd View commit details
    Browse the repository at this point in the history
  27. Disabled usage of the POLYGON_MODE_LINE gpu feature in the examples (b…

    …evyengine#14402)
    
    Fixes bevyengine#14353
    Fixes bevyengine#14371
    
    ---------
    
    Signed-off-by: Sarthak Singh <sarthak.singh99@gmail.com>
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    Co-authored-by: BD103 <59022059+BD103@users.noreply.github.com>
    3 people authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    0886e6a View commit details
    Browse the repository at this point in the history
  28. fix issue with phantom ui node children (bevyengine#14490)

    # Objective
    
    The `ui_layout_system` relies on change detection to sync parent-child
    relation to taffy. The children need to by synced before node removal to
    avoid trying to set deleted nodes as children (due to how the different
    queries collect entities). This however may leave nodes that were
    removed set as children to other nodes in special cases.
    
    Fixes bevyengine#11385
    
    ## Solution
    
    The solution is simply to re-sync the changed children after the nodes
    are removed.
    
    ## Testing
    
    Tested with `sickle_ui` where docking zone highlights would end up
    glitched when docking was done in a certain manner:
    - run the `docking_zone_splits` example
    - pop out a tab from the top
    - dock the floating panel in the center right
    - grab another tab and try to hover the original static docking zone:
    the highlight is semi-stuck
    - (NOTE: sometimes it worked even without the fix due to scheduling
    order not producing the bugged query results)
    
    After the fix, the issue is no longer present.
    
    NOTE: The performance impact should be minimal, as the child sync relies
    on change detection. The change detection was also the reason the parent
    nodes remained "stuck" with the phantom children if no other update were
    done to them.
    eidloi authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    ebfe545 View commit details
    Browse the repository at this point in the history
  29. Properly handle repeated window close requests (bevyengine#14573)

    # Objective
    
    Spamming the window close button on window may trigger a panic.
    
    ```
    thread 'main' panicked at <Bevy repo>\crates\bevy_ecs\src\system\commands\mod.rs:1320:13:
    error[B0003]: Could not insert a bundle (of type `bevy_window::window::ClosingWindow`) for entity 0v1#4294967296 because it doesn't exist in this World. See: https://bevyengine.org/learn/errors/b0003
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    Encountered a panic when applying buffers for system `bevy_window::system::close_when_requested`!
    2024-08-01T15:00:29.742612Z  WARN bevy_ecs::world::command_queue: CommandQueue has un-applied commands being dropped. Did you forget to call SystemState::apply?
    Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!
    error: process didn't exit successfully: `target\debug\bevy.exe` (exit code: 101)
    ```
    
    ## Solution
    
    Don't panic when trying to insert the `ClosingWindow` component into a
    entity.
    
    ## Testing
    
    Found and tested on windows. I haven't checked if this bug happens on
    linux or macos.
    For testing I ran this code:
    
    ```rust
    use std::{thread, time::Duration};
    
    use bevy::prelude::*;
    
    fn lag() {
        thread::sleep(Duration::from_millis(300));
    }
    
    fn main() -> AppExit {
        App::new()
            .add_plugins(DefaultPlugins)
            .add_systems(Update, lag)
            .run()
    }
    ```
    
    Then spammed the window close button. The panic no longer occurs.
    Brezak authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    3a6176b View commit details
    Browse the repository at this point in the history
  30. fix asymmetrical 9-slicing (bevyengine#14148)

    # Objective
    
    Fixes bevyengine#14147.
    
    ## Solution
    
    Modify the slicing checks and algorithm to fully allow asymmetrical
    textures to work.
    Some opinionated code cleanup.
    
    ## Testing
    
    Tested using the ui_texture_slice example and a custom asymmetrical
    texture.
    
    Before:
    
    ![asymmetrical_texture_slice_before](https://github.com/bevyengine/bevy/assets/88861660/00dafce1-904a-41ac-b5d9-faaf087b0681)
    
    After:
    
    ![asymmetrical_texture_slice_after](https://github.com/bevyengine/bevy/assets/88861660/f3d742f3-6157-4d35-b383-aee4b8f6e7d0)
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    2 people authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    d888640 View commit details
    Browse the repository at this point in the history
  31. Skip batching for phase items from other pipelines (bevyengine#14296)

    # Objective
    
    - Fix bevyengine#14295
    
    ## Solution
    
    - Early out when `GFBD::get_index_and_compare_data` returns None.
    
    ## Testing
    
    - Tested on a selection of examples including `many_foxes` and
    `3d_shapes`.
    - Resolved the original issue in `bevy_vector_shapes`.
    james-j-obrien authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    833ee3f View commit details
    Browse the repository at this point in the history
  32. feat: add insert_after and insert_startup_before (bevyengine#13941)

    # Objective
    
    Fixes bevyengine#13866 
    
    ## Solution
    
    Add `insert_before` in **FixedMainScheduleOrder** and
    **MainScheduleOrder**, add `insert_startup_before` in
    **MainScheduleOrder**, applying the same logic as `insert_after`, except
    for parameters naming and insertion index.
    kettei-sproutty authored and mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    61c683f View commit details
    Browse the repository at this point in the history
  33. clippy happy

    mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    c217238 View commit details
    Browse the repository at this point in the history
  34. Release 0.14.1

    mockersf committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    d65eb39 View commit details
    Browse the repository at this point in the history

Commits on Aug 8, 2024

  1. Configuration menu
    Copy the full SHA
    aa034e7 View commit details
    Browse the repository at this point in the history