-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add http
& https
asset sources
#16366
base: main
Are you sure you want to change the base?
Conversation
It looks like |
It's possible to add an exception for the licenses, but unmaintained and vulnerable is pretty bad. |
This could be done with something like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep this looks awesome to me! Also I wasn't aware of the surf
crate; I'll have to keep it in mind for any bevy dashboards I make in the future
@mnmaita actually that would be great, I've replaced // crates/bevy_asset/src/http_source.rs#134
let client = reqwest_middleware::ClientBuilder::new(Client::new())
.with(Cache(HttpCache {
mode: CacheMode::Default,
manager: CACacheManager::default(),
options: HttpCacheOptions::default(),
}))
.build();
let response = ContinuousPoll(client.get(str_path).send())
.await |
FWIW surf has a bug where any erroring http response >8kb stops every subsequent request from succeeding and is unlikely to ever be fixed which made me unable to use bevy_web_asset so I would personally appreciate a switch 😄. If you can't get reqwest to work perhaps hyper would suffice since it's already in the dep tree for BRP? Perhaps too low level for this. |
The council of bevy async wizards has spoken and we're going with A few notes:
|
You added a new example but didn't add metadata for it. Please update the root Cargo.toml file. |
Tested on Windows 11. The example prints a 404 error when the .meta file fails to load and doesn't show the sprite. If I configure AssetPlugin to AssetMetaCheck::Never, it runs correctly. I believe the asset is still supposed to load successfully even if the .meta file 404s so I think this is a bug? |
You can ignore that. It isn't a required check. Once those 2 small issues above are fixed, this should be in a pretty good state, I think. |
The generated |
http
& https
asset sourceshttp
& https
asset sources
Ok I can confirm the example is working in wasm and native builds. I'm a bit uneasy merging without native http caching. One of the primary use-cases for the feature is large assets and the current implementation wil re-download them every time the app is run. Maybe a stupidly naive cache, ie one that never automatically invalidates, is better than nothing? In the long run it looks like a |
A simple native cache has been added and is ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a couple of concerns but overall looks good. I really want this so I appreciate you spearheading it!
You added a new feature but didn't update the readme. Please run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
http_source should be added a required feature for the example but otherwise looks good to me
…vyengine#17592) This reverts commit ae52222. # Objective Fixes bevyengine#16856 ## Solution Remove rounding from `OrthographicProjection::update`, which was causing the center of the orthographic projection to be off center. ## Testing Ran the examples mentioned on bevyengine#16856 and code from bevyengine#16773 ## Showcase `orthographic` example ![image](https://github.com/user-attachments/assets/d3bb1480-5908-4427-b1f2-af8a5c411745) `projection_zoom` example ![image](https://github.com/user-attachments/assets/e560c81b-db8f-44f0-91f4-d6bae3ae7f32) `camera_sub_view` example ![image](https://github.com/user-attachments/assets/615e9eb8-f4e5-406a-b98a-501f7d652145) `custom_primitives` example ![image](https://github.com/user-attachments/assets/8fd7702e-07e7-47e3-9510-e247d268a3e7) bevyengine#16773 code ![image](https://github.com/user-attachments/assets/1b759e90-6c53-4279-987e-284518db034b)
# Objective Expose accessor functions to the `ObserverDescriptor`, so that users can use the `Observer` component to inspect what the observer is watching. This would be useful for me, I don't think there's any reason to hide these.
# Objective We have default query filters now, but there is no first-party marker for entity disabling yet Fixes bevyengine#17458 ## Solution Add the marker, cool recursive features and/or potential hook changes should be follow up work ## Testing Added a unit test to check that the new marker is enabled by default
# Objective Currently, `prepare_sprite_image_bind_group` spawns sprite batches onto an individual representative entity of the batch. This poses significant problems for multi-camera setups, since an entity may appear in multiple phase instances. ## Solution Instead, move batches into a resource that is keyed off the view and the representative entity. Long term we should switch to mesh2d and use the existing BinnedRenderPhase functionality rather than naively queueing into transparent and doing our own ad-hoc batching logic. Fixes bevyengine#16867, bevyengine#17351 ## Testing Tested repros in above issues.
# Objective ``` cargo test --package bevy_ecs --lib --all-features ``` fails to compile, with output like > error[E0433]: failed to resolve: could not find `Serialize` in `serde` > --> crates/bevy_ecs/src/entity/index_set.rs:14:69 > | > 14 | #[cfg_attr(feature = "serialize", derive(serde::Deserialize, serde::Serialize))] > | ^^^^^^^^^ could not find `Serialize` in `serde` > | > note: found an item that was configured out > --> /home/alice/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.217/src/lib.rs:343:37 > | > 343 | pub use serde_derive::{Deserialize, Serialize}; > | ^^^^^^^^^ > note: the item is gated behind the `serde_derive` feature > --> /home/alice/.cargo/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.217/src/lib.rs:341:7 > | > 341 | #[cfg(feature = "serde_derive")] > | ^^^^^^^^^^^^^^^^^^^^^^^^ ## Solution Add the required feature flags and get bevy_ecs compiling standalone corrctly. ## Testing The command above now compiles succesfully. Note that several system stepping tests are failing, and were not being tested in CI. That's a different PR's problem though.
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.29.4 to 1.29.5. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/crate-ci/typos/releases">crate-ci/typos's releases</a>.</em></p> <blockquote> <h2>v1.29.5</h2> <h2>[1.29.5] - 2025-01-30</h2> <h3>Internal</h3> <ul> <li>Update a dependency</li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/crate-ci/typos/blob/master/CHANGELOG.md">crate-ci/typos's changelog</a>.</em></p> <blockquote> <h2>[1.29.5] - 2025-01-30</h2> <h3>Internal</h3> <ul> <li>Update a dependency</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/crate-ci/typos/commit/11ca4583f2f3f74c7e7785c0ecb20fe2c99a4308"><code>11ca458</code></a> chore: Release</li> <li><a href="https://github.com/crate-ci/typos/commit/99fd37f157f55c0565a0574a86eb3949dbd38165"><code>99fd37f</code></a> docs: Update changelog</li> <li><a href="https://github.com/crate-ci/typos/commit/4f604f6effffe7f41833b65ee75da75d416821ef"><code>4f604f6</code></a> Merge pull request <a href="https://redirect.github.com/crate-ci/typos/issues/1220">#1220</a> from epage/w7</li> <li><a href="https://github.com/crate-ci/typos/commit/ba04a1a0fd67a0e00ad36c5c5655b9740ee5e68a"><code>ba04a1a</code></a> perf: Remove ErrMode overhead</li> <li><a href="https://github.com/crate-ci/typos/commit/60452b5a81caa4f70c81282f2cdd2116fc045f52"><code>60452b5</code></a> chore: Update to Winnow 0.7</li> <li><a href="https://github.com/crate-ci/typos/commit/4c22f194b5c24cf2b7d0524df0857f0f8bbc32a5"><code>4c22f19</code></a> refactor: Migrate from Parser to ModalParser</li> <li><a href="https://github.com/crate-ci/typos/commit/7830eb8730de84bf14bc14cadb996c0e52f9fe93"><code>7830eb8</code></a> refactor: Resolve deprecations</li> <li><a href="https://github.com/crate-ci/typos/commit/07f1292e290f35153fb91dad3324e7bdb9cd827a"><code>07f1292</code></a> chore: Upgrade to Winnow 0.6.26</li> <li><a href="https://github.com/crate-ci/typos/commit/3683264986a72f63f13e9e8fc132a13af2a322b8"><code>3683264</code></a> chore(deps): Update Rust Stable to v1.84 (<a href="https://redirect.github.com/crate-ci/typos/issues/1216">#1216</a>)</li> <li><a href="https://github.com/crate-ci/typos/commit/2ed38e07fc83ec249f9736b81008690c2c88ec98"><code>2ed38e0</code></a> chore(deps): Update Rust crate bstr to v1.11.3 (<a href="https://redirect.github.com/crate-ci/typos/issues/1202">#1202</a>)</li> <li>See full diff in <a href="https://github.com/crate-ci/typos/compare/v1.29.4...v1.29.5">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=crate-ci/typos&package-manager=github_actions&previous-version=1.29.4&new-version=1.29.5)](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] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
# Objective Revert bevyengine#17631 After some more experimentation, realised it's not the right approach.
# Objective Our [`TextSpan`](https://docs.rs/bevy/latest/bevy/prelude/struct.TextSpan.html) docs include a code example that does not actually "work." The code silently does not render anything, and the `Text*Writer` helpers fail. This seems to be by design, because we can't use `Text` or `Text2d` from `bevy_ui` or `bevy_sprite` within docs in `bevy_text`. (Correct me if I am wrong) I have seen multiple users confused by these docs. Also fixes bevyengine#16794 ## Solution Remove the code example from `TextSpan`, and instead encourage users to seek docs on `Text` or `Text2d`. Add examples with nested `TextSpan`s in those areas.
) # Objective The method `World::as_unsafe_world_cell_readonly` is used to create an `UnsafeWorldCell` which is only allowed to access world data immutably. This can be tricky to use, as the data that an `UnsafeWorldCell` is allowed to access exists only in documentation (you could think of it as a "doc-time abstraction" rather than a "compile-time" abstraction). It's quite easy to forget where a particular instance came from and attempt to use it for mutable access, leading to instant, silent undefined behavior. ## Solution Add a debug-mode only flag to `UnsafeWorldCell` which tracks whether or not the instance can be used to access world data mutably. This should catch basic improper usages of `as_unsafe_world_cell_readonly`. ## Future work There are a few ways that you can bypass the runtime checks introduced by this PR: * Any world accesses done via `UnsafeWorldCell::storages` are completely invisible to these runtime checks. Unfortunately, `storages` constitutes most of the world accesses used in the engine itself, so this PR will mostly benefit downstream users of bevy. * It's possible to call `get_resource_by_id`, and then convert the returned `Ptr` to a `PtrMut` by calling `assert_unique`. In the future we'll probably want to add a debug-mode only flag to `Ptr` which tracks whether or not it can be upgraded to a `PtrMut`. I didn't include this change in this PR as those types are currently defined using macros which makes it a bit tricky to modify their definitions. * Any data accesses done through a mutable `UnsafeWorldCell` are completely unchecked, meaning it's possible to unsoundly create multiple mutable references to a single component, for example. In the future we may want to store an `Access<>` set inside of the world's `Storages` to add granular debug-mode runtime checks. That said, I'd consider this PR to be a good first step towards adding full runtime checks to `UnsafeWorldCell`. ## Testing Added a few tests that basic invalid mutable world access result in a panic. --------- Co-authored-by: Joseph <[email protected]> Co-authored-by: Alice I Cecile <[email protected]>
# Objective - Fix the atmosphere LUT parameterization in the aerial -view and sky-view LUTs - Correct the light accumulation according to a ray-marched reference - Avoid negative values of the sun disk illuminance when the sun disk is below the horizon ## Solution - Adding a Newton's method iteration to `fast_sqrt` function - Switched to using `fast_acos_4` for better precision of the sun angle towards the horizon (view mu angle = 0) - Simplified the function for mapping to and from the Sky View UV coordinates by removing an if statement and correctly apply the method proposed by the [Hillarie paper](https://sebh.github.io/publications/egsr2020.pdf) detailed in section 5.3 and 5.4. - Replaced the `ray_dir_ws.y` term with a shadow factor in the `sample_sun_illuminance` function that correctly approximates the sun disk occluded by the earth from any view point ## Testing - Ran the atmosphere and SSAO examples to make sure the shaders still compile and run as expected. --- ## Showcase <img width="1151" alt="showcase-img" src="https://github.com/user-attachments/assets/de875533-42bd-41f9-9fd0-d7cc57d6e51c" /> --------- Co-authored-by: Emerson Coskey <[email protected]>
# Objective - Most of the `*MeshBuilder` classes are not implementing `Reflect` ## Solution - Implementing `Reflect` for all `*MeshBuilder` were is possible. - Make sure all `*MeshBuilder` implements `Default`. - Adding new `MeshBuildersPlugin` that registers all `*MeshBuilder` types. ## Testing - `cargo run -p ci` - Tested some examples like `3d_scene` just in case something was broken.
# Objective Prevent unsound uses of `DeferredWorld` as a `SystemParam`. It is currently unsound because it does not check for existing access, and because it incorrectly registers filtered access. ## Solution Have `DeferredWorld` panic if a previous parameter has conflicting access. Have `DeferredWorld` update `archetype_component_access` so that the multi-threaded executor sees the access. Fix `FilteredAccessSet::read_all()` and `write_all()` to correctly add a `FilteredAccess` with no filter so that `Query` is able to detect the conflicts. Remove redundant `read_all()` call, since `write_all()` already declares read access. Remove unnecessary `set_has_deferred()` call, since `<DeferredWorld as SystemParam>::apply_deferred()` does nothing. Previously we were inserting unnecessary `apply_deferred` systems in the schedule. ## Testing Added unit tests for systems where `DeferredWorld` conflicts with a `Query` in the same system.
… (alternative to bevyengine#17604) (bevyengine#17646) # Objective - When obtaining an axis from the transform and putting that into `Transform::rotate_axis` or `Transform::rotate_axis_local`, floating point errors could accumulate exponentially, resulting in denormalized rotation. - This is an alternative to and closes bevyengine#17604, due to lack of consent around this in the [discord discussion](https://discord.com/channels/691052431525675048/1203087353850364004/1334232710658392227) - Closes bevyengine#16480 ## Solution - Add a warning of this issue and a recommendation to normalize to the API docs. - Add a runtime warning that checks for denormalized axis in debug mode, with a reference to the API docs.
# Objective Allow mapping `Mut` to another value while returning a custom error on failure. ## Solution Added `try_map_unchanged` to `Mut` which returns a `Result` instead of `Option` .
# Objective While working on bevyengine#17649, I found the docs for `WorldQuery` and the related traits frustratingly vague. ## Solution Clarify them and add some more tangible advice. Also fix a copy-pasted typo in related comments. --------- Co-authored-by: James O'Brien <[email protected]>
Awesome everything working as expected on ubuntu and wasm, and |
Can I have a summary of the licensing situation as it currently stands? I want to make sure I have all the details straight :) |
@alice-i-cecile this pr adds two licences:
ci still picks up ring because On another note this pr commit history has gotten super messy, it has a tonne of commits from when i was working out how to do ci checks locally and i think i did a bad merge, maybe I could open up a fresh one and link to it? |
Objective
bevy_web_asset
, allowing assets loaded viahttp
#16307Solution
http
&https
asset sourcesTesting
cargo run --example http_source
Showcase
Bevy now supports assets loaded via url!
Add the
http_source
feature to load assets served over the web, with support for both native and wasm targets. On native targets thehttp_source_cache
feature will use a basic caching mechanism to avoid repeated network requests.