diff options
author | David Robillard <d@drobilla.net> | 2021-01-02 21:09:27 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-01-02 21:09:27 +0100 |
commit | 1c365945ed2ebd5b9f54eb0c8c5c1c6d97cad712 (patch) | |
tree | 4b77266a9ce3e2a11b59bbd2754869c6ee1d172b /examples/shaders | |
parent | a92a194b4fc64e0cfa4a88a59e261f236414d61c (diff) | |
download | pugl-1c365945ed2ebd5b9f54eb0c8c5c1c6d97cad712.tar.gz pugl-1c365945ed2ebd5b9f54eb0c8c5c1c6d97cad712.tar.bz2 pugl-1c365945ed2ebd5b9f54eb0c8c5c1c6d97cad712.zip |
Simplify clang-format configuration and format all code
Diffstat (limited to 'examples/shaders')
-rw-r--r-- | examples/shaders/header_330.glsl | 1 | ||||
-rw-r--r-- | examples/shaders/header_420.glsl | 1 | ||||
-rw-r--r-- | examples/shaders/rect.frag | 22 | ||||
-rw-r--r-- | examples/shaders/rect.vert | 27 |
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); } |