Skip to content

Commit

Permalink
Break UI
Browse files Browse the repository at this point in the history
Signed-off-by: Torstein Grindvik <[email protected]>
  • Loading branch information
torsteingrindvik committed Dec 23, 2022
1 parent 9e75efe commit ebf98b7
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_core_pipeline/src/core_2d/main_pass_2d_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl Node for MainPass2dNode {
color_attachments.push(Some(picking_textures.get_color_attachment(Operations {
load: LoadOp::Clear(PickingTextures::clear_color()),
store: true,
})))
})));
}

let pass_descriptor = RenderPassDescriptor {
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_core_pipeline/src/core_3d/main_pass_3d_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl Node for MainPass3dNode {
color_attachments.push(Some(picking_textures.get_color_attachment(Operations {
load: LoadOp::Clear(PickingTextures::clear_color()),
store: true,
})))
})));
}

let pass_descriptor = RenderPassDescriptor {
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_pbr/src/render/mesh_types.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
struct Mesh {
model: mat4x4<f32>,
inverse_transpose_model: mat4x4<f32>,
#ifdef PICKING
entity_index: u32,
#endif
// 'flags' is a bit field indicating various options. u32 is 32 bits so we have up to 32 options.
flags: u32,
};
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_sprite/src/mesh2d/mesh2d_types.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
struct Mesh2d {
model: mat4x4<f32>,
inverse_transpose_model: mat4x4<f32>,
#ifdef PICKING
entity_index: u32,
#endif
// 'flags' is a bit field indicating various options. u32 is 32 bits so we have up to 32 options.
flags: u32,
};
6 changes: 6 additions & 0 deletions crates/bevy_sprite/src/render/sprite.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ var<uniform> view: View;

struct VertexOutput {
@location(0) uv: vec2<f32>,
#ifdef PICKING
@location(1) entity_index: u32,
#endif
#ifdef COLORED
@location(2) color: vec4<f32>,
#endif
Expand All @@ -29,14 +31,18 @@ struct VertexOutput {
fn vertex(
@location(0) vertex_position: vec3<f32>,
@location(1) vertex_uv: vec2<f32>,
#ifdef PICKING
@location(2) entity_index: u32,
#endif
#ifdef COLORED
@location(3) vertex_color: vec4<f32>,
#endif
) -> VertexOutput {
var out: VertexOutput;
out.uv = vertex_uv;
#ifdef PICKING
out.entity_index = entity_index;
#endif
out.position = view.view_proj * vec4<f32>(vertex_position, 1.0);
#ifdef COLORED
out.color = vertex_color;
Expand Down
10 changes: 8 additions & 2 deletions crates/bevy_ui/src/render/ui.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,30 @@ struct View {
var<uniform> view: View;

struct VertexOutput {
@builtin(position) position: vec4<f32>,
@location(0) uv: vec2<f32>,
@location(1) color: vec4<f32>,
#ifdef PICKING
@location(2) entity_index: u32,
@builtin(position) position: vec4<f32>,
#endif
};

@vertex
fn vertex(
@location(0) vertex_position: vec3<f32>,
@location(1) vertex_uv: vec2<f32>,
@location(2) vertex_color: vec4<f32>,
#ifdef PICKING
@location(3) entity_index: u32,
#endif
) -> VertexOutput {
var out: VertexOutput;
out.uv = vertex_uv;
out.position = view.view_proj * vec4<f32>(vertex_position, 1.0);
out.uv = vertex_uv;
out.color = vertex_color;
#ifdef PICKING
out.entity_index = entity_index;
#endif
return out;
}

Expand Down

0 comments on commit ebf98b7

Please sign in to comment.