diff options
author | enricoturri1966 <enricoturri@seznam.cz> | 2020-08-26 16:29:33 +0300 |
---|---|---|
committer | enricoturri1966 <enricoturri@seznam.cz> | 2020-08-26 16:29:33 +0300 |
commit | ba9c3a74ed6f46725fd092a43ae3895c38a19bc7 (patch) | |
tree | 9e095cf6531af3dade85546a1ccd736da29bed02 /resources | |
parent | 2783653369fd080b2b585d02525a905eee524432 (diff) |
GCodeViewer -> 1st iteration of rendering of extrude toolpaths as solid
Diffstat (limited to 'resources')
-rw-r--r-- | resources/shaders/options_110.fs | 4 | ||||
-rw-r--r-- | resources/shaders/options_120.fs | 10 | ||||
-rw-r--r-- | resources/shaders/toolpaths_lines.fs | 4 |
3 files changed, 7 insertions, 11 deletions
diff --git a/resources/shaders/options_110.fs b/resources/shaders/options_110.fs index 474e355e0..ab656998d 100644 --- a/resources/shaders/options_110.fs +++ b/resources/shaders/options_110.fs @@ -1,8 +1,8 @@ #version 110 -uniform vec3 uniform_color; +uniform vec4 uniform_color; void main() { - gl_FragColor = vec4(uniform_color, 1.0); + gl_FragColor = uniform_color; } diff --git a/resources/shaders/options_120.fs b/resources/shaders/options_120.fs index 5bcc71876..d897a8ca7 100644 --- a/resources/shaders/options_120.fs +++ b/resources/shaders/options_120.fs @@ -1,19 +1,15 @@ // version 120 is needed for gl_PointCoord #version 120 -uniform vec3 uniform_color; +uniform vec4 uniform_color; uniform float percent_outline_radius; uniform float percent_center_radius; -vec4 hardcoded_color(float radius, vec3 color) -{ - return ((radius < 0.15) || (radius > 0.85)) ? vec4(0.5 * color, 1.0) : vec4(color, 1.0); -} -vec4 customizable_color(float radius, vec3 color) +vec4 customizable_color(float radius, vec4 color) { return ((radius < percent_center_radius) || (radius > 1.0 - percent_outline_radius)) ? - vec4(0.5 * color, 1.0) : vec4(color, 1.0); + vec4(0.5 * color.rgb, color.a) : color; } void main() diff --git a/resources/shaders/toolpaths_lines.fs b/resources/shaders/toolpaths_lines.fs index 13f60c0a8..7202a2e3e 100644 --- a/resources/shaders/toolpaths_lines.fs +++ b/resources/shaders/toolpaths_lines.fs @@ -6,7 +6,7 @@ const vec3 LIGHT_FRONT_DIR = vec3(0.0, 0.0, 1.0); // x = ambient, y = top diffuse, z = front diffuse, w = global uniform vec4 light_intensity; -uniform vec3 uniform_color; +uniform vec4 uniform_color; varying vec3 eye_position; varying vec3 eye_normal; @@ -27,5 +27,5 @@ void main() NdotL = abs(dot(normal, LIGHT_FRONT_DIR)); intensity += NdotL * light_intensity.z; - gl_FragColor = vec4(uniform_color * light_intensity.w * intensity, 1.0); + gl_FragColor = vec4(uniform_color.rgb * light_intensity.w * intensity, uniform_color.a); } |