Skip to content

Commit f1c69b9

Browse files
committed
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
1 parent 10d0336 commit f1c69b9

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ wasm = false
372372
[[example]]
373373
name = "load_gltf"
374374
path = "examples/3d/load_gltf.rs"
375-
required-features = ["ktx2", "zstd"]
376375

377376
[package.metadata.example.load_gltf]
378377
name = "Load glTF"
@@ -1432,7 +1431,6 @@ wasm = true
14321431
[[example]]
14331432
name = "scene_viewer"
14341433
path = "examples/tools/scene_viewer/main.rs"
1435-
required-features = ["ktx2", "zstd"]
14361434

14371435
[package.metadata.example.scene_viewer]
14381436
name = "Scene Viewer"

examples/3d/load_gltf.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,18 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
2727
.looking_at(Vec3::new(0.0, 0.3, 0.0), Vec3::Y),
2828
..default()
2929
},
30+
#[cfg(all(feature = "ktx2", feature = "zstd"))]
3031
EnvironmentMapLight {
3132
diffuse_map: asset_server.load("environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"),
3233
specular_map: asset_server.load("environment_maps/pisa_specular_rgb9e5_zstd.ktx2"),
3334
},
3435
));
36+
#[cfg(not(all(feature = "ktx2", feature = "zstd")))]
37+
{
38+
warn!("feature ktx2 or zstd wasn't enabled.");
39+
warn!("rerun this example with `--features=\"ktx2 zstd\" to get environment maps for ambient light");
40+
}
41+
3542
commands.spawn(DirectionalLightBundle {
3643
directional_light: DirectionalLight {
3744
shadows_enabled: true,

examples/tools/scene_viewer/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ fn setup_scene_after_load(
128128
},
129129
..default()
130130
},
131+
#[cfg(all(feature = "ktx2", feature = "zstd"))]
131132
EnvironmentMapLight {
132133
diffuse_map: asset_server
133134
.load("assets/environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"),
@@ -136,6 +137,11 @@ fn setup_scene_after_load(
136137
},
137138
camera_controller,
138139
));
140+
#[cfg(not(all(feature = "ktx2", feature = "zstd")))]
141+
{
142+
warn!("feature ktx2 or zstd wasn't enabled.");
143+
warn!("rerun this example with `--features=\"ktx2 zstd\" to get environment maps for ambient light");
144+
}
139145

140146
// Spawn a default light if the scene does not have one
141147
if !scene_handle.has_light {

0 commit comments

Comments
 (0)