Commit Graph

3 Commits

Author SHA1 Message Date
Gonçalo Rica Pais da Silva f255b8e57a Upgrade glam, hexasphere, rand & uuid to latest versions (#22928)
# Objective

- `glam`, `hexasphere` & `rand` have released their latest versions,
update Bevy to support them.

## Solution

- The above have been updated to their compatible versions. `rand_distr`
updated as well to match `rand` v0.10 support.
- `rand_chacha` is soft deprecated and no longer used by `rand`, so its
usage has been changed to `chacha20` to match `rand` dep tree.
- `uuid` is in the process of updating to `getrandom` v0.4, which `rand`
v0.10 supports. This PR remains in draft until a new `uuid` release hits
crates.io.
- `RngCore` is now `Rng`, and `Rng` is now `RngExt`, so this required
updating across many files.
- `choose_multiple` method is deprecated, changed to `sample`.

## Testing

- Chase all compiler errors, since this should not regress any already
existing behaviour.
- This must pass CI without regressions.

## Additional Notes

`getrandom` v0.4 doesn't add anything new for Web WASM support, so the
same `wasm_js` feature is used.
2026-02-19 22:17:25 +00:00
Aevyrie a88af65738 Contact Shadows (#22382)
# Objective

- Implement contact shadows to add fine shadow detail where shadow
cascades cannot.

## Solution

- Extend our existing pbr implementation using our existing raymarching
functions.

---

## Showcase

<img width="1824" height="1180" alt="image"
src="https://github.com/user-attachments/assets/e93b79c5-c596-4a9e-b94d-20bdde1d863b"
/>

<img width="1824" height="1180" alt="image"
src="https://github.com/user-attachments/assets/0fd7dffa-60b8-4b92-8fad-7f993d4d89dd"
/>


https://github.com/user-attachments/assets/e74b190d-9ae3-4aaf-97f0-b520930a0667


https://github.com/user-attachments/assets/e80ccb26-bbaa-4d25-a823-8ea12354c5b9


https://github.com/user-attachments/assets/b04f4b00-92bd-4a2f-b7dd-5157d8fbe0ab

<img width="1073" height="685" alt="image"
src="https://github.com/user-attachments/assets/b7629908-dd32-48db-8ee7-a4d2dd8f66c2"
/>

<img width="1073" height="685" alt="image"
src="https://github.com/user-attachments/assets/3de0258e-9191-4180-ac57-41b32e1205bd"
/>

<img width="1073" height="685" alt="image"
src="https://github.com/user-attachments/assets/951477f9-e9a9-426f-ae8d-18ae50cc7b85"
/>

<img width="1073" height="685" alt="image"
src="https://github.com/user-attachments/assets/2291453c-da57-4fcc-a6b0-f60f6eac6cbb"
/>

<img width="1073" height="685" alt="image"
src="https://github.com/user-attachments/assets/5820cdff-ea54-4294-b520-2a8d8dc24996"
/>

<img width="1073" height="685" alt="image"
src="https://github.com/user-attachments/assets/3ea16481-7689-4e99-87e2-1589f1532e4c"
/>

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: charlotte 🌸 <charlotte.c.mcelwain@gmail.com>
2026-01-13 21:51:39 +00:00
syszery 1bd6f42719 Fix(examples): improve async examples to showcase good patterns (#21647)
# Objective

In #21598 and the related Discord discussion, it was pointed out that
the `async_compute` example promotes an inefficient and potentially
error-prone pattern: `future::block_on(poll_once)`.

It is now recommended to use `bevy::tasks::futures::check_ready`
instead, which is much cheaper and avoids blocking the main thread while
waiting on the future. Another valid approach is to pass a channel into
the async tasks and detach them, letting the channel handle task
readiness.

This PR implements both suggestions.


## Solution

* **Updated `async_compute` example**
Replaced the use of `future::block_on(poll_once)` with the recommended
`check_ready`.
  The change is minimal and limited to the directly affected lines.

* **Added new example: `async_channel_pattern`**
Demonstrates how to spawn async tasks using a channel-based
communication pattern.

* Each task is executed on a separate thread via `AsyncComputeTaskPool`.
* Results (cube positions) are sent back through a `CubeChannel` once
completed.
* Tasks are detached to run fully asynchronously, ensuring the main
thread remains unblocked.
* A rotating light in the scene visually indicates that the frame loop
remains responsive.



I am relatively new to both Bevy and async Rust, and I genuinely
appreciate any feedback or suggestions to improve these examples —
especially regarding idiomatic async patterns and best practices for
Bevy task management.

Fixes #21598

---------

Co-authored-by: syszery <syszery@users.noreply.github.com>
Co-authored-by: François Mockers <francois.mockers@vleue.com>
2025-10-28 22:35:21 +00:00