mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +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
587cffdcde
commit
0886e6a302
3 changed files with 36 additions and 9 deletions
|
@ -753,7 +753,8 @@ doc-scrape-examples = true
|
|||
name = "Lines"
|
||||
description = "Create a custom material to draw 3d lines"
|
||||
category = "3D Rendering"
|
||||
wasm = true
|
||||
# WASM does not support the `POLYGON_MODE_LINE` feature.
|
||||
wasm = false
|
||||
|
||||
[[example]]
|
||||
name = "ssao"
|
||||
|
|
|
@ -1,16 +1,26 @@
|
|||
//! 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::{
|
||||
prelude::*,
|
||||
sprite::{MaterialMesh2dBundle, Mesh2dHandle, Wireframe2dConfig, Wireframe2dPlugin},
|
||||
sprite::{MaterialMesh2dBundle, Mesh2dHandle},
|
||||
};
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugins((DefaultPlugins, Wireframe2dPlugin))
|
||||
.add_systems(Startup, setup)
|
||||
.add_systems(Update, toggle_wireframe)
|
||||
.run();
|
||||
let mut app = App::new();
|
||||
app.add_plugins((
|
||||
DefaultPlugins,
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
Wireframe2dPlugin,
|
||||
))
|
||||
.add_systems(Startup, setup);
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
app.add_systems(Update, toggle_wireframe);
|
||||
app.run();
|
||||
}
|
||||
|
||||
const X_EXTENT: f32 = 900.;
|
||||
|
@ -57,6 +67,7 @@ fn setup(
|
|||
});
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
commands.spawn(
|
||||
TextBundle::from_section("Press space to toggle wireframes", TextStyle::default())
|
||||
.with_style(Style {
|
||||
|
@ -68,6 +79,7 @@ fn setup(
|
|||
);
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn toggle_wireframe(
|
||||
mut wireframe_config: ResMut<Wireframe2dConfig>,
|
||||
keyboard: Res<ButtonInput<KeyCode>>,
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
//! 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.
|
||||
//!
|
||||
//! 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;
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use bevy::pbr::wireframe::{WireframeConfig, WireframePlugin};
|
||||
use bevy::{
|
||||
color::palettes::basic::SILVER,
|
||||
pbr::wireframe::{WireframeConfig, WireframePlugin},
|
||||
prelude::*,
|
||||
render::{
|
||||
render_asset::RenderAssetUsages,
|
||||
|
@ -17,10 +21,18 @@ fn main() {
|
|||
App::new()
|
||||
.add_plugins((
|
||||
DefaultPlugins.set(ImagePlugin::default_nearest()),
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
WireframePlugin,
|
||||
))
|
||||
.add_systems(Startup, setup)
|
||||
.add_systems(Update, (rotate, toggle_wireframe))
|
||||
.add_systems(
|
||||
Update,
|
||||
(
|
||||
rotate,
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
toggle_wireframe,
|
||||
),
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -128,6 +140,7 @@ fn setup(
|
|||
..default()
|
||||
});
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
commands.spawn(
|
||||
TextBundle::from_section("Press space to toggle wireframes", TextStyle::default())
|
||||
.with_style(Style {
|
||||
|
@ -174,6 +187,7 @@ fn uv_debug_texture() -> Image {
|
|||
)
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn toggle_wireframe(
|
||||
mut wireframe_config: ResMut<WireframeConfig>,
|
||||
keyboard: Res<ButtonInput<KeyCode>>,
|
||||
|
|
Loading…
Reference in a new issue