Skip to content

Commit cc49321

Browse files
committed
Merge branch 'main' of github.com:bevyengine/bevy into fix-wesl-embeded-path
2 parents b302637 + 80e8d37 commit cc49321

File tree

42 files changed

+561
-173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+561
-173
lines changed

Cargo.toml

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ default = [
142142
"bevy_gltf",
143143
"bevy_input_focus",
144144
"bevy_log",
145-
"bevy_mesh_picking_backend",
146145
"bevy_pbr",
147146
"bevy_picking",
148147
"bevy_render",
@@ -154,27 +153,28 @@ default = [
154153
"bevy_light",
155154
"bevy_shader",
156155
"bevy_sprite",
157-
"bevy_sprite_picking_backend",
158156
"bevy_sprite_render",
159157
"bevy_state",
160158
"bevy_text",
161159
"bevy_ui",
162-
"bevy_ui_picking_backend",
163160
"bevy_ui_render",
164161
"bevy_window",
165162
"bevy_winit",
166163
"custom_cursor",
167164
"default_font",
168165
"hdr",
169166
"ktx2",
167+
"mesh_picking",
170168
"morph",
171169
"morph_animation",
172170
"multi_threaded",
173171
"png",
174172
"reflect_auto_register",
175173
"smaa_luts",
174+
"sprite_picking",
176175
"sysinfo_plugin",
177176
"tonemapping_luts",
177+
"ui_picking",
178178
"vorbis",
179179
"webgl2",
180180
"x11",
@@ -187,13 +187,13 @@ default = [
187187
default_no_std = ["libm", "critical-section", "bevy_color", "bevy_state"]
188188

189189
# Provides an implementation for picking meshes
190-
bevy_mesh_picking_backend = ["bevy_internal/bevy_mesh_picking_backend"]
190+
mesh_picking = ["bevy_internal/mesh_picking"]
191191

192192
# Provides an implementation for picking sprites
193-
bevy_sprite_picking_backend = ["bevy_internal/bevy_sprite_picking_backend"]
193+
sprite_picking = ["bevy_internal/sprite_picking"]
194194

195195
# Provides an implementation for picking UI
196-
bevy_ui_picking_backend = ["bevy_internal/bevy_ui_picking_backend"]
196+
ui_picking = ["bevy_internal/ui_picking"]
197197

198198
# Provides a debug overlay for bevy UI
199199
bevy_ui_debug = ["bevy_internal/bevy_ui_debug"]
@@ -291,6 +291,12 @@ bevy_gizmos = ["bevy_internal/bevy_gizmos"]
291291
# Provides a collection of developer tools
292292
bevy_dev_tools = ["bevy_internal/bevy_dev_tools"]
293293

294+
# Provides a collection of prebuilt camera controllers
295+
bevy_camera_controller = ["bevy_internal/bevy_camera_controller"]
296+
297+
# Enables the free cam from bevy_camera_controller
298+
free_cam = ["bevy_internal/free_cam"]
299+
294300
# Enable the Bevy Remote Protocol
295301
bevy_remote = ["bevy_internal/bevy_remote"]
296302

@@ -1160,6 +1166,7 @@ wasm = true
11601166
name = "decal"
11611167
path = "examples/3d/decal.rs"
11621168
doc-scrape-examples = true
1169+
required-features = ["free_cam"]
11631170

11641171
[package.metadata.example.decal]
11651172
name = "Decal"
@@ -1271,6 +1278,7 @@ wasm = true
12711278
name = "shadow_biases"
12721279
path = "examples/3d/shadow_biases.rs"
12731280
doc-scrape-examples = true
1281+
required-features = ["free_cam"]
12741282

12751283
[package.metadata.example.shadow_biases]
12761284
name = "Shadow Biases"
@@ -1293,6 +1301,7 @@ wasm = true
12931301
name = "skybox"
12941302
path = "examples/3d/skybox.rs"
12951303
doc-scrape-examples = true
1304+
required-features = ["free_cam"]
12961305

12971306
[package.metadata.example.skybox]
12981307
name = "Skybox"
@@ -2276,7 +2285,7 @@ wasm = false
22762285
name = "error_handling"
22772286
path = "examples/ecs/error_handling.rs"
22782287
doc-scrape-examples = true
2279-
required-features = ["bevy_mesh_picking_backend"]
2288+
required-features = ["mesh_picking"]
22802289

22812290
[package.metadata.example.error_handling]
22822291
name = "Error handling"
@@ -3196,6 +3205,7 @@ wasm = false
31963205
name = "scene_viewer"
31973206
path = "examples/tools/scene_viewer/main.rs"
31983207
doc-scrape-examples = true
3208+
required-features = ["free_cam"]
31993209

32003210
[package.metadata.example.scene_viewer]
32013211
name = "Scene Viewer"
@@ -3971,6 +3981,7 @@ wasm = true
39713981
name = "3d_gizmos"
39723982
path = "examples/gizmos/3d_gizmos.rs"
39733983
doc-scrape-examples = true
3984+
required-features = ["free_cam"]
39743985

39753986
[package.metadata.example.3d_gizmos]
39763987
name = "3D Gizmos"
@@ -4351,7 +4362,7 @@ wasm = false
43514362
name = "mesh_picking"
43524363
path = "examples/picking/mesh_picking.rs"
43534364
doc-scrape-examples = true
4354-
required-features = ["bevy_mesh_picking_backend"]
4365+
required-features = ["mesh_picking"]
43554366

43564367
[package.metadata.example.mesh_picking]
43574368
name = "Mesh Picking"
@@ -4375,7 +4386,7 @@ wasm = true
43754386
name = "sprite_picking"
43764387
path = "examples/picking/sprite_picking.rs"
43774388
doc-scrape-examples = true
4378-
required-features = ["bevy_sprite_picking_backend"]
4389+
required-features = ["sprite_picking"]
43794390

43804391
[package.metadata.example.sprite_picking]
43814392
name = "Sprite Picking"
@@ -4603,18 +4614,6 @@ description = "Demonstration of Occlusion Culling"
46034614
category = "3D Rendering"
46044615
wasm = false
46054616

4606-
[[example]]
4607-
name = "camera_controller"
4608-
path = "examples/helpers/camera_controller.rs"
4609-
doc-scrape-examples = true
4610-
crate-type = ["lib"]
4611-
4612-
[package.metadata.example.camera_controller]
4613-
name = "Camera Controller"
4614-
description = "Example Free-Cam Styled Camera Controller"
4615-
category = "Helpers"
4616-
wasm = true
4617-
46184617
[[example]]
46194618
name = "widgets"
46204619
path = "examples/helpers/widgets.rs"

benches/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ criterion = { version = "0.6.0", features = ["html_reports"] }
1717
bevy_app = { path = "../crates/bevy_app" }
1818
bevy_ecs = { path = "../crates/bevy_ecs", features = ["multi_threaded"] }
1919
bevy_math = { path = "../crates/bevy_math" }
20-
bevy_picking = { path = "../crates/bevy_picking", features = [
21-
"bevy_mesh_picking_backend",
22-
] }
20+
bevy_picking = { path = "../crates/bevy_picking", features = ["mesh_picking"] }
2321
bevy_reflect = { path = "../crates/bevy_reflect", features = ["functions"] }
2422
bevy_camera = { path = "../crates/bevy_camera" }
2523
bevy_mesh = { path = "../crates/bevy_mesh" }

crates/bevy_anti_alias/src/smaa/mod.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,13 +296,30 @@ impl Plugin for SmaaPlugin {
296296

297297
#[cfg(feature = "smaa_luts")]
298298
let smaa_luts = {
299+
use bevy_asset::RenderAssetUsages;
300+
use bevy_image::ImageLoaderSettings;
301+
299302
// Load the two lookup textures. These are compressed textures in KTX2 format.
300303
embedded_asset!(app, "SMAAAreaLUT.ktx2");
301304
embedded_asset!(app, "SMAASearchLUT.ktx2");
302305

303306
SmaaLuts {
304-
area_lut: load_embedded_asset!(app, "SMAAAreaLUT.ktx2"),
305-
search_lut: load_embedded_asset!(app, "SMAASearchLUT.ktx2"),
307+
area_lut: load_embedded_asset!(
308+
app,
309+
"SMAAAreaLUT.ktx2",
310+
|settings: &mut ImageLoaderSettings| {
311+
settings.is_srgb = false;
312+
settings.asset_usage = RenderAssetUsages::RENDER_WORLD;
313+
}
314+
),
315+
search_lut: load_embedded_asset!(
316+
app,
317+
"SMAASearchLUT.ktx2",
318+
|settings: &mut ImageLoaderSettings| {
319+
settings.is_srgb = false;
320+
settings.asset_usage = RenderAssetUsages::RENDER_WORLD;
321+
}
322+
),
306323
}
307324
};
308325
#[cfg(not(feature = "smaa_luts"))]

crates/bevy_asset/src/handle.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,13 @@ impl<A: Asset> From<&mut Handle<A>> for UntypedAssetId {
268268
}
269269
}
270270

271+
impl<A: Asset> From<Uuid> for Handle<A> {
272+
#[inline]
273+
fn from(uuid: Uuid) -> Self {
274+
Handle::Uuid(uuid, PhantomData)
275+
}
276+
}
277+
271278
/// An untyped variant of [`Handle`], which internally stores the [`Asset`] type information at runtime
272279
/// as a [`TypeId`] instead of encoding it in the compile-time type. This allows handles across [`Asset`] types
273280
/// to be stored together and compared.
@@ -626,6 +633,15 @@ mod tests {
626633
assert_eq!(UntypedHandle::from(typed.clone()), untyped);
627634
}
628635

636+
#[test]
637+
fn from_uuid() {
638+
let uuid = UUID_1;
639+
let handle: Handle<TestAsset> = uuid.into();
640+
641+
assert!(handle.is_uuid());
642+
assert_eq!(handle.id(), AssetId::Uuid { uuid });
643+
}
644+
629645
/// `PartialReflect::reflect_clone`/`PartialReflect::to_dynamic` should increase the strong count of a strong handle
630646
#[test]
631647
fn strong_handle_reflect_clone() {

crates/bevy_asset/src/io/source.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use bevy_ecs::resource::Resource;
1212
use bevy_platform::collections::HashMap;
1313
use core::{fmt::Display, hash::Hash, time::Duration};
1414
use thiserror::Error;
15-
use tracing::{error, warn};
15+
use tracing::warn;
1616

1717
use super::{ErasedAssetReader, ErasedAssetWriter};
1818

crates/bevy_asset/src/server/info.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,12 @@ impl AssetInfos {
384384
world: &mut World,
385385
sender: &Sender<InternalAssetEvent>,
386386
) {
387+
// Process all the labeled assets first so that they don't get skipped due to the "parent"
388+
// not having its handle alive.
389+
for (_, asset) in loaded_asset.labeled_assets {
390+
self.process_asset_load(asset.handle.id(), asset.asset, world, sender);
391+
}
392+
387393
// Check whether the handle has been dropped since the asset was loaded.
388394
if !self.infos.contains_key(&loaded_asset_id) {
389395
return;

crates/bevy_asset/src/server/mod.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,10 @@ impl AssetServer {
830830
fetched_handle
831831
};
832832

833-
self.send_loaded_asset(base_asset_id, loaded_asset);
833+
self.send_asset_event(InternalAssetEvent::Loaded {
834+
id: base_asset_id,
835+
loaded_asset,
836+
});
834837
Ok(final_handle)
835838
}
836839
Err(err) => {
@@ -844,16 +847,6 @@ impl AssetServer {
844847
}
845848
}
846849

847-
/// Sends a load event for the given `loaded_asset` and does the same recursively for all
848-
/// labeled assets.
849-
fn send_loaded_asset(&self, id: UntypedAssetId, mut loaded_asset: ErasedLoadedAsset) {
850-
for (_, labeled_asset) in loaded_asset.labeled_assets.drain() {
851-
self.send_loaded_asset(labeled_asset.handle.id(), labeled_asset.asset);
852-
}
853-
854-
self.send_asset_event(InternalAssetEvent::Loaded { id, loaded_asset });
855-
}
856-
857850
/// Kicks off a reload of the asset stored at the given path. This will only reload the asset if it currently loaded.
858851
pub fn reload<'a>(&self, path: impl Into<AssetPath<'a>>) {
859852
self.reload_internal(path, false);
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[package]
2+
name = "bevy_camera_controller"
3+
version = "0.18.0-dev"
4+
edition = "2024"
5+
description = "Premade camera controllers for Bevy"
6+
homepage = "https://bevy.org"
7+
repository = "https://github.com/bevyengine/bevy"
8+
license = "MIT OR Apache-2.0"
9+
keywords = ["bevy", "input", "camera", "control"]
10+
rust-version = "1.85.0"
11+
12+
[dependencies]
13+
bevy_app = { path = "../bevy_app", version = "0.18.0-dev", default-features = false }
14+
bevy_camera = { path = "../bevy_camera", version = "0.18.0-dev", default-features = false }
15+
bevy_ecs = { path = "../bevy_ecs", version = "0.18.0-dev", default-features = false }
16+
bevy_input = { path = "../bevy_input", version = "0.18.0-dev", default-features = false }
17+
bevy_log = { path = "../bevy_log", version = "0.18.0-dev", default-features = false }
18+
bevy_math = { path = "../bevy_math", version = "0.18.0-dev", default-features = false, features = [
19+
"curve",
20+
] }
21+
bevy_reflect = { path = "../bevy_reflect", version = "0.18.0-dev", default-features = false, optional = true }
22+
bevy_time = { path = "../bevy_time", version = "0.18.0-dev", default-features = false }
23+
bevy_transform = { path = "../bevy_transform", version = "0.18.0-dev", default-features = false }
24+
bevy_window = { path = "../bevy_window", version = "0.18.0-dev", default-features = false }
25+
26+
[features]
27+
default = ["bevy_reflect"]
28+
bevy_reflect = ["dep:bevy_reflect"]
29+
libm = ["bevy_math/libm"]
30+
31+
# Camera controllers
32+
free_cam = []
33+
34+
[lints]
35+
workspace = true
36+
37+
[package.metadata.docs.rs]
38+
rustdoc-args = ["-Zunstable-options", "--generate-link-to-definition"]
39+
all-features = true

0 commit comments

Comments
 (0)