Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use bevy::{
},
texture::BevyDefault,
view::{ComputedVisibility, Msaa, VisibleEntities},
RenderApp, RenderStage,
Extract, RenderApp, RenderStage,
},
sprite::{
DrawMesh2d, Mesh2dHandle, Mesh2dPipeline, Mesh2dPipelineKey, Mesh2dUniform,
Expand Down Expand Up @@ -84,11 +84,11 @@ impl SpecializedRenderPipeline for ShapePipeline {
shader: SHAPE_SHADER_HANDLE.typed::<Shader>(),
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![
Expand Down Expand Up @@ -160,11 +160,11 @@ impl Plugin for RenderShapePlugin {
fn extract_shape(
mut commands: Commands,
mut previous_len: Local<usize>,
query: Query<(Entity, &ComputedVisibility), With<Shape>>,
query: Extract<Query<(Entity, &ComputedVisibility), With<Shape>>>,
) {
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,)));
Expand Down
18 changes: 9 additions & 9 deletions src/render/shape.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
//[[group(0), binding(0)]]
//var<uniform> view: View;
#import bevy_sprite::mesh2d_types
[[group(1), binding(0)]]
@group(1) @binding(0)
var<uniform> mesh: Mesh2d;
// The structure of the vertex buffer is as specified in `specialize()`
struct Vertex {
[[location(0)]] position: vec3<f32>;
[[location(1)]] color: vec4<f32>;
@location(0) position: vec3<f32>,
@location(1) color: vec4<f32>,
};
struct VertexOutput {
// The vertex shader must set the on-screen position of the vertex
[[builtin(position)]] clip_position: vec4<f32>;
@builtin(position) clip_position: vec4<f32>,
// We pass the vertex color to the framgent shader in location 0
[[location(0)]] color: vec4<f32>;
@location(0) color: vec4<f32>,
};
/// 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
Expand All @@ -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<f32>;
@location(0) color: vec4<f32>,
};
/// Entry point for the fragment shader
[[stage(fragment)]]
fn fragment(in: FragmentInput) -> [[location(0)]] vec4<f32> {
@fragment
fn fragment(in: FragmentInput) -> @location(0) vec4<f32> {
return in.color;
}