mirror of
https://github.com/bevyengine/bevy
synced 2024-12-24 03:53:06 +00:00
Fix example build for wasm (#16557)
# Objective - Some examples failed to build for wasm on the website ## Solution - Fix them - `Msaa` is now a component instead of a resource
This commit is contained in:
parent
c1d392a5c6
commit
2745aa102d
2 changed files with 8 additions and 10 deletions
|
@ -20,12 +20,6 @@ fn main() {
|
||||||
.add_systems(Startup, setup)
|
.add_systems(Startup, setup)
|
||||||
.add_systems(Update, example_control_system);
|
.add_systems(Update, example_control_system);
|
||||||
|
|
||||||
// Unfortunately, MSAA and HDR are not supported simultaneously under WebGL.
|
|
||||||
// Since this example uses HDR, we must disable MSAA for Wasm builds, at least
|
|
||||||
// until WebGPU is ready and no longer behind a feature flag in Web browsers.
|
|
||||||
#[cfg(target_arch = "wasm32")]
|
|
||||||
app.insert_resource(Msaa::Off);
|
|
||||||
|
|
||||||
app.run();
|
app.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,6 +149,11 @@ fn setup(
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
Camera3d::default(),
|
Camera3d::default(),
|
||||||
Transform::from_xyz(0.0, 2.5, 10.0).looking_at(Vec3::ZERO, Vec3::Y),
|
Transform::from_xyz(0.0, 2.5, 10.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||||
|
// Unfortunately, MSAA and HDR are not supported simultaneously under WebGL.
|
||||||
|
// Since this example uses HDR, we must disable MSAA for Wasm builds, at least
|
||||||
|
// until WebGPU is ready and no longer behind a feature flag in Web browsers.
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
Msaa::Off,
|
||||||
));
|
));
|
||||||
|
|
||||||
// Controls Text
|
// Controls Text
|
||||||
|
|
|
@ -11,10 +11,6 @@ use bevy::{
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut app = App::new();
|
let mut app = App::new();
|
||||||
|
|
||||||
// MSAA and Motion Blur together are not compatible on WebGL
|
|
||||||
#[cfg(all(feature = "webgl2", target_arch = "wasm32", not(feature = "webgpu")))]
|
|
||||||
app.insert_resource(Msaa::Off);
|
|
||||||
|
|
||||||
app.add_plugins(DefaultPlugins)
|
app.add_plugins(DefaultPlugins)
|
||||||
.add_systems(Startup, (setup_camera, setup_scene, setup_ui))
|
.add_systems(Startup, (setup_camera, setup_scene, setup_ui))
|
||||||
.add_systems(Update, (keyboard_inputs, move_cars, move_camera).chain())
|
.add_systems(Update, (keyboard_inputs, move_cars, move_camera).chain())
|
||||||
|
@ -33,6 +29,9 @@ fn setup_camera(mut commands: Commands) {
|
||||||
#[cfg(all(feature = "webgl2", target_arch = "wasm32", not(feature = "webgpu")))]
|
#[cfg(all(feature = "webgl2", target_arch = "wasm32", not(feature = "webgpu")))]
|
||||||
_webgl2_padding: Default::default(),
|
_webgl2_padding: Default::default(),
|
||||||
},
|
},
|
||||||
|
// MSAA and Motion Blur together are not compatible on WebGL
|
||||||
|
#[cfg(all(feature = "webgl2", target_arch = "wasm32", not(feature = "webgpu")))]
|
||||||
|
Msaa::Off,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue