mirror of
https://github.com/bevyengine/bevy
synced 2024-11-29 08:00:20 +00:00
Disabled usage of the POLYGON_MODE_LINE gpu feature in the examples (#14402)
Fixes #14353 Fixes #14371 --------- Signed-off-by: Sarthak Singh <sarthak.singh99@gmail.com> Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: BD103 <59022059+BD103@users.noreply.github.com>
This commit is contained in:
parent
848e7fae43
commit
a9f4fd8ea1
3 changed files with 36 additions and 9 deletions
|
@ -760,7 +760,8 @@ doc-scrape-examples = true
|
||||||
name = "Lines"
|
name = "Lines"
|
||||||
description = "Create a custom material to draw 3d lines"
|
description = "Create a custom material to draw 3d lines"
|
||||||
category = "3D Rendering"
|
category = "3D Rendering"
|
||||||
wasm = true
|
# WASM does not support the `POLYGON_MODE_LINE` feature.
|
||||||
|
wasm = false
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "ssao"
|
name = "ssao"
|
||||||
|
|
|
@ -1,16 +1,26 @@
|
||||||
//! Shows how to render simple primitive shapes with a single color.
|
//! Shows how to render simple primitive shapes with a single color.
|
||||||
|
//!
|
||||||
|
//! You can toggle wireframes with the space bar except on wasm. Wasm does not support
|
||||||
|
//! `POLYGON_MODE_LINE` on the gpu.
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
use bevy::sprite::{Wireframe2dConfig, Wireframe2dPlugin};
|
||||||
use bevy::{
|
use bevy::{
|
||||||
prelude::*,
|
prelude::*,
|
||||||
sprite::{MaterialMesh2dBundle, Mesh2dHandle, Wireframe2dConfig, Wireframe2dPlugin},
|
sprite::{MaterialMesh2dBundle, Mesh2dHandle},
|
||||||
};
|
};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
App::new()
|
let mut app = App::new();
|
||||||
.add_plugins((DefaultPlugins, Wireframe2dPlugin))
|
app.add_plugins((
|
||||||
.add_systems(Startup, setup)
|
DefaultPlugins,
|
||||||
.add_systems(Update, toggle_wireframe)
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
.run();
|
Wireframe2dPlugin,
|
||||||
|
))
|
||||||
|
.add_systems(Startup, setup);
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
app.add_systems(Update, toggle_wireframe);
|
||||||
|
app.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
const X_EXTENT: f32 = 900.;
|
const X_EXTENT: f32 = 900.;
|
||||||
|
@ -57,6 +67,7 @@ fn setup(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
commands.spawn(
|
commands.spawn(
|
||||||
TextBundle::from_section("Press space to toggle wireframes", TextStyle::default())
|
TextBundle::from_section("Press space to toggle wireframes", TextStyle::default())
|
||||||
.with_style(Style {
|
.with_style(Style {
|
||||||
|
@ -68,6 +79,7 @@ fn setup(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
fn toggle_wireframe(
|
fn toggle_wireframe(
|
||||||
mut wireframe_config: ResMut<Wireframe2dConfig>,
|
mut wireframe_config: ResMut<Wireframe2dConfig>,
|
||||||
keyboard: Res<ButtonInput<KeyCode>>,
|
keyboard: Res<ButtonInput<KeyCode>>,
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
//! This example demonstrates the built-in 3d shapes in Bevy.
|
//! This example demonstrates the built-in 3d shapes in Bevy.
|
||||||
//! The scene includes a patterned texture and a rotation for visualizing the normals and UVs.
|
//! The scene includes a patterned texture and a rotation for visualizing the normals and UVs.
|
||||||
|
//!
|
||||||
|
//! You can toggle wireframes with the space bar except on wasm. Wasm does not support
|
||||||
|
//! `POLYGON_MODE_LINE` on the gpu.
|
||||||
|
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
use bevy::pbr::wireframe::{WireframeConfig, WireframePlugin};
|
||||||
use bevy::{
|
use bevy::{
|
||||||
color::palettes::basic::SILVER,
|
color::palettes::basic::SILVER,
|
||||||
pbr::wireframe::{WireframeConfig, WireframePlugin},
|
|
||||||
prelude::*,
|
prelude::*,
|
||||||
render::{
|
render::{
|
||||||
render_asset::RenderAssetUsages,
|
render_asset::RenderAssetUsages,
|
||||||
|
@ -17,10 +21,18 @@ fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
.add_plugins((
|
.add_plugins((
|
||||||
DefaultPlugins.set(ImagePlugin::default_nearest()),
|
DefaultPlugins.set(ImagePlugin::default_nearest()),
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
WireframePlugin,
|
WireframePlugin,
|
||||||
))
|
))
|
||||||
.add_systems(Startup, setup)
|
.add_systems(Startup, setup)
|
||||||
.add_systems(Update, (rotate, toggle_wireframe))
|
.add_systems(
|
||||||
|
Update,
|
||||||
|
(
|
||||||
|
rotate,
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
toggle_wireframe,
|
||||||
|
),
|
||||||
|
)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,6 +140,7 @@ fn setup(
|
||||||
..default()
|
..default()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
commands.spawn(
|
commands.spawn(
|
||||||
TextBundle::from_section("Press space to toggle wireframes", TextStyle::default())
|
TextBundle::from_section("Press space to toggle wireframes", TextStyle::default())
|
||||||
.with_style(Style {
|
.with_style(Style {
|
||||||
|
@ -174,6 +187,7 @@ fn uv_debug_texture() -> Image {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
fn toggle_wireframe(
|
fn toggle_wireframe(
|
||||||
mut wireframe_config: ResMut<WireframeConfig>,
|
mut wireframe_config: ResMut<WireframeConfig>,
|
||||||
keyboard: Res<ButtonInput<KeyCode>>,
|
keyboard: Res<ButtonInput<KeyCode>>,
|
||||||
|
|
Loading…
Reference in a new issue