mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-12 02:02:20 +00:00
99 lines
3.0 KiB
GLSL
99 lines
3.0 KiB
GLSL
(
|
|
name: "GizmoShader",
|
|
|
|
resources: [
|
|
(
|
|
name: "properties",
|
|
kind: PropertyGroup([
|
|
(
|
|
name: "diffuseColor",
|
|
kind: Color(r: 255, g: 255, b: 255, a: 255),
|
|
),
|
|
]),
|
|
binding: 0
|
|
),
|
|
(
|
|
name: "fyrox_instanceData",
|
|
kind: PropertyGroup([
|
|
// Autogenerated
|
|
]),
|
|
binding: 1
|
|
),
|
|
],
|
|
|
|
disabled_passes: ["GBuffer", "DirectionalShadow", "PointShadow", "SpotShadow"],
|
|
|
|
passes: [
|
|
(
|
|
name: "Forward",
|
|
draw_parameters: DrawParameters(
|
|
cull_face: None,
|
|
color_write: ColorMask(
|
|
red: true,
|
|
green: true,
|
|
blue: true,
|
|
alpha: true,
|
|
),
|
|
depth_write: true,
|
|
stencil_test: None,
|
|
depth_test: Some(Less),
|
|
blend: Some(BlendParameters(
|
|
func: BlendFunc(
|
|
sfactor: SrcAlpha,
|
|
dfactor: OneMinusSrcAlpha,
|
|
alpha_sfactor: SrcAlpha,
|
|
alpha_dfactor: OneMinusSrcAlpha,
|
|
),
|
|
equation: BlendEquation(
|
|
rgb: Add,
|
|
alpha: Add
|
|
)
|
|
)),
|
|
stencil_op: StencilOp(
|
|
fail: Keep,
|
|
zfail: Keep,
|
|
zpass: Keep,
|
|
write_mask: 0xFFFF_FFFF,
|
|
),
|
|
scissor_box: None
|
|
),
|
|
vertex_shader:
|
|
r#"
|
|
struct VertexInput {
|
|
@location(0) vertexPosition: vec3f,
|
|
};
|
|
|
|
struct VertexOutput {
|
|
@builtin(position) position: vec4f,
|
|
};
|
|
|
|
@vertex
|
|
fn vs_main(input: VertexInput) -> VertexOutput {
|
|
var output: VertexOutput;
|
|
output.position = fyrox_instanceData.worldViewProjection * vec4f(input.vertexPosition, 1.0);
|
|
return output;
|
|
}
|
|
"#,
|
|
|
|
fragment_shader:
|
|
r#"
|
|
struct FragOutput {
|
|
@location(0) color: vec4f,
|
|
@builtin(frag_depth) depth: f32,
|
|
};
|
|
|
|
@fragment
|
|
fn fs_main(@builtin(position) fragCoord: vec4f) -> FragOutput {
|
|
var output: FragOutput;
|
|
output.color = properties.diffuseColor;
|
|
|
|
// Pull depth towards near clipping plane so the gizmo will be drawn on top
|
|
// of everything, but its parts will be correctly handled by depth test.
|
|
output.depth = fragCoord.z * 0.001;
|
|
return output;
|
|
}
|
|
"#,
|
|
),
|
|
],
|
|
)
|