summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/28-wireframe/fs_wf_wireframe.sc
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/examples/28-wireframe/fs_wf_wireframe.sc')
-rw-r--r--3rdparty/bgfx/examples/28-wireframe/fs_wf_wireframe.sc26
1 files changed, 26 insertions, 0 deletions
diff --git a/3rdparty/bgfx/examples/28-wireframe/fs_wf_wireframe.sc b/3rdparty/bgfx/examples/28-wireframe/fs_wf_wireframe.sc
new file mode 100644
index 00000000000..e2ff1420011
--- /dev/null
+++ b/3rdparty/bgfx/examples/28-wireframe/fs_wf_wireframe.sc
@@ -0,0 +1,26 @@
+$input v_view, v_bc
+
+/*
+ * Copyright 2016 Dario Manesku. All rights reserved.
+ * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
+ */
+
+#include "../common/common.sh"
+#include "uniforms.sh"
+
+void main()
+{
+ vec3 color = u_wfColor;
+ float opacity = u_wfOpacity;
+ float thickness = u_wfThickness;
+
+ if (gl_FrontFacing) { opacity *= 0.5; }
+
+ vec3 fw = abs(dFdx(v_bc)) + abs(dFdy(v_bc));
+ vec3 val = smoothstep(vec3_splat(0.0), fw*thickness, v_bc);
+ float edge = min(min(val.x, val.y), val.z); // Gets to 0.0 around the edges.
+
+ vec4 rgba = vec4(color, (1.0-edge)*opacity);
+ gl_FragColor = rgba;
+}
+