Skip to content

Commit de097f4

Browse files
committed
docs and PR fixes
1 parent 6f35da3 commit de097f4

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

crates/bevy_pbr/src/wireframe.rs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ use bevy_render::{
1515
pub const WIREFRAME_SHADER_HANDLE: Handle<Shader> = Handle::weak_from_u128(192598014480025766);
1616

1717
/// A [`Plugin`] that draws wireframes.
18+
///
19+
/// Wireframes currently do not work when using webgl or webgpu.
20+
/// Supported platforms:
21+
/// - DX12
22+
/// - Vulkan
23+
/// - Metal
24+
///
25+
/// This is a native only feature.
1826
#[derive(Debug, Default)]
1927
pub struct WireframePlugin;
2028

@@ -31,8 +39,11 @@ impl Plugin for WireframePlugin {
3139
.register_type::<WireframeConfig>()
3240
.init_resource::<WireframeConfig>()
3341
.add_plugins(MaterialPlugin::<WireframeMaterial>::default())
34-
.add_systems(Startup, setup)
35-
.add_systems(Update, (apply_global, apply_material));
42+
.add_systems(Startup, setup_global_wireframe_material)
43+
.add_systems(
44+
Update,
45+
(apply_global_wireframe_material, apply_wireframe_material),
46+
);
3647
}
3748
}
3849

@@ -58,15 +69,18 @@ struct GlobalWireframeMaterial {
5869
handle: Handle<WireframeMaterial>,
5970
}
6071

61-
fn setup(mut commands: Commands, mut materials: ResMut<Assets<WireframeMaterial>>) {
72+
fn setup_global_wireframe_material(
73+
mut commands: Commands,
74+
mut materials: ResMut<Assets<WireframeMaterial>>,
75+
) {
6276
// Create the handle used for the global material
6377
commands.insert_resource(GlobalWireframeMaterial {
6478
handle: materials.add(WireframeMaterial {}),
6579
});
6680
}
6781

68-
/// Applies the wireframe material to any mesh with a [`Wireframe`] component.
69-
fn apply_material(
82+
/// Applies or remove the wireframe material to any mesh with a [`Wireframe`] component.
83+
fn apply_wireframe_material(
7084
mut commands: Commands,
7185
mut materials: ResMut<Assets<WireframeMaterial>>,
7286
wireframes: Query<Entity, (With<Wireframe>, Without<Handle<WireframeMaterial>>)>,
@@ -87,7 +101,7 @@ fn apply_material(
87101

88102
/// Applies or removes a wireframe material on any mesh without a [`Wireframe`] component.
89103
#[allow(clippy::type_complexity)]
90-
fn apply_global(
104+
fn apply_global_wireframe_material(
91105
mut commands: Commands,
92106
config: Res<WireframeConfig>,
93107
meshes_without_material: Query<

examples/3d/wireframe.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
//! Showcases wireframe rendering.
2+
//!
3+
//! Wireframes currently do not work when using webgl or webgpu.
4+
//! Supported platforms:
5+
//! - DX12
6+
//! - Vulkan
7+
//! - Metal
8+
//!
9+
//! This is a native only feature.
210
311
use bevy::{
412
pbr::wireframe::{Wireframe, WireframeConfig, WireframePlugin},

0 commit comments

Comments
 (0)