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

Query data rename #163

Merged

Commits on Dec 19, 2023

  1. Add non-existent entity behavior to Has doc (bevyengine#11025)

    # Objective
    
    `Has<T>` in some niche cases may behave in an unexpected way.
    
    Specifically, when using `Query::get` on a `Has<T>` with a despawned
    entity.
    
    ## Solution
    
    Add precision about cases wehre `Query::get` could return an `Err`.
    nicopap authored Dec 19, 2023
    Configuration menu
    Copy the full SHA
    d64e148 View commit details
    Browse the repository at this point in the history
  2. Fix typo in docs for Has (bevyengine#11028)

    # Objective
    
    Fix typo
    
    ## Solution
    
    Put the letter `i` in there.
    rparrett authored Dec 19, 2023
    Configuration menu
    Copy the full SHA
    7d2e6cb View commit details
    Browse the repository at this point in the history
  3. OrthographicProjection.scaling_mode is not just for resize (bevyengin…

    …e#11024)
    
    Current comment is somewhat misleading: one may assume the field is used
    only when window is resized.
    stepancheg authored Dec 19, 2023
    Configuration menu
    Copy the full SHA
    4852233 View commit details
    Browse the repository at this point in the history
  4. Reexport winit::platform::android::activity::* in bevy_winit (bevyeng…

    …ine#11011)
    
    # Objective
    
    - Fixes bevyengine#10630
    
    ## Solution
    
    - Reexport winit::platform::android::activity::* in bevy_init
    
    ---------
    
    Co-authored-by: François <mockersf@gmail.com>
    hecksmosis and mockersf authored Dec 19, 2023
    Configuration menu
    Copy the full SHA
    dc8fc6c View commit details
    Browse the repository at this point in the history

Commits on Dec 21, 2023

  1. Update base64 requirement from 0.13.0 to 0.21.5 (bevyengine#10336)

    # Objective
    
    - Update base64 requirement from 0.13.0 to 0.21.5.
    - Closes bevyengine#10317.
    
    ## Solution
    
    - Bumped `base64` requirement and manually migrated code to fix a
    breaking change after updating.
    mnmaita authored Dec 21, 2023
    Configuration menu
    Copy the full SHA
    3b59dbd View commit details
    Browse the repository at this point in the history
  2. Update winit dependency to 0.29 (bevyengine#10702)

    # Objective
    
    - Update winit dependency to 0.29
    
    ## Changelog
    
    ### KeyCode changes
    
    - Removed `ScanCode`, as it was [replaced by
    KeyCode](https://github.com/rust-windowing/winit/blob/master/CHANGELOG.md#0292).
    - `ReceivedCharacter.char` is now a `SmolStr`, [relevant
    doc](https://docs.rs/winit/latest/winit/event/struct.KeyEvent.html#structfield.text).
    - Changed most `KeyCode` values, and added more.
    
    KeyCode has changed meaning. With this PR, it refers to physical
    position on keyboard rather than the printed letter on keyboard keys.
    
    In practice this means:
    - On QWERTY keyboard layouts, nothing changes
    - On any other keyboard layout, `KeyCode` no longer reflects the label
    on key.
    - This is "good". In bevy 0.12, when you used WASD for movement, users
    with non-QWERTY keyboards couldn't play your game! This was especially
    bad for non-latin keyboards. Now, WASD represents the physical keys. A
    French player will press the ZQSD keys, which are near each other,
    Kyrgyz players will use "Цфыв".
    - This is "bad" as well. You can't know in advance what the label of the
    key for input is. Your UI says "press WASD to move", even if in reality,
    they should be pressing "ZQSD" or "Цфыв". You also no longer can use
    `KeyCode` for text inputs. In any case, it was a pretty bad API for text
    input. You should use `ReceivedCharacter` now instead.
    
    ### Other changes
    - Use `web-time` rather than `instant` crate.
    (rust-windowing/winit#2836)
    - winit did split `run_return` in `run_onDemand` and `pump_events`, I
    did the same change in bevy_winit and used `pump_events`.
    - Removed `return_from_run` from `WinitSettings` as `winit::run` now
    returns on supported platforms.
    - I left the example "return_after_run" as I think it's still useful.
    - This winit change is done partly to allow to create a new window after
    quitting all windows: emilk/egui#1918 ; this
    PR doesn't address.
    - added `width` and `height` properties in the `canvas` from wasm
    example
    (bevyengine#10702 (comment))
    
    ## Known regressions (important follow ups?)
    - Provide an API for reacting when a specific key from current layout
    was released.
    - possible solutions: use winit::Key from winit::KeyEvent ; mapping
    between KeyCode and Key ; or .
    - We don't receive characters through alt+numpad (e.g. alt + 151 = "ù")
    anymore ; reproduced on winit example "ime". maybe related to
    rust-windowing/winit#2945
    - (windows) Window content doesn't refresh at all when resizing. By
    reading rust-windowing/winit#2900 ; I suspect
    we should just fire a `window.request_redraw();` from `AboutToWait`, and
    handle actual redrawing within `RedrawRequested`. I'm not sure how to
    move all that code so I'd appreciate it to be a follow up.
    - (windows) unreleased winit fix for using set_control_flow in
    AboutToWait rust-windowing/winit#3215 ; ⚠️ I'm
    not sure what the implications are, but that feels bad 🤔
    
    ## Follow up 
    
    I'd like to avoid bloating this PR, here are a few follow up tasks
    worthy of a separate PR, or new issue to track them once this PR is
    closed, as they would either complicate reviews, or at risk of being
    controversial:
    - remove CanvasParentResizePlugin
    (bevyengine#10702 (comment))
    - avoid mentionning explicitly winit in docs from bevy_window ?
    - NamedKey integration on bevy_input:
    rust-windowing/winit#3143 introduced a new
    NamedKey variant. I implemented it only on the converters but we'd
    benefit making the same changes to bevy_input.
    - Add more info in KeyboardInput
    bevyengine#10702 (review)
    - bevyengine#9905 added a workaround on a
    bug allegedly fixed by winit 0.29. We should check if it's still
    necessary.
    - update to raw_window_handle 0.6
      - blocked by wgpu
    - Rename `KeyCode` to `PhysicalKeyCode`
    bevyengine#10702 (comment)
    - remove `instant` dependency, [replaced
    by](rust-windowing/winit#2836) `web_time`), we'd
    need to update to :
      - fastrand >= 2.0
    - [`async-executor`](https://github.com/smol-rs/async-executor) >= 1.7
        - [`futures-lite`](https://github.com/smol-rs/futures-lite) >= 2.0
    - Verify license, see
    [discussion](bevyengine#8745 (comment))
      - we might be missing a short notice or description of changes made
    - Consider using https://github.com/rust-windowing/cursor-icon directly
    rather than vendoring it in bevy.
    - investigate [this
    unwrap](bevyengine#8745 (comment))
    (`winit_window.canvas().unwrap();`)
    - Use more good things about winit's update
    - bevyengine#10689 (comment)
    ## Migration Guide
    
    This PR should have one.
    Vrixyz authored Dec 21, 2023
    Configuration menu
    Copy the full SHA
    ced216f View commit details
    Browse the repository at this point in the history
  3. Add SystemTime to bevy_utils (bevyengine#11054)

    # Objective
    
    bevyengine#10702 has overridden the changes
    that bevyengine#10980 did.
    
    ## Solution
    
    Re-add `SystemTime` to `bevy_utils`, along with a few other types.
    
    ---
    
    ## Changelog
    
    - Rexported `SystemTime`, `SystemTimeError`, and `TryFromFloatSecsError`
    from `bevy_utils`.
    doonv authored Dec 21, 2023
    Configuration menu
    Copy the full SHA
    42f7213 View commit details
    Browse the repository at this point in the history
  4. Add insert_state to App. (bevyengine#11043)

    # Objective
    
    Fix bevyengine#10731.
    
    ## Solution
    
    Rename `App::add_state<T>(&mut self)` to `init_state`, and add
    `App::insert_state<T>(&mut self, state: T)`. I decided on these names
    because they are more similar to `init_resource` and `insert_resource`.
    
    I also removed the `States` trait's requirement for `Default`. Instead,
    `init_state` requires `FromWorld`.
    
    ---
    
    ## Changelog
    
    - Renamed `App::add_state` to `init_state`.
    - Added `App::insert_state`.
    - Removed the `States` trait's requirement for `Default`.
    
    ## Migration Guide
    
    - Renamed `App::add_state` to `init_state`.
    doonv authored Dec 21, 2023
    Configuration menu
    Copy the full SHA
    ba0f8f9 View commit details
    Browse the repository at this point in the history
  5. Derive Debug for BloomCompositeMode (bevyengine#11041)

    # Objective
    
    - API guidelines recommend that every type should implement `Debug`
    where possible.
    
    ## Solution
    
    - Do that.
    SludgePhD authored Dec 21, 2023
    Configuration menu
    Copy the full SHA
    37e8074 View commit details
    Browse the repository at this point in the history
  6. fix base64 padding when loading a gltf file (bevyengine#11053)

    # Objective
    
    - After bevyengine#10336, some gltf files fail to load (examples
    custom_gltf_vertex_attribute, gltf_skinned_mesh, ...)
    - Fix them
    
    ## Solution
    
    - Allow padding in base 64 decoder
    mockersf authored Dec 21, 2023
    Configuration menu
    Copy the full SHA
    8666b07 View commit details
    Browse the repository at this point in the history
  7. Explain Changed, Added are not archetype filters (bevyengine#11049)

    Explain potential footgun.
    stepancheg authored Dec 21, 2023
    Configuration menu
    Copy the full SHA
    b27f749 View commit details
    Browse the repository at this point in the history
  8. Remove CanvasParentResizePlugin (bevyengine#11057)

    Improves bevyengine#11052
    
    # Changelog
    - Remove `Window::fit_canvas_to_parent`, as its resizing on wasm now
    respects its CSS configuration.
    
    ## Migration Guide
    - Remove uses of `Window::fit_canvas_to_parent` in favor of CSS
    properties, for example:
      ```css
      canvas {
        width: 100%;
        height: 100%;
      }
      ```
    Vrixyz authored Dec 21, 2023
    Configuration menu
    Copy the full SHA
    80f15e0 View commit details
    Browse the repository at this point in the history
  9. add libxkbcommon-x11-0 to the default linux dependencies (bevyengine#…

    …11060)
    
    # Objective
    
    - After bevyengine#10702, it seems `libxkbcommon-x11-0` is now a default
    dependency
    ```
    2023-12-21T14:13:14.876926Z  INFO log: Failed loading `libxkbcommon-x11.so.0`. Error: CantOpen(DlOpen { desc: "libxkbcommon-x11.so.0: cannot open shared object file: No such file or directory" })   
    ```
    
    ## Solution
    
    - Add the new dependency on linux
    mockersf authored Dec 21, 2023
    Configuration menu
    Copy the full SHA
    049de6f View commit details
    Browse the repository at this point in the history
  10. Document None conditions on compute_aabb (bevyengine#11051)

    The error conditions were not documented, this requires the user to
    inspect the source code to know when to expect a `None`.
    
    Error conditions should always be documented, so we document them.
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    nicopap and alice-i-cecile authored Dec 21, 2023
    Configuration menu
    Copy the full SHA
    fcb49a5 View commit details
    Browse the repository at this point in the history

Commits on Dec 22, 2023

  1. fix patches for example showcase after winit update (bevyengine#11058)

    # Objective
    
    - bevyengine#10702 introduced some changes that broke patches for the example
    showcase
    
    ## Solution
    
    - Update those patches
    mockersf authored Dec 22, 2023
    Configuration menu
    Copy the full SHA
    6fd5802 View commit details
    Browse the repository at this point in the history
  2. Add missing colon in States documentation (bevyengine#11064)

    # Objective
    
    The documentation for the `States` trait contains an error! There is a
    single colon missing from `OnExit<T:Variant>`.
    
    ## Solution
    
    Replace `OnExit<T:Variant>` with `OnExit<T::Variant>`. (Notice the added
    colon.)
    
    ---
    
    ## Changelog
    
    ### Added
    
    - Added missing colon in `States` documentation.
    
    ---
    
    Bevy community, you may now rest easy.
    valentinegb authored Dec 22, 2023
    Configuration menu
    Copy the full SHA
    1142d53 View commit details
    Browse the repository at this point in the history

Commits on Dec 23, 2023

  1. Give UI nodes with Display::None an empty clipping rect (bevyengine…

    …#10942)
    
    # Objective
    Outlines are drawn for UI nodes with `Display::None` set and their
    descendants. They should not be visible.
    
    ## Solution
    
    Make all Nodes with `Display::None` inherit an empty clipping rect,
    ensuring that the outlines are not visible.
    
    Fixes bevyengine#10940
    
    ---
    
    ## Changelog
    * In `update_clipping_system` if a node has `Display::None` set, clip
    the entire node and all its descendants by replacing the inherited clip
    with a default rect (which is empty)
    ickshonpe authored Dec 23, 2023
    Configuration menu
    Copy the full SHA
    efb4fa5 View commit details
    Browse the repository at this point in the history
  2. Replace calculation with function call (bevyengine#11077)

    # Objective
    
    - Simplify execution.
    
    ## Solution
    
    - Replace degrees to radians calculation with function call.
    tygyh authored Dec 23, 2023
    Configuration menu
    Copy the full SHA
    22acd62 View commit details
    Browse the repository at this point in the history
  3. Update sysinfo version to 0.30.0 (bevyengine#11071)

    New version comes with a lot of improvements. Full list is available
    there:
    https://github.com/GuillaumeGomez/sysinfo/blob/master/migration_guide.md
    GuillaumeGomez authored Dec 23, 2023
    Configuration menu
    Copy the full SHA
    e360763 View commit details
    Browse the repository at this point in the history
  4. Register Camera types. (bevyengine#11069)

    # Objective
    
    Register and Serialize `Camera3dDepthTextureUsage` and
    `ScreenSpaceTransmissionQuality`.
    
    Fixes: bevyengine#11036
    
    ## Solution
    
    Added the relevant derives for reflection and serialization and type
    registrations.
    kidrigger authored Dec 23, 2023
    Configuration menu
    Copy the full SHA
    7374e58 View commit details
    Browse the repository at this point in the history
  5. finish cleaning up dependency bans job (bevyengine#11059)

    # Objective
    
    - After bevyengine#10151, cache check is less useful in dependency ban job
    - It fails anyway because the steps are not in the right order
    
    ## Solution
    
    - Remove the added steps
    mockersf authored Dec 23, 2023
    Configuration menu
    Copy the full SHA
    eca7924 View commit details
    Browse the repository at this point in the history

Commits on Dec 24, 2023

  1. Bump actions/upload-artifact from 2 to 4 (bevyengine#11014)

    Bumps
    [actions/upload-artifact](https://github.com/actions/upload-artifact)
    from 2 to 4.
    <details>
    <summary>Release notes</summary>
    <p><em>Sourced from <a
    href="https://github.com/actions/upload-artifact/releases">actions/upload-artifact's
    releases</a>.</em></p>
    <blockquote>
    <h2>v4.0.0</h2>
    <h2>What's Changed</h2>
    <p>The release of upload-artifact@v4 and download-artifact@v4 are major
    changes to the backend architecture of Artifacts. They have numerous
    performance and behavioral improvements.</p>
    <p>For more information, see the <a
    href="https://github.com/actions/toolkit/tree/main/packages/artifact"><code>@​actions/artifact</code></a>
    documentation.</p>
    <h2>New Contributors</h2>
    <ul>
    <li><a href="https://github.com/vmjoseph"><code>@​vmjoseph</code></a>
    made their first contribution in <a
    href="https://github.com/actions/upload-artifact/pull/464">actions/upload-artifact#464</a></li>
    </ul>
    <p><strong>Full Changelog</strong>: <a
    href="https://github.com/actions/upload-artifact/compare/v3...v4.0.0">https://github.com/actions/upload-artifact/compare/v3...v4.0.0</a></p>
    <h2>v3.1.3</h2>
    <h2>What's Changed</h2>
    <ul>
    <li>chore(github): remove trailing whitespaces by <a
    href="https://github.com/ljmf00"><code>@​ljmf00</code></a> in <a
    href="https://github.com/actions/upload-artifact/pull/313">actions/upload-artifact#313</a></li>
    <li>Bump <code>@​actions/artifact</code> version to v1.1.2 by <a
    href="https://github.com/bethanyj28"><code>@​bethanyj28</code></a> in <a
    href="https://github.com/actions/upload-artifact/pull/436">actions/upload-artifact#436</a></li>
    </ul>
    <p><strong>Full Changelog</strong>: <a
    href="https://github.com/actions/upload-artifact/compare/v3...v3.1.3">https://github.com/actions/upload-artifact/compare/v3...v3.1.3</a></p>
    <h2>v3.1.2</h2>
    <ul>
    <li>Update all <code>@actions/*</code> NPM packages to their latest
    versions- <a
    href="https://github.com/actions/upload-artifact/issues/374">#374</a></li>
    <li>Update all dev dependencies to their most recent versions - <a
    href="https://github.com/actions/upload-artifact/issues/375">#375</a></li>
    </ul>
    <h2>v3.1.1</h2>
    <ul>
    <li>Update actions/core package to latest version to remove
    <code>set-output</code> deprecation warning <a
    href="https://github.com/actions/upload-artifact/issues/351">#351</a></li>
    </ul>
    <h2>v3.1.0</h2>
    <h2>What's Changed</h2>
    <ul>
    <li>Bump <code>@​actions/artifact</code> to v1.1.0 (<a
    href="https://github.com/actions/upload-artifact/pull/327">actions/upload-artifact#327</a>)
    <ul>
    <li>Adds checksum headers on artifact upload (<a
    href="https://github.com/actions/toolkit/pull/1095">actions/toolkit#1095</a>)
    (<a
    href="https://github.com/actions/toolkit/pull/1063">actions/toolkit#1063</a>)</li>
    </ul>
    </li>
    </ul>
    <h2>v3.0.0</h2>
    <h2>What's Changed</h2>
    <ul>
    <li>Update default runtime to node16 (<a
    href="https://github.com/actions/upload-artifact/issues/293">#293</a>)</li>
    <li>Update package-lock.json file version to 2 (<a
    href="https://github.com/actions/upload-artifact/issues/302">#302</a>)</li>
    </ul>
    <h3>Breaking Changes</h3>
    <p>With the update to Node 16, all scripts will now be run with Node 16
    rather than Node 12.</p>
    <h2>v2.3.1</h2>
    <p>Fix for empty fails on Windows failing on upload <a
    href="https://github.com/actions/upload-artifact/issues/281">#281</a></p>
    <h2>v2.3.0 Upload Artifact</h2>
    <ul>
    <li>Optimizations for faster uploads of larger files that are already
    compressed</li>
    <li>Significantly improved logging when there are chunked uploads</li>
    <li>Clarifications in logs around the upload size and prohibited
    characters that aren't allowed in the artifact name or any uploaded
    files</li>
    <li>Various other small bugfixes &amp; optimizations</li>
    </ul>
    <h2>v2.2.4</h2>
    <!-- raw HTML omitted -->
    </blockquote>
    <p>... (truncated)</p>
    </details>
    <details>
    <summary>Commits</summary>
    <ul>
    <li><a
    href="https://github.com/actions/upload-artifact/commit/c7d193f32edcb7bfad88892161225aeda64e9392"><code>c7d193f</code></a>
    Merge pull request <a
    href="https://github.com/actions/upload-artifact/issues/466">#466</a>
    from actions/v4-beta</li>
    <li><a
    href="https://github.com/actions/upload-artifact/commit/13131bb095770b4070a7477c3cd2d96e1c16d9f4"><code>13131bb</code></a>
    licensed cache</li>
    <li><a
    href="https://github.com/actions/upload-artifact/commit/4a6c273b9834f66a1d05c170dc3f80f9cdb9def1"><code>4a6c273</code></a>
    Merge branch 'main' into v4-beta</li>
    <li><a
    href="https://github.com/actions/upload-artifact/commit/f391bb91a3d3118aeca171c365bb319ece276b37"><code>f391bb9</code></a>
    Merge pull request <a
    href="https://github.com/actions/upload-artifact/issues/465">#465</a>
    from actions/robherley/v4-documentation</li>
    <li><a
    href="https://github.com/actions/upload-artifact/commit/9653d03c4b74c32144e02dae644fea70e079d4b3"><code>9653d03</code></a>
    Apply suggestions from code review</li>
    <li><a
    href="https://github.com/actions/upload-artifact/commit/875b63076402f25ef9d52c294c86ba4f97810575"><code>875b630</code></a>
    add limitations section</li>
    <li><a
    href="https://github.com/actions/upload-artifact/commit/ecb21463e93740a6be75c3116242169bfdbcb15a"><code>ecb2146</code></a>
    add compression example</li>
    <li><a
    href="https://github.com/actions/upload-artifact/commit/5e7604f84a055838f64ed68bb9904751523081ae"><code>5e7604f</code></a>
    trim some repeated info</li>
    <li><a
    href="https://github.com/actions/upload-artifact/commit/d6437d07581fe318a364512e6cf6b1dca6b4f92c"><code>d6437d0</code></a>
    naming</li>
    <li><a
    href="https://github.com/actions/upload-artifact/commit/1b561557037b4957d7d184e9aac02bec86c771eb"><code>1b56155</code></a>
    s/v4-beta/v4/g</li>
    <li>Additional commits viewable in <a
    href="https://github.com/actions/upload-artifact/compare/v2...v4">compare
    view</a></li>
    </ul>
    </details>
    <br />
    
    
    [![Dependabot compatibility
    score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/upload-artifact&package-manager=github_actions&previous-version=2&new-version=4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
    
    Dependabot will resolve any conflicts with this PR as long as you don't
    alter it yourself. You can also trigger a rebase manually by commenting
    `@dependabot rebase`.
    
    [//]: # (dependabot-automerge-start)
    [//]: # (dependabot-automerge-end)
    
    ---
    
    <details>
    <summary>Dependabot commands and options</summary>
    <br />
    
    You can trigger Dependabot actions by commenting on this PR:
    - `@dependabot rebase` will rebase this PR
    - `@dependabot recreate` will recreate this PR, overwriting any edits
    that have been made to it
    - `@dependabot merge` will merge this PR after your CI passes on it
    - `@dependabot squash and merge` will squash and merge this PR after
    your CI passes on it
    - `@dependabot cancel merge` will cancel a previously requested merge
    and block automerging
    - `@dependabot reopen` will reopen this PR if it is closed
    - `@dependabot close` will close this PR and stop Dependabot recreating
    it. You can achieve the same result by closing it manually
    - `@dependabot show <dependency name> ignore conditions` will show all
    of the ignore conditions of the specified dependency
    - `@dependabot ignore this major version` will close this PR and stop
    Dependabot creating any more for this major version (unless you reopen
    the PR or upgrade to it yourself)
    - `@dependabot ignore this minor version` will close this PR and stop
    Dependabot creating any more for this minor version (unless you reopen
    the PR or upgrade to it yourself)
    - `@dependabot ignore this dependency` will close this PR and stop
    Dependabot creating any more for this dependency (unless you reopen the
    PR or upgrade to it yourself)
    
    
    </details>
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Dec 24, 2023
    Configuration menu
    Copy the full SHA
    e61da11 View commit details
    Browse the repository at this point in the history
  2. Re-export smallvec crate from bevy_utils (bevyengine#11006)

    Matches versioning & features from other Cargo.toml files in the
    project.
    
    # Objective
    Resolves bevyengine#10932 
    
    ## Solution
    Added smallvec to the bevy_utils cargo.toml and added a line to
    re-export the crate. Target version and features set to match what's
    used in the other bevy crates.
    DavJCosby authored Dec 24, 2023
    Configuration menu
    Copy the full SHA
    42b7378 View commit details
    Browse the repository at this point in the history
  3. Remove unnecessary parens (bevyengine#11075)

    # Objective
    
    - Increase readability.
    
    ## Solution
    
    - Remove unnecessary parens.
    tygyh authored Dec 24, 2023
    Configuration menu
    Copy the full SHA
    7b8305e View commit details
    Browse the repository at this point in the history
  4. Reorder impl to be the same as the trait (bevyengine#11076)

    # Objective
    
    - Make the implementation order consistent between all sources to fit
    the order in the trait.
    
    ## Solution
    
    - Change the implementation order.
    tygyh authored Dec 24, 2023
    Configuration menu
    Copy the full SHA
    1568d4a View commit details
    Browse the repository at this point in the history
  5. Use WindowBuilder::with_append() to append canvas (bevyengine#11065)

    # Objective
    
    Replace the canvas appending code with a simpler version provided by
    Winit v0.29.
    
    Related: bevyengine#11052.
    
    ## Solution
    
    Use
    [`WindowBuilder::with_append()`](https://docs.rs/winit/0.29.5/wasm32-unknown-unknown/winit/platform/web/trait.WindowBuilderExtWebSys.html#tymethod.with_append).
    daxpedda authored Dec 24, 2023
    Configuration menu
    Copy the full SHA
    dc698f0 View commit details
    Browse the repository at this point in the history
  6. Explain EventWriter limits concurrency (bevyengine#11063)

    Co-authored-by: François <mockersf@gmail.com>
    Co-authored-by: James Liu <contact@jamessliu.com>
    3 people authored Dec 24, 2023
    Configuration menu
    Copy the full SHA
    c6b32a2 View commit details
    Browse the repository at this point in the history
  7. reflect: maximally relax TypePath bounds (bevyengine#11037)

    # Objective
    
    - Provides an alternate solution to the one implemented in bevyengine#10791
    without breaking changes.
    
    ## Solution
    
    - Changes the bounds of macro-generated `TypePath` implementations to
    universally ignore the types of fields, rather than use the same bounds
    as other implementations. I think this is a more holistic solution than
    bevyengine#10791 because it totally erases the finicky bounds we currently
    generate, helping to untangle the reflection trait system.
    soqb authored Dec 24, 2023
    Configuration menu
    Copy the full SHA
    13feac6 View commit details
    Browse the repository at this point in the history

Commits on Dec 25, 2023

  1. Better doc for SystemName (bevyengine#11084)

    Compared to [current
    documentation](https://docs.rs/bevy/latest/bevy/ecs/system/struct.SystemName.html)
    it is now immediately clear that it is `SystemParam` readily available
    to user, and not just some accidentally exposed internal data type.
    stepancheg authored Dec 25, 2023
    Configuration menu
    Copy the full SHA
    ac58a5f View commit details
    Browse the repository at this point in the history

Commits on Dec 26, 2023

  1. Add example for pixel-perfect grid snapping in 2D (bevyengine#8112)

    # Objective
    
    Provide an example of how to achieve pixel-perfect "grid snapping" in 2D
    via rendering to a texture. This is a common use case in retro pixel art
    game development.
    
    ## Solution
    
    Render sprites to a canvas via a Camera, then use another (scaled up)
    Camera to render the resulting canvas to the screen. This example is
    based on the `3d/render_to_texture.rs` example. Furthermore, this
    example demonstrates mixing retro-style graphics with high-resolution
    graphics, as well as pixel-snapped rendering of a
    `MaterialMesh2dBundle`.
    nxsaken authored Dec 26, 2023
    Configuration menu
    Copy the full SHA
    8067e46 View commit details
    Browse the repository at this point in the history

Commits on Dec 30, 2023

  1. Fix ci xvfb (bevyengine#11143)

    # Objective
    
    Fix ci hang, so we can merge pr's again.
    
    ## Solution
    
    - switch ppa action to use mesa stable versions
    https://launchpad.net/~kisak/+archive/ubuntu/turtle
    - use commit from bevyengine#11123
    
    ---------
    
    Co-authored-by: Stepan Koltsov <stepan.koltsov@gmail.com>
    hymm and stepancheg authored Dec 30, 2023
    Configuration menu
    Copy the full SHA
    786abbf View commit details
    Browse the repository at this point in the history
  2. Misc cleanup (bevyengine#11134)

    Re-exports a few types/functions I need that have no reason to be
    private, and some minor code quality changes.
    JMS55 authored Dec 30, 2023
    Configuration menu
    Copy the full SHA
    3d3a065 View commit details
    Browse the repository at this point in the history

Commits on Dec 31, 2023

  1. Keep track of when a texture is first cleared (bevyengine#10325)

    # Objective
    - Custom render passes, or future passes in the engine (such as
    bevyengine#10164) need a better way to know
    and indicate to the core passes whether the view color/depth/prepass
    attachments have been cleared or not yet this frame, to know if they
    should clear it themselves or load it.
    
    ## Solution
    
    - For all render targets (depth textures, shadow textures, prepass
    textures, main textures) use an atomic bool to track whether or not each
    texture has been cleared this frame. Abstracted away in the new
    ColorAttachment and DepthAttachment wrappers.
    
    ---
    
    ## Changelog
    - Changed `ViewTarget::get_color_attachment()`, removed arguments.
    - Changed `ViewTarget::get_unsampled_color_attachment()`, removed
    arguments.
    - Removed `Camera3d::clear_color`.
    - Removed `Camera2d::clear_color`.
    - Added `Camera::clear_color`.
    - Added `ExtractedCamera::clear_color`.
    - Added `ColorAttachment` and `DepthAttachment` wrappers.
    - Moved `ClearColor` and `ClearColorConfig` from
    `bevy::core_pipeline::clear_color` to `bevy::render::camera`.
    - Core render passes now track when a texture is first bound as an
    attachment in order to decide whether to clear or load it.
    
    ## Migration Guide
    - Remove arguments to `ViewTarget::get_color_attachment()` and
    `ViewTarget::get_unsampled_color_attachment()`.
    - Configure clear color on `Camera` instead of on `Camera3d` and
    `Camera2d`.
    - Moved `ClearColor` and `ClearColorConfig` from
    `bevy::core_pipeline::clear_color` to `bevy::render::camera`.
    - `ViewDepthTexture` must now be created via the `new()` method
    
    ---------
    
    Co-authored-by: vero <email@atlasdostal.com>
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    3 people authored Dec 31, 2023
    Configuration menu
    Copy the full SHA
    70b0eac View commit details
    Browse the repository at this point in the history
  2. support all types of animation interpolation from gltf (bevyengine#10755

    )
    
    # Objective
    
    - Support step and cubic spline interpolation from gltf
    
    ## Solution
    
    - Support step and cubic spline interpolation from gltf
    
    Tested with
    https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/InterpolationTest
    expected: 
    
    ![](https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/InterpolationTest/screenshot/screenshot.gif)
    result: 
    
    ![output](https://github.com/bevyengine/bevy/assets/8672791/e7f1afd5-20c9-4921-97d4-8d0c82203068)
    
    ---
    
    ## Migration Guide
    
    When manually specifying an animation `VariableCurve`, the interpolation
    type must be specified:
    
    - Bevy 0.12
    ```rust
            VariableCurve {
                keyframe_timestamps: vec![0.0, 1.0, 2.0, 3.0, 4.0],
                keyframes: Keyframes::Rotation(vec![
                    Quat::IDENTITY,
                    Quat::from_axis_angle(Vec3::Y, PI / 2.),
                    Quat::from_axis_angle(Vec3::Y, PI / 2. * 2.),
                    Quat::from_axis_angle(Vec3::Y, PI / 2. * 3.),
                    Quat::IDENTITY,
                ]),
            },
    ```
    
    - Bevy 0.13
    ```rust
            VariableCurve {
                keyframe_timestamps: vec![0.0, 1.0, 2.0, 3.0, 4.0],
                keyframes: Keyframes::Rotation(vec![
                    Quat::IDENTITY,
                    Quat::from_axis_angle(Vec3::Y, PI / 2.),
                    Quat::from_axis_angle(Vec3::Y, PI / 2. * 2.),
                    Quat::from_axis_angle(Vec3::Y, PI / 2. * 3.),
                    Quat::IDENTITY,
                ]),
                interpolation: Interpolation::Linear,
            },
    ```
    mockersf authored Dec 31, 2023
    Configuration menu
    Copy the full SHA
    71adb77 View commit details
    Browse the repository at this point in the history

Commits on Jan 1, 2024

  1. impl ExclusiveSystemParam for WorldId (bevyengine#11164)

    # Objective
    
    Mostly for consistency.
    
    ## Solution
    
    ```rust
    impl ExclusiveSystemParam for WorldId
    ```
    
    - Also add a test for `SystemParam for WorldId`
    
    ## Changelog
    Added: Worldd now implements ExclusiveSystemParam.
    stepancheg authored Jan 1, 2024
    Configuration menu
    Copy the full SHA
    9f397d0 View commit details
    Browse the repository at this point in the history
  2. impl ExclusiveSystemParam for PhantomData (bevyengine#11153)

    # Objective
    
    Implement `ExclusiveSystemParam` for `PhantomData`.
    
    For the same reason `SystemParam` impl exists: to simplify writing
    generic code.
    
    
    https://github.com/bevyengine/bevy/blob/786abbf3f5e5be4b89c6b53d2d03162079f8e1f4/crates/bevy_ecs/src/system/system_param.rs#L1557
    
    Also for consistency.
    
    ## Solution
    
    `impl ExclusiveSystemParam for PhantomData`.
    
    ## Changelog
    Added: PhantomData<T> now implements ExclusiveSystemParam.
    stepancheg authored Jan 1, 2024
    Configuration menu
    Copy the full SHA
    4fba03b View commit details
    Browse the repository at this point in the history
  3. Remove little warn on bevy_ecs (bevyengine#11149)

    # Objective
    
    - There is an warning about non snake case on system_param.rs generated
    by a macro
    
    ## Solution
    
    - Allow non snake case on the function at fault
    pablo-lua authored Jan 1, 2024
    Configuration menu
    Copy the full SHA
    bf0be9c View commit details
    Browse the repository at this point in the history
  4. Rename ArchetypeEntity::entity into ArchetypeEntity::id (bevyengi…

    …ne#11118)
    
    # Objective
    
    Fixes bevyengine#11050
    
    Rename ArchetypeEntity::entity to ArchetypeEntity::id to be consistent
    with `EntityWorldMut`, `EntityMut` and `EntityRef`.
    
    ## Migration Guide
    
    The method `ArchetypeEntity::entity` has been renamed to
    `ArchetypeEntity::id`
    capt-glorypants authored Jan 1, 2024
    Configuration menu
    Copy the full SHA
    ffded5b View commit details
    Browse the repository at this point in the history
  5. Replace or document ignored doctests (bevyengine#11040)

    # Objective
    
    There are a lot of doctests that are `ignore`d for no documented reason.
    And that should be fixed.
    
    ## Solution
    
    I searched the bevy repo with the regex ` ```[a-z,]*ignore ` in order to
    find all `ignore`d doctests. For each one of the `ignore`d doctests, I
    did the following steps:
    1. Attempt to remove the `ignored` attribute while still passing the
    test. I did this by adding hidden dummy structs and imports.
    2. If step 1 doesn't work, attempt to replace the `ignored` attribute
    with the `no_run` attribute while still passing the test.
    3. If step 2 doesn't work, keep the `ignored` attribute but add
    documentation for why the `ignored` attribute was added.
    
    ---------
    
    Co-authored-by: François <mockersf@gmail.com>
    doonv and mockersf authored Jan 1, 2024
    Configuration menu
    Copy the full SHA
    189ceaf View commit details
    Browse the repository at this point in the history
  6. Fixed Typo in the description of EntityMut (bevyengine#11103)

    # Objective
    Fix a typo in the description of the  `EntityMut` struct
    Kees-van-Beilen authored Jan 1, 2024
    Configuration menu
    Copy the full SHA
    2fd0043 View commit details
    Browse the repository at this point in the history
  7. Implement Deref and DerefMut for In (bevyengine#11104)

    # Objective
    
    Implement Deref and DerefMut for In<T>
    
    makes it so the user doesn't have to add ".0" in most cases
    Adamkob12 authored Jan 1, 2024
    Configuration menu
    Copy the full SHA
    8baefa1 View commit details
    Browse the repository at this point in the history
  8. refactor collide code (Adopted) (bevyengine#11106)

    # Objective
    
    - Refactor collide code and add tests.
    
    ## Solution
    
    - Rebase the changes made in bevyengine#4485.
    
    Co-authored-by: Eduardo Canellas de Oliveira <eduardo.canellas@bemobi.com>
    tygyh and Eduardo Canellas de Oliveira authored Jan 1, 2024
    Configuration menu
    Copy the full SHA
    55c9958 View commit details
    Browse the repository at this point in the history
  9. Fix Mesh::ATTRIBUTE_UV_0 documentation (bevyengine#11110)

    Comment incorrect suggests that texture is clamped outside of `0..=1`
    range, while it can actually be configured.
    
    CC bevyengine#11109
    stepancheg authored Jan 1, 2024
    Configuration menu
    Copy the full SHA
    17ef731 View commit details
    Browse the repository at this point in the history
  10. Do not load prepass normals for transmissive materials (bevyengine#11140

    )
    
    Turns out whenever a normal prepass was active (which includes whenever
    you use SSAO) we were attempting to read the normals from the prepass
    for the specular transmissive material. Since transmissive materials
    don't participate in the prepass (unlike opaque materials) we were
    reading the normals from “behind” the mesh, producing really weird
    visual results.
    
    # Objective
    
    - Fixes bevyengine#11112.
    
    ## Solution
    
    - We introduce a new `READS_VIEW_TRANSMISSION_TEXTURE` mesh pipeline
    key;
    - We set it whenever the material properties has the
    `reads_view_transmission_texture` flag set; (i.e. the material is
    transmissive)
    - If this key is set we prevent the reading of normals from the prepass,
    by not setting the `LOAD_PREPASS_NORMALS` shader def.
    
    ---
    
    ## Changelog
    
    ### Fixed
    
    - Specular transmissive materials no longer attempt to erroneously load
    prepass normals, and now work correctly even with the normal prepass
    active (e.g. when using SSAO)
    coreh authored Jan 1, 2024
    Configuration menu
    Copy the full SHA
    c2ab3a0 View commit details
    Browse the repository at this point in the history
  11. impl ExclusiveSystemParam for SystemName (bevyengine#11163)

    # Objective
    
    `SystemName` might be useful in systems which accept `&mut World`.
    
    ## Solution
    
    - `impl ExclusiveSystemParam for SystemName`
    - move `SystemName` into a separate file, because it no longer belongs
    to a file which defines `SystemParam`
    - add a test for new impl, and for existing impl
    
    ## Changelog
    
    - `impl ExclusiveSystemParam for SystemName`
    stepancheg authored Jan 1, 2024
    Configuration menu
    Copy the full SHA
    6bc2686 View commit details
    Browse the repository at this point in the history
  12. Print to stderr from panic handler in LogPlugin (bevyengine#11170)

    # Objective
    
    When panic handler prints to stdout instead of stderr, I've observed two
    outcomes with this PR test bevyengine#11169:
    - Sometimes output is mixed up, so it is not clear where one record ends
    and another stards
    - Sometimes output is lost
    
    ## Solution
    
    Print to stderr.
    
    ## Changelog
    
    - Panic handler in `LogPlugin` writes to stderr instead of stdin.
    stepancheg authored Jan 1, 2024
    Configuration menu
    Copy the full SHA
    443b64a View commit details
    Browse the repository at this point in the history
  13. Export tonemapping_pipeline_key (2d), alpha_mode_pipeline_key (bevyen…

    …gine#11166)
    
    This expands upon bevyengine#11134.
    
    I found myself needing `tonemapping_pipeline_key` for some custom 2d
    draw functions. bevyengine#11134 exported the 3d version of
    `tonemapping_pipeline_key` and this PR exports the 2d version. I also
    made `alpha_mode_pipeline_key` public for good measure.
    brianreavis authored Jan 1, 2024
    Configuration menu
    Copy the full SHA
    846a871 View commit details
    Browse the repository at this point in the history

Commits on Jan 2, 2024

  1. Add ability to panic to logs example (bevyengine#11171)

    # Objective
    
    To debug issues like bevyengine#11169.
    
    ## Solution
    
    When P is pressed in logs example, call `panic!()`.
    
    <img width="1392" alt="Screenshot 2024-01-02 at 01 10 16"
    src="https://github.com/bevyengine/bevy/assets/28969/a788737e-d23c-43a3-bc68-d6c5b0ab88ad">
    stepancheg authored Jan 2, 2024
    Configuration menu
    Copy the full SHA
    d8d8bcf View commit details
    Browse the repository at this point in the history
  2. Add window entity to TouchInput events (bevyengine#11128)

    # Objective
    
    If you have multiple windows, there is no way to determine which window
    a `TouchInput` event applies to. This fixes that.
    
    ## Solution
    
    - Add the window entity directly to `TouchInput`, just like the other
    input events.
    - Fixes bevyengine#6011.
    
    ## Migration Guide
    
    + Add a `window` field when constructing or destructuring a `TouchInput`
    struct.
    NthTensor authored Jan 2, 2024
    Configuration menu
    Copy the full SHA
    4034740 View commit details
    Browse the repository at this point in the history
  3. Implement Neg for Direction2d and Direction3d (bevyengine#11179)

    # Objective
    
    I frequently encounter cases where I need to get the opposite direction.
    This currently requires something like
    `Direction2d::from_normalized(-*direction)`, which is very inconvenient.
    
    ## Solution
    
    Implement `Neg` for `Direction2d` and `Direction3d`.
    Jondolf authored Jan 2, 2024
    Configuration menu
    Copy the full SHA
    6086d41 View commit details
    Browse the repository at this point in the history
  4. Add constants for Direction2d and Direction3d (bevyengine#11180)

    # Objective
    
    I often need a direction along one of the cartesian XYZ axes, and it
    currently requires e.g. `Direction2d::from_normalized(Vec2::X)`, which
    isn't ideal.
    
    ## Solution
    
    Add direction constants that are the same as the ones on Glam types. I
    also copied the doc comment format "A unit vector pointing along the ...
    axis", but I can change it if there's a better wording for directions.
    Jondolf authored Jan 2, 2024
    Configuration menu
    Copy the full SHA
    2c5439b View commit details
    Browse the repository at this point in the history
  5. Add approx feature to bevy_math (bevyengine#11176)

    # Objective
    
    `bevy_math` re-exports Glam, but doesn't have a feature for enabling
    `approx` for it. Many projects (including some of Bevy's own crates)
    need `approx`, and it'd be nice if you didn't have to manually add Glam
    to specify the feature for it.
    
    ## Solution
    
    Add an `approx` feature to `bevy_math`.
    Jondolf authored Jan 2, 2024
    Configuration menu
    Copy the full SHA
    536a7bd View commit details
    Browse the repository at this point in the history
  6. Enable cloning EntityHashMap and PreHashMap (bevyengine#11178)

    # Objective
    
    - `EntityHashMap`, `EntityHashSet` and `PreHashMap` are currently not
    Cloneable because of a missing trivial `Clone` bound for `EntityHash`
    and `PreHash`. This PR makes them Cloneable.
    
    (the parent struct `hashbrown::HashMap` requires the `HashBuilder` to be
    `Clone` for the `HashMap` to be `Clone`, see:
    https://github.com/rust-lang/hashbrown/blob/master/src/map.rs#L195)
    
    
    ## Solution
    
    - Add a `Clone` bound to `PreHash` and `EntityHash`
    
    ---------
    
    Co-authored-by: Charles Bournhonesque <cbournhonesque@snapchat.com>
    cBournhonesque and cbournhonesque-sc authored Jan 2, 2024
    Configuration menu
    Copy the full SHA
    ab10e85 View commit details
    Browse the repository at this point in the history
  7. Publish dev-docs with Github Pages artifacts (2nd attempt) (bevyengin…

    …e#10892)
    
    Supersedes bevyengine#10888.
    
    # Objective
    
    Closes bevyengine#10821
    
    ## Solution
    
    - Replaced
    [JamesIves/github-pages-deploy-action](https://github.com/JamesIves/github-pages-deploy-action)
    with
    [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact)
    and [actions/deploy-pages](https://github.com/actions/deploy-pages).
    
    ## Notes
    
    - I made this workflow possible to run through dispatch
    (`workflow_dispatch`), in case something goes wrong.
    - I restricted the permissions to just the things Github Pages needs.
    - I made it so that only one deployments can happen at a time, the other
    deployment requests will be queued up and the latest one will be run.
    BD103 authored Jan 2, 2024
    Configuration menu
    Copy the full SHA
    1a2a184 View commit details
    Browse the repository at this point in the history
  8. Simplify examples/3d/orthographic (bevyengine#11045)

    Current example may mislead into thinking both parameters are mandatory
    to make orthographic projection work.
    stepancheg authored Jan 2, 2024
    Configuration menu
    Copy the full SHA
    0f71dcb View commit details
    Browse the repository at this point in the history
  9. Add bevy_hierarchy Crate and plugin documentation (bevyengine#10951)

    This PR is part of a project aimed at improving the API documentation of
    `bevy_hierarchy`. Other PRs will be based on this.
    
    This PR in particular is also an experiment in providing a high level
    overview of the tools provided by a Bevy plugin/crate. It also provides
    general information about universal invariants, so statement repetition
    in crate items can be dramatically reduced.
    
    ## Other changes
    
    The other PRs of this project that expand on this one:
    
    - bevyengine#10952
    - bevyengine#10953
    - bevyengine#10954
    - bevyengine#10955
    - bevyengine#10956
    - bevyengine#10957
    
    ---------
    
    Co-authored-by: GitGhillie <jillisnoordhoek@gmail.com>
    Nilirad and GitGhillie authored Jan 2, 2024
    Configuration menu
    Copy the full SHA
    2440aa8 View commit details
    Browse the repository at this point in the history
  10. Implement lightmaps. (bevyengine#10231)

    ![Screenshot](https://i.imgur.com/A4KzWFq.png)
    
    # Objective
    
    Lightmaps, textures that store baked global illumination, have been a
    mainstay of real-time graphics for decades. Bevy currently has no
    support for them, so this pull request implements them.
    
    ## Solution
    
    The new `Lightmap` component can be attached to any entity that contains
    a `Handle<Mesh>` and a `StandardMaterial`. When present, it will be
    applied in the PBR shader. Because multiple lightmaps are frequently
    packed into atlases, each lightmap may have its own UV boundaries within
    its texture. An `exposure` field is also provided, to control the
    brightness of the lightmap.
    
    Note that this PR doesn't provide any way to bake the lightmaps. That
    can be done with [The Lightmapper] or another solution, such as Unity's
    Bakery.
    
    ---
    
    ## Changelog
    
    ### Added
    * A new component, `Lightmap`, is available, for baked global
    illumination. If your mesh has a second UV channel (UV1), and you attach
    this component to the entity with that mesh, Bevy will apply the texture
    referenced in the lightmap.
    
    [The Lightmapper]: https://github.com/Naxela/The_Lightmapper
    
    ---------
    
    Co-authored-by: Carter Anderson <mcanders1@gmail.com>
    pcwalton and cart authored Jan 2, 2024
    Configuration menu
    Copy the full SHA
    dd14f3a View commit details
    Browse the repository at this point in the history
  11. Add static assertions to bevy_utils for compile-time checks (bevyengi…

    …ne#11182)
    
    # Objective
    
    - We want to use `static_assertions` to perform precise compile time
    checks at testing time. In this PR, we add those checks to make sure
    that `EntityHashMap` and `PreHashMap` are `Clone` (and we replace the
    more clumsy previous tests)
    - Fixes bevyengine#11181 
    
    (will need to be rebased once
    bevyengine#11178 is merged)
    
    ---------
    
    Co-authored-by: Charles Bournhonesque <cbournhonesque@snapchat.com>
    cBournhonesque and cbournhonesque-sc authored Jan 2, 2024
    Configuration menu
    Copy the full SHA
    0275508 View commit details
    Browse the repository at this point in the history

Commits on Jan 3, 2024

  1. Unload render assets from RAM (bevyengine#10520)

    # Objective
    - No point in keeping Meshes/Images in RAM once they're going to be sent
    to the GPU, and kept in VRAM. This saves a _significant_ amount of
    memory (several GBs) on scenes like bistro.
    - References
      - bevyengine#1782
      - bevyengine#8624 
    
    ## Solution
    - Augment RenderAsset with the capability to unload the underlying asset
    after extracting to the render world.
    - Mesh/Image now have a cpu_persistent_access field. If this field is
    RenderAssetPersistencePolicy::Unload, the asset will be unloaded from
    Assets<T>.
    - A new AssetEvent is sent upon dropping the last strong handle for the
    asset, which signals to the RenderAsset to remove the GPU version of the
    asset.
    
    ---
    
    ## Changelog
    - Added `AssetEvent::NoLongerUsed` and
    `AssetEvent::is_no_longer_used()`. This event is sent when the last
    strong handle of an asset is dropped.
    - Rewrote the API for `RenderAsset` to allow for unloading the asset
    data from the CPU.
    - Added `RenderAssetPersistencePolicy`.
    - Added `Mesh::cpu_persistent_access` for memory savings when the asset
    is not needed except for on the GPU.
    - Added `Image::cpu_persistent_access` for memory savings when the asset
    is not needed except for on the GPU.
    - Added `ImageLoaderSettings::cpu_persistent_access`.
    - Added `ExrTextureLoaderSettings`.
    - Added `HdrTextureLoaderSettings`.
    
    ## Migration Guide
    - Asset loaders (GLTF, etc) now load meshes and textures without
    `cpu_persistent_access`. These assets will be removed from
    `Assets<Mesh>` and `Assets<Image>` once `RenderAssets<Mesh>` and
    `RenderAssets<Image>` contain the GPU versions of these assets, in order
    to reduce memory usage. If you require access to the asset data from the
    CPU in future frames after the GLTF asset has been loaded, modify all
    dependent `Mesh` and `Image` assets and set `cpu_persistent_access` to
    `RenderAssetPersistencePolicy::Keep`.
    - `Mesh` now requires a new `cpu_persistent_access` field. Set it to
    `RenderAssetPersistencePolicy::Keep` to mimic the previous behavior.
    - `Image` now requires a new `cpu_persistent_access` field. Set it to
    `RenderAssetPersistencePolicy::Keep` to mimic the previous behavior.
    - `MorphTargetImage::new()` now requires a new `cpu_persistent_access`
    parameter. Set it to `RenderAssetPersistencePolicy::Keep` to mimic the
    previous behavior.
    - `DynamicTextureAtlasBuilder::add_texture()` now requires that the
    `TextureAtlas` you pass has an `Image` with `cpu_persistent_access:
    RenderAssetPersistencePolicy::Keep`. Ensure you construct the image
    properly for the texture atlas.
    - The `RenderAsset` trait has significantly changed, and requires
    adapting your existing implementations.
      - The trait now requires `Clone`.
    - The `ExtractedAsset` associated type has been removed (the type itself
    is now extracted).
      - The signature of `prepare_asset()` is slightly different
    - A new `persistence_policy()` method is now required (return
    RenderAssetPersistencePolicy::Unload to match the previous behavior).
    - Match on the new `NoLongerUsed` variant for exhaustive matches of
    `AssetEvent`.
    JMS55 authored Jan 3, 2024
    Configuration menu
    Copy the full SHA
    4442439 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5697fee View commit details
    Browse the repository at this point in the history
  3. Fix: Gizmos crash due to the persistence policy being set to Unload

    …. Change it to `Keep` (bevyengine#11192)
    
    # Objective
    
    Fixes Gizmos crash due to the persistence policy being set to `Unload`
    
    ## Solution
    
    Change it to `Keep`
    
    Co-authored-by: rqg <ranqingguo318@gmail.com>
    fantasyRqg and rqg authored Jan 3, 2024
    Configuration menu
    Copy the full SHA
    07cd955 View commit details
    Browse the repository at this point in the history
  4. Fix typos plugin.rs (bevyengine#11193)

    # Objective
    
    - There are multiple grammar mistakes in the `plugin.rs` file.
    
    ## Solution
    
    - Corrects the grammar and spelling in the docs of `plugin.rs`
    TheBlckbird authored Jan 3, 2024
    Configuration menu
    Copy the full SHA
    19f5222 View commit details
    Browse the repository at this point in the history
  5. Print a warning for un-applied commands being dropped from a CommandQ…

    …ueue (bevyengine#11146)
    
    # Objective
    
    - Fixes bevyengine#11125 
    ## Solution
    
    Add a warning for un-applied commands to the `drop` function.
    garychia authored Jan 3, 2024
    Configuration menu
    Copy the full SHA
    b6da40c View commit details
    Browse the repository at this point in the history
  6. Create serialize feature for bevy_ui (bevyengine#11188)

    # Objective
    
    - Fixes bevyengine#11119  
    
    ## Solution
    
    - Creation of the serialize feature to ui
    
    ---
    
    ## Changelog
    
    ### Changed
    - Changed all the structs that implement Serialize and Deserialize to
    only implement when feature is on
    
    ## Migration Guide
    
    - If you want to use serialize and deserialize with types from bevy_ui,
    you need to use the feature serialize in your TOML
    ```toml
    [dependencies.bevy]
    features = ["serialize"]
    ```
    pablo-lua authored Jan 3, 2024
    Configuration menu
    Copy the full SHA
    41c3620 View commit details
    Browse the repository at this point in the history
  7. Made the remaining types from bevy_ui to reflect the Default trait if… (

    bevyengine#11199)
    
    # Objective
    
    - Fixes bevyengine#11197
    
    ## Solution
    
    - Made the remaining types from bevy_ui that do not reflect the Default
    trait to do it if possible.
    Ato2207 authored Jan 3, 2024
    Configuration menu
    Copy the full SHA
    3f535d5 View commit details
    Browse the repository at this point in the history
  8. missed negation during accessibility refactor (bevyengine#11206)

    # Objective
    
    - Since bevyengine#10911, example `button` crashes when clicking the button
    ```
    thread 'main' panicked at .cargo/registry/src/index.crates.io-6f17d22bba15001f/accesskit_consumer-0.16.1/src/tree.rs:139:9:
    assertion `left == right` failed
      left: 1
     right: 0
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    Encountered a panic in system `bevy_winit::accessibility::update_accessibility_nodes`!
    Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!
    ```
    
    
    ## Solution
    
    - Re-add lost negation
    mockersf authored Jan 3, 2024
    Configuration menu
    Copy the full SHA
    5511483 View commit details
    Browse the repository at this point in the history

Commits on Jan 4, 2024

  1. Rename "AddChild" to "PushChild" (bevyengine#11194)

    # Objective
    
    - Fixes bevyengine#11187 
    
    ## Solution
    
    - Rename the `AddChild` struct to `PushChild`
    - Rename the `AddChildInPlace` struct to `PushChildInPlace`
    
    ## Migration Guide
    
    The struct `AddChild` has been renamed to `PushChild`, and the struct
    `AddChildInPlace` has been renamed to `PushChildInPlace`.
    garychia authored Jan 4, 2024
    Configuration menu
    Copy the full SHA
    93c7e7c View commit details
    Browse the repository at this point in the history
  2. Usability methods for RenderTargets and image handles (bevyengine#10736)

    # Objective
    
    In my code I use a lot of images as render targets.
    I'd like some convenience methods for working with this type.
    
    ## Solution
    
    - Allow `.into()` to construct a `RenderTarget`
    - Add `.as_image()` 
    
    ---
    
    ## Changelog
    
    ### Added
    
    - `RenderTarget` can be constructed via `.into()` on a `Handle<Image>`
    - `RenderTarget` new method: `as_image`
    
    ---------
    
    Signed-off-by: Torstein Grindvik <torstein.grindvik@muybridge.com>
    Co-authored-by: Torstein Grindvik <torstein.grindvik@muybridge.com>
    torsteingrindvik and Torstein Grindvik authored Jan 4, 2024
    Configuration menu
    Copy the full SHA
    99c43fa View commit details
    Browse the repository at this point in the history
  3. Implement TypePath for EntityHash (bevyengine#11195)

    # Objective
    
    - Fix bevyengine#11117 by implementing `Reflect` for `EntityHashMap`
    
    ## Solution
    
    - By implementing `TypePath` for `EntityHash`, Bevy will automatically
    implement `Reflect` for `EntityHashMap`
    
    ---
    
    ## Changelog
    
    - `TypePath` is implemented for `EntityHash`
    - A test called `entity_hashmap_should_impl_reflect` was created to
    verify that bevyengine#11117 was solved.
    Adamkob12 authored Jan 4, 2024
    Configuration menu
    Copy the full SHA
    fe68005 View commit details
    Browse the repository at this point in the history
  4. Explain Camera physical size is in pixel (bevyengine#11189)

    # Objective
    
    It may be not be obviously clear what is physical size. Is it inches? Is
    it scaled somehow?
    
    ## Solution
    
    Add rustdoc comments.
    stepancheg authored Jan 4, 2024
    Configuration menu
    Copy the full SHA
    cc2a77b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    cf70f53 View commit details
    Browse the repository at this point in the history
  6. Extend Touches with clear and reset methods (bevyengine#10930)

    # Objective
    
    - Resolves bevyengine#10913.
    - Extend `Touches` with methods that are implemented on `ButtonInput`.
    
    ## Solution
    
    - Add function `clear_just_pressed` that clears the `just_pressed` state
    of the touch input.
    - Add function `clear_just_released` that clears the `just_released`
    state of the touch input.
    - Add function `clear_just_canceled` that clears the `just_canceled`
    state of the touch input.
    - Add function `release` that changes state of the touch input from
    `pressed` to `just_released`.
    - Add function `release_all` that changes state of every touch input
    from `pressed` to `just_released`
    - Add function `clear` that clears `just_pressed`, `just_released` and
    `just_canceled` data for every input.
    - Add function `reset_all` that clears `pressed`, `just_pressed`,
    `just_released` and `just_canceled` data for every input.
    - Add tests for functions above.
    matiqo15 authored Jan 4, 2024
    Configuration menu
    Copy the full SHA
    759b398 View commit details
    Browse the repository at this point in the history

Commits on Jan 5, 2024

  1. assets should be kept on CPU by default (bevyengine#11212)

    # Objective
    
    - Since bevyengine#10520, assets are unloaded from RAM by default. This breaks a
    number of scenario:
      - using `load_folder`
    - loading a gltf, then going through its mesh to transform them /
    compute a collider / ...
    - any assets/subassets scenario should be `Keep` as you can't know what
    the user will do with the assets
      - android suspension, where GPU memory is unloaded
    
    - Alternative to bevyengine#11202 
    
    ## Solution
    
    - Keep assets on CPU memory by default
    mockersf authored Jan 5, 2024
    Configuration menu
    Copy the full SHA
    425570a View commit details
    Browse the repository at this point in the history

Commits on Jan 6, 2024

  1. Fix integer overflow in BlobVec::reserve_exact (bevyengine#11234)

    # Objective
    
    When `BlobVec::reserve` is called with an argument causing capacity
    overflow, in release build capacity overflow is ignored, and capacity is
    decreased.
    
    I'm not sure it is possible to exploit this issue using public API of
    `bevy_ecs`, but better fix it anyway.
    
    ## Solution
    
    Check for capacity overflow.
    stepancheg authored Jan 6, 2024
    Configuration menu
    Copy the full SHA
    a35a151 View commit details
    Browse the repository at this point in the history
  2. Fix perf degradation on web builds (bevyengine#11227)

    # Objective
    
    - Since bevyengine#10702, the way bevy updates the window leads to major slowdowns
    as seen in
        - bevyengine#11122 
        - bevyengine#11220
    - Slow is bad, furthermore, _very_ slow is _very_ bad. We should fix
    this issue.
    
    ## Solution
    
    - Move the app update code into the `Event::WindowEvent { event:
    WindowEvent::RedrawRequested }` branch of the event loop.
    - Run `window.request_redraw()` When `runner_state.redraw_requested`
    - Instead of swapping `ControlFlow` between `Poll` and `Wait`, we always
    keep it at `Wait`, and use `window.request_redraw()` to schedule an
    immediate call to the event loop.
    - `runner_state.redraw_requested` is set to `true` when
    `UpdateMode::Continuous` and when a `RequestRedraw` event is received.
    - Extract the redraw code into a separate function, because otherwise
    I'd go crazy with the indentation level.
    - Fix bevyengine#11122.
    
    ## Testing
    
    I tested the WASM builds as follow:
    
    ```sh
    cargo run -p build-wasm-example -- --api webgl2 bevymark
    python -m http.server --directory examples/wasm/ 8080
    # Open browser at http://localhost:8080
    ```
    
    On main, even spawning a couple sprites is super choppy. Even if it says
    "300 FPS". While on this branch, it is smooth as butter.
    
    I also found that it fixes all choppiness on window resize (tested on
    Linux/X11). This was another issue from bevyengine#10702 IIRC.
    
    So here is what I tested:
    
    - On `wasm`: `many_foxes` and `bevymark`, with `argh::from_env()`
    commented out, otherwise we get a cryptic error.
    - Both with `PresentMode::AutoVsync` and `PresentMode::AutoNoVsync`
      - On main, it is consistently choppy.
    - With this PR, the visible frame rate is consistent with the diagnostic
    numbers
    - On native (linux/x11) I ran similar tests, making sure that
    `AutoVsync` limits to monitor framerate, and `AutoNoVsync` doesn't.
    
    ## Future work
    
    Code could be improved, I wanted a quick solution easy to review, but we
    really need to make the code more accessible.
    
    - bevyengine#9768
    - ~~**`WinitSettings::desktop_app()` is completely borked.**~~ actually
    broken on main as well
    
    ### Review guide
    
    Consider enable the non-whitespace diff to see the _real_ change set.
    nicopap authored Jan 6, 2024
    Configuration menu
    Copy the full SHA
    79021c7 View commit details
    Browse the repository at this point in the history
  3. Add libm feature to bevy_math (bevyengine#11238)

    # Objective
    
    Different platforms use their own implementations of several
    mathematical functions (especially transcendental functions like sin,
    cos, tan, atan, and so on) to provide hardware-level optimization using
    intrinsics. This is good for performance, but bad when you expect
    consistent outputs across machines.
    
    [`libm`](https://github.com/rust-lang/libm) is a widely used crate that
    provides mathematical functions that don't use intrinsics like `std`
    functions. This allows bit-for-bit deterministic math across hardware,
    which is crucial for things like cross-platform deterministic physics
    simulation.
    
    Glam has the `libm` feature for using [`libm` for the
    math](https://github.com/bitshifter/glam-rs/blob/d2871a151bb1ecc91bb160e1c1cce336d8a52d9d/src/f32/math.rs#L35)
    in its own types. This would be nice to expose as a feature in
    `bevy_math`.
    
    ## Solution
    
    Add `libm` feature to `bevy_math`. We could name it something like
    `enhanced-determinism`, but this wouldn't be accurate for the rest of
    Bevy, so I think just `libm` is more fitting and explicit.
    Jondolf authored Jan 6, 2024
    Configuration menu
    Copy the full SHA
    0349809 View commit details
    Browse the repository at this point in the history
  4. Change SceneSpawner::spawn_dynamic_sync to return InstanceID (bevyeng…

    …ine#11239)
    
    # Objective
    
    `SceneSpawner::spawn_dynamic_sync` currently returns `()` on success,
    which is inconsistent with the other `SceneSpawner::spawn_` methods that
    all return an `InstanceId`. We need this ID to do useful work with the
    newly-created data.
    
    ## Solution
    
    Updated `SceneSpawner::spawn_dynamic_sync` to return `Result<InstanceId,
    SceneSpawnError>` instead of `Result<(), SceneSpawnError>`
    thebluefish authored Jan 6, 2024
    Configuration menu
    Copy the full SHA
    cfcb688 View commit details
    Browse the repository at this point in the history

Commits on Jan 7, 2024

  1. update Outdated comment (bevyengine#11243)

    # Objective
    
    - since bevyengine#9236 queue_mesh_bind_group has been renamed to
    prepare_mesh_bind_group,but the comment referring to it has not been
    updated. .
    re0312 authored Jan 7, 2024
    Configuration menu
    Copy the full SHA
    101037d View commit details
    Browse the repository at this point in the history
  2. Migrate third party plugins guidelines to the book (bevyengine#11242)

    # Objective
    
    - Describe the objective or issue this PR addresses.
    - If you're fixing a specific issue, say "Fixes #X".
    
    Removes the old third party plugin guidelines section and related links
    since it is being moved to the Bevy book in the site per
    bevyengine/bevy-website#848 and
    bevyengine/bevy-website#298
    
    ## Solution
    
    - Describe the solution used to achieve the objective above. 
    
    Removes the old links and files.
    TrialDragon authored Jan 7, 2024
    Configuration menu
    Copy the full SHA
    c1b785c View commit details
    Browse the repository at this point in the history

Commits on Jan 8, 2024

  1. example showcase patches: use default instead of game mode for desktop (

    bevyengine#11250)
    
    # Objective
    
    - After bevyengine#11227, example showcase
    timeouts
    - `ReactiveLowPower` now can wait indefinitely depending on "platform
    specifics"
    
    ## Solution
    
    - Patch desktop mode in example showcase to use default mode which is
    always `Continuous`
    mockersf authored Jan 8, 2024
    Configuration menu
    Copy the full SHA
    371cd69 View commit details
    Browse the repository at this point in the history
  2. Don't auto create assets folder (bevyengine#11218)

    # Objective
    
    - Don't automatically create an assets folder
    - resolves bevyengine#11208
    
    ## Solution
    
    - Removes directory creation from file reader.
    - Clearer panic when using file watcher and asset folder doesn't exist
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    Co-authored-by: Nicola Papale <nicopap@users.noreply.github.com>
    3 people authored Jan 8, 2024
    Configuration menu
    Copy the full SHA
    2847cc6 View commit details
    Browse the repository at this point in the history
  3. Implement minimal reflection probes. (bevyengine#10057)

    # Objective
    
    This pull request implements *reflection probes*, which generalize
    environment maps to allow for multiple environment maps in the same
    scene, each of which has an axis-aligned bounding box. This is a
    standard feature of physically-based renderers and was inspired by [the
    corresponding feature in Blender's Eevee renderer].
    
    ## Solution
    
    This is a minimal implementation of reflection probes that allows
    artists to define cuboid bounding regions associated with environment
    maps. For every view, on every frame, a system builds up a list of the
    nearest 4 reflection probes that are within the view's frustum and
    supplies that list to the shader. The PBR fragment shader searches
    through the list, finds the first containing reflection probe, and uses
    it for indirect lighting, falling back to the view's environment map if
    none is found. Both forward and deferred renderers are fully supported.
    
    A reflection probe is an entity with a pair of components, *LightProbe*
    and *EnvironmentMapLight* (as well as the standard *SpatialBundle*, to
    position it in the world). The *LightProbe* component (along with the
    *Transform*) defines the bounding region, while the
    *EnvironmentMapLight* component specifies the associated diffuse and
    specular cubemaps.
    
    A frequent question is "why two components instead of just one?" The
    advantages of this setup are:
    
    1. It's readily extensible to other types of light probes, in particular
    *irradiance volumes* (also known as ambient cubes or voxel global
    illumination), which use the same approach of bounding cuboids. With a
    single component that applies to both reflection probes and irradiance
    volumes, we can share the logic that implements falloff and blending
    between multiple light probes between both of those features.
    
    2. It reduces duplication between the existing *EnvironmentMapLight* and
    these new reflection probes. Systems can treat environment maps attached
    to cameras the same way they treat environment maps applied to
    reflection probes if they wish.
    
    Internally, we gather up all environment maps in the scene and place
    them in a cubemap array. At present, this means that all environment
    maps must have the same size, mipmap count, and texture format. A
    warning is emitted if this restriction is violated. We could potentially
    relax this in the future as part of the automatic mipmap generation
    work, which could easily do texture format conversion as part of its
    preprocessing.
    
    An easy way to generate reflection probe cubemaps is to bake them in
    Blender and use the `export-blender-gi` tool that's part of the
    [`bevy-baked-gi`] project. This tool takes a `.blend` file containing
    baked cubemaps as input and exports cubemap images, pre-filtered with an
    embedded fork of the [glTF IBL Sampler], alongside a corresponding
    `.scn.ron` file that the scene spawner can use to recreate the
    reflection probes.
    
    Note that this is intentionally a minimal implementation, to aid
    reviewability. Known issues are:
    
    * Reflection probes are basically unsupported on WebGL 2, because WebGL
    2 has no cubemap arrays. (Strictly speaking, you can have precisely one
    reflection probe in the scene if you have no other cubemaps anywhere,
    but this isn't very useful.)
    
    * Reflection probes have no falloff, so reflections will abruptly change
    when objects move from one bounding region to another.
    
    * As mentioned before, all cubemaps in the world of a given type
    (diffuse or specular) must have the same size, format, and mipmap count.
    
    Future work includes:
    
    * Blending between multiple reflection probes.
    
    * A falloff/fade-out region so that reflected objects disappear
    gradually instead of vanishing all at once.
    
    * Irradiance volumes for voxel-based global illumination. This should
    reuse much of the reflection probe logic, as they're both GI techniques
    based on cuboid bounding regions.
    
    * Support for WebGL 2, by breaking batches when reflection probes are
    used.
    
    These issues notwithstanding, I think it's best to land this with
    roughly the current set of functionality, because this patch is useful
    as is and adding everything above would make the pull request
    significantly larger and harder to review.
    
    ---
    
    ## Changelog
    
    ### Added
    
    * A new *LightProbe* component is available that specifies a bounding
    region that an *EnvironmentMapLight* applies to. The combination of a
    *LightProbe* and an *EnvironmentMapLight* offers *reflection probe*
    functionality similar to that available in other engines.
    
    [the corresponding feature in Blender's Eevee renderer]:
    https://docs.blender.org/manual/en/latest/render/eevee/light_probes/reflection_cubemaps.html
    
    [`bevy-baked-gi`]: https://github.com/pcwalton/bevy-baked-gi
    
    [glTF IBL Sampler]: https://github.com/KhronosGroup/glTF-IBL-Sampler
    pcwalton authored Jan 8, 2024
    Configuration menu
    Copy the full SHA
    54a943d View commit details
    Browse the repository at this point in the history
  4. Use impl Into<A> for Assets::add (bevyengine#10878)

    # Motivation
    
    When spawning entities into a scene, it is very common to create assets
    like meshes and materials and to add them via asset handles. A common
    setup might look like this:
    
    ```rust
    fn setup(
        mut commands: Commands,
        mut meshes: ResMut<Assets<Mesh>>,
        mut materials: ResMut<Assets<StandardMaterial>>,
    ) {
        commands.spawn(PbrBundle {
            mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })),
            material: materials.add(StandardMaterial::from(Color::RED)),
            ..default()
        });
    }
    ```
    
    Let's take a closer look at the part that adds the assets using `add`.
    
    ```rust
    mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })),
    material: materials.add(StandardMaterial::from(Color::RED)),
    ```
    
    Here, "mesh" and "material" are both repeated three times. It's very
    explicit, but I find it to be a bit verbose. In addition to being more
    code to read and write, the extra characters can sometimes also lead to
    the code being formatted to span multiple lines even though the core
    task, adding e.g. a primitive mesh, is extremely simple.
    
    A way to address this is by using `.into()`:
    
    ```rust
    mesh: meshes.add(shape::Cube { size: 1.0 }.into()),
    material: materials.add(Color::RED.into()),
    ```
    
    This is fine, but from the names and the type of `meshes`, we already
    know what the type should be. It's very clear that `Cube` should be
    turned into a `Mesh` because of the context it's used in. `.into()` is
    just seven characters, but it's so common that it quickly adds up and
    gets annoying.
    
    It would be nice if you could skip all of the conversion and let Bevy
    handle it for you:
    
    ```rust
    mesh: meshes.add(shape::Cube { size: 1.0 }),
    material: materials.add(Color::RED),
    ```
    
    # Objective
    
    Make adding assets more ergonomic by making `Assets::add` take an `impl
    Into<A>` instead of `A`.
    
    ## Solution
    
    `Assets::add` now takes an `impl Into<A>` instead of `A`, so e.g. this
    works:
    
    ```rust
        commands.spawn(PbrBundle {
            mesh: meshes.add(shape::Cube { size: 1.0 }),
            material: materials.add(Color::RED),
            ..default()
        });
    ```
    
    I also changed all examples to use this API, which increases consistency
    as well because `Mesh::from` and `into` were being used arbitrarily even
    in the same file. This also gets rid of some lines of code because
    formatting is nicer.
    
    ---
    
    ## Changelog
    
    - `Assets::add` now takes an `impl Into<A>` instead of `A`
    - Examples don't use `T::from(K)` or `K.into()` when adding assets
    
    ## Migration Guide
    
    Some `into` calls that worked previously might now be broken because of
    the new trait bounds. You need to either remove `into` or perform the
    conversion explicitly with `from`:
    
    ```rust
    // Doesn't compile
    let mesh_handle = meshes.add(shape::Cube { size: 1.0 }.into()),
    
    // These compile
    let mesh_handle = meshes.add(shape::Cube { size: 1.0 }),
    let mesh_handle = meshes.add(Mesh::from(shape::Cube { size: 1.0 })),
    ```
    
    ## Concerns
    
    I believe the primary concerns might be:
    
    1. Is this too implicit?
    2. Does this increase codegen bloat?
    
    Previously, the two APIs were using `into` or `from`, and now it's
    "nothing" or `from`. You could argue that `into` is slightly more
    explicit than "nothing" in cases like the earlier examples where a
    `Color` gets converted to e.g. a `StandardMaterial`, but I personally
    don't think `into` adds much value even in this case, and you could
    still see the actual type from the asset type.
    
    As for codegen bloat, I doubt it adds that much, but I'm not very
    familiar with the details of codegen. I personally value the user-facing
    code reduction and ergonomics improvements that these changes would
    provide, but it might be worth checking the other effects in more
    detail.
    
    Another slight concern is migration pain; apps might have a ton of
    `into` calls that would need to be removed, and it did take me a while
    to do so for Bevy itself (maybe around 20-40 minutes). However, I think
    the fact that there *are* so many `into` calls just highlights that the
    API could be made nicer, and I'd gladly migrate my own projects for it.
    Jondolf authored Jan 8, 2024
    Configuration menu
    Copy the full SHA
    a795de3 View commit details
    Browse the repository at this point in the history
  5. Add reserve_handle to Assets. (bevyengine#10939)

    # Objective
    
    Fixes bevyengine#10938.
    
    ## Solution
    
    Adds `reserve_handle` to `Assets`.
    
    ---
    
    ## Changelog
    
    - Added `reserve_handle` to `Assets`.
    andriyDev authored Jan 8, 2024
    Configuration menu
    Copy the full SHA
    da485c2 View commit details
    Browse the repository at this point in the history
  6. Explain OrthographicProjection.scale (bevyengine#11023)

    Alternative to bevyengine#11022.
    
    (Also remove "in world units", it is probably a mistake.)
    stepancheg authored Jan 8, 2024
    Configuration menu
    Copy the full SHA
    38ef170 View commit details
    Browse the repository at this point in the history
  7. Mul<f32> for ScalingMode (bevyengine#11030)

    Complement to bevyengine#11022: if
    `OrthographicProjection.scale` is removed, this can be used instead.
    
    CC @doonv @Davier
    stepancheg authored Jan 8, 2024
    Configuration menu
    Copy the full SHA
    8d9a0a8 View commit details
    Browse the repository at this point in the history
  8. StateTransitionEvent (bevyengine#11089)

    # Objective
    
    - Make it possible to react to arbitrary state changes
    - this will be useful regardless of the other changes to states
    currently being discussed
    
    ## Solution
    
    - added `StateTransitionEvent<S>` struct
    - previously, this would have been impossible:
    
    ```rs
    #[derive(States, Eq, PartialEq, Hash, Copy, Clone, Default)]
    enum MyState {
      #[default]
      Foo,
      Bar(MySubState),
    }
    
    enum MySubState {
      Spam,
      Eggs,
    }
    
    app.add_system(Update, on_enter_bar);
    
    fn on_enter_bar(trans: EventReader<StateTransition<MyState>>){
      for (befoare, after) in trans.read() {
        match before, after {
          MyState::Foo, MyState::Bar(_) => info!("detected transition foo => bar");
          _, _ => ();
        }
      }
    }
    ```
    
    ---
    
    ## Changelog
    
    - Added
      - `StateTransitionEvent<S>` - Fired on state changes of `S`
    
    ## Migration Guide
    
    N/A no breaking changes
    
    ---------
    
    Co-authored-by: Federico Rinaldi <gisquerin@gmail.com>
    SIGSTACKFAULT and Nilirad authored Jan 8, 2024
    Configuration menu
    Copy the full SHA
    1260b7b View commit details
    Browse the repository at this point in the history
  9. Restore support for running fn EntityCommands on entities that mi…

    …ght be despawned (bevyengine#11107)
    
    # Objective
    
    In bevyengine#9604 we removed the ability to define an `EntityCommand` as
    `fn(Entity, &mut World)`. However I have since realized that `fn(Entity,
    &mut World)` is an incredibly expressive and powerful way to define a
    command for an entity that may or may not exist (`fn(EntityWorldMut)`
    only works on entities that are alive).
    
    ## Solution
    
    Support `EntityCommand`s in the style of `fn(Entity, &mut World)`, as
    well as `fn(EntityWorldMut)`. Use a marker generic on the
    `EntityCommand` trait to allow multiple impls.
    
    The second commit in this PR replaces all of the internal command
    definitions with ones using `fn` definitions. This is mostly just to
    show off how expressive this style of command is -- we can revert this
    commit if we'd rather avoid breaking changes.
    
    ---
    
    ## Changelog
    
    Re-added support for expressively defining an `EntityCommand` as a
    function that takes `Entity, &mut World`.
    
    ## Migration Guide
    
    All `Command` types in `bevy_ecs`, such as `Spawn`, `SpawnBatch`,
    `Insert`, etc., have been made private. Use the equivalent methods on
    `Commands` or `EntityCommands` instead.
    JoJoJet authored Jan 8, 2024
    Configuration menu
    Copy the full SHA
    df2ba09 View commit details
    Browse the repository at this point in the history
  10. Remove apply_deferred example (bevyengine#11142)

    # Objective
    
    Re this comment:
    bevyengine#11141 (comment)
    
    Since bevyengine#9822, Bevy automatically
    inserts `apply_deferred` between systems with dependencies where needed,
    so manually inserted `apply_deferred` doesn't to anything useful, and in
    current state this example does more harm than good.
    
    ## Solution
    
    The example can be modified with removal of automatic `apply_deferred`
    insertion, but that would immediately upgrade this example from beginner
    level, to upper intermediate. Most users don't need to disable automatic
    sync point insertion, and remaining few who do probably already know how
    it works.
    
    CC @hymm
    stepancheg authored Jan 8, 2024
    Configuration menu
    Copy the full SHA
    42e9908 View commit details
    Browse the repository at this point in the history
  11. Add new_and_length method to Direction2d and Direction3d (bevye…

    …ngine#11172)
    
    # Objective
    
    When creating a normalized direction from a vector, it can be useful to
    get both the direction *and* the original length of the vector.
    
    This came up when I was recreating some Parry APIs using bevy_math, and
    doing it manually is quite painful. Nalgebra calls this method
    [`Unit::try_new_and_get`](https://docs.rs/nalgebra/latest/nalgebra/base/struct.Unit.html#method.try_new_and_get).
    
    ## Solution
    
    Add a `new_and_length` method to `Direction2d` and `Direction3d`.
    
    Usage:
    
    ```rust
    if let Ok((direction, length)) = Direction2d::new_and_length(Vec2::X * 10.0) {
        assert_eq!(direction, Vec2::X);
        assert_eq!(length, 10.0);
    }
    ```
    
    I'm open to different names, couldn't come up with a perfectly clear one
    that isn't too long. My reasoning with the current name is that it's
    like using `new` and calling `length` on the original vector.
    Jondolf authored Jan 8, 2024
    Configuration menu
    Copy the full SHA
    bcbb7bb View commit details
    Browse the repository at this point in the history
  12. Minimize small allocations by dropping the tick Vecs from Resources (b…

    …evyengine#11226)
    
    # Objective
    `Column` unconditionally requires three separate allocations: one for
    the data, and two for the tick Vecs. The tick Vecs aren't really needed
    for Resources, so we're allocating a bunch of one-element Vecs, and it
    costs two extra dereferences when fetching/inserting/removing resources.
    
    ## Solution
    Drop one level lower in `ResourceData` and directly store a `BlobVec`
    and two `UnsafeCell<Tick>`s. This should significantly shrink
    `ResourceData` (exchanging 6 usizes for 2 u32s), removes the need to
    dereference two separate ticks when inserting/removing/fetching
    resources, and can significantly decrease the number of small
    allocations the ECS makes by default.
    
    This tentatively might have a non-insignificant impact on the CPU cost
    for rendering since we're constantly fetching resources in draw
    functions, depending on how aggressively inlined the functions are.
    
    This requires reimplementing some of the unsafe functions that `Column`
    wraps, but it also allows us to delete a few Column APIs that were only
    used for Resources, so the total amount of unsafe we're maintaining
    shouldn't change significantly.
    
    ---------
    
    Co-authored-by: Joseph <21144246+JoJoJet@users.noreply.github.com>
    james7132 and JoJoJet authored Jan 8, 2024
    Configuration menu
    Copy the full SHA
    13570cd View commit details
    Browse the repository at this point in the history
  13. Better error message on incorrect asset label (bevyengine#11254)

    # Objective
    
    When you have no idea what to put after `#` when loading an asset, error
    message may help.
    
    ## Solution
    
    Add all labels to the error message.
    
    ## Test plan
    
    Modified `anti_alias` example to put incorrect label, the error is:
    
    ```
    2024-01-08T07:41:25.462287Z ERROR bevy_asset::server: The file at 'models/FlightHelmet/FlightHelmet.gltf' does not contain the labeled asset 'Rrrr'; it contains the following 25 assets: 'Material0', 'Material1', 'Material2', 'Material3', 'Material4', 'Material5', 'Mesh0', 'Mesh0/Primitive0', 'Mesh1', 'Mesh1/Primitive0', 'Mesh2', 'Mesh2/Primitive0', 'Mesh3', 'Mesh3/Primitive0', 'Mesh4', 'Mesh4/Primitive0', 'Mesh5', 'Mesh5/Primitive0', 'Node0', 'Node1', 'Node2', 'Node3', 'Node4', 'Node5', 'Scene0'
    ```
    stepancheg authored Jan 8, 2024
    Configuration menu
    Copy the full SHA
    c0f8338 View commit details
    Browse the repository at this point in the history
  14. Update glam, encase and hexasphere (bevyengine#11082)

    Update to `glam` 0.25, `encase` 0.7 and `hexasphere` to 10.0
    
    ## Changelog
    Added the `FloatExt` trait to the `bevy_math` prelude which adds `lerp`,
    `inverse_lerp` and `remap` methods to the `f32` and `f64` types.
    tim-blackbird authored Jan 8, 2024
    Configuration menu
    Copy the full SHA
    ec14e94 View commit details
    Browse the repository at this point in the history
  15. Explain where rendering is (bevyengine#11018)

    It was not easy to find. Add some pointers to the comment.
    stepancheg authored Jan 8, 2024
    Configuration menu
    Copy the full SHA
    dfa1a5e View commit details
    Browse the repository at this point in the history
  16. Change Entity::generation from u32 to NonZeroU32 for niche optimizati…

    …on (bevyengine#9907)
    
    # Objective
    
    - Implements change described in
    bevyengine#3022
    - Goal is to allow Entity to benefit from niche optimization, especially
    in the case of Option<Entity> to reduce memory overhead with structures
    with empty slots
    
    ## Discussion
    - First PR attempt: bevyengine#3029
    - Discord:
    https://discord.com/channels/691052431525675048/1154573759752183808/1154573764240093224
    
    ## Solution
    
    - Change `Entity::generation` from u32 to NonZeroU32 to allow for niche
    optimization.
    - The reason for changing generation rather than index is so that the
    costs are only encountered on Entity free, instead of on Entity alloc
    - There was some concern with generations being used, due to there being
    some desire to introduce flags. This was more to do with the original
    retirement approach, however, in reality even if generations were
    reduced to 24-bits, we would still have 16 million generations available
    before wrapping and current ideas indicate that we would be using closer
    to 4-bits for flags.
    - Additionally, another concern was the representation of relationships
    where NonZeroU32 prevents us using the full address space, talking with
    Joy it seems unlikely to be an issue. The majority of the time these
    entity references will be low-index entries (ie. `ChildOf`, `Owes`),
    these will be able to be fast lookups, and the remainder of the range
    can use slower lookups to map to the address space.
    - It has the additional benefit of being less visible to most users,
    since generation is only ever really set through `from_bits` type
    methods.
    - `EntityMeta` was changed to match
    - On free, generation now explicitly wraps:
    - Originally, generation would panic in debug mode and wrap in release
    mode due to using regular ops.
    - The first attempt at this PR changed the behavior to "retire" slots
    and remove them from use when generations overflowed. This change was
    controversial, and likely needs a proper RFC/discussion.
    - Wrapping matches current release behaviour, and should therefore be
    less controversial.
    - Wrapping also more easily migrates to the retirement approach, as
    users likely to exhaust the exorbitant supply of generations will code
    defensively against aliasing and that defensive code is less likely to
    break than code assuming that generations don't wrap.
    - We use some unsafe code here when wrapping generations, to avoid
    branch on NonZeroU32 construction. It's guaranteed safe due to how we
    perform wrapping and it results in significantly smaller ASM code.
        - https://godbolt.org/z/6b6hj8PrM 
    
    ## Migration
    
    - Previous `bevy_scene` serializations have a high likelihood of being
    broken, as they contain 0th generation entities.
    
    ## Current Issues
     
    - `Entities::reserve_generations` and `EntityMapper` wrap now, even in
    debug - although they technically did in release mode already so this
    probably isn't a huge issue. It just depends if we need to change
    anything here?
    
    ---------
    
    Co-authored-by: Natalie Baker <natalie.baker@advancednavigation.com>
    notverymoe and Natalie Baker authored Jan 8, 2024
    Configuration menu
    Copy the full SHA
    b257fff View commit details
    Browse the repository at this point in the history
  17. Add run conditions for executing a system after a delay (bevyengine#1…

    …1095)
    
    # Objective
    
    I want to run a system once after a given delay.
    
    - First, I tried using the `on_timer` run condition, but it uses a
    repeating timer, causing the system to run multiple times.
    - Next, I tried combining the `on_timer` with the `run_once` run
    condition. However, this causes the timer to *tick* only once, so the
    system is never executed.
    
    ## Solution
    
    - ~~Replace `on_timer` by `on_time_interval` and `on_real_timer` by
    `on_real_time_interval` to clarify the meaning (the old ones are
    deprecated to avoid a breaking change).~~ (Reverted according to
    feedback)
    - Add `once_after_delay` and `once_after_real_delay` to run the system
    exactly once after the delay, using `TimerMode::Once`.
    - Add `repeating_after_delay` and `repeating_after_real_delay` to run
    the system indefinitely after the delay, using `Timer::finished` instead
    of `Timer::just_finished`.
    
    ---
    
    ## Changelog
    
    ### Added
    
    - `once_after_delay` and `once_after_real_delay` run conditions to run
    the system exactly once after the delay, using `TimerMode::Once`.
    - `repeating_after_delay` and `repeating_after_real_delay` run
    conditions to run the system indefinitely after the delay, using
    `Timer::finished` instead of `Timer::just_finished`.
    TimJentzsch authored Jan 8, 2024
    Configuration menu
    Copy the full SHA
    cf3105a View commit details
    Browse the repository at this point in the history

Commits on Jan 9, 2024

  1. Rustdoc examples for OrthographicProjection (bevyengine#11031)

    Minimal working examples are helpful.
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    stepancheg and alice-i-cecile authored Jan 9, 2024
    Configuration menu
    Copy the full SHA
    9813e39 View commit details
    Browse the repository at this point in the history
  2. Fix missed explicit conversions in examples (bevyengine#11261)

    # Objective
    
    A few of these were missed in bevyengine#10878
    
    ## Solution
    
    Fix em
    rparrett authored Jan 9, 2024
    Configuration menu
    Copy the full SHA
    9c972f0 View commit details
    Browse the repository at this point in the history
  3. Option to enable deterministic rendering (bevyengine#11248)

    # Objective
    
    Issue bevyengine#10243: rendering multiple triangles in the same place results in
    flickering.
    
    ## Solution
    
    Considered these alternatives:
    - `depth_bias` may not work, because of high number of entities, so
    creating a material per entity is practically not possible
    - rendering at slightly different positions does not work, because when
    camera is far, float rounding causes the same issues (edit: assuming we
    have to use the same `depth_bias`)
    - considered implementing deterministic operation like
    `query.par_iter().flat_map(...).collect()` to be used in
    `check_visibility` system (which would solve the issue since query is
    deterministic), and could not figure out how to make it as cheap as
    current approach with thread-local collectors (bevyengine#11249)
    
    So adding an option to sort entities after `check_visibility` system
    run.
    
    Should not be too bad, because after visibility check, only a handful
    entities remain.
    
    This is probably not the only source of non-determinism in Bevy, but
    this is one I could find so far. At least it fixes the repro example.
    
    ## Changelog
    
    - `DeterministicRenderingConfig` option to enable deterministic
    rendering
    
    ## Test
    
    <img width="1392" alt="image"
    src="https://github.com/bevyengine/bevy/assets/28969/c735bce1-3a71-44cd-8677-c19f6c0ee6bd">
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    stepancheg and alice-i-cecile authored Jan 9, 2024
    Configuration menu
    Copy the full SHA
    06bf928 View commit details
    Browse the repository at this point in the history
  4. mobile and webgpu: trigger redraw request when needed and improve win…

    …dow creation (bevyengine#11245)
    
    # Objective
    
    - Since bevyengine#11227, Bevy doesn't work on mobile anymore. Windows are not
    created.
    
    ## Solution
    
    - Create initial window on mobile after the initial `Resume` event.
    macOS is included because it's excluded from the other initial window
    creation and I didn't want it to feel alone. Also, it makes sense. this
    is needed for Android
    
    https://github.com/bevyengine/bevy/blob/cfcb6885e3b475a93ec0fe7e88023ac0f354bbbf/crates/bevy_winit/src/lib.rs#L152
    - request redraw during plugin initialisation (needed for WebGPU)
    - request redraw when receiving `AboutToWait` instead of at the end of
    the event handler. request to redraw during a `RedrawRequested` event
    are ignored on iOS
    mockersf authored Jan 9, 2024
    Configuration menu
    Copy the full SHA
    0e61435 View commit details
    Browse the repository at this point in the history
  5. Remove unused event-listener dependency (bevyengine#11269)

    # Objective
    
    This dependency is seemingly no longer used directly after bevyengine#7267.
    
    Unfortunately, this doesn't fix us having versions of `event-listener`
    in our tree.
    
    Closes bevyengine#10654
    
    ## Solution
    
    Remove it, see if anything breaks.
    rparrett authored Jan 9, 2024
    Configuration menu
    Copy the full SHA
    6901688 View commit details
    Browse the repository at this point in the history
  6. Remove unnecessary unsafe impls for WinitWindows on Wasm (bevyengine#…

    …11270)
    
    # Objective
    
    In the past `winit::window::Window` was not Send + Sync on web.
    rust-windowing/winit#2834 made
    `winit::window::Window` Sync + Send so Bevy's `unsafe impl` is no longer
    necessary.
    
    ## Solution
    
    Remove the unsafe impls.
    kettle11 authored Jan 9, 2024
    Configuration menu
    Copy the full SHA
    13d3de8 View commit details
    Browse the repository at this point in the history
  7. resolve all internal ambiguities (bevyengine#10411)

    - ignore all ambiguities that are not a problem
    - remove `.before(Assets::<Image>::track_assets),` that points into a
    different schedule (-> should this be caught?)
    - add some explicit orderings:
    - run `poll_receivers` and `update_accessibility_nodes` after
    `window_closed` in `bevy_winit::accessibility`
      - run `bevy_ui::accessibility::calc_bounds` after `CameraUpdateSystem`
    - run ` bevy_text::update_text2d_layout` and `bevy_ui::text_system`
    after `font_atlas_set::remove_dropped_font_atlas_sets`
    - add `app.ignore_ambiguity(a, b)` function for cases where you want to
    ignore an ambiguity between two independent plugins `A` and `B`
    - add `IgnoreAmbiguitiesPlugin` in `DefaultPlugins` that allows
    cross-crate ambiguities like `bevy_animation`/`bevy_ui`
    - Fixes bevyengine#9511
    
    ## Before
    **Render**
    ![render_schedule_Render
    dot](https://github.com/bevyengine/bevy/assets/22177966/1c677968-7873-40cc-848c-91fca4c8e383)
    
    **PostUpdate**
    ![schedule_PostUpdate
    dot](https://github.com/bevyengine/bevy/assets/22177966/8fc61304-08d4-4533-8110-c04113a7367a)
    
    ## After
    **Render**
    ![render_schedule_Render
    dot](https://github.com/bevyengine/bevy/assets/22177966/462f3b28-cef7-4833-8619-1f5175983485)
    **PostUpdate**
    ![schedule_PostUpdate
    dot](https://github.com/bevyengine/bevy/assets/22177966/8cfb3d83-7842-4a84-9082-46177e1a6c70)
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    Co-authored-by: Alice Cecile <alice.i.cecil@gmail.com>
    Co-authored-by: François <mockersf@gmail.com>
    4 people authored Jan 9, 2024
    Configuration menu
    Copy the full SHA
    a657478 View commit details
    Browse the repository at this point in the history

Commits on Jan 10, 2024

  1. fix B0003 example and update logs (bevyengine#11162)

    # Objective
    
    - Example in error B0003 is not failing anymore after bevyengine#9822
    
    ## Solution
    
    - Update the example code so that is always fail
    - Also update logs and instructions on how to debug as it's easier now
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    mockersf and alice-i-cecile authored Jan 10, 2024
    Configuration menu
    Copy the full SHA
    d4ffd4f View commit details
    Browse the repository at this point in the history
  2. Implement bounding volume types (bevyengine#10946)

    # Objective
    
    Implement bounding volume trait and the 4 types from
    bevyengine#10570. I will add intersection
    tests in a future PR.
    
    ## Solution
    
    Implement mostly everything as written in the issue, except:
    - Intersection is no longer a method on the bounding volumes, but a
    separate trait.
    - I implemented a `visible_area` since it's the most common usecase to
    care about the surface that could collide with cast rays.
      - Maybe we want both?
    
    ---
    
    ## Changelog
    
    - Added bounding volume types to bevy_math
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    NiseVoid and alice-i-cecile authored Jan 10, 2024
    Configuration menu
    Copy the full SHA
    c4e479a View commit details
    Browse the repository at this point in the history

Commits on Jan 11, 2024

  1. Fixed typo in generate_custom_mesh.rs example (bevyengine#11293)

    # Objective
    
    - Fix a typo in the "Generate Custom Mesh" example
    
    ## Solution
    
    - Fixed small typo
    Gadzev authored Jan 11, 2024
    Configuration menu
    Copy the full SHA
    ce5bae5 View commit details
    Browse the repository at this point in the history

Commits on Jan 12, 2024

  1. Fix ssao only sampling mip 0 (bevyengine#11292)

    # Objective
    
    Fixes bevyengine#11222
    
    ## Solution
    
    SSAO's sample_mip_level was always giving negative values because it was
    in UV space (0..1) when it needed to be in pixel units (0..resolution).
    
    Fixing it so it properly samples lower mip levels when appropriate is a
    pretty large speedup (~3.2ms -> ~1ms at 4k, ~507us-> 256us at 1080p on a
    6800xt), and I didn't notice any obvious visual quality differences.
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    Elabajaba and alice-i-cecile authored Jan 12, 2024
    Configuration menu
    Copy the full SHA
    64a15f1 View commit details
    Browse the repository at this point in the history
  2. Revert "Implement minimal reflection probes. (bevyengine#10057)" (bev…

    …yengine#11307)
    
    # Objective
    
    - Fix working on macOS, iOS, Android on main 
    - Fixes bevyengine#11281 
    - Fixes bevyengine#11282 
    - Fixes bevyengine#11283 
    - Fixes bevyengine#11299
    
    ## Solution
    
    - Revert bevyengine#10057
    mockersf authored Jan 12, 2024
    Configuration menu
    Copy the full SHA
    3d99663 View commit details
    Browse the repository at this point in the history
  3. Add paused run condition (bevyengine#11313)

    # Objective
    
    - It is common to run a system only when the clock is paused or not
    paused, but this run condition doesn't exist.
    
    ## Solution
    
    - Add the "paused" run condition.
    
    ---
    
    ## Changelog
    
    - Systems can now be scheduled to run only if the clock is paused or not
    using `.run_if(paused())` or `.run_if(not(paused()))`.
    
    ---------
    
    Co-authored-by: radiish <cb.setho@gmail.com>
    Ixentus and soqb authored Jan 12, 2024
    Configuration menu
    Copy the full SHA
    5c6b7d5 View commit details
    Browse the repository at this point in the history

Commits on Jan 13, 2024

  1. Unified identifer for entities & relations (bevyengine#9797)

    # Objective
    
    The purpose of this PR is to begin putting together a unified identifier
    structure that can be used by entities and later components (as
    entities) as well as relationship pairs for relations, to enable all of
    these to be able to use the same storages. For the moment, to keep
    things small and focused, only `Entity` is being changed to make use of
    the new `Identifier` type, keeping `Entity`'s API and
    serialization/deserialization the same. Further changes are for
    follow-up PRs.
    
    ## Solution
    
    `Identifier` is a wrapper around `u64` split into two `u32` segments
    with the idea of being generalised to not impose restrictions on
    variants. That is for `Entity` to do. Instead, it is a general API for
    taking bits to then merge and map into a `u64` integer. It exposes
    low/high methods to return the two value portions as `u32` integers,
    with then the MSB masked for usage as a type flag, enabling entity kind
    discrimination and future activation/deactivation semantics.
    
    The layout in this PR for `Identifier` is described as below, going from
    MSB -> LSB.
    
    ```
    |F| High value                    | Low value                      |
    |_|_______________________________|________________________________|
    |1| 31                            | 32                             |
    
    F = Bit Flags
    ```
    
    The high component in this implementation has only 31 bits, but that
    still leaves 2^31 or 2,147,483,648 values that can be stored still, more
    than enough for any generation/relation kinds/etc usage. The low part is
    a full 32-bit index. The flags allow for 1 bit to be used for
    entity/pair discrimination, as these have different usages for the
    low/high portions of the `Identifier`. More bits can be reserved for
    more variants or activation/deactivation purposes, but this currently
    has no use in bevy.
    
    More bits could be reserved for future features at the cost of bits for
    the high component, so how much to reserve is up for discussion. Also,
    naming of the struct and methods are also subject to further
    bikeshedding and feedback.
    
    Also, because IDs can have different variants, I wonder if
    `Entity::from_bits` needs to return a `Result` instead of potentially
    panicking on receiving an invalid ID.
    
    PR is provided as an early WIP to obtain feedback and notes on whether
    this approach is viable.
    
    ---
    
    ## Changelog
    
    ### Added
    
    New `Identifier` struct for unifying IDs.
    
    ### Changed
    
    `Entity` changed to use new `Identifier`/`IdentifierMask` as the
    underlying ID logic.
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    Co-authored-by: vero <email@atlasdostal.com>
    3 people authored Jan 13, 2024
    Configuration menu
    Copy the full SHA
    e6a324a View commit details
    Browse the repository at this point in the history
  2. Simplify conditions (bevyengine#11316)

    # Objective
    
    - Conditions don't have to be closures unless they have state or mutate.
    
    ## Solution
    
    - Simplify conditions when possible.
    
    ---
    
    ## Changelog
    
    The following run conditions are now regular systems:
    - resource_exists<T>
    - resource_added<T>
    - resource_changed<T>
    - resource_exists_and_changed<T>
    - state_exists<S: States>
    - state_changed<S: States>
    - any_with_component<T: Component>
    
    ## Migration Guide
    
    - resource_exists<T>() -> resource_exists<T>
    - resource_added<T>() -> resource_added<T>
    - resource_changed<T>() -> resource_changed<T>
    - resource_exists_and_changed<T>() -> resource_exists_and_changed<T>
    - state_exists<S: States>() -> state_exists<S: States>
    - state_changed<S: States>() -> state_changed<S: States>
    - any_with_component<T: Component>() -> any_with_component<T: Component>
    Ixentus authored Jan 13, 2024
    Configuration menu
    Copy the full SHA
    e2fd631 View commit details
    Browse the repository at this point in the history
  3. Add example using State in docs (bevyengine#11319)

    # Objective
    
    - It may be confusing whether
    [`State`](https://docs.rs/bevy_ecs/latest/bevy_ecs/schedule/struct.State.html)
    is a `Resource` or a `SystemParam`.
    - Fixes bevyengine#11312.
    
    ## Solution
    
    - Add an example using `State` in a system in the docs, to clarify that
    it is a `Resource`.
    
    ---
    
    I basically copied the example from
    [`States`](https://docs.rs/bevy_ecs/latest/bevy_ecs/schedule/trait.States.html)
    and added a system beside it. I don't have a strong opinion on what the
    example should look like, so please comment if you have a better idea.
    :)
    BD103 authored Jan 13, 2024
    Configuration menu
    Copy the full SHA
    9926123 View commit details
    Browse the repository at this point in the history
  4. Clean up code to find the current keyframe (bevyengine#11306)

    # Objective
    
    While working on bevyengine#10832, I found this code very dense and hard to
    understand.
    
    I was not confident in my fix (or the correctness of the existing code).
    
    ## Solution
    
    Clean up, test and document the code used in the `apply_animation`
    system.
    
    I also added a pair of length-related utility methods to `Keyframes` for
    easier testing. They seemed generically useful, so I made them pub.
    
    ## Changelog
    
    - Added `VariableCurve::find_current_keyframe` method.
    - Added `Keyframes::len` and `is_empty` methods.
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecil@gmail.com>
    alice-i-cecile and Alice Cecile authored Jan 13, 2024
    Configuration menu
    Copy the full SHA
    98b62e8 View commit details
    Browse the repository at this point in the history
  5. Skip rehashing TypeIds (bevyengine#11268)

    # Objective
    
    `TypeId` contains a high-quality hash. Whenever a lookup based on a
    `TypeId` is performed (e.g. to insert/remove components), the hash is
    run through a second hash function. This is unnecessary.
    
    ## Solution
    
    Skip re-hashing `TypeId`s.
    
    In my
    [testing](https://gist.github.com/SpecificProtagonist/4b49ad74c6b82b0aedd3b4ea35121be8),
    this improves lookup performance consistently by 10%-15% (of course, the
    lookup is only a small part of e.g. a bundle insertion).
    SpecificProtagonist authored Jan 13, 2024
    Configuration menu
    Copy the full SHA
    69760c7 View commit details
    Browse the repository at this point in the history
  6. Skip alloc when updating animation path cache (bevyengine#11330)

    Not always, but skip it if the new length is smaller.
    
    For context, `path_cache` is a `Vec<Vec<Option<Entity>>>`.
    
    # Objective
    
    Previously, when setting a new length to the `path_cache`, we would:
    
    1. Deallocate all existing `Vec<Option<Entity>>`
    2. Deallocate the `path_cache`
    3. Allocate a new `Vec<Vec<Option<Entity>>>`, where each item is an
    empty `Vec`, and would have to be allocated when pushed to.
    
    This is a lot of allocations!
    
    ## Solution
    
    Use
    [`Vec::resize_with`](https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.resize_with).
    
    With this change, what occurs is:
    
    1. We `clear` each `Vec<Option<Entity>>`, keeping the allocation, but
    making the memory of each `Vec` re-usable
    2. We only append new `Vec` to `path_cache` when it is too small.
    
    * Fixes bevyengine#11328 
    
    ### Note on performance
    
    I didn't benchmark it, I just ran a diff on the generated assembly (ran
    with `--profile stress-test` and `--native`). I found this PR has 20
    less instructions in `apply_animation` (out of 2504).
    
    Though on a purely abstract level, I can deduce this leads to less
    allocation.
    
    More information on profiling allocations in rust:
    https://nnethercote.github.io/perf-book/heap-allocations.html
    
    ## Future work
    
    I think a [jagged vec](https://en.wikipedia.org/wiki/Jagged_array) would
    be much more pertinent. Because it allocates everything in a single
    contiguous buffer.
    
    This would avoid dancing around allocations, and reduces the overhead of
    one `*mut T` and two `usize` per row, also removes indirection,
    improving cache efficiency. I think it would both improve code quality
    and performance.
    nicopap authored Jan 13, 2024
    Configuration menu
    Copy the full SHA
    78b5f32 View commit details
    Browse the repository at this point in the history
  7. Inline trivial methods in bevy_hierarchy (bevyengine#11332)

    # Objective
    
    In bevyengine#11330 I found out that `Parent::get` didn't get inlined, **even with
    LTO on**!
    
    This means that just to access a field, we have an instruction cache
    invalidation, we will move some registers to the stack, will jump to new
    instructions, move the field into a register, then do the same dance in
    the other direction to go back to the call site.
    
    ## Solution
    
    Mark trivial functions as `#[inline]`.
    
    `inline(always)` may increase compilation time proportional to how many
    time the function is called **and the size of the function marked with
    `inline`**. Since we mark as `inline` functions that consists in a
    single instruction, the cost is absolutely negligible.
    
    I also took the opportunity to `inline` other functions. I'm not as
    confident that marking functions calling other functions as `inline`
    works similarly to very simple functions, so I used `inline` over
    `inline(always)`, which doesn't have the same downsides as
    `inline(always)`.
    
    More information on inlining in rust:
    https://nnethercote.github.io/perf-book/inlining.html
    nicopap authored Jan 13, 2024
    Configuration menu
    Copy the full SHA
    a634075 View commit details
    Browse the repository at this point in the history
  8. UI text rotation and scaling fix (bevyengine#11326)

    # Objective
    
    UI node text is drawn in the wrong position after rotation or scaling.
    
    
    ![294723406-d031a3e6-a4f9-48b4-a66a-ee963100a8b9](https://github.com/bevyengine/bevy/assets/27962798/2755e2e3-6a03-4ee8-8676-bdcaa72ec678)
    
    ## Solution
    In `extract_text_uinodes` to set the text's offset create a translation
    matrix and multiply it by the UI node's transform.
    
    Previously the offset was just added directly to the translation of the
    Node's `GlobalTransform`, which meant no scaling or rotation would be
    applied to the offset.
    
    <img width="961" alt="296440025-537ec11c-1ea1-469c-8eec-2ad4ae012095"
    src="https://github.com/bevyengine/bevy/assets/27962798/eae1a1d2-1369-47ad-8963-3862d03ec0bf">
    
    <img width="961" alt="296440156-dd04029d-8112-4fa5-89a2-56d7acab66df"
    src="https://github.com/bevyengine/bevy/assets/27962798/90b1b6db-13f4-4745-9f14-7c1661baad50">
    
    Fixes bevyengine#11241
    ickshonpe authored Jan 13, 2024
    Configuration menu
    Copy the full SHA
    03404c4 View commit details
    Browse the repository at this point in the history

Commits on Jan 14, 2024

  1. Make TypeId::hash more robust in case of upstream rustc changes (be…

    …vyengine#11334)
    
    Based on discussion after bevyengine#11268 was merged:
    Instead of panicking should the impl of `TypeId::hash` change
    significantly, have a fallback and detect this in a test.
    SpecificProtagonist authored Jan 14, 2024
    Configuration menu
    Copy the full SHA
    cd12e7c View commit details
    Browse the repository at this point in the history
  2. Remove Default impl for CubicCurve (bevyengine#11335)

    # Objective
    
    - Implementing `Default` for
    [`CubicCurve`](https://docs.rs/bevy/latest/bevy/math/cubic_splines/struct.CubicCurve.html)
    does not make sense because it cannot be mutated after creation.
    - Closes bevyengine#11209.
    - Alternative to bevyengine#11211.
    
    ## Solution
    
    - Remove `Default` from `CubicCurve`'s derive statement.
    
    Based off of @mockersf comment
    (bevyengine#11211 (comment)):
    
    > CubicCurve can't be updated once created... I would prefer to remove
    the Default impl as it doesn't make sense
    
    ---
    
    ## Changelog
    
    - Removed the `Default` implementation for `CubicCurve`.
    
    ## Migration Guide
    
    - Remove `CubicCurve` from any structs that implement `Default`.
    - Wrap `CubicCurve` in a new type and provide your own default.
    
    ```rust
    #[derive(Deref)]
    struct MyCubicCurve<P: Point>(pub CubicCurve<P>);
    
    impl Default for MyCubicCurve<Vec2> {
        fn default() -> Self {
            let points = [[
                vec2(-1.0, -20.0),
                vec2(3.0, 2.0),
                vec2(5.0, 3.0),
                vec2(9.0, 8.0),
            ]];
    
            Self(CubicBezier::new(points).to_curve())
        }
    }
    ```
    BD103 authored Jan 14, 2024
    Configuration menu
    Copy the full SHA
    6f6269e View commit details
    Browse the repository at this point in the history
  3. Extract examples CameraController into a module (bevyengine#11338)

    # Objective
    
    Unify flycam-style camera controller from the examples.
    
    `parallax_mapping` controller was kept as is.
    
    ## Solution
    
    Fixed some mouse movement & cursor grabbing related issues too.
    MiniaczQ authored Jan 14, 2024
    Configuration menu
    Copy the full SHA
    ec5b9ee View commit details
    Browse the repository at this point in the history
  4. Warn when bevy_sprite and bevy_pbr are not enabled with bevy_gizmos (b…

    …evyengine#11296)
    
    # Objective
    
    - `bevy_gizmos` cannot work if both `bevy_sprite` and `bevy_pbr` are
    disabled.
    - It silently fails to render, making it difficult to debug.
    - Fixes bevyengine#10984
    
    ## Solution
    
    - Log an error message when `GizmoPlugin` is registered.
    
    ## Alternatives
    
    I chose to log an error message, since it seemed the least intrusive of
    potential solutions. Some alternatives include:
    
    - Choosing one dependency as the default, neglecting the other. (bevyengine#11035)
    - Raising a compile error when neither dependency is enabled. ([See my
    original
    comment](bevyengine#10984 (comment)))
    - Raising a compile warning using a macro hack. ([Pre-RFC - Add
    compile_warning!
    macro](https://internals.rust-lang.org/t/pre-rfc-add-compile-warning-macro/9370/7?u=bd103))
    - Logging a warning instead of an error.
    - _This might be the better option. Let me know if I should change it._
    
    ---
    
    ## Changelog
    
    - `bevy_gizmos` will now log an error if neither `bevy_pbr` nor
    `bevy_sprite` are enabled.
    BD103 authored Jan 14, 2024
    Configuration menu
    Copy the full SHA
    b2d417b View commit details
    Browse the repository at this point in the history
  5. Make sure tracy deps conform to compatibility table (bevyengine#11331)

    # Objective
    
    The table [here](https://github.com/nagisa/rust_tracy_client) shows
    which versions of [Tracy](https://github.com/wolfpld/tracy) should be
    used combined with which Rust deps.
    
    Reading `bevy_log`'s `Cargo.toml` can be slightly confusing since the
    exact versions are not picked from the same row.
    
    Reading the produced `Cargo.lock` when building a Bevy example shows
    that it's the most recent row that is resolved, but this should be more
    clearly understood without needing to check the lock file.
    
    
    ## Solution
    
    - Specify versions from the compatibility table including patch version
    
    Signed-off-by: Torstein Grindvik <torstein.grindvik@muybridge.com>
    Co-authored-by: Torstein Grindvik <torstein.grindvik@muybridge.com>
    torsteingrindvik and Torstein Grindvik authored Jan 14, 2024
    Configuration menu
    Copy the full SHA
    4778fbe View commit details
    Browse the repository at this point in the history
  6. Describe purpose of bevy_diagnostic (bevyengine#11327)

    # Objective
    
    - Explain purpose of bevy_diagnostic, see:
    bevyengine#11309 (comment)
    
    ## Solution
    
    - Add doc comment
    matiqo15 authored Jan 14, 2024
    Configuration menu
    Copy the full SHA
    8a523de View commit details
    Browse the repository at this point in the history

Commits on Jan 15, 2024

  1. Add support for updating the tracing subscriber in LogPlugin (bevyeng…

    …ine#10822)
    
    # Objective
    
    This PR is heavily inspired by
    bevyengine#7682
    It aims to solve the same problem: allowing the user to extend the
    tracing subscriber with extra layers.
    
    (in my case, I'd like to use `use
    metrics_tracing_context::{MetricsLayer, TracingContextLayer};`)
    
    
    ## Solution
    
    I'm proposing a different api where the user has the opportunity to take
    the existing `subscriber` and apply any transformations on it.
    
    ---
    
    ## Changelog
    
    - Added a `update_subscriber` option on the `LogPlugin` that lets the
    user modify the `subscriber` (for example to extend it with more tracing
    `Layers`
    
    
    ## Migration Guide
    
    > This section is optional. If there are no breaking changes, you can
    delete this section.
    
    - Added a new field `update_subscriber` in the `LogPlugin`
    
    ---------
    
    Co-authored-by: Charles Bournhonesque <cbournhonesque@snapchat.com>
    cBournhonesque and cbournhonesque-sc authored Jan 15, 2024
    Configuration menu
    Copy the full SHA
    8c6d9b8 View commit details
    Browse the repository at this point in the history
  2. Remove the ability to ignore global volume (bevyengine#11092)

    # Objective
    
    The ability to ignore the global volume doesn't seem desirable and
    complicates the API.
    
    bevyengine#7706 added global volume and the ability to ignore it, but there was no
    further discussion about whether that's useful. Feel free to discuss
    here :)
    
    ## Solution
    
    Replace the `Volume` type's functionality with the `VolumeLevel`. Remove
    `VolumeLevel`.
    
    I also removed `DerefMut` derive that effectively made the volume `pub`
    and actually ensured that the volume isn't set below `0` even in release
    builds.
    
    ## Migration Guide
    
    The option to ignore the global volume using `Volume::Absolute` has been
    removed and `Volume` now stores the volume level directly, removing the
    need for the `VolumeLevel` struct.
    tim-blackbird authored Jan 15, 2024
    Configuration menu
    Copy the full SHA
    c29a972 View commit details
    Browse the repository at this point in the history
  3. GLTF extension support (bevyengine#11138)

    # Objective
    Adds support for accessing raw extension data of loaded GLTF assets
    
    ## Solution
    Via the GLTF loader settings, you can specify whether or not to include
    the GLTF source. While not the ideal way of solving this problem,
    modeling all of GLTF within Bevy just for extensions adds a lot of
    complexity to the way Bevy handles GLTF currently. See the example GLTF
    meta file and code
    ```
    (
        meta_format_version: "1.0",
        asset: Load(
            loader: "bevy_gltf::loader::GltfLoader",
            settings: (
                load_meshes: true,
                load_cameras: true,
                load_lights: true,
                include_source: true,
            ),
        ),
    )
    ```
    ```rs
    pub fn load_gltf(mut commands: Commands, assets: Res<AssetServer>) {
        let my_gltf = assets.load("test_platform.gltf");
    
        commands.insert_resource(MyAssetPack {
            spawned: false,
            handle: my_gltf,
        });
    }
    
    #[derive(Resource)]
    pub struct MyAssetPack {
        pub spawned: bool,
        pub handle: Handle<Gltf>,
    }
    
    pub fn spawn_gltf_objects(
        mut commands: Commands,
        mut my: ResMut<MyAssetPack>,
        assets_gltf: Res<Assets<Gltf>>,
    ) {
        // This flag is used to because this system has to be run until the asset is loaded.
        // If there's a better way of going about this I am unaware of it.
        if my.spawned {
            return;
        }
    
        if let Some(gltf) = assets_gltf.get(&my.handle) {
            info!("spawn");
            my.spawned = true;
            // spawn the first scene in the file
            commands.spawn(SceneBundle {
                scene: gltf.scenes[0].clone(),
                ..Default::default()
            });
    
            let source = gltf.source.as_ref().unwrap();
            info!("materials count {}", &source.materials().size_hint().0);
            info!(
                "materials ext is some {}",
                &source.materials().next().unwrap().extensions().is_some()
            );
        }
    }
    ```
    
    ---
    
    ## Changelog
    Added support for GLTF extensions through including raw GLTF source via
    loader flag `GltfLoaderSettings::include_source == true`, stored in
    `Gltf::source: Option<gltf::Gltf>`
    
    ## Migration Guide
    This will have issues with "asset migrations", as there is currently no
    way for .meta files to be migrated. Attempting to migrate .meta files
    without the new flag will yield the following error:
    ```
    bevy_asset::server: Failed to deserialize meta for asset test_platform.gltf: Failed to deserialize asset meta: SpannedError { code: MissingStructField { field: "include_source", outer: Some("GltfLoaderSettings") }, position: Position { line: 9, col: 9 } }
    ```
    This means users who want to migrate their .meta files will have to add
    the `include_source: true,` setting to their meta files by hand.
    CorneliusCornbread authored Jan 15, 2024
    Configuration menu
    Copy the full SHA
    a7b99f0 View commit details
    Browse the repository at this point in the history
  4. Sprite slicing and tiling (bevyengine#10588)

    > Replaces bevyengine#5213
    
    # Objective
    
    Implement sprite tiling and [9 slice
    scaling](https://en.wikipedia.org/wiki/9-slice_scaling) for
    `bevy_sprite`.
    Allowing slice scaling and texture tiling.
    
    Basic scaling vs 9 slice scaling:
    
    
    ![Traditional_scaling_vs_9-slice_scaling](https://user-images.githubusercontent.com/26703856/177335801-27f6fa27-c569-4ce6-b0e6-4f54e8f4e80a.svg)
    
    Slicing example:
    
    <img width="481" alt="Screenshot 2022-07-05 at 15 05 49"
    src="https://user-images.githubusercontent.com/26703856/177336112-9e961af0-c0af-4197-aec9-430c1170a79d.png">
    
    Tiling example:
    
    <img width="1329" alt="Screenshot 2023-11-16 at 13 53 32"
    src="https://github.com/bevyengine/bevy/assets/26703856/14db39b7-d9e0-4bc3-ba0e-b1f2db39ae8f">
    
    # Solution
    
    - `SpriteBundlue` now has a `scale_mode` component storing a
    `SpriteScaleMode` enum with three variants:
      - `Stretched` (default) 
      - `Tiled` to have sprites tile horizontally and/or vertically
    - `Sliced` allowing 9 slicing the texture and optionally tile some
    sections with a `Textureslicer`.
    - `bevy_sprite` has two extra systems to compute a
    `ComputedTextureSlices` if necessary,:
    - One system react to changes on `Sprite`, `Handle<Image>` or
    `SpriteScaleMode`
    - The other listens to `AssetEvent<Image>` to compute slices on sprites
    when the texture is ready or changed
    - I updated the `bevy_sprite` extraction stage to extract potentially
    multiple textures instead of one, depending on the presence of
    `ComputedTextureSlices`
    - I added two examples showcasing the slicing and tiling feature.
    
    The addition of `ComputedTextureSlices` as a cache is to avoid querying
    the image data, to retrieve its dimensions, every frame in a extract or
    prepare stage. Also it reacts to changes so we can have stuff like this
    (tiling example):
    
    
    https://github.com/bevyengine/bevy/assets/26703856/a349a9f3-33c3-471f-8ef4-a0e5dfce3b01
    
    # Related 
    
    - [ ] Once bevyengine#5103 or bevyengine#10099 is merged I can enable tiling and slicing for
    texture sheets as ui
    
    # To discuss
    
    There is an other option, to consider slice/tiling as part of the asset,
    using the new asset preprocessing but I have no clue on how to do it.
    
    Also, instead of retrieving the Image dimensions, we could use the same
    system as the sprite sheet and have the user give the image dimensions
    directly (grid). But I think it's less user friendly
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    Co-authored-by: ickshonpe <david.curthoys@googlemail.com>
    Co-authored-by: Alice Cecile <alice.i.cecil@gmail.com>
    4 people authored Jan 15, 2024
    Configuration menu
    Copy the full SHA
    01139b3 View commit details
    Browse the repository at this point in the history
  5. Fix Reactive and ReactiveLowPower update modes (bevyengine#11325)

    # Objective
    
    - Partial fix for bevyengine#11235 
    - Fixes bevyengine#11274 
    - Fixes bevyengine#11320 
    - Fixes bevyengine#11273
    
    ## Solution
    
    - check update mode to trigger redraw request, instead of once a redraw
    request has been triggered
    - don't ignore device event in case of `Reactive` update mode
    - make sure that at least 5 updates are triggered on application start
    to ensure everything is correctly initialized
    - trigger manual updates instead of relying on redraw requests when
    there are no window or they are not visible
    mockersf authored Jan 15, 2024
    Configuration menu
    Copy the full SHA
    3d628a8 View commit details
    Browse the repository at this point in the history
  6. Use EntityHashMap whenever possible (bevyengine#11353)

    # Objective
    
    Fixes bevyengine#11352
    
    ## Solution
    
    - Use `EntityHashMap<Entity, T>` instead of `HashMap<Entity, T>`
    
    ---
    
    ## Changelog
    
    Changed
    - Use `EntityHashMap<Entity, T>` instead of `HashMap<Entity, T>`
    whenever possible
    
    ## Migration Guide
    
    TODO
    atlv24 authored Jan 15, 2024
    Configuration menu
    Copy the full SHA
    4695b82 View commit details
    Browse the repository at this point in the history
  7. Approximate indirect specular occlusion (bevyengine#11152)

    # Objective
    
    - The current PBR renderer over-brightens indirect specular reflections,
    which tends to cause objects to appear to glow, because specular
    occlusion is not accounted for.
    
    ## Solution
    
    - Attenuate indirect specular term with an approximation for specular
    occlusion, using [[Lagarde et al., 2014] (pg.
    76)](https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf).
    
    | Before | After | Animation |
    | --- | --- | --- |
    | <img width="1840" alt="before bike"
    src="https://github.com/bevyengine/bevy/assets/2632925/b6e10d15-a998-4a94-875a-1c2b1e98348a">
    | <img width="1840" alt="after bike"
    src="https://github.com/bevyengine/bevy/assets/2632925/53b1479c-b1e4-427f-b140-53df26ca7193">
    |
    ![ezgif-1-fbcbaf272b](https://github.com/bevyengine/bevy/assets/2632925/c2dece1c-eb3d-4e05-92a2-46cf83052c7c)
    |
    | <img width="1840" alt="classroom before"
    src="https://github.com/bevyengine/bevy/assets/2632925/b16c0e74-741e-4f40-a7df-8863eaa62596">
    | <img width="1840" alt="classroom after"
    src="https://github.com/bevyengine/bevy/assets/2632925/26f9e971-0c63-4ee9-9544-964e5703d65e">
    |
    ![ezgif-1-0f390edd06](https://github.com/bevyengine/bevy/assets/2632925/d8894e52-380f-4528-aa0d-1ca249108178)
    |
    
    ---
    
    ## Changelog
    
    - Ambient occlusion now applies to indirect specular reflections to
    approximate how objects occlude specular light.
    
    ## Migration Guide
    
    - Renamed `PbrInput::occlusion` to `diffuse_occlusion`, and added
    `specular_occlusion`.
    aevyrie authored Jan 15, 2024
    Configuration menu
    Copy the full SHA
    839d2f8 View commit details
    Browse the repository at this point in the history
  8. Change WinitPlugin defaults to limit game update rate when window …

    …is not visible (for real this time) (bevyengine#11305)
    
    # Objective
    
    I goofed. bevyengine#7611 forgot to change the default update modes set by the
    `WinitPlugin`.
    
    
    <https://github.com/bevyengine/bevy/blob/ce5bae55f64bb095e1516427a706a2622ccf2d23/crates/bevy_winit/src/winit_config.rs#L53-L60>
    
    
    <https://github.com/bevyengine/bevy/blob/ce5bae55f64bb095e1516427a706a2622ccf2d23/crates/bevy_winit/src/lib.rs#L127>
    
    ## Solution
    
    Change `Default` impl for `WinitSettings` to return the `game` settings
    that limit FPS when the app runs in the background.
    maniwani authored Jan 15, 2024
    Configuration menu
    Copy the full SHA
    aeab690 View commit details
    Browse the repository at this point in the history
  9. Fix doc of [Schedules] to mention exclusion of current schedule. (b…

    …evyengine#11360)
    
    Document that [`Schedules`] resource does not include the current
    schedule.
    tjamaan authored Jan 15, 2024
    Configuration menu
    Copy the full SHA
    fcc1113 View commit details
    Browse the repository at this point in the history
  10. Async channel v2 (bevyengine#10692)

    # Objective
    
    - Update async channel to v2.
    
    ## Solution
    
    - async channel doesn't support `send_blocking` on wasm anymore. So
    don't compile the pipelined rendering plugin on wasm anymore.
    - Replaces bevyengine#10405
    
    ## Migration Guide
    - The `PipelinedRendering` plugin is no longer exported on wasm. If you
    are including it in your wasm builds you should remove it.
    
    ```rust
    #[cfg(all(not(target_arch = "wasm32"))]
    app.add_plugins(bevy_render::pipelined_rendering::PipelinedRenderingPlugin);
    ```
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    hymm and alice-i-cecile authored Jan 15, 2024
    Configuration menu
    Copy the full SHA
    ee9a150 View commit details
    Browse the repository at this point in the history

Commits on Jan 16, 2024

  1. Camera-driven UI (bevyengine#10559)

    # Objective
    
    Add support for presenting each UI tree on a specific window and
    viewport, while making as few breaking changes as possible.
    
    This PR is meant to resolve the following issues at once, since they're
    all related.
    
    - Fixes bevyengine#5622 
    - Fixes bevyengine#5570 
    - Fixes bevyengine#5621 
    
    Adopted bevyengine#5892 , but started over since the current codebase diverged
    significantly from the original PR branch. Also, I made a decision to
    propagate component to children instead of recursively iterating over
    nodes in search for the root.
    
    
    ## Solution
    
    Add a new optional component that can be inserted to UI root nodes and
    propagate to children to specify which camera it should render onto.
    This is then used to get the render target and the viewport for that UI
    tree. Since this component is optional, the default behavior should be
    to render onto the single camera (if only one exist) and warn of
    ambiguity if multiple cameras exist. This reduces the complexity for
    users with just one camera, while giving control in contexts where it
    matters.
    
    ## Changelog
    
    - Adds `TargetCamera(Entity)` component to specify which camera should a
    node tree be rendered into. If only one camera exists, this component is
    optional.
    - Adds an example of rendering UI to a texture and using it as a
    material in a 3D world.
    - Fixes recalculation of physical viewport size when target scale factor
    changes. This can happen when the window is moved between displays with
    different DPI.
    - Changes examples to demonstrate assigning UI to different viewports
    and windows and make interactions in an offset viewport testable.
    - Removes `UiCameraConfig`. UI visibility now can be controlled via
    combination of explicit `TargetCamera` and `Visibility` on the root
    nodes.
    
    ---------
    
    Co-authored-by: davier <bricedavier@gmail.com>
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    Co-authored-by: Alice Cecile <alice.i.cecil@gmail.com>
    4 people authored Jan 16, 2024
    Configuration menu
    Copy the full SHA
    eb9db21 View commit details
    Browse the repository at this point in the history
  2. Bump toml_edit in build-template-pages tool (bevyengine#11342)

    # Objective
    
    - The
    [`build-templated-pages`](https://github.com/bevyengine/bevy/tree/4778fbeb65d840eb39bda017fd428ebfc17a1153/tools/build-templated-pages)
    tool is used to render the Markdown templates in the
    [docs-template](https://github.com/bevyengine/bevy/tree/4778fbeb65d840eb39bda017fd428ebfc17a1153/docs-template)
    folder.
    - It depends on out outdated version of `toml_edit`.
    
    ## Solution
    
    - Bump `toml_edit` to 0.21, disabling all features except `parse`.
    BD103 authored Jan 16, 2024
    Configuration menu
    Copy the full SHA
    9f8db0d View commit details
    Browse the repository at this point in the history
  3. Texture Atlas rework (bevyengine#5103)

    # Objective
    
    > Old MR: bevyengine#5072 
    > ~~Associated UI MR: bevyengine#5070~~
    > Adresses bevyengine#1618
    
    Unify sprite management
    
    ## Solution
    
    - Remove the `Handle<Image>` field in `TextureAtlas` which is the main
    cause for all the boilerplate
    - Remove the redundant `TextureAtlasSprite` component
    - Renamed `TextureAtlas` asset to `TextureAtlasLayout`
    ([suggestion](bevyengine#5103 (comment)))
    - Add a `TextureAtlas` component, containing the atlas layout handle and
    the section index
    
    The difference between this solution and bevyengine#5072 is that instead of the
    `enum` approach is that we can more easily manipulate texture sheets
    without any breaking changes for classic `SpriteBundle`s (@mockersf
    [comment](bevyengine#5072 (comment)))
    
    Also, this approach is more *data oriented* extracting the
    `Handle<Image>` and avoiding complex texture atlas manipulations to
    retrieve the texture in both applicative and engine code.
    With this method, the only difference between a `SpriteBundle` and a
    `SpriteSheetBundle` is an **additional** component storing the atlas
    handle and the index.
    
    ~~This solution can be applied to `bevy_ui` as well (see bevyengine#5070).~~
    
    EDIT: I also applied this solution to Bevy UI
    
    ## Changelog
    
    - (**BREAKING**) Removed `TextureAtlasSprite`
    - (**BREAKING**) Renamed `TextureAtlas` to `TextureAtlasLayout`
    - (**BREAKING**) `SpriteSheetBundle`:
      - Uses a  `Sprite` instead of a `TextureAtlasSprite` component
    - Has a `texture` field containing a `Handle<Image>` like the
    `SpriteBundle`
    - Has a new `TextureAtlas` component instead of a
    `Handle<TextureAtlasLayout>`
    - (**BREAKING**) `DynamicTextureAtlasBuilder::add_texture` takes an
    additional `&Handle<Image>` parameter
    - (**BREAKING**) `TextureAtlasLayout::from_grid` no longer takes a
    `Handle<Image>` parameter
    - (**BREAKING**) `TextureAtlasBuilder::finish` now returns a
    `Result<(TextureAtlasLayout, Handle<Image>), _>`
    - `bevy_text`:
      - `GlyphAtlasInfo` stores the texture `Handle<Image>`
      - `FontAtlas` stores the texture `Handle<Image>`
    - `bevy_ui`:
    - (**BREAKING**) Removed `UiAtlasImage` , the atlas bundle is now
    identical to the `ImageBundle` with an additional `TextureAtlas`
    
    ## Migration Guide
    
    * Sprites
    
    ```diff
    fn my_system(
      mut images: ResMut<Assets<Image>>, 
    -  mut atlases: ResMut<Assets<TextureAtlas>>, 
    +  mut atlases: ResMut<Assets<TextureAtlasLayout>>, 
      asset_server: Res<AssetServer>
    ) {
        let texture_handle: asset_server.load("my_texture.png");
    -   let layout = TextureAtlas::from_grid(texture_handle, Vec2::new(25.0, 25.0), 5, 5, None, None);
    +   let layout = TextureAtlasLayout::from_grid(Vec2::new(25.0, 25.0), 5, 5, None, None);
        let layout_handle = atlases.add(layout);
        commands.spawn(SpriteSheetBundle {
    -      sprite: TextureAtlasSprite::new(0),
    -      texture_atlas: atlas_handle,
    +      atlas: TextureAtlas {
    +         layout: layout_handle,
    +         index: 0
    +      },
    +      texture: texture_handle,
           ..Default::default()
         });
    }
    ```
    * UI
    
    
    ```diff
    fn my_system(
      mut images: ResMut<Assets<Image>>, 
    -  mut atlases: ResMut<Assets<TextureAtlas>>, 
    +  mut atlases: ResMut<Assets<TextureAtlasLayout>>, 
      asset_server: Res<AssetServer>
    ) {
        let texture_handle: asset_server.load("my_texture.png");
    -   let layout = TextureAtlas::from_grid(texture_handle, Vec2::new(25.0, 25.0), 5, 5, None, None);
    +   let layout = TextureAtlasLayout::from_grid(Vec2::new(25.0, 25.0), 5, 5, None, None);
        let layout_handle = atlases.add(layout);
        commands.spawn(AtlasImageBundle {
    -      texture_atlas_image: UiTextureAtlasImage {
    -           index: 0,
    -           flip_x: false,
    -           flip_y: false,
    -       },
    -      texture_atlas: atlas_handle,
    +      atlas: TextureAtlas {
    +         layout: layout_handle,
    +         index: 0
    +      },
    +      image: UiImage {
    +           texture: texture_handle,
    +           flip_x: false,
    +           flip_y: false,
    +       },
           ..Default::default()
         });
    }
    ```
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    Co-authored-by: François <mockersf@gmail.com>
    Co-authored-by: IceSentry <IceSentry@users.noreply.github.com>
    4 people authored Jan 16, 2024
    Configuration menu
    Copy the full SHA
    135c724 View commit details
    Browse the repository at this point in the history
  4. Use glam for computing gLTF node transform (bevyengine#11361)

    # Objective
    
    gltf-rs does its own computations when accessing `transform.matrix()`
    which does not use glam types, rendering bevyengine#11238 useless if people were
    to load gltf models and expecting the results to be deterministic across
    platforms.
    
    ## Solution
    
    Move the computation to bevy side which uses glam types, it was already
    used in one place, so I created one common function to handle the two
    cases.
    
    The added benefit this has, is that some gltf files can have
    translation, rotation and scale directly instead of matrix which skips
    the transform computation completely, win-win.
    richardhozak authored Jan 16, 2024
    Configuration menu
    Copy the full SHA
    184f233 View commit details
    Browse the repository at this point in the history
  5. Exposure settings (adopted) (bevyengine#11347)

    Rebased and finished version of
    bevyengine#8407. Huge thanks to @GitGhillie
    for adjusting all the examples, and the many other people who helped
    write this PR (@superdump , @coreh , among others) :)
    
    Fixes bevyengine#8369
    
    ---
    
    ## Changelog
    - Added a `brightness` control to `Skybox`.
    - Added an `intensity` control to `EnvironmentMapLight`.
    - Added `ExposureSettings` and `PhysicalCameraParameters` for
    controlling exposure of 3D cameras.
    - Removed the baked-in `DirectionalLight` exposure Bevy previously
    hardcoded internally.
    
    ## Migration Guide
    - If using a `Skybox` or `EnvironmentMapLight`, use the new `brightness`
    and `intensity` controls to adjust their strength.
    - All 3D scene will now have different apparent brightnesses due to Bevy
    implementing proper exposure controls. You will have to adjust the
    intensity of your lights and/or your camera exposure via the new
    `ExposureSettings` component to compensate.
    
    ---------
    
    Co-authored-by: Robert Swain <robert.swain@gmail.com>
    Co-authored-by: GitGhillie <jillisnoordhoek@gmail.com>
    Co-authored-by: Marco Buono <thecoreh@gmail.com>
    Co-authored-by: vero <email@atlasdostal.com>
    Co-authored-by: atlas dostal <rodol@rivalrebels.com>
    6 people authored Jan 16, 2024
    Configuration menu
    Copy the full SHA
    fcd7c0f View commit details
    Browse the repository at this point in the history
  6. Fix embedded watcher to work with external crates (bevyengine#11370)

    # Objective
    
    Tried using "embedded_watcher" feature and `embedded_asset!()` from
    another crate. The assets embedded fine but were not "watched." The
    problem appears to be that checking for the feature was done inside the
    macro, so rather than checking if "embedded_watcher" was enabled for
    bevy, it would check if it was enabled for the current crate.
    
    ## Solution
    
    I extracted the checks for the "embedded_watcher" feature into its own
    function called `watched_path()`. No external changes.
    
    ### Alternative Solution
    
    An alternative fix would be to not do any feature checking in
    `embedded_asset!()` or an extracted function and always send the
    full_path to `insert_asset()` where it's promptly dropped when the
    feature isn't turned on. That would be simpler.
    
    ```
        ($app: ident, $source_path: expr, $path: expr) => {{
            let mut embedded = $app
                .world
                .resource_mut::<$crate::io::embedded::EmbeddedAssetRegistry>();
            let path = $crate::embedded_path!($source_path, $path);
            //#[cfg(feature = "embedded_watcher")]
            let full_path = std::path::Path::new(file!()).parent().unwrap().join($path);
            //#[cfg(not(feature = "embedded_watcher"))]
            //let full_path = std::path::PathBuf::new();
            embedded.insert_asset(full_path, &path, include_bytes!($path));
        }};
    ```
    
    ## Changelog
    
    > Fix embedded_watcher feature to work with external crates
    shanecelis authored Jan 16, 2024
    Configuration menu
    Copy the full SHA
    b6e154f View commit details
    Browse the repository at this point in the history
  7. Remove Vec from GpuArrayBuffer (bevyengine#11368)

    # Objective
    
    - Remove Vec as described in
    bevyengine#11290 (comment)
    
    ## Solution
    
    - Rely on StorageBuffer's backing Vec instead
    
    ---
    
    ## Changelog
    
    - GpuArrayBuffer no longer has a redundant backing Vec
    atlv24 authored Jan 16, 2024
    Configuration menu
    Copy the full SHA
    54a54d4 View commit details
    Browse the repository at this point in the history
  8. Dynamic queries and builder API (bevyengine#9774)

    # Objective
    Expand the existing `Query` API to support more dynamic use cases i.e.
    scripting.
    
    ## Prior Art
     - bevyengine#6390 
     - bevyengine#8308 
    - bevyengine#10037
    
    ## Solution
    - Create a `QueryBuilder` with runtime methods to define the set of
    component accesses for a built query.
    - Create new `WorldQueryData` implementations `FilteredEntityMut` and
    `FilteredEntityRef` as variants of `EntityMut` and `EntityRef` that
    provide run time checked access to the components included in a given
    query.
    - Add new methods to `Query` to create "query lens" with a subset of the
    access of the initial query.
    
    ### Query Builder
    The `QueryBuilder` API allows you to define a query at runtime. At it's
    most basic use it will simply create a query with the corresponding type
    signature:
    ```rust
    let query = QueryBuilder::<Entity, With<A>>::new(&mut world).build();
    // is equivalent to
    let query = QueryState::<Entity, With<A>>::new(&mut world);
    ```
    Before calling `.build()` you also have the opportunity to add
    additional accesses and filters. Here is a simple example where we add
    additional filter terms:
    ```rust
    let entity_a = world.spawn((A(0), B(0))).id();
    let entity_b = world.spawn((A(0), C(0))).id();
    
    let mut query_a = QueryBuilder::<Entity>::new(&mut world)
        .with::<A>()
        .without::<C>()
        .build();
                
    assert_eq!(entity_a, query_a.single(&world));
    ```
    This alone is useful in that allows you to decide which archetypes your
    query will match at runtime. However it is also very limited, consider a
    case like the following:
    ```rust
    let query_a = QueryBuilder::<&A>::new(&mut world)
    // Add an additional access
        .data::<&B>()
        .build();
    ```
    This will grant the query an additional read access to component B
    however we have no way of accessing the data while iterating as the type
    signature still only includes &A. For an even more concrete example of
    this consider dynamic components:
    ```rust
    let query_a = QueryBuilder::<Entity>::new(&mut world)
    // Adding a filter is easy since it doesn't need be read later
        .with_id(component_id_a)
    // How do I access the data of this component?
        .ref_id(component_id_b)
        .build();
    ```
    With this in mind the `QueryBuilder` API seems somewhat incomplete by
    itself, we need some way method of accessing the components dynamically.
    So here's one:
    ### Query Transmutation
    If the problem is not having the component in the type signature why not
    just add it? This PR also adds transmute methods to `QueryBuilder` and
    `QueryState`. Here's a simple example:
    ```rust
    world.spawn(A(0));
    world.spawn((A(1), B(0)));
    let mut query = QueryBuilder::<()>::new(&mut world)
        .with::<B>()
        .transmute::<&A>()
        .build();
    
    query.iter(&world).for_each(|a| assert_eq!(a.0, 1));
    ```
    The `QueryState` and `QueryBuilder` transmute methods look quite similar
    but are different in one respect. Transmuting a builder will always
    succeed as it will just add the additional accesses needed for the new
    terms if they weren't already included. Transmuting a `QueryState` will
    panic in the case that the new type signature would give it access it
    didn't already have, for example:
    ```rust
    let query = QueryState::<&A, Option<&B>>::new(&mut world);
    /// This is fine, the access for Option<&A> is less restrictive than &A
    query.transmute::<Option<&A>>(&world);
    /// Oh no, this would allow access to &B on entities that might not have it, so it panics
    query.transmute::<&B>(&world);
    /// This is right out
    query.transmute::<&C>(&world);
    ```
    This is quite an appealing API to also have available on `Query` however
    it does pose one additional wrinkle: In order to to change the iterator
    we need to create a new `QueryState` to back it. `Query` doesn't own
    it's own state though, it just borrows it, so we need a place to borrow
    it from. This is why `QueryLens` exists, it is a place to store the new
    state so it can be borrowed when you call `.query()` leaving you with an
    API like this:
    ```rust
    fn function_that_takes_a_query(query: &Query<&A>) {
        // ...
    }
    
    fn system(query: Query<(&A, &B)>) {
        let lens = query.transmute_lens::<&A>();
        let q = lens.query();
        function_that_takes_a_query(&q);
    }
    ```
    Now you may be thinking: Hey, wait a second, you introduced the problem
    with dynamic components and then described a solution that only works
    for static components! Ok, you got me, I guess we need a bit more:
    ### Filtered Entity References
    Currently the only way you can access dynamic components on entities
    through a query is with either `EntityMut` or `EntityRef`, however these
    can access all components and so conflict with all other accesses. This
    PR introduces `FilteredEntityMut` and `FilteredEntityRef` as
    alternatives that have additional runtime checking to prevent accessing
    components that you shouldn't. This way you can build a query with a
    `QueryBuilder` and actually access the components you asked for:
    ```rust
    let mut query = QueryBuilder::<FilteredEntityRef>::new(&mut world)
        .ref_id(component_id_a)
        .with(component_id_b)
        .build();
    
    let entity_ref = query.single(&world);
    
    // Returns Some(Ptr) as we have that component and are allowed to read it
    let a = entity_ref.get_by_id(component_id_a);
    // Will return None even though the entity does have the component, as we are not allowed to read it
    let b = entity_ref.get_by_id(component_id_b);
    ```
    For the most part these new structs have the exact same methods as their
    non-filtered equivalents.
    
    Putting all of this together we can do some truly dynamic ECS queries,
    check out the `dynamic` example to see it in action:
    ```
    Commands:
        comp, c   Create new components
        spawn, s  Spawn entities
        query, q  Query for entities
    Enter a command with no parameters for usage.
    
    > c A, B, C, Data 4  
    Component A created with id: 0
    Component B created with id: 1
    Component C created with id: 2
    Component Data created with id: 3
    
    > s A, B, Data 1
    Entity spawned with id: 0v0
    
    > s A, C, Data 0
    Entity spawned with id: 1v0
    
    > q &Data
    0v0: Data: [1, 0, 0, 0]
    1v0: Data: [0, 0, 0, 0]
    
    > q B, &mut Data                                                                                     
    0v0: Data: [2, 1, 1, 1]
    
    > q B || C, &Data 
    0v0: Data: [2, 1, 1, 1]
    1v0: Data: [0, 0, 0, 0]
    ```
    ## Changelog
     - Add new `transmute_lens` methods to `Query`.
    - Add new types `QueryBuilder`, `FilteredEntityMut`, `FilteredEntityRef`
    and `QueryLens`
    - `update_archetype_component_access` has been removed, archetype
    component accesses are now determined by the accesses set in
    `update_component_access`
    - Added method `set_access` to `WorldQuery`, this is called before
    `update_component_access` for queries that have a restricted set of
    accesses, such as those built by `QueryBuilder` or `QueryLens`. This is
    primarily used by the `FilteredEntity*` variants and has an empty trait
    implementation.
    - Added method `get_state` to `WorldQuery` as a fallible version of
    `init_state` when you don't have `&mut World` access.
    
    ## Future Work
    Improve performance of `FilteredEntityMut` and `FilteredEntityRef`,
    currently they have to determine the accesses a query has in a given
    archetype during iteration which is far from ideal, especially since we
    already did the work when matching the archetype in the first place. To
    avoid making more internal API changes I have left it out of this PR.
    
    ---------
    
    Co-authored-by: Mike Hsu <mike.hsu@gmail.com>
    james-j-obrien and hymm authored Jan 16, 2024
    Configuration menu
    Copy the full SHA
    ea42d14 View commit details
    Browse the repository at this point in the history
  9. Make DynamicUniformBuffer::push accept an &T instead of T (bevy…

    …engine#11373)
    
    # Objective
    
    - `DynamicUniformBuffer::push` takes an owned `T` but only uses a shared
    reference to it
    - This in turn requires users of `DynamicUniformBuffer::push` to
    potentially unecessarily clone data
    
    ## Solution
    
    - Have `DynamicUniformBuffer::push` take a shared reference to `T`
    
    ---
    
    ## Changelog
    
    - `DynamicUniformBuffer::push` now takes a `&T` instead of `T`
    
    ## Migration Guide
    
    - Users of `DynamicUniformBuffer::push` now need to pass references to
    `DynamicUniformBuffer::push` (e.g. existing `uniforms.push(value)` will
    now become `uniforms.push(&value)`)
    SkiFire13 authored Jan 16, 2024
    Configuration menu
    Copy the full SHA
    39cca41 View commit details
    Browse the repository at this point in the history

Commits on Jan 17, 2024

  1. Fix link to plugin guidelines (bevyengine#11379)

    # Objective
    
    The document was moved in bevyengine#11242, so this link is now broken.
    
    ## Solution
    
    Swap in a working link.
    rparrett authored Jan 17, 2024
    Configuration menu
    Copy the full SHA
    3a666ca View commit details
    Browse the repository at this point in the history
  2. Run markdownlint (bevyengine#11386)

    # Objective
    
    - Fix formatting in markdown file.
    
    ## Solution
    
    - Ran `markdownlint -f -c .github/linters/.markdown-lint.yml .` from
    [CONTRIBUTING.md](https://github.com/bevyengine/bevy/blob/main/CONTRIBUTING.md?plain=1#L341)
    
    I came across this when working on `bevy_dev_tools`
    matiqo15 authored Jan 17, 2024
    Configuration menu
    Copy the full SHA
    9a8349a View commit details
    Browse the repository at this point in the history
  3. Remove duplicate #[automatically_derived] in ECS macro (bevyengine#…

    …11388)
    
    # Objective
    
    It's already provided by `item_attrs`, so it can be removed.
    
    # Solution
    
    Remove the extra `#[automatically_derived]`.
    wackbyte authored Jan 17, 2024
    Configuration menu
    Copy the full SHA
    43f83d5 View commit details
    Browse the repository at this point in the history
  4. fix occasional crash moving ui root nodes (bevyengine#11371)

    # Objective
    
    fix an occasional crash when moving ui root nodes between cameras.
    
    occasionally, updating the TargetCamera of a ui element and then
    removing the element causes a crash.
    
    i believe that is because when we assign a child in taffy, the old
    parent doesn't remove that child from it's children, so we have:
    
    ```
    user: create root node N1, camera A
    -> layout::set_camera_children(A) : 
    	- create implicit node A1
    	- assign 1 as child -> taffy.children[A1] = [N1], taffy.parents[1] = A1
    
    user: move root node N1 to camera B
    -> layout::set_camera_children(B) :
    	- create implicit node B1
    	- assign 1 as child -> taffy.children[A1] = [N1], taffy.children[B1] = [N1], taffy.parents[1] = B1
    -> layout::set_camera_children(A) :
    	- remove implicit node A1 (which still has N1 as a child) -> 
    		-> taffy sets parent[N1] = None ***
    		-> taffy.children[B1] = [N1], taffy.parents[1] = None
    
    user: remove N1
    -> layout::remove_entities(N1)
    	- since parent[N1] is None, it's not removed from B1 -> taffy.children[B1] = [N1], taffy.parents[1] is removed
    -> layout::set_camera_children(B)
    	- remove implicit node B1
    	- taffy crash accessing taffy.parents[N1]
    ```
    
    ## Solution
    
    we can work around this by making sure to remove the child from the old
    parent if one exists (this pr).
    
    i think a better fix may be for taffy to check in `Taffy::remove` and
    only set the child's parent to None if it is currently equal to the node
    being removed but i'm not sure if there's an explicit assumption we're
    violating here (@nicoburns).
    robtfm authored Jan 17, 2024
    Configuration menu
    Copy the full SHA
    30940e5 View commit details
    Browse the repository at this point in the history
  5. [doc] Fix typo and formatting in CONTRIBUTING.md (bevyengine#11381)

    # Objective
    
    Issue: There is a typo in `CONTRIBUTING.md` ("then" used in place of
    "them"). There is also an inconsistency of usage of periods at ends of
    items in lists, and one section is written with non-breaking spaces
    without good reason.
    
    ## Solution
    
    Fix the aforementioned typo and consistency issues.
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    Co-authored-by: Rob Parrett <robparrett@gmail.com>
    3 people authored Jan 17, 2024
    Configuration menu
    Copy the full SHA
    8db4723 View commit details
    Browse the repository at this point in the history
  6. Restore brightness in the remaining three examples after exposure PR (b…

    …evyengine#11389)
    
    # Objective
    
    Fixes bevyengine#11376
    During the development of the exposure settings PR (bevyengine#11347) all examples
    with lighting had to be adjusted, but three were missed or simply didn't
    exist yet at the time. This PR restores the brightness in those examples
    again:
    
    render_ui_to_texture
    asset_loading
    hot_asset_reloading
    
    All of them are a bit brighter now compared to before the exposure PR,
    but it looks better IMO.
    GitGhillie authored Jan 17, 2024
    Configuration menu
    Copy the full SHA
    9abf565 View commit details
    Browse the repository at this point in the history
  7. Added AssetLoadFailedEvent, UntypedAssetLoadFailedEvent (bevyengine#1…

    …1369)
    
    # Objective
    
    This adds events for assets that fail to load along with minor utility
    methods to make them useful. This paves the way for users writing their
    own error handling and retry systems, plus Bevy including robust retry
    handling: bevyengine#11349.
    
    * Addresses bevyengine#11288
    * Needed for bevyengine#11349
    
    # Solution
    
    ```rust
    /// An event emitted when a specific [`Asset`] fails to load.
    #[derive(Event, Clone, Debug)]
    pub struct AssetLoadFailedEvent<A: Asset> {
        pub id: AssetId<A>,
        /// The original handle returned when the asset load was requested.
        pub handle: Option<Handle<A>>,
        /// The asset path that was attempted.
        pub path: AssetPath<'static>,
        /// Why the asset failed to load.
        pub error: AssetLoadError,
    }
    ```
    
    I started implementing `AssetEvent::Failed` like suggested in bevyengine#11288,
    but decided it was better as its own type because:
    
    * I think it makes sense for `AssetEvent` to only refer to assets that
    actually exist.
    * In order to return `AssetLoadError` in the event (which is useful
    information for error handlers that might attempt a retry) we would have
    to remove `Copy` from `AssetEvent`.
    * There are numerous places in the render app that match against
    `AssetEvent`, and I don't think it's worth introducing extra noise about
    assets that don't exist.
    
    I also introduced `UntypedAssetLoadErrorEvent`, which is very useful in
    places that need to support type flexibility, like an Asset-agnostic
    retry plugin.
    
    # Changelog
    
    * **Added:** `AssetLoadFailedEvent<A>`
    * **Added**: `UntypedAssetLoadFailedEvent`
    * **Added:** `AssetReaderError::Http` for status code information on
    HTTP errors. Before this, status codes were only available by parsing
    the error message of generic `Io` errors.
    * **Added:** `asset_server.get_path_id(path)`. This method simply gets
    the asset id for the path. Without this, one was left using
    `get_path_handle(path)`, which has the overhead of returning a strong
    handle.
    * **Fixed**: Made `AssetServer` loads return the same handle for assets
    that already exist in a failed state. Now, when you attempt a `load`
    that's in a `LoadState::Failed` state, it'll re-use the original asset
    id. The advantage of this is that any dependent assets created using the
    original handle will "unbreak" if a retry succeeds.
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    brianreavis and alice-i-cecile authored Jan 17, 2024
    Configuration menu
    Copy the full SHA
    c9e1fcd View commit details
    Browse the repository at this point in the history

Commits on Jan 18, 2024

  1. Multiple Configurations for Gizmos (bevyengine#10342)

    # Objective
    
    This PR aims to implement multiple configs for gizmos as discussed in
    bevyengine#9187.
    
    ## Solution
    
    Configs for the new `GizmoConfigGroup`s are stored in a
    `GizmoConfigStore` resource and can be accesses using a type based key
    or iterated over. This type based key doubles as a standardized location
    where plugin authors can put their own configuration not covered by the
    standard `GizmoConfig` struct. For example the `AabbGizmoGroup` has a
    default color and toggle to show all AABBs. New configs can be
    registered using `app.init_gizmo_group::<T>()` during startup.
    
    When requesting the `Gizmos<T>` system parameter the generic type
    determines which config is used. The config structs are available
    through the `Gizmos` system parameter allowing for easy access while
    drawing your gizmos.
    
    Internally, resources and systems used for rendering (up to an including
    the extract system) are generic over the type based key and inserted on
    registering a new config.
    
    ## Alternatives
    
    The configs could be stored as components on entities with markers which
    would make better use of the ECS. I also implemented this approach
    ([here](https://github.com/jeliag/bevy/tree/gizmo-multiconf-comp)) and
    believe that the ergonomic benefits of a central config store outweigh
    the decreased use of the ECS.
    
    ## Unsafe Code
    
    Implementing system parameter by hand is unsafe but seems to be required
    to access the config store once and not on every gizmo draw function
    call. This is critical for performance. ~Is there a better way to do
    this?~
    
    ## Future Work
    
    New gizmos (such as bevyengine#10038, and ideas from bevyengine#9400) will require custom
    configuration structs. Should there be a new custom config for every
    gizmo type, or should we group them together in a common configuration?
    (for example `EditorGizmoConfig`, or something more fine-grained)
    
    ## Changelog
    
    - Added `GizmoConfigStore` resource and `GizmoConfigGroup` trait
    - Added `init_gizmo_group` to `App`
    - Added early returns to gizmo drawing increasing performance when
    gizmos are disabled
    - Changed `GizmoConfig` and aabb gizmos to use new `GizmoConfigStore`
    - Changed `Gizmos` system parameter to use type based key to retrieve
    config
    - Changed resources and systems used for gizmo rendering to be generic
    over type based key
    - Changed examples (3d_gizmos, 2d_gizmos) to showcase new API
    
    ## Migration Guide
    
    - `GizmoConfig` is no longer a resource and has to be accessed through
    `GizmoConfigStore` resource. The default config group is
    `DefaultGizmoGroup`, but consider using your own custom config group if
    applicable.
    
    ---------
    
    Co-authored-by: Nicola Papale <nicopap@users.noreply.github.com>
    jeliag and nicopap authored Jan 18, 2024
    Configuration menu
    Copy the full SHA
    f6b40a6 View commit details
    Browse the repository at this point in the history
  2. Implement bounding volumes for primitive shapes (bevyengine#11336)

    # Objective
    
    Closes bevyengine#10570.
    
    bevyengine#10946 added bounding volume types and traits, but didn't use them for
    anything yet. This PR implements `Bounded2d` and `Bounded3d` for Bevy's
    primitive shapes.
    
    ## Solution
    
    Implement `Bounded2d` and `Bounded3d` for primitive shapes. This allows
    computing AABBs and bounding circles/spheres for them.
    
    For most shapes, there are several ways of implementing bounding
    volumes. I took inspiration from [Parry's bounding
    volumes](https://github.com/dimforge/parry/tree/master/src/bounding_volume),
    [Inigo Quilez](http://iquilezles.org/articles/diskbbox/), and figured
    out the rest myself using geometry. I tried to comment all slightly
    non-trivial or unclear math to make it understandable.
    
    Parry uses support mapping (finding the farthest point in some direction
    for convex shapes) for some AABBs like cones, cylinders, and line
    segments. This involves several quat operations and normalizations, so I
    opted for the simpler and more efficient geometric approaches shown in
    [Quilez's article](http://iquilezles.org/articles/diskbbox/).
    
    Below you can see some of the bounding volumes working in 2D and 3D.
    Note that I can't conveniently add these examples yet because they use
    primitive shape meshing, which is still WIP.
    
    
    https://github.com/bevyengine/bevy/assets/57632562/4465cbc6-285b-4c71-b62d-a2b3ee16f8b4
    
    
    https://github.com/bevyengine/bevy/assets/57632562/94b4ac84-a092-46d7-b438-ce2e971496a4
    
    ---
    
    ## Changelog
    
    - Implemented `Bounded2d`/`Bounded3d` for primitive shapes
    - Added `from_point_cloud` method for bounding volumes (used by many
    bounding implementations)
    - Added `point_cloud_2d/3d_center` and `rotate_vec2` utility functions
    - Added `RegularPolygon::vertices` method (used in regular polygon AABB
    construction)
    - Added `Triangle::circumcenter` method (used in triangle bounding
    circle construction)
    - Added bounding circle/sphere creation from AABBs and vice versa
    
    ## Extra
    
    Do we want to implement `Bounded2d` for some "3D-ish" shapes too? For
    example, capsules are sort of dimension-agnostic and useful for 2D, so I
    think that would be good to implement. But a cylinder in 2D is just a
    rectangle, and a cone is a triangle, so they wouldn't make as much sense
    to me. A conical frustum would be an isosceles trapezoid, which could be
    useful, but I'm not sure if computing the 2D AABB of a 3D frustum makes
    semantic sense.
    Jondolf authored Jan 18, 2024
    Configuration menu
    Copy the full SHA
    c62ad4b View commit details
    Browse the repository at this point in the history
  3. Get Change Tick methods for Resources (bevyengine#11404)

    # Objective
    
    - Add methods to get Change Ticks for a given resource by type or
    ComponentId
    - Fixes bevyengine#11390
    The `is_resource_id_changed` requested in the Issue already exists, this
    adds their request for `get_resource_change_ticks`
    
    ## Solution
    
    - Added two methods to get change ticks by Type or ComponentId
    TheTacBanana authored Jan 18, 2024
    Configuration menu
    Copy the full SHA
    d151883 View commit details
    Browse the repository at this point in the history
  4. Use static_assertions to check for trait impls (bevyengine#11407)

    # Objective
    
    - Tests are manually checking whether derived types implement certain
    traits. (Specifically in `bevy_reflect.)
    - bevyengine#11182 introduces
    [`static_assertions`](https://docs.rs/static_assertions/) to
    automatically check this.
    - Simplifies `Reflect` test in bevyengine#11195.
    - Closes bevyengine#11196.
    
    ## Solution
    
    - Add `static_assertions` and replace current tests.
    
    ---
    
    I wasn't sure whether to remove the existing test or not. What do you
    think?
    BD103 authored Jan 18, 2024
    Configuration menu
    Copy the full SHA
    056b006 View commit details
    Browse the repository at this point in the history
  5. Fix panic on Text UI without Cameras (bevyengine#11405)

    # Objective
    
    Fix bevyengine#11396.
    
    ## Solution
    
    Don't panic on taffy node not existing.
    
    Plus minor warning text improvement.
    doonv authored Jan 18, 2024
    Configuration menu
    Copy the full SHA
    03ee959 View commit details
    Browse the repository at this point in the history
  6. Customizable camera main texture usage (bevyengine#11412)

    # Objective
    
    - Some users want to change the default texture usage of the main camera
    but they are currently hardcoded
    
    ## Solution
    
    - Add a component that is used to configure the main texture usage field
    
    ---
    
    ## Changelog
    
    Added `CameraMainTextureUsage`
    Added `CameraMainTextureUsage` to `Camera3dBundle` and `Camera2dBundle`
    
    ## Migration Guide
    
    Add `main_texture_usages: Default::default()` to your camera bundle.
    
    # Notes
    
    Inspired by: bevyengine#6815
    IceSentry authored Jan 18, 2024
    Configuration menu
    Copy the full SHA
    7125dcb View commit details
    Browse the repository at this point in the history

Commits on Jan 19, 2024

  1. Miri is failing on latest nightly: pin nightly to last known working …

    …version (bevyengine#11421)
    
    # Objective
    
    - rust-lang/rust#118553 seems to have broken
    miri test
    
    ## Solution
    
    - Pin nightly to before it was merged
    mockersf authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    cd2cdb4 View commit details
    Browse the repository at this point in the history
  2. Fix gizmos app new panic (bevyengine#11420)

    # Objective
    
    After the Gizmos changes, `App::init_gizmos_group` turned into a
    important function that for sure mustn't panic. The problem is: the
    actual implementation causes a panic if somehow the code is runned
    before `GizmoPlugin` was added to the App
    - The error occurs here for example:
    ```rust
    fn main() {
        App::new()
            .init_gizmo_group::<MyGizmoConfig>()
            .add_plugins(DefaultPlugins)
            .run();
    }
    
    #[derive(Default, Reflect, GizmoConfigGroup)]
    struct MyGizmoConfig;
    ```
    
    ![image](https://github.com/bevyengine/bevy/assets/126117294/35e75608-0946-4320-8035-00a82562e37e)
    
    
    ## Solution
    
    - Instead of panicking when getting `GizmoConfigStore`, insert the store
    in `App::init_gizmos_group` if needed
    
    ---
    
    ## Changelog
    
    ### Changed
    - Changed App::init_gizmos_group to insert the resource if it don't
    exist
    
    ### Removed
    - Removed explicit init of `GizmoConfigStore`
    
    ---------
    
    Co-authored-by: François <mockersf@gmail.com>
    pablo-lua and mockersf authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    6fbd585 View commit details
    Browse the repository at this point in the history
  3. move once from bevy_log to bevy_utils, to allow for it's use in bevy_…

    …ecs (bevyengine#11419)
    
    # Objective
    
    When working within `bevy_ecs`, we can't use the `log_once` macros due
    to their placement in `bevy_log` - which depends on `bevy_ecs`. All this
    create does is migrate those macros to the `bevy_utils` crate, while
    still re-exporting them in `bevy_log`.
    
    created to resolve this:
    bevyengine#11417 (comment)
    
    ---------
    
    Co-authored-by: François <mockersf@gmail.com>
    lee-orr and mockersf authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    e9b8c71 View commit details
    Browse the repository at this point in the history
  4. Cleanup deterministic example (bevyengine#11416)

    # Objective
    
    - Example `deterministic` crashes on CI on Windows because it uses too
    much memory
    
    ## Solution
    
    - Reduce the number of planes displayed while still having the issue
    - While there, add a small margin to the text so that it's prettier
    mockersf authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    a00c71e View commit details
    Browse the repository at this point in the history
  5. Winit update: fix suspend on Android (bevyengine#11403)

    # Objective
    
    - Android still plays audio when suspended
    
    ## Solution
    
    - When status is `WillSuspend`, trigger an update without requesting a
    redraw
    mockersf authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    f795656 View commit details
    Browse the repository at this point in the history
  6. Implement minimal reflection probes (fixed macOS, iOS, and Android). (b…

    …evyengine#11366)
    
    This pull request re-submits bevyengine#10057, which was backed out for breaking
    macOS, iOS, and Android. I've tested this version on macOS and Android
    and on the iOS simulator.
    
    # Objective
    
    This pull request implements *reflection probes*, which generalize
    environment maps to allow for multiple environment maps in the same
    scene, each of which has an axis-aligned bounding box. This is a
    standard feature of physically-based renderers and was inspired by [the
    corresponding feature in Blender's Eevee renderer].
    
    ## Solution
    
    This is a minimal implementation of reflection probes that allows
    artists to define cuboid bounding regions associated with environment
    maps. For every view, on every frame, a system builds up a list of the
    nearest 4 reflection probes that are within the view's frustum and
    supplies that list to the shader. The PBR fragment shader searches
    through the list, finds the first containing reflection probe, and uses
    it for indirect lighting, falling back to the view's environment map if
    none is found. Both forward and deferred renderers are fully supported.
    
    A reflection probe is an entity with a pair of components, *LightProbe*
    and *EnvironmentMapLight* (as well as the standard *SpatialBundle*, to
    position it in the world). The *LightProbe* component (along with the
    *Transform*) defines the bounding region, while the
    *EnvironmentMapLight* component specifies the associated diffuse and
    specular cubemaps.
    
    A frequent question is "why two components instead of just one?" The
    advantages of this setup are:
    
    1. It's readily extensible to other types of light probes, in particular
    *irradiance volumes* (also known as ambient cubes or voxel global
    illumination), which use the same approach of bounding cuboids. With a
    single component that applies to both reflection probes and irradiance
    volumes, we can share the logic that implements falloff and blending
    between multiple light probes between both of those features.
    
    2. It reduces duplication between the existing *EnvironmentMapLight* and
    these new reflection probes. Systems can treat environment maps attached
    to cameras the same way they treat environment maps applied to
    reflection probes if they wish.
    
    Internally, we gather up all environment maps in the scene and place
    them in a cubemap array. At present, this means that all environment
    maps must have the same size, mipmap count, and texture format. A
    warning is emitted if this restriction is violated. We could potentially
    relax this in the future as part of the automatic mipmap generation
    work, which could easily do texture format conversion as part of its
    preprocessing.
    
    An easy way to generate reflection probe cubemaps is to bake them in
    Blender and use the `export-blender-gi` tool that's part of the
    [`bevy-baked-gi`] project. This tool takes a `.blend` file containing
    baked cubemaps as input and exports cubemap images, pre-filtered with an
    embedded fork of the [glTF IBL Sampler], alongside a corresponding
    `.scn.ron` file that the scene spawner can use to recreate the
    reflection probes.
    
    Note that this is intentionally a minimal implementation, to aid
    reviewability. Known issues are:
    
    * Reflection probes are basically unsupported on WebGL 2, because WebGL
    2 has no cubemap arrays. (Strictly speaking, you can have precisely one
    reflection probe in the scene if you have no other cubemaps anywhere,
    but this isn't very useful.)
    
    * Reflection probes have no falloff, so reflections will abruptly change
    when objects move from one bounding region to another.
    
    * As mentioned before, all cubemaps in the world of a given type
    (diffuse or specular) must have the same size, format, and mipmap count.
    
    Future work includes:
    
    * Blending between multiple reflection probes.
    
    * A falloff/fade-out region so that reflected objects disappear
    gradually instead of vanishing all at once.
    
    * Irradiance volumes for voxel-based global illumination. This should
    reuse much of the reflection probe logic, as they're both GI techniques
    based on cuboid bounding regions.
    
    * Support for WebGL 2, by breaking batches when reflection probes are
    used.
    
    These issues notwithstanding, I think it's best to land this with
    roughly the current set of functionality, because this patch is useful
    as is and adding everything above would make the pull request
    significantly larger and harder to review.
    
    ---
    
    ## Changelog
    
    ### Added
    
    * A new *LightProbe* component is available that specifies a bounding
    region that an *EnvironmentMapLight* applies to. The combination of a
    *LightProbe* and an *EnvironmentMapLight* offers *reflection probe*
    functionality similar to that available in other engines.
    
    [the corresponding feature in Blender's Eevee renderer]:
    https://docs.blender.org/manual/en/latest/render/eevee/light_probes/reflection_cubemaps.html
    
    [`bevy-baked-gi`]: https://github.com/pcwalton/bevy-baked-gi
    
    [glTF IBL Sampler]: https://github.com/KhronosGroup/glTF-IBL-Sampler
    pcwalton authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    83d6600 View commit details
    Browse the repository at this point in the history
  7. Add ReflectFromWorld and replace the FromWorld requirement on `Re…

    …flectComponent` and `ReflectBundle` with `FromReflect` (bevyengine#9623)
    
    # Objective
    
    - `FromType<T>` for `ReflectComponent` and `ReflectBundle` currently
    require `T: FromWorld` for two reasons:
        - they include a `from_world` method;
    - they create dummy `T`s using `FromWorld` and then `apply` a `&dyn
    Reflect` to it to simulate `FromReflect`.
    - However `FromWorld`/`Default` may be difficult/weird/impractical to
    implement, while `FromReflect` is easier and also more natural for the
    job.
    - See also
    https://discord.com/channels/691052431525675048/1146022009554337792
    
    ## Solution
    
    - Split `from_world` from `ReflectComponent` and `ReflectBundle` into
    its own `ReflectFromWorld` struct.
    - Replace the requirement on `FromWorld` in `ReflectComponent` and
    `ReflectBundle` with `FromReflect`
    
    ---
    
    ## Changelog
    
    - `ReflectComponent` and `ReflectBundle` no longer offer a `from_world`
    method.
    - `ReflectComponent` and `ReflectBundle`'s `FromType<T>` implementation
    no longer requires `T: FromWorld`, but now requires `FromReflect`.
    - `ReflectComponent::insert`, `ReflectComponent::apply_or_insert` and
    `ReflectComponent::copy` now take an extra `&TypeRegistry` parameter.
    - There is now a new `ReflectFromWorld` struct.
    
    ## Migration Guide
    
    - Existing uses of `ReflectComponent::from_world` and
    `ReflectBundle::from_world` will have to be changed to
    `ReflectFromWorld::from_world`.
    - Users of `#[reflect(Component)]` and `#[reflect(Bundle)]` will need to
    also implement/derive `FromReflect`.
    - Users of `#[reflect(Component)]` and `#[reflect(Bundle)]` may now want
    to also add `FromWorld` to the list of reflected traits in case their
    `FromReflect` implementation may fail.
    - Users of `ReflectComponent` will now need to pass a `&TypeRegistry` to
    its `insert`, `apply_or_insert` and `copy` methods.
    SkiFire13 authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    eff96e2 View commit details
    Browse the repository at this point in the history
  8. Optional state (bevyengine#11417)

    # Objective
    
    Adjust bevy internals to utilize `Option<Res<State<S>>>` instead of
    `Res<State<S>>`, to allow for adding/removing states at runtime and
    avoid unexpected panics.
    
    As requested here:
    bevyengine#10088 (comment)
    
    ---
    
    ## Changelog
    
    - Changed the use of `world.resource`/`world.resource_mut` to
    `world.get_resource`/`world.get_resource_mut` in the
    `run_enter_schedule` and `apply_state_transition` systems and handled
    the `None` option.
    - `in_state` now returns a ` FnMut(Option<Res<State<S>>>) -> bool +
    Clone`, returning `false` if the resource doesn't exist.
    - `state_exists_and_equals` was marked as deprecated, and now just runs
    and returns `in_state`, since their bevhaviour is now identical
    - `state_changed` now takes an `Option<Res<State<S>>>` and returns
    `false` if it does not exist.
    
    I would like to remove `state_exists_and_equals` fully, but wanted to
    ensure that is acceptable before doing so.
    
    ---------
    
    Co-authored-by: Mike <mike.hsu@gmail.com>
    lee-orr and hymm authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    63eb151 View commit details
    Browse the repository at this point in the history

Commits on Jan 20, 2024

  1. Bump dev-docs pages actions (bevyengine#11418)

    # Objective
    
    - `actions/upload-pages-artifact` and `actions/deploy-pages` are
    outdated.
    - Alternative to bevyengine#11253 and bevyengine#11252.
    
    ## Solution
    
    - Bump the version of both actions.
    
    ---
    
    
    There appear to be no user-facing changes. They just both need to be
    updated together. (The `actions: read` permission was a bug that was
    fixed later.)
    BD103 authored Jan 20, 2024
    Configuration menu
    Copy the full SHA
    11e4386 View commit details
    Browse the repository at this point in the history
  2. optimize batch_and_prepare_render_phase (bevyengine#11323)

    # Objective
    
    - since bevyengine#9685  ,bevy introduce automatic batching of draw commands, 
    - `batch_and_prepare_render_phase` take the responsibility for batching
    `phaseItem`,
    - `GetBatchData` trait is used for indentify each phaseitem how to
    batch. it defines a associated type `Data `used for Query to fetch data
    from world.
    
    - however,the impl of `GetBatchData ` in bevy always set ` type
    Data=Entity` then we acually get following code
    `let entity:Entity =query.get(item.entity())` that cause unnecessary
    overhead .
    
    ## Solution
    
    - remove associated type `Data ` and `Filter` from `GetBatchData `,
    - change the type of the `query_item ` parameter in get_batch_data from`
    Self::Data` to `Entity`.
    - `batch_and_prepare_render_phase ` no longer takes a query using
    `F::Data, F::Filter`
    - `get_batch_data `now returns `Option<(Self::BufferData,
    Option<Self::CompareData>)>`
    
    ---
    
    ## Performance
    based in main merged with bevyengine#11290 
    Window 11 ,Intel 13400kf, NV 4070Ti
    
    ![image](https://github.com/bevyengine/bevy/assets/45868716/f63b9d98-6aee-4057-a2c7-a2162b2db765)
    frame time from 3.34ms to 3 ms,  ~ 10%
    
    
    ![image](https://github.com/bevyengine/bevy/assets/45868716/a06eea9c-f79e-4324-8392-8d321560c5ba)
    `batch_and_prepare_render_phase` from 800us ~ 400 us  
    
    ## Migration Guide
    trait `GetBatchData` no longer hold associated type  `Data `and `Filter`
    `get_batch_data` `query_item `type from `Self::Data` to `Entity` and
    return `Option<(Self::BufferData, Option<Self::CompareData>)>`
    `batch_and_prepare_render_phase`  should not have a query
    re0312 authored Jan 20, 2024
    Configuration menu
    Copy the full SHA
    04aedf1 View commit details
    Browse the repository at this point in the history
  3. Replace DiagnosticId by DiagnosticPath (bevyengine#9266)

    # Objective
    
    Implements bevyengine#9216 
    
    ## Solution
    
    - Replace `DiagnosticId` by `DiagnosticPath`. It's pre-hashed using
    `const-fnv1a-hash` crate, so it's possible to create path in const
    contexts.
    
    ---
    
    ## Changelog
    
    - Replaced `DiagnosticId` by `DiagnosticPath`
    - Set default history length to 120 measurements (2 seconds on 60 fps).
    
    I've noticed hardcoded constant 20 everywhere and decided to change it
    to `DEFAULT_MAX_HISTORY_LENGTH` , which is set to new diagnostics by
    default. To override it, use `with_max_history_length`.
    
    
    ## Migration Guide
    
    ```diff
    - const UNIQUE_DIAG_ID: DiagnosticId = DiagnosticId::from_u128(42);
    + const UNIQUE_DIAG_PATH: DiagnosticPath = DiagnosticPath::const_new("foo/bar");
    
    - Diagnostic::new(UNIQUE_DIAG_ID, "example", 10)
    + Diagnostic::new(UNIQUE_DIAG_PATH).with_max_history_length(10)
    
    - diagnostics.add_measurement(UNIQUE_DIAG_ID, || 42);
    + diagnostics.add_measurement(&UNIQUE_DIAG_ID, || 42);
    ```
    LeshaInc authored Jan 20, 2024
    Configuration menu
    Copy the full SHA
    320ac65 View commit details
    Browse the repository at this point in the history
  4. Improve Rectangle and Cuboid consistency (bevyengine#11434)

    # Objective
    
    The `Rectangle` and `Cuboid` primitives currently use different
    representations:
    
    ```rust
    pub struct Rectangle {
        /// The half width of the rectangle
        pub half_width: f32,
        /// The half height of the rectangle
        pub half_height: f32,
    }
    
    pub struct Cuboid {
        /// Half of the width, height and depth of the cuboid
        pub half_extents: Vec3,
    }
    ```
    
    The property names and helpers are also inconsistent. `Cuboid` has
    `half_extents`, but it also has a method called `from_size`. Most
    existing code also uses "size" instead of "extents".
    
    ## Solution
    
    Represent both `Rectangle` and `Cuboid` with `half_size` properties.
    Jondolf authored Jan 20, 2024
    Configuration menu
    Copy the full SHA
    6337fb3 View commit details
    Browse the repository at this point in the history
  5. Change Ellipse representation and improve helpers (bevyengine#11435)

    # Objective
    
    Currently, the `Ellipse` primitive is represented by a `half_width` and
    `half_height`. To improve consistency (similarly to bevyengine#11434), it might
    make more sense to use a `Vec2` `half_size` instead.
    
    Alternatively, to make the elliptical nature clearer, the properties
    could also be called `radius_x` and `radius_y`.
    
    Secondly, `Ellipse::new` currently takes a *full* width and height
    instead of two radii. I would expect it to take the half-width and
    half-height because ellipses and circles are almost always defined using
    radii. I wouldn't expect `Circle::new` to take a diameter (if we had
    that method).
    
    ## Solution
    
    Change `Ellipse` to store a `half_size` and `new` to take the half-width
    and half-height.
    
    I also added a `from_size` method similar to `Rectangle::from_size`, and
    added the `semi_minor` and `semi_major` helpers to get the
    semi-minor/major radius.
    Jondolf authored Jan 20, 2024
    Configuration menu
    Copy the full SHA
    b592a72 View commit details
    Browse the repository at this point in the history
  6. add a required feature for shader_material_glsl (bevyengine#11440)

    # Objective
    
    - Since bevyengine#11366, feature `glsl` of
    `naga_oil` is not enabled by default
    - It is needed for example `shader_material_glsl`
    
    ```
    thread 'Compute Task Pool (0)' panicked at crates\bevy_render\src\render_resource\shader.rs:238:35:
    GLSL is not supported in this configuration; use the feature `shader_format_glsl`
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    Encountered a panic in system `bevy_render::render_resource::pipeline_cache::PipelineCache::process_pipeline_queue_system`!
    thread 'main' panicked at crates\bevy_render\src\pipelined_rendering.rs:145:45:
    called `Result::unwrap()` on an `Err` value: RecvError
    ```
    
    ## Solution
    
    - Add feature `shader_format_glsl` as a required feature for example
    `shader_material_glsl`
    mockersf authored Jan 20, 2024
    Configuration menu
    Copy the full SHA
    440bba8 View commit details
    Browse the repository at this point in the history
  7. Add Aabb2d::new and Aabb3d::new constructors (bevyengine#11433)

    # Objective
    
    Currently, the only way to create an AABB is to specify its `min` and
    `max` coordinates. However, it's often more useful to use the center and
    half-size instead.
    
    ## Solution
    
    Add `new` constructors for `Aabb2d` and `Aabb3d`.
    
    This:
    
    ```rust
    let aabb = Aabb3d {
        min: center - half_size,
        max: center + half_size,
    }
    ```
    
    becomes this:
    
    ```rust
    let aabb = Aabb3d::new(center, half_size);
    ```
    
    I also made the usage of "half-extents" vs. "half-size" a bit more
    consistent.
    Jondolf authored Jan 20, 2024
    Configuration menu
    Copy the full SHA
    c31f3aa View commit details
    Browse the repository at this point in the history
  8. Add geometric primitives to bevy_math::prelude (bevyengine#11432)

    # Objective
    
    Currently, the `primitives` module is inside of the prelude for
    `bevy_math`, but the actual primitives are not. This requires either
    importing the shapes everywhere that uses them, or adding the
    `primitives::` prefix:
    
    ```rust
    let rectangle = meshes.add(primitives::Rectangle::new(5.0, 2.5));
    ```
    
    (Note: meshing isn't actually implemented yet, but it's in bevyengine#11431)
    
    The primitives are meant to be used for a variety of tasks across
    several crates, like for meshing, bounding volumes, gizmos, colliders,
    and so on, so I think having them in the prelude is justified. It would
    make several common tasks a lot more ergonomic.
    
    ```rust
    let rectangle = meshes.add(Rectangle::new(5.0, 2.5));
    ```
    
    ## Solution
    
    Add `primitives::*` to `bevy_math::prelude`.
    
    ---------
    
    Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
    Jondolf and alice-i-cecile authored Jan 20, 2024
    Configuration menu
    Copy the full SHA
    c6f4583 View commit details
    Browse the repository at this point in the history
  9. Direction: Rename from_normalized to new_unchecked (bevyengine#11425

    )
    
    # Objective
    
    `Direction2d::from_normalized` & `Direction3d::from_normalized` don't
    emphasize that importance of the vector being normalized enough.
    
    ## Solution
    
    Rename `from_normalized` to `new_unchecked` and add more documentation.
    
    ---
    
    `Direction2d` and `Direction3d` were added somewhat recently in
    bevyengine#10466 (after 0.12), so I don't
    think documenting the changelog and migration guide is necessary (Since
    there is no major previous version to migrate from).
    
    But here it is anyway in case it's needed:
    
    ## Changelog
    
    - Renamed `Direction2d::from_normalized` and
    `Direction3d::from_normalized` to `new_unchecked`.
    
    ## Migration Guide
    
    - Renamed `Direction2d::from_normalized` and
    `Direction3d::from_normalized` to `new_unchecked`.
    
    ---------
    
    Co-authored-by: Tristan Guichaoua <33934311+tguichaoua@users.noreply.github.com>
    Co-authored-by: Joona Aalto <jondolf.dev@gmail.com>
    3 people authored Jan 20, 2024
    Configuration menu
    Copy the full SHA
    0387331 View commit details
    Browse the repository at this point in the history

Commits on Jan 21, 2024

  1. auto create imported asset folder if needed (bevyengine#11284)

    # Objective
    
    - Since bevyengine#11218, example `asset_processing` fails:
    ```
    thread 'main' panicked at crates/bevy_asset/src/io/source.rs:489:18:
    Failed to create file watcher: Error { kind: PathNotFound, paths: ["examples/asset/processing/imported_assets/Default"] }
    ```
    
    start from a fresh git clone or delete the folder before running to
    reproduce, it is in gitignore and should not be present on a fresh run
    
    https://github.com/bevyengine/bevy/blob/a6574786757c0a0a7ddffb99fdc40ce90980fc82/.gitignore#L18
    
    ## Solution
    
    - Auto create the `imported_assets` folder if it is configured
    
    ---------
    
    Co-authored-by: Kyle <37520732+nvdaz@users.noreply.github.com>
    mockersf and nvdaz authored Jan 21, 2024
    Configuration menu
    Copy the full SHA
    259fb68 View commit details
    Browse the repository at this point in the history
  2. Use Direction3d for gizmos.circle normal (bevyengine#11422)

    # Objective
    
    Fix weird visuals when drawing a gizmo with a non-normed normal.
    
    Fixes bevyengine#11401
    
    ## Solution
    Just normalize right before we draw. Could do it when constructing the
    builder but that seems less consistent.
    
    ## Changelog
    - gizmos.circle normal is now a Direction3d instead of a Vec3.
    
    ## Migration Guide
    - Pass a Direction3d for gizmos.circle normal, eg.
    `Direction3d::new(vec).unwrap_or(default)` or potentially
    `Direction3d::new_unchecked(vec)` if you know your vec is definitely
    normalized.
    ArthurBrussee authored Jan 21, 2024
    Configuration menu
    Copy the full SHA
    ffb6faa View commit details
    Browse the repository at this point in the history
  3. Fix reflected serialization/deserialization on Name component (bevy…

    …engine#11447)
    
    # Objective
    
    - This PR makes it so that `ReflectSerialize` and `ReflectDeserialize`
    traits are properly derived on `Name`. This avoids having the internal
    hash “leak” into the serialization when using reflection.
    
    ## Solution
    
    - Added a conditional derive for `ReflectDeserialize` and
    `ReflectSerialize` via `#[cfg_attr()]`
    
    ---
    
    ## Changelog
    
    - `Name` now implements `ReflectDeserialize` and `ReflectSerialize`
    whenever the `serialize` feature is enabled.
    coreh authored Jan 21, 2024
    Configuration menu
    Copy the full SHA
    18833fa View commit details
    Browse the repository at this point in the history
  4. Fix wrong transmuted type in TaskPool::scope_with_executor_inner (b…

    …evyengine#11455)
    
    # Objective
    
    bevyengine#8219 changed the target type of a `transmute` without changing the one
    transmuting from ([see the relevant
    diff](bevyengine@55e9ab7#diff-11413fb2eeba97978379d325353d32aa76eefd0af0c8e9b50b7f394ddfda7a26R351-R355)),
    making them incompatible. This PR fixes this by changing the initial
    type to match the target one (modulo lifetimes).
    
    ## Solution
    
    Change the type to be transmuted from to match the one transmuting into
    (modulo lifetimes)
    SkiFire13 authored Jan 21, 2024
    Configuration menu
    Copy the full SHA
    0fa14c8 View commit details
    Browse the repository at this point in the history
  5. add storage_texture option to as_bind_group macro (bevyengine#9943)

    # Objective
    
    - Add the ability to describe storage texture bindings when deriving
    `AsBindGroup`.
    - This is especially valuable for the compute story of bevy which
    deserves some extra love imo.
    
    ## Solution
    
    - This add the ability to annotate struct fields with a
    `#[storage_texture(0)]` annotation.
    - Instead of adding specific option parsing for all the image formats
    and access modes, I simply accept a token stream and defer checking to
    see if the option is valid to the compiler. This still results in useful
    and friendly errors and is free to maintain and always compatible with
    wgpu changes.
    
    ---
    
    ## Changelog
    
    - The `#[storage_texture(..)]` annotation is now accepted for fields of
    `Handle<Image>` in structs that derive `AsBindGroup`.
    - The game_of_life compute shader example has been updated to use
    `AsBindGroup` together with `[storage_texture(..)]` to obtain the
    `BindGroupLayout`.
    
    ## Migration Guide
    HugoPeters1024 authored Jan 21, 2024
    Configuration menu
    Copy the full SHA
    8afb3ce View commit details
    Browse the repository at this point in the history

Commits on Jan 22, 2024

  1. Configuration menu
    Copy the full SHA
    7fee38a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    723c2f8 View commit details
    Browse the repository at this point in the history
  3. Fix example

    atlv24 committed Jan 22, 2024
    Configuration menu
    Copy the full SHA
    3cfe5ea View commit details
    Browse the repository at this point in the history
  4. Fix example againg

    atlv24 committed Jan 22, 2024
    Configuration menu
    Copy the full SHA
    1410816 View commit details
    Browse the repository at this point in the history