From 5bccb67aa32d7802620d99fdcf2ea03917c8d115 Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Tue, 13 Apr 2021 02:39:50 +0000 Subject: [PATCH] Remove unused material (#1898) This doesn't do anything and complicates the example. --- examples/shader/mesh_custom_attribute.rs | 47 ++++-------------------- 1 file changed, 8 insertions(+), 39 deletions(-) diff --git a/examples/shader/mesh_custom_attribute.rs b/examples/shader/mesh_custom_attribute.rs index 5fc22dc6e1..c8d329d3c5 100644 --- a/examples/shader/mesh_custom_attribute.rs +++ b/examples/shader/mesh_custom_attribute.rs @@ -1,11 +1,8 @@ use bevy::{ prelude::*, - reflect::TypeUuid, render::{ mesh::{shape, VertexAttributeValues}, pipeline::{PipelineDescriptor, RenderPipeline}, - render_graph::{base, AssetRenderResourcesNode, RenderGraph}, - renderer::RenderResources, shader::{ShaderStage, ShaderStages}, }, }; @@ -14,15 +11,10 @@ use bevy::{ fn main() { App::build() .add_plugins(DefaultPlugins) - .add_asset::() .add_startup_system(setup.system()) .run(); } -#[derive(RenderResources, Default, TypeUuid)] -#[uuid = "0320b9b8-b3a3-4baa-8bfa-c94008177b17"] -struct MyMaterialWithVertexColorSupport; - const VERTEX_SHADER: &str = r#" #version 450 layout(location = 0) in vec3 Vertex_Position; @@ -56,8 +48,6 @@ fn setup( mut pipelines: ResMut>, mut shaders: ResMut>, mut meshes: ResMut>, - mut materials: ResMut>, - mut render_graph: ResMut, ) { // Create a new shader pipeline let pipeline_handle = pipelines.add(PipelineDescriptor::default_config(ShaderStages { @@ -65,25 +55,6 @@ fn setup( fragment: Some(shaders.add(Shader::from_glsl(ShaderStage::Fragment, FRAGMENT_SHADER))), })); - // Add an AssetRenderResourcesNode to our Render Graph. This will bind - // MyMaterialWithVertexColorSupport resources to our shader - render_graph.add_system_node( - "my_material_with_vertex_color_support", - AssetRenderResourcesNode::::new(true), - ); - - // Add a Render Graph edge connecting our new "my_material" node to the main pass node. This - // ensures "my_material" runs before the main pass - render_graph - .add_node_edge( - "my_material_with_vertex_color_support", - base::node::MAIN_PASS, - ) - .unwrap(); - - // Create a new material - let material = materials.add(MyMaterialWithVertexColorSupport {}); - // create a generic cube let mut cube_with_vertex_colors = Mesh::from(shape::Cube { size: 2.0 }); @@ -128,16 +99,14 @@ fn setup( ]), ); // cube - commands - .spawn_bundle(MeshBundle { - mesh: meshes.add(cube_with_vertex_colors), // use our cube with vertex colors - render_pipelines: RenderPipelines::from_pipelines(vec![RenderPipeline::new( - pipeline_handle, - )]), - transform: Transform::from_xyz(0.0, 0.0, 0.0), - ..Default::default() - }) - .insert(material); + commands.spawn_bundle(MeshBundle { + mesh: meshes.add(cube_with_vertex_colors), // use our cube with vertex colors + render_pipelines: RenderPipelines::from_pipelines(vec![RenderPipeline::new( + pipeline_handle, + )]), + transform: Transform::from_xyz(0.0, 0.0, 0.0), + ..Default::default() + }); // camera commands.spawn_bundle(PerspectiveCameraBundle { transform: Transform::from_xyz(3.0, 5.0, -8.0).looking_at(Vec3::ZERO, Vec3::Y),