mirror of
https://github.com/bevyengine/bevy
synced 2024-11-26 06:30:19 +00:00
don't require features on examples where it's not the main focus (#7615)
# Objective - Required features were added to some examples in #7051 even though those features aren't the main focus of the examples - Don't require features on examples that are useful without them ## Solution - Remove required features on examples `load_gltf` and `scene_viewer`, but log a warning when they are not enabled
This commit is contained in:
parent
10d0336287
commit
f1c69b925e
3 changed files with 13 additions and 2 deletions
|
@ -372,7 +372,6 @@ wasm = false
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "load_gltf"
|
name = "load_gltf"
|
||||||
path = "examples/3d/load_gltf.rs"
|
path = "examples/3d/load_gltf.rs"
|
||||||
required-features = ["ktx2", "zstd"]
|
|
||||||
|
|
||||||
[package.metadata.example.load_gltf]
|
[package.metadata.example.load_gltf]
|
||||||
name = "Load glTF"
|
name = "Load glTF"
|
||||||
|
@ -1432,7 +1431,6 @@ wasm = true
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "scene_viewer"
|
name = "scene_viewer"
|
||||||
path = "examples/tools/scene_viewer/main.rs"
|
path = "examples/tools/scene_viewer/main.rs"
|
||||||
required-features = ["ktx2", "zstd"]
|
|
||||||
|
|
||||||
[package.metadata.example.scene_viewer]
|
[package.metadata.example.scene_viewer]
|
||||||
name = "Scene Viewer"
|
name = "Scene Viewer"
|
||||||
|
|
|
@ -27,11 +27,18 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||||
.looking_at(Vec3::new(0.0, 0.3, 0.0), Vec3::Y),
|
.looking_at(Vec3::new(0.0, 0.3, 0.0), Vec3::Y),
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
|
#[cfg(all(feature = "ktx2", feature = "zstd"))]
|
||||||
EnvironmentMapLight {
|
EnvironmentMapLight {
|
||||||
diffuse_map: asset_server.load("environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"),
|
diffuse_map: asset_server.load("environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"),
|
||||||
specular_map: asset_server.load("environment_maps/pisa_specular_rgb9e5_zstd.ktx2"),
|
specular_map: asset_server.load("environment_maps/pisa_specular_rgb9e5_zstd.ktx2"),
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
|
#[cfg(not(all(feature = "ktx2", feature = "zstd")))]
|
||||||
|
{
|
||||||
|
warn!("feature ktx2 or zstd wasn't enabled.");
|
||||||
|
warn!("rerun this example with `--features=\"ktx2 zstd\" to get environment maps for ambient light");
|
||||||
|
}
|
||||||
|
|
||||||
commands.spawn(DirectionalLightBundle {
|
commands.spawn(DirectionalLightBundle {
|
||||||
directional_light: DirectionalLight {
|
directional_light: DirectionalLight {
|
||||||
shadows_enabled: true,
|
shadows_enabled: true,
|
||||||
|
|
|
@ -128,6 +128,7 @@ fn setup_scene_after_load(
|
||||||
},
|
},
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
|
#[cfg(all(feature = "ktx2", feature = "zstd"))]
|
||||||
EnvironmentMapLight {
|
EnvironmentMapLight {
|
||||||
diffuse_map: asset_server
|
diffuse_map: asset_server
|
||||||
.load("assets/environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"),
|
.load("assets/environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"),
|
||||||
|
@ -136,6 +137,11 @@ fn setup_scene_after_load(
|
||||||
},
|
},
|
||||||
camera_controller,
|
camera_controller,
|
||||||
));
|
));
|
||||||
|
#[cfg(not(all(feature = "ktx2", feature = "zstd")))]
|
||||||
|
{
|
||||||
|
warn!("feature ktx2 or zstd wasn't enabled.");
|
||||||
|
warn!("rerun this example with `--features=\"ktx2 zstd\" to get environment maps for ambient light");
|
||||||
|
}
|
||||||
|
|
||||||
// Spawn a default light if the scene does not have one
|
// Spawn a default light if the scene does not have one
|
||||||
if !scene_handle.has_light {
|
if !scene_handle.has_light {
|
||||||
|
|
Loading…
Reference in a new issue