From 4c4e611629cba873d795b84159860de4c7bc7e07 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 29 Apr 2020 12:06:20 +0200 Subject: [PATCH] Fix x-ray error color. X-ray errors showed as green and translucent instead of read and solid. Now fixed. CURA-7407 --- plugins/SolidView/SolidView.py | 1 + plugins/XRayView/XRayView.py | 1 + resources/shaders/xray_composite.shader | 7 +++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/SolidView/SolidView.py b/plugins/SolidView/SolidView.py index 09d27859b5..bfe803f224 100644 --- a/plugins/SolidView/SolidView.py +++ b/plugins/SolidView/SolidView.py @@ -149,6 +149,7 @@ class SolidView(View): theme = Application.getInstance().getTheme() self._xray_composite_shader.setUniformValue("u_background_color", Color(*theme.getColor("viewport_background").getRgb())) self._xray_composite_shader.setUniformValue("u_outline_color", Color(*theme.getColor("model_selection_outline").getRgb())) + self._xray_composite_shader.setUniformValue("u_flat_error_color_mix", 0.) # Don't show flat error color in solid-view. renderer = self.getRenderer() if not self._composite_pass or not 'xray' in self._composite_pass.getLayerBindings(): diff --git a/plugins/XRayView/XRayView.py b/plugins/XRayView/XRayView.py index e12bd9b9ea..0144f4c176 100644 --- a/plugins/XRayView/XRayView.py +++ b/plugins/XRayView/XRayView.py @@ -93,6 +93,7 @@ class XRayView(CuraView): theme = Application.getInstance().getTheme() self._xray_composite_shader.setUniformValue("u_background_color", Color(*theme.getColor("viewport_background").getRgb())) self._xray_composite_shader.setUniformValue("u_outline_color", Color(*theme.getColor("model_selection_outline").getRgb())) + self._xray_composite_shader.setUniformValue("u_flat_error_color_mix", 1.) # Show flat error color _only_ in xray-view. if not self._composite_pass: self._composite_pass = self.getRenderer().getRenderPass("composite") diff --git a/resources/shaders/xray_composite.shader b/resources/shaders/xray_composite.shader index c955d4fc18..6619b00544 100644 --- a/resources/shaders/xray_composite.shader +++ b/resources/shaders/xray_composite.shader @@ -30,6 +30,7 @@ fragment = uniform vec4 u_outline_color; uniform vec4 u_background_color; uniform float u_xray_error_strength; + uniform float u_flat_error_color_mix; const vec3 x_axis = vec3(1.0, 0.0, 0.0); const vec3 y_axis = vec3(0.0, 1.0, 0.0); @@ -73,7 +74,7 @@ fragment = float rest = mod(intersection_count + .01, 2.0); if (rest > 1.0 && rest < 1.5 && intersection_count < 49.0) { - result = vec4(shiftHue(layer0.rgb, hue_shift), result.a); + result = mix(vec4(shiftHue(layer0.rgb, hue_shift), result.a), vec4(1.,0.,0.,1.), u_flat_error_color_mix); } vec4 sum = vec4(0.0); @@ -122,6 +123,7 @@ fragment41core = uniform vec4 u_outline_color; uniform vec4 u_background_color; uniform float u_xray_error_strength; + uniform float u_flat_error_color_mix; const vec3 x_axis = vec3(1.0, 0.0, 0.0); const vec3 y_axis = vec3(0.0, 1.0, 0.0); @@ -166,7 +168,7 @@ fragment41core = float rest = mod(intersection_count + .01, 2.0); if (rest > 1.0 && rest < 1.5 && intersection_count < 49) { - result = vec4(shiftHue(layer0.rgb, hue_shift), result.a); + result = mix(vec4(shiftHue(layer0.rgb, hue_shift), result.a), vec4(1.,0.,0.,1.), u_flat_error_color_mix); } vec4 sum = vec4(0.0); @@ -196,6 +198,7 @@ u_layer2 = 2 u_background_color = [0.965, 0.965, 0.965, 1.0] u_outline_strength = 1.0 u_outline_color = [0.05, 0.66, 0.89, 1.0] +u_flat_error_color_mix = 0.5 [bindings]