Skip to content

Commit 5bccb67

Browse files
committed
Remove unused material (#1898)
This doesn't do anything and complicates the example.
1 parent 5c4f355 commit 5bccb67

File tree

1 file changed

+8
-39
lines changed

1 file changed

+8
-39
lines changed

examples/shader/mesh_custom_attribute.rs

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
use bevy::{
22
prelude::*,
3-
reflect::TypeUuid,
43
render::{
54
mesh::{shape, VertexAttributeValues},
65
pipeline::{PipelineDescriptor, RenderPipeline},
7-
render_graph::{base, AssetRenderResourcesNode, RenderGraph},
8-
renderer::RenderResources,
96
shader::{ShaderStage, ShaderStages},
107
},
118
};
@@ -14,15 +11,10 @@ use bevy::{
1411
fn main() {
1512
App::build()
1613
.add_plugins(DefaultPlugins)
17-
.add_asset::<MyMaterialWithVertexColorSupport>()
1814
.add_startup_system(setup.system())
1915
.run();
2016
}
2117

22-
#[derive(RenderResources, Default, TypeUuid)]
23-
#[uuid = "0320b9b8-b3a3-4baa-8bfa-c94008177b17"]
24-
struct MyMaterialWithVertexColorSupport;
25-
2618
const VERTEX_SHADER: &str = r#"
2719
#version 450
2820
layout(location = 0) in vec3 Vertex_Position;
@@ -56,34 +48,13 @@ fn setup(
5648
mut pipelines: ResMut<Assets<PipelineDescriptor>>,
5749
mut shaders: ResMut<Assets<Shader>>,
5850
mut meshes: ResMut<Assets<Mesh>>,
59-
mut materials: ResMut<Assets<MyMaterialWithVertexColorSupport>>,
60-
mut render_graph: ResMut<RenderGraph>,
6151
) {
6252
// Create a new shader pipeline
6353
let pipeline_handle = pipelines.add(PipelineDescriptor::default_config(ShaderStages {
6454
vertex: shaders.add(Shader::from_glsl(ShaderStage::Vertex, VERTEX_SHADER)),
6555
fragment: Some(shaders.add(Shader::from_glsl(ShaderStage::Fragment, FRAGMENT_SHADER))),
6656
}));
6757

68-
// Add an AssetRenderResourcesNode to our Render Graph. This will bind
69-
// MyMaterialWithVertexColorSupport resources to our shader
70-
render_graph.add_system_node(
71-
"my_material_with_vertex_color_support",
72-
AssetRenderResourcesNode::<MyMaterialWithVertexColorSupport>::new(true),
73-
);
74-
75-
// Add a Render Graph edge connecting our new "my_material" node to the main pass node. This
76-
// ensures "my_material" runs before the main pass
77-
render_graph
78-
.add_node_edge(
79-
"my_material_with_vertex_color_support",
80-
base::node::MAIN_PASS,
81-
)
82-
.unwrap();
83-
84-
// Create a new material
85-
let material = materials.add(MyMaterialWithVertexColorSupport {});
86-
8758
// create a generic cube
8859
let mut cube_with_vertex_colors = Mesh::from(shape::Cube { size: 2.0 });
8960

@@ -128,16 +99,14 @@ fn setup(
12899
]),
129100
);
130101
// cube
131-
commands
132-
.spawn_bundle(MeshBundle {
133-
mesh: meshes.add(cube_with_vertex_colors), // use our cube with vertex colors
134-
render_pipelines: RenderPipelines::from_pipelines(vec![RenderPipeline::new(
135-
pipeline_handle,
136-
)]),
137-
transform: Transform::from_xyz(0.0, 0.0, 0.0),
138-
..Default::default()
139-
})
140-
.insert(material);
102+
commands.spawn_bundle(MeshBundle {
103+
mesh: meshes.add(cube_with_vertex_colors), // use our cube with vertex colors
104+
render_pipelines: RenderPipelines::from_pipelines(vec![RenderPipeline::new(
105+
pipeline_handle,
106+
)]),
107+
transform: Transform::from_xyz(0.0, 0.0, 0.0),
108+
..Default::default()
109+
});
141110
// camera
142111
commands.spawn_bundle(PerspectiveCameraBundle {
143112
transform: Transform::from_xyz(3.0, 5.0, -8.0).looking_at(Vec3::ZERO, Vec3::Y),

0 commit comments

Comments
 (0)