Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: bevyengine/bevy
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1f6984d664ee6514f06534de8e06ee829b5b4507
Choose a base ref
...
head repository: bevyengine/bevy
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 70b9cc4068e1a33a57d89be3064277446c440302
Choose a head ref
  • 19 commits
  • 72 files changed
  • 14 contributors

Commits on May 4, 2022

  1. Make RunOnce a non-manual System impl (#3922)

    # Objective
    
    - `RunOnce` was a manual `System` implementation.
    - Adding run criteria to stages was yet to be systemyoten
    
    ## Solution
    
    - Make it a normal function
    - yeet
    
    ##  Changelog
    
    - Replaced `RunOnce` with `ShouldRun::once`
    
    ## Migration guide
    
    The run criterion `RunOnce`, which would make the controlled systems run only once, has been replaced with a new run criterion function `ShouldRun::once`. Replace all instances of `RunOnce` with `ShouldRun::once`.
    DJMcNab committed May 4, 2022
    Configuration menu
    Copy the full SHA
    9d440fb View commit details
    Browse the repository at this point in the history
  2. bevy_ptr standalone crate (#4653)

    # Objective
    
    The pointer types introduced in #3001 are useful not just in `bevy_ecs`, but also in crates like `bevy_reflect` (#4475) or even outside of bevy.
    
    ## Solution
    
    Extract `Ptr<'a>`, `PtrMut<'a>`, `OwnedPtr<'a>`, `ThinSlicePtr<'a, T>` and `UnsafeCellDeref` from `bevy_ecs::ptr` into `bevy_ptr`.
    
    **Note:** `bevy_ecs` still reexports the `bevy_ptr` as `bevy_ecs::ptr` so that crates like `bevy_transform` can use the `Bundle` derive without needing to depend on `bevy_ptr` themselves.
    jakobhellermann committed May 4, 2022
    Configuration menu
    Copy the full SHA
    1e322d9 View commit details
    Browse the repository at this point in the history
  3. set alpha_mode based on alpha value (#4658)

    # Objective
    
    - When spawning a sprite the alpha is used for transparency, but when using the `Color::into()` implementation to spawn a `StandardMaterial`, the alpha is ignored.
    - Pretty much everytime I want to make something transparent I started with a `Color::rgb().into()` and I'm always surprised that it doesn't work when changing it to  `Color::rgba().into()`
    - It's possible there's an issue with this approach I am not thinking of, but I'm not sure what's the point of setting an alpha value without the goal of making a color transparent.
    
    ## Solution
    
    - Set the alpha_mode to AlphaMode::Blend when the alpha is not the default value.
    
    ---
    
    ## Migration Guide
    
    This is not a breaking change, but it can easily be migrated to reduce boilerplate
    
    ```rust
    commands.spawn_bundle(PbrBundle {
        mesh: meshes.add(shape::Cube::default().into()),
        material: materials.add(StandardMaterial {
            base_color: Color::rgba(1.0, 0.0, 0.0, 0.75),
            alpha_mode: AlphaMode::Blend,
            ..default()
        }),
        ..default()
    });
    
    // becomes
    
    commands.spawn_bundle(PbrBundle {
        mesh: meshes.add(shape::Cube::default().into()),
        material: materials.add(Color::rgba(1.0, 0.0, 0.0, 0.75).into()),
        ..default()
    });
    ```
    
    
    Co-authored-by: Charles <IceSentry@users.noreply.github.com>
    IceSentry and IceSentry committed May 4, 2022
    Configuration menu
    Copy the full SHA
    3f4ac65 View commit details
    Browse the repository at this point in the history
  4. Make Wireframe respect visible entities (#4660)

    # Objective
    
    - Make meshes with a Wireframe component not render if they are not in the VisibleEntities list of a given camera
    - See [discussion](https://discord.com/channels/691052431525675048/742884593551802431/971392761972527144) on the Bevy Engine Discord
    - Fixes this kind of issues:
    ![image](https://user-images.githubusercontent.com/1733200/166746303-39003d57-8b07-4ae2-9ddf-bacdb04e7d84.png)
    Camera for the RenderTexture in the bottom left is set to only see layer 1 entities. The three colored lines are on the render layer 1, but not the sphere (which has a Wireframe component).
    
    ## Solution
    
    - Mimick what is done in [bevy_pbr/src/material.rs#L307](https://github.com/bevyengine/bevy/blob/479f43bbf34834ad2d4667de43351b6fa51f22d1/crates/bevy_pbr/src/material.rs#L307) for [bevy_pbr/src/wireframe.rs#L106](https://github.com/bevyengine/bevy/blob/2b6e67f4cb441f658cad17486eea9e3485e56709/crates/bevy_pbr/src/wireframe.rs#L106)
    - Credits to beep for finding this out!
    dtaralla committed May 4, 2022
    Configuration menu
    Copy the full SHA
    f02bea5 View commit details
    Browse the repository at this point in the history

Commits on May 5, 2022

  1. Add RegularPolygon and Circle meshes (#3730)

    # Objective
    
    Bevy users often want to create circles and other simple shapes.
    
    All the machinery is in place to accomplish this, and there are external crates that help. But when writing code for e.g. a new bevy example, it's not really possible to draw a circle without bringing in a new asset, writing a bunch of scary looking mesh code, or adding a dependency.
    
    In particular, this PR was inspired by this interaction in another PR: #3721 (comment)
    
    ## Solution
    
    This PR adds `shape::RegularPolygon` and `shape::Circle` (which is just a `RegularPolygon` that defaults to a large number of sides)
    
    ## Discussion
    
    There's a lot of ongoing discussion about shapes in <bevyengine/rfcs#12> and at least one other lingering shape PR (although it seems incomplete).
    
    That RFC currently includes `RegularPolygon` and `Circle` shapes, so I don't think that having working mesh generation code in the engine for those shapes would add much burden to an author of an implementation.
    
    But if we'd prefer not to add additional shapes until after that's sorted out, I'm happy to close this for now.
    
    ## Alternatives for users
    
    For any users stumbling on this issue, here are some plugins that will help if you need more shapes.
    
    https://github.com/Nilirad/bevy_prototype_lyon
    https://github.com/johanhelsing/bevy_smud
    https://github.com/Weasy666/bevy_svg
    https://github.com/redpandamonium/bevy_more_shapes
    https://github.com/ForesightMiningSoftwareCorporation/bevy_polyline
    rparrett committed May 5, 2022
    Configuration menu
    Copy the full SHA
    f8e0fc1 View commit details
    Browse the repository at this point in the history
  2. Add support for vertex colors (#4528)

    # Objective
    
    Add support for vertex colors
    
    ## Solution
    
    This change is modeled after how vertex tangents are handled, so the shader is conditionally compiled with vertex color support if the mesh has the corresponding attribute set.
    
    Vertex colors are multiplied by the base color. I'm not sure if this is the best for all cases, but may be useful for modifying vertex colors without creating a new mesh.
    
    I chose `VertexFormat::Float32x4`, but I'd prefer 16-bit floats if/when support is added.
    
    ## Changelog
    
    ### Added
    - Vertex colors can be specified using the `Mesh::ATTRIBUTE_COLOR` mesh attribute.
    HackerFoo committed May 5, 2022
    Configuration menu
    Copy the full SHA
    82d849d View commit details
    Browse the repository at this point in the history
  3. StorageBuffer uses wrong type to calculate the buffer size. (#4557)

    # Objective
    Fixes #4556
    
    ## Solution
    StorageBuffer must use the Size of the std430 representation to calculate the buffer size, as the std430 representation is the data that will be written to it.
    MonaMayrhofer committed May 5, 2022
    Configuration menu
    Copy the full SHA
    5585308 View commit details
    Browse the repository at this point in the history
  4. Allow closing windows at runtime (#3575)

    # Objective
    
    Fixes #3180, builds from #2898
    
    ## Solution
    
    Support requesting a window to be closed and closing a window in `bevy_window`, and handle this in `bevy_winit`.
    
    This is a stopgap until we move to windows as entites, which I'm sure I'll get around to eventually.
    
    ## Changelog
    
    ### Added
    
    - `Window::close` to allow closing windows.
    - `WindowClosed` to allow reacting to windows being closed.
    
    ### Changed
    
    Replaced `bevy::system::exit_on_esc_system` with `bevy::window::close_on_esc`.
    
    ## Fixed
    
    The app no longer exits when any window is closed. This difference is only observable when there are multiple windows. 
    
    ## Migration Guide
    
    `bevy::input::system::exit_on_esc_system` has been removed. Use `bevy::window::close_on_esc` instead.
    `CloseWindow` has been removed. Use `Window::close` instead.
    The `Close` variant has been added to `WindowCommand`. Handle this by closing the relevant window.
    DJMcNab committed May 5, 2022
    Configuration menu
    Copy the full SHA
    b731eba View commit details
    Browse the repository at this point in the history

Commits on May 6, 2022

  1. Fix CI (#4675)

    BoxyUwU committed May 6, 2022
    Configuration menu
    Copy the full SHA
    96b4956 View commit details
    Browse the repository at this point in the history
  2. Apply buffers in ParamSet (#4677)

    # Objective
    
    - Fix #4676
    
    ## Solution
    
    - Fixes #4676
    - I have no reason to think this isn't sound, but `ParamSet` is a bit spooky
    DJMcNab committed May 6, 2022
    Configuration menu
    Copy the full SHA
    ec805e9 View commit details
    Browse the repository at this point in the history
  3. some cleanup for bevy_ptr (#4668)

    1. change `PtrMut::as_ptr(self)` and `OwnedPtr::as_ptr(self)` to take `&self`, otherwise printing the pointer will prevent doing anything else afterwards
    2. make all `as_ptr` methods safe. There's nothing unsafe about obtaining a pointer, these kinds of methods are safe in std as well [str::as_ptr](https://doc.rust-lang.org/stable/std/primitive.str.html#method.as_ptr), [Rc::as_ptr](https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.as_ptr)
    3. rename `offset`/`add` to `byte_offset`/`byte_add`. The unprefixed methods in std add in increments of `std::mem::size_of::<T>`, not in bytes. There's a PR for rust to add these byte_ methods rust-lang/rust#95643 and at the call site it makes it much more clear that you need to do `.byte_add(i * layout_size)` instead of `.add(i)`
    jakobhellermann committed May 6, 2022
    Configuration menu
    Copy the full SHA
    d63b7e9 View commit details
    Browse the repository at this point in the history
  4. Add the license for the FiraMono font (#3589)

    I copied the license from https://github.com/mozilla/Fira/blob/master/LICENSE. The fact that the license file was missing came up in a discussion on [discord](https://discord.com/channels/691052431525675048/695741366520512563/929332683149017119).
    bjorn3 committed May 6, 2022
    Configuration menu
    Copy the full SHA
    d46cf69 View commit details
    Browse the repository at this point in the history
  5. simple tool to compare traces between executions (#4628)

    # Objective
    
    - Have an easy way to compare spans between executions
    
    ## Solution
    
    - Add a tool to compare spans from chrome traces
    
    ```bash
    > cargo run --release  -p spancmp -- --help
       Compiling spancmp v0.1.0
        Finished release [optimized] target(s) in 1.10s
         Running `target/release/spancmp --help`
    spancmp
    
    USAGE:
        spancmp [OPTIONS] <TRACE> [SECOND_TRACE]
    
    ARGS:
        <TRACE>
        <SECOND_TRACE>
    
    OPTIONS:
        -h, --help                     Print help information
        -p, --pattern <PATTERN>        Filter spans by name matching the pattern
        -t, --threshold <THRESHOLD>    Filter spans that have an average shorther than the threshold
                                       [default: 0]
    ```
    
    for each span, it will display the count, minimum duration, average duration and max duration. It can be filtered by a pattern on the span name or by a minimum average duration.
    
    just displaying a trace
    ![Screenshot 2022-04-28 at 21 56 21](https://user-images.githubusercontent.com/8672791/165835310-f465c6f2-9e6b-4808-803e-884b06e49292.png)
    
    comparing two traces
    ![Screenshot 2022-04-28 at 21 56 55](https://user-images.githubusercontent.com/8672791/165835353-097d266b-a70c-41b8-a8c1-27804011dc97.png)
    
    
    
    Co-authored-by: Robert Swain <robert.swain@gmail.com>
    mockersf and superdump committed May 6, 2022
    Configuration menu
    Copy the full SHA
    068e9ea View commit details
    Browse the repository at this point in the history
  6. Make public macros more robust with $crate (#4655)

    # Objective
    
    We have some macros that are public but only used internally for now. They fail on user's code due to the use of crate names like `bevy_utils`, while the user only has `bevy::utils`. There are two affected macros.
    
    - `bevy_utils::define_label`: it may be useful in user's code for defining custom kinds of label traits (this is why I made this PR).
    - `bevy_asset::load_internal_asset`: not useful currently due to limitations of the debug asset server, but this may change in the future.
    
    ## Solution
    
    We can make them work by using `$crate` instead of names of their own crates, which can refer to the macro's defining crate regardless of the user's setup. Even though our objective is rather low-priority here, the solution adds no maintenance cost so it is still worthwhile.
    infmagic2047 committed May 6, 2022
    Configuration menu
    Copy the full SHA
    aabc47f View commit details
    Browse the repository at this point in the history
  7. use const Vec2 in lights cluster and bounding box when possible (#4602)

    # Objective
    
    - noticed a few Vec3 and Vec2 that could be const
    
    ## Solution
    
    - Declared them as const
    - It seems to make a tiny improvement in example `many_light`, but given that the change is not complex at all it could still be worth it
    mockersf committed May 6, 2022
    Configuration menu
    Copy the full SHA
    743bd30 View commit details
    Browse the repository at this point in the history

Commits on May 7, 2022

  1. Stop labeling PRs with Needs-Triage (#4686)

    # Objective
    
    - New PRs are labeled with Needs-Triage, but this is unhelpful and creates busy work: it's just as easy to check for unlabelled PRs, especially now that we no longer have an unlabelled backlog.
    
    Note: this is not true for issues. Issues start with at least one label based on which template they use, and so there's no good way to filter for issues that need attention from the triage team.
    
    ## Solution
    
    - Remove responsible CI tasks.
    alice-i-cecile committed May 7, 2022
    Configuration menu
    Copy the full SHA
    d867b61 View commit details
    Browse the repository at this point in the history

Commits on May 8, 2022

  1. Configuration menu
    Copy the full SHA
    76829f9 View commit details
    Browse the repository at this point in the history
  2. yeet

    BoxyUwU committed May 8, 2022
    Configuration menu
    Copy the full SHA
    7b89a01 View commit details
    Browse the repository at this point in the history
  3. filtered access docs

    BoxyUwU committed May 8, 2022
    Configuration menu
    Copy the full SHA
    70b9cc4 View commit details
    Browse the repository at this point in the history
Loading