runmat_plot/gpu/shaders/vertex/
point.rs1pub const SHADER: &str = r#"// Point vertex shader for scatter plots and point clouds
2
3struct Uniforms {
4 view_proj: mat4x4<f32>,
5 model: mat4x4<f32>,
6 normal_matrix: mat3x4<f32>,
7}
8
9@group(0) @binding(0)
10var<uniform> uniforms: Uniforms;
11
12struct VertexInput {
13 @location(0) position: vec3<f32>,
14 @location(1) color: vec4<f32>,
15 @location(2) normal: vec3<f32>,
16 @location(3) tex_coords: vec2<f32>,
17}
18
19struct VertexOutput {
20 @builtin(position) clip_position: vec4<f32>,
21 @location(0) color: vec4<f32>,
22 @location(1) world_position: vec3<f32>,
23 @location(2) normal: vec3<f32>,
24}
25
26@vertex
27fn vs_main(input: VertexInput) -> VertexOutput {
28 var out: VertexOutput;
29
30 let world_position = uniforms.model * vec4<f32>(input.position, 1.0);
31 out.clip_position = uniforms.view_proj * world_position;
32 out.world_position = world_position.xyz;
33 out.color = input.color;
34 out.normal = input.normal;
35
36 return out;
37}
38
39@fragment
40fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
41 return input.color;
42}
43"#;