aboutsummaryrefslogtreecommitdiffstats
path: root/examples/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'examples/shaders')
-rw-r--r--examples/shaders/header_330.glsl1
-rw-r--r--examples/shaders/header_420.glsl1
-rw-r--r--examples/shaders/rect.frag22
-rw-r--r--examples/shaders/rect.vert27
4 files changed, 25 insertions, 26 deletions
diff --git a/examples/shaders/header_330.glsl b/examples/shaders/header_330.glsl
index bfe7a00..59d5f6f 100644
--- a/examples/shaders/header_330.glsl
+++ b/examples/shaders/header_330.glsl
@@ -2,4 +2,3 @@
#define INTER(qualifiers)
#define UBO(qualifiers) layout(std140)
-
diff --git a/examples/shaders/header_420.glsl b/examples/shaders/header_420.glsl
index 55fbe8a..2beaad0 100644
--- a/examples/shaders/header_420.glsl
+++ b/examples/shaders/header_420.glsl
@@ -2,4 +2,3 @@
#define INTER(qualifiers) layout(qualifiers)
#define UBO(qualifiers) layout(std140, qualifiers)
-
diff --git a/examples/shaders/rect.frag b/examples/shaders/rect.frag
index ecec50d..33bfbb2 100644
--- a/examples/shaders/rect.frag
+++ b/examples/shaders/rect.frag
@@ -17,17 +17,17 @@ layout(location = 0) out vec4 FragColor;
void
main()
{
- const float borderWidth = 2.0;
+ const float borderWidth = 2.0;
- vec4 borderColor = f_fillColor + vec4(0.0, 0.4, 0.4, 0.0);
- float t = step(borderWidth, f_uv[1]);
- float r = step(borderWidth, f_size.x - f_uv[0]);
- float b = step(borderWidth, f_size.y - f_uv[1]);
- float l = step(borderWidth, f_uv[0]);
- float fillMix = t * r * b * l;
- float borderMix = 1.0 - fillMix;
- vec4 fill = fillMix * f_fillColor;
- vec4 border = borderMix * borderColor;
+ vec4 borderColor = f_fillColor + vec4(0.0, 0.4, 0.4, 0.0);
+ float t = step(borderWidth, f_uv[1]);
+ float r = step(borderWidth, f_size.x - f_uv[0]);
+ float b = step(borderWidth, f_size.y - f_uv[1]);
+ float l = step(borderWidth, f_uv[0]);
+ float fillMix = t * r * b * l;
+ float borderMix = 1.0 - fillMix;
+ vec4 fill = fillMix * f_fillColor;
+ vec4 border = borderMix * borderColor;
- FragColor = fill + border;
+ FragColor = fill + border;
}
diff --git a/examples/shaders/rect.vert b/examples/shaders/rect.vert
index 09f1917..2c7b5f1 100644
--- a/examples/shaders/rect.vert
+++ b/examples/shaders/rect.vert
@@ -3,8 +3,9 @@
UBO(binding = 0) uniform UniformBufferObject
{
- mat4 projection;
-} ubo;
+ mat4 projection;
+}
+ubo;
layout(location = 0) in vec2 v_position;
layout(location = 1) in vec2 v_origin;
@@ -18,18 +19,18 @@ INTER(location = 2) noperspective out vec4 f_fillColor;
void
main()
{
- // clang-format off
- mat4 m = mat4(v_size[0], 0.0, 0.0, 0.0,
- 0.0, v_size[1], 0.0, 0.0,
- 0.0, 0.0, 1.0, 0.0,
- v_origin[0], v_origin[1], 0.0, 1.0);
- // clang-format on
+ // clang-format off
+ mat4 m = mat4(v_size[0], 0.0, 0.0, 0.0,
+ 0.0, v_size[1], 0.0, 0.0,
+ 0.0, 0.0, 1.0, 0.0,
+ v_origin[0], v_origin[1], 0.0, 1.0);
+ // clang-format on
- mat4 MVP = ubo.projection * m;
+ mat4 MVP = ubo.projection * m;
- f_uv = v_position * v_size;
- f_size = v_size;
- f_fillColor = v_fillColor;
+ f_uv = v_position * v_size;
+ f_size = v_size;
+ f_fillColor = v_fillColor;
- gl_Position = MVP * vec4(v_position, 0.0, 1.0);
+ gl_Position = MVP * vec4(v_position, 0.0, 1.0);
}