Skip to content

Commit 3453d23

Browse files
committedOct 27, 2024·
Disable wireframe mode on wasm32 target arch.
1 parent 65b1bf6 commit 3453d23

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed
 

‎RELEASES.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
* Update `bevy_egui`.
44
* Bump MSRV.
5+
* Disable wireframe mode in examples when unsupported.
56

67
# Version 0.7.0 (2024-07-06)
78

‎examples/constellation_clamp.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313

1414
use std::f32::consts::PI;
1515

16+
#[cfg(not(target_arch = "wasm32"))]
17+
use bevy::pbr::wireframe::{WireframeConfig, WireframePlugin};
1618
use bevy::{
1719
color::palettes::basic::SILVER,
18-
pbr::wireframe::{WireframeConfig, WireframePlugin},
1920
prelude::*,
2021
render::{
2122
camera::Viewport,
@@ -38,11 +39,19 @@ fn main() {
3839
}),
3940
..default()
4041
}),
42+
#[cfg(not(target_arch = "wasm32"))]
4143
WireframePlugin,
4244
))
4345
.add_plugins(TrackballPlugin)
4446
.add_systems(Startup, setup)
45-
.add_systems(Update, (rotate, toggle_wireframe))
47+
.add_systems(
48+
Update,
49+
(
50+
rotate,
51+
#[cfg(not(target_arch = "wasm32"))]
52+
toggle_wireframe,
53+
),
54+
)
4655
.add_systems(Update, (resize_minimap, toggle_rigid_loose))
4756
.run();
4857
}
@@ -191,6 +200,7 @@ fn setup(
191200
));
192201

193202
// UI
203+
#[cfg(not(target_arch = "wasm32"))]
194204
commands.spawn((
195205
TargetCamera(maximap),
196206
TextBundle::from_section("Press space to toggle wireframes", TextStyle::default())
@@ -300,6 +310,7 @@ fn uv_debug_texture() -> Image {
300310
)
301311
}
302312

313+
#[cfg(not(target_arch = "wasm32"))]
303314
fn toggle_wireframe(
304315
mut wireframe_config: ResMut<WireframeConfig>,
305316
keyboard: Res<ButtonInput<KeyCode>>,

‎examples/gliding_clamp.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55

66
use std::f32::consts::PI;
77

8+
#[cfg(not(target_arch = "wasm32"))]
9+
use bevy::pbr::wireframe::{WireframeConfig, WireframePlugin};
810
use bevy::{
911
color::palettes::basic::SILVER,
10-
pbr::wireframe::{WireframeConfig, WireframePlugin},
1112
prelude::*,
1213
render::{
1314
render_asset::RenderAssetUsages,
@@ -28,11 +29,19 @@ fn main() {
2829
}),
2930
..default()
3031
}),
32+
#[cfg(not(target_arch = "wasm32"))]
3133
WireframePlugin,
3234
))
3335
.add_plugins(TrackballPlugin)
3436
.add_systems(Startup, setup)
35-
.add_systems(Update, (rotate, toggle_wireframe))
37+
.add_systems(
38+
Update,
39+
(
40+
rotate,
41+
#[cfg(not(target_arch = "wasm32"))]
42+
toggle_wireframe,
43+
),
44+
)
3645
.run();
3746
}
3847

@@ -151,6 +160,7 @@ fn setup(
151160
Camera3dBundle::default(),
152161
));
153162

163+
#[cfg(not(target_arch = "wasm32"))]
154164
commands.spawn(
155165
TextBundle::from_section("Press space to toggle wireframes", TextStyle::default())
156166
.with_style(Style {
@@ -197,6 +207,7 @@ fn uv_debug_texture() -> Image {
197207
)
198208
}
199209

210+
#[cfg(not(target_arch = "wasm32"))]
200211
fn toggle_wireframe(
201212
mut wireframe_config: ResMut<WireframeConfig>,
202213
keyboard: Res<ButtonInput<KeyCode>>,

0 commit comments

Comments
 (0)
Please sign in to comment.