Skip to content

Commit

Permalink
Fix bar.wgsl
Browse files Browse the repository at this point in the history
  • Loading branch information
Indy2222 committed Feb 20, 2024
1 parent d1b34fb commit e4458b3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions assets/shaders/bar.wgsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import bevy_pbr::{
mesh_bindings::mesh,
mesh_functions::mesh_position_local_to_clip,
mesh_functions::{get_model_matrix, mesh_position_local_to_clip},
}

const BACKGROUND_COLOR = vec4<f32>(0., 0., 0., 0.75);
Expand All @@ -10,6 +10,7 @@ const FOREGROUND_COLOR = vec4<f32>(0.6, 1., 0.6, 0.75);
var<uniform> value: f32;

struct Vertex {
@builtin(instance_index) instance_index: u32,
@location(0) position: vec2<f32>,
@location(1) uv: vec2<f32>,
};
Expand All @@ -27,7 +28,10 @@ struct FragmentInput {
fn vertex(vertex: Vertex) -> VertexOutput {
var out: VertexOutput;

out.clip_position = mesh_position_local_to_clip(mesh.model, vec4<f32>(0., 0., 0., 1.0));
out.clip_position = mesh_position_local_to_clip(
get_model_matrix(vertex.instance_index),
vec4<f32>(0., 0., 0., 1.0),
);

let scale = max(1., out.clip_position.w / 40.);
out.clip_position += vec4<f32>(scale * vertex.position, 0., 0.);
Expand Down

0 comments on commit e4458b3

Please sign in to comment.