From 173329de8ffff50c95c97902cd1cbabd7ba487d5 Mon Sep 17 00:00:00 2001 From: scuffedjays Date: Tue, 12 Nov 2019 10:58:41 -0600 Subject: [PATCH 1/2] move outline to content --- Resources/Prototypes/Shaders/outline.yml | 7 +++ Resources/Shaders/outline.swsl | 77 ++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 Resources/Prototypes/Shaders/outline.yml create mode 100644 Resources/Shaders/outline.swsl diff --git a/Resources/Prototypes/Shaders/outline.yml b/Resources/Prototypes/Shaders/outline.yml new file mode 100644 index 0000000000..56f7d4fa52 --- /dev/null +++ b/Resources/Prototypes/Shaders/outline.yml @@ -0,0 +1,7 @@ +- type: shader + id: selection_outline + kind: source + path: "/Shaders/outline.swsl" + params: + outline_width: 1 + outline_color: "#FF000055" diff --git a/Resources/Shaders/outline.swsl b/Resources/Shaders/outline.swsl new file mode 100644 index 0000000000..0c3ffc701b --- /dev/null +++ b/Resources/Shaders/outline.swsl @@ -0,0 +1,77 @@ +// Taken from the godot-demo-projects repo. +// GODOT ENGINE +// http://www.godotengine.org +// +// ************************************************************************ +// +// Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +//************************************************************************ + +light_mode unshaded; +//shader_type canvas_item; +uniform float outline_width = 2.0; +// TODO: implement that hint_color thingy. +//uniform vec4 outline_color: hint_color; +uniform vec4 outline_color=vec4(1,0,0,0.33); + +void fragment() { + vec4 col = texture(TEXTURE, UV); + vec2 ps = TEXTURE_PIXEL_SIZE; + float a; + float maxa = col.a; + float mina = col.a; + + a = texture(TEXTURE, UV + vec2(0, -outline_width)*ps).a; + maxa = max(a, maxa); + mina = min(a, mina); + + a = texture(TEXTURE, UV + vec2(-outline_width, -outline_width)*ps).a; + maxa = max(a, maxa); + mina = min(a, mina); + + a = texture(TEXTURE, UV + vec2(0, outline_width)*ps).a; + maxa = max(a, maxa); + mina = min(a, mina); + + a = texture(TEXTURE, UV + vec2(outline_width, -outline_width)*ps).a; + maxa = max(a, maxa); + mina = min(a, mina); + + a = texture(TEXTURE, UV + vec2(-outline_width,0)*ps).a; + maxa = max(a, maxa); + mina = min(a, mina); + + a = texture(TEXTURE, UV + vec2(-outline_width, outline_width)*ps).a; + maxa = max(a, maxa); + mina = min(a, mina); + + a = texture(TEXTURE, UV + vec2(outline_width, 0)*ps).a; + maxa = max(a, maxa); + mina = min(a, mina); + + a = texture(TEXTURE, UV + vec2(outline_width, outline_width)*ps).a; + maxa = max(a, maxa); + mina = min(a, mina); + + COLOR = mix(col, outline_color, maxa-col.a); +} From 34083d3e8da4cabf49b3af3eb8be1f5b67804fd7 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Tue, 12 Nov 2019 18:51:03 +0100 Subject: [PATCH 2/2] Update submodule --- RobustToolbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobustToolbox b/RobustToolbox index 64112c556e..a3879b7bbd 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 64112c556eea1e89011c185248d533dc4a9a86b6 +Subproject commit a3879b7bbdef878a2c45722c7f7dda41a5a09e90