2023-03-20 20:57:54 +00:00
|
|
|
#ifdef GIZMO_LINES_3D
|
|
|
|
#import bevy_pbr::mesh_view_bindings
|
|
|
|
#else
|
|
|
|
#import bevy_sprite::mesh2d_view_bindings
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct VertexInput {
|
|
|
|
@location(0) pos: vec3<f32>,
|
|
|
|
@location(1) color: vec4<f32>,
|
|
|
|
}
|
|
|
|
|
|
|
|
struct VertexOutput {
|
|
|
|
@builtin(position) pos: vec4<f32>,
|
|
|
|
@location(0) color: vec4<f32>,
|
|
|
|
}
|
|
|
|
|
|
|
|
struct FragmentOutput {
|
2023-03-29 18:05:03 +00:00
|
|
|
#ifdef GIZMO_LINES_3D
|
2023-03-20 20:57:54 +00:00
|
|
|
@builtin(frag_depth) depth: f32,
|
2023-03-29 18:05:03 +00:00
|
|
|
#endif
|
2023-03-20 20:57:54 +00:00
|
|
|
@location(0) color: vec4<f32>,
|
|
|
|
}
|
|
|
|
|
|
|
|
@vertex
|
|
|
|
fn vertex(in: VertexInput) -> VertexOutput {
|
|
|
|
var out: VertexOutput;
|
|
|
|
|
|
|
|
out.pos = view.view_proj * vec4<f32>(in.pos, 1.0);
|
|
|
|
out.color = in.color;
|
|
|
|
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
@fragment
|
|
|
|
fn fragment(in: VertexOutput) -> FragmentOutput {
|
|
|
|
var out: FragmentOutput;
|
|
|
|
|
2023-03-29 18:05:03 +00:00
|
|
|
#ifdef GIZMO_LINES_3D
|
2023-03-20 20:57:54 +00:00
|
|
|
#ifdef DEPTH_TEST
|
|
|
|
out.depth = in.pos.z;
|
|
|
|
#else
|
|
|
|
out.depth = 1.0;
|
2023-03-29 18:05:03 +00:00
|
|
|
#endif
|
2023-03-20 20:57:54 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
out.color = in.color;
|
|
|
|
return out;
|
|
|
|
}
|