Skip to content

Commit 4983a41

Browse files
committed
yeet vertex shader
1 parent de097f4 commit 4983a41

File tree

2 files changed

+2
-64
lines changed

2 files changed

+2
-64
lines changed
Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,6 @@
1-
#import bevy_pbr::mesh_bindings mesh
2-
#import bevy_pbr::mesh_functions get_model_matrix, mesh_position_local_to_clip
3-
#import bevy_pbr::morph
4-
5-
#ifdef SKINNED
6-
#import bevy_pbr::skinning
7-
#endif
8-
9-
struct Vertex {
10-
@builtin(instance_index) instance_index: u32,
11-
@location(0) position: vec3<f32>,
12-
#ifdef SKINNED
13-
@location(5) joint_indexes: vec4<u32>,
14-
@location(6) joint_weights: vec4<f32>,
15-
#endif
16-
#ifdef MORPH_TARGETS
17-
@builtin(vertex_index) index: u32,
18-
#endif
19-
};
20-
21-
struct VertexOutput {
22-
@builtin(position) clip_position: vec4<f32>,
23-
};
24-
25-
26-
#ifdef MORPH_TARGETS
27-
fn morph_vertex(vertex_in: Vertex) -> Vertex {
28-
var vertex = vertex_in;
29-
let weight_count = bevy_pbr::morph::layer_count();
30-
for (var i: u32 = 0u; i < weight_count; i ++) {
31-
let weight = bevy_pbr::morph::weight_at(i);
32-
if weight == 0.0 {
33-
continue;
34-
}
35-
vertex.position += weight * bevy_pbr::morph::morph(vertex.index, bevy_pbr::morph::position_offset, i);
36-
}
37-
return vertex;
38-
}
39-
#endif
40-
41-
@vertex
42-
fn vertex(vertex_no_morph: Vertex) -> VertexOutput {
43-
44-
#ifdef MORPH_TARGETS
45-
var vertex = morph_vertex(vertex_no_morph);
46-
#else
47-
var vertex = vertex_no_morph;
48-
#endif
49-
50-
#ifdef SKINNED
51-
let model = bevy_pbr::skinning::skin_model(vertex.joint_indexes, vertex.joint_weights);
52-
#else
53-
let model = get_model_matrix(vertex.instance_index);
54-
#endif
55-
56-
var out: VertexOutput;
57-
out.clip_position = mesh_position_local_to_clip(model, vec4<f32>(vertex.position, 1.0));
58-
return out;
59-
}
1+
#import bevy_pbr::mesh_vertex_output MeshVertexOutput
602

613
@fragment
62-
fn fragment() -> @location(0) vec4<f32> {
4+
fn fragment(in: MeshVertexOutput) -> @location(0) vec4<f32> {
635
return vec4<f32>(1.0, 1.0, 1.0, 1.0);
646
}

crates/bevy_pbr/src/wireframe.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,6 @@ fn apply_global_wireframe_material(
146146
struct WireframeMaterial {}
147147

148148
impl Material for WireframeMaterial {
149-
fn vertex_shader() -> ShaderRef {
150-
WIREFRAME_SHADER_HANDLE.into()
151-
}
152-
153149
fn fragment_shader() -> ShaderRef {
154150
WIREFRAME_SHADER_HANDLE.into()
155151
}

0 commit comments

Comments
 (0)