Skip to content

Commit

Permalink
update to main
Browse files Browse the repository at this point in the history
  • Loading branch information
IceSentry committed Jan 15, 2024
1 parent c98df11 commit 3b9f042
Show file tree
Hide file tree
Showing 2 changed files with 157 additions and 141 deletions.
27 changes: 12 additions & 15 deletions assets/shaders/custom_draw.wgsl
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
#import bevy_pbr::mesh_functions as mesh_functions
#import bevy_render::view View
#import bevy_pbr::mesh_types Mesh
#import bevy_pbr::{
mesh_types::Mesh,
view_transformations,
forward_io::Vertex,
}
#import bevy_render::view::View

@group(0) @binding(0)
var<uniform> view: View;
@group(0) @binding(0) var<uniform> view: View;
@group(1) @binding(0) var<uniform> mesh: Mesh;

struct CustomMaterial {
color: vec4<f32>,
};
@group(1) @binding(0)
var<uniform> material: CustomMaterial;

@group(2) @binding(0)
var<uniform> mesh: Mesh;

struct Vertex {
@location(0) position: vec3<f32>,
};
@group(2) @binding(0) var<uniform> material: CustomMaterial;

struct VertexOutput {
@builtin(position) position: vec4<f32>,
Expand All @@ -25,8 +21,9 @@ struct VertexOutput {
@vertex
fn vertex(vertex: Vertex) -> VertexOutput {
var out: VertexOutput;
let world_position = mesh_functions::mesh_position_local_to_world(mesh.model, vec4(vertex.position, 1.0));
out.position = mesh_functions::mesh_position_world_to_clip(world_position);
let model = mesh_functions::get_model_matrix(vertex.instance_index);
let world_position = mesh_functions::mesh_position_local_to_world(model, vec4<f32>(vertex.position, 1.0));
out.position = view_transformations::position_world_to_clip(world_position.xyz);
return out;
}

Expand Down
Loading

0 comments on commit 3b9f042

Please sign in to comment.