diff --git a/examples/svg.rs b/examples/svg.rs index 81edb0b..1a7efd1 100644 --- a/examples/svg.rs +++ b/examples/svg.rs @@ -32,8 +32,9 @@ fn setup_system(mut commands: Commands) { commands.spawn_bundle(BuildingBundle { name: Name("Blacksmith".to_owned()), transform:Transform::from_translation(Vec3::new(-50.,0.,0.)), - global_transform:GlobalTransform::default() + global_transform:GlobalTransform::default(), }) + .insert_bundle(VisibilityBundle::default()) .insert(BlacksmithMarker) //we split our art in this example to two children because our art is made out of 2 paths, //one path who's width is 4, diff --git a/src/render/mod.rs b/src/render/mod.rs index 8ac5f93..4158159 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -24,7 +24,7 @@ use bevy::{ }, texture::BevyDefault, view::{ComputedVisibility, Msaa, VisibleEntities}, - RenderApp, RenderStage, + Extract, RenderApp, RenderStage, }, sprite::{ DrawMesh2d, Mesh2dHandle, Mesh2dPipeline, Mesh2dPipelineKey, Mesh2dUniform, @@ -84,11 +84,11 @@ impl SpecializedRenderPipeline for ShapePipeline { shader: SHAPE_SHADER_HANDLE.typed::(), shader_defs: Vec::new(), entry_point: "fragment".into(), - targets: vec![ColorTargetState { + targets: vec![Some(ColorTargetState { format: TextureFormat::bevy_default(), blend: Some(BlendState::ALPHA_BLENDING), write_mask: ColorWrites::ALL, - }], + })], }), // Use the two standard uniforms for 2d meshes layout: Some(vec![ @@ -160,11 +160,11 @@ impl Plugin for RenderShapePlugin { fn extract_shape( mut commands: Commands, mut previous_len: Local, - query: Query<(Entity, &ComputedVisibility), With>, + query: Extract>>, ) { let mut values = Vec::with_capacity(*previous_len); for (entity, computed_visibility) in query.iter() { - if !computed_visibility.is_visible { + if !computed_visibility.is_visible() { continue; } values.push((entity, (Shape,))); diff --git a/src/render/shape.wgsl b/src/render/shape.wgsl index c451782..beaac4e 100644 --- a/src/render/shape.wgsl +++ b/src/render/shape.wgsl @@ -3,21 +3,21 @@ //[[group(0), binding(0)]] //var view: View; #import bevy_sprite::mesh2d_types -[[group(1), binding(0)]] +@group(1) @binding(0) var mesh: Mesh2d; // The structure of the vertex buffer is as specified in `specialize()` struct Vertex { - [[location(0)]] position: vec3; - [[location(1)]] color: vec4; + @location(0) position: vec3, + @location(1) color: vec4, }; struct VertexOutput { // The vertex shader must set the on-screen position of the vertex - [[builtin(position)]] clip_position: vec4; + @builtin(position) clip_position: vec4, // We pass the vertex color to the framgent shader in location 0 - [[location(0)]] color: vec4; + @location(0) color: vec4, }; /// Entry point for the vertex shader -[[stage(vertex)]] +@vertex fn vertex(vertex: Vertex) -> VertexOutput { var out: VertexOutput; // Project the world position of the mesh into screen position @@ -28,10 +28,10 @@ fn vertex(vertex: Vertex) -> VertexOutput { // The input of the fragment shader must correspond to the output of the vertex shader for all `location`s struct FragmentInput { // The color is interpolated between vertices by default - [[location(0)]] color: vec4; + @location(0) color: vec4, }; /// Entry point for the fragment shader -[[stage(fragment)]] -fn fragment(in: FragmentInput) -> [[location(0)]] vec4 { +@fragment +fn fragment(in: FragmentInput) -> @location(0) vec4 { return in.color; }