diff options
author | enricoturri1966 <enricoturri@seznam.cz> | 2020-05-26 09:16:08 +0300 |
---|---|---|
committer | enricoturri1966 <enricoturri@seznam.cz> | 2020-05-26 09:16:08 +0300 |
commit | 1d317489fd096751335c633a85b2ff2ee1669e2d (patch) | |
tree | b757ab8c2dfe4c243f4e3ee6019d53f79c13f92d /resources | |
parent | 13098938ac3c1ad1b4d5f2b6795ed461e06a4ab2 (diff) |
GCodeViewer -> Temporary ImGui dialog for editing shaders parameters
Diffstat (limited to 'resources')
-rw-r--r-- | resources/shaders/options_120.fs | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/resources/shaders/options_120.fs b/resources/shaders/options_120.fs index 1c53f6c72..90d417b6e 100644 --- a/resources/shaders/options_120.fs +++ b/resources/shaders/options_120.fs @@ -2,6 +2,26 @@ #version 120 uniform vec3 uniform_color; +uniform float percent_outline_radius; +uniform float percent_center_radius; + +vec4 hard_color(float sq_radius) +{ + if ((sq_radius < 0.005625) || (sq_radius > 0.180625)) + return vec4(0.5 * uniform_color, 1.0); + else + return vec4(uniform_color, 1.0); +} + +vec4 custom_color(float sq_radius) +{ + float in_radius = 0.5 * percent_center_radius; + float out_radius = 0.5 * (1.0 - percent_outline_radius); + if ((sq_radius < in_radius * in_radius) || (sq_radius > out_radius * out_radius)) + return vec4(0.5 * uniform_color, 1.0); + else + return vec4(uniform_color, 1.0); +} void main() { @@ -9,9 +29,6 @@ void main() float sq_radius = dot(pos, pos); if (sq_radius > 0.25) discard; - - if ((sq_radius < 0.005625) || (sq_radius > 0.180625)) - gl_FragColor = vec4(0.5 * uniform_color, 1.0); - else - gl_FragColor = vec4(uniform_color, 1.0); + + gl_FragColor = custom_color(sq_radius); } |