diff --git a/src/Shaders/ColorReplace.gdshader b/src/Shaders/ColorReplace.gdshader index 73ac9a80c..ea6c74abd 100644 --- a/src/Shaders/ColorReplace.gdshader +++ b/src/Shaders/ColorReplace.gdshader @@ -9,7 +9,7 @@ uniform float similarity_percent : hint_range(0.0, 100.0); // Must be the same size as image // Selected pixels are 1,1,1,1 and unselected 0,0,0,0 -uniform sampler2D selection; +uniform sampler2D selection : filter_nearest; uniform bool has_pattern; uniform sampler2D pattern: repeat_enable; diff --git a/src/Shaders/Effects/Desaturate.gdshader b/src/Shaders/Effects/Desaturate.gdshader index 61d166537..057c783d1 100644 --- a/src/Shaders/Effects/Desaturate.gdshader +++ b/src/Shaders/Effects/Desaturate.gdshader @@ -5,7 +5,7 @@ uniform bool red = true; uniform bool blue = true; uniform bool green = true; uniform bool alpha = false; -uniform sampler2D selection; +uniform sampler2D selection : filter_nearest; float stolChannel(float x) { return (x < 0.04045) ? (x / 12.92) : pow((x + 0.055) / 1.055, 2.4); diff --git a/src/Shaders/Effects/DropShadow.gdshader b/src/Shaders/Effects/DropShadow.gdshader index 148077833..93bafe726 100644 --- a/src/Shaders/Effects/DropShadow.gdshader +++ b/src/Shaders/Effects/DropShadow.gdshader @@ -3,7 +3,7 @@ render_mode unshaded; uniform vec2 offset = vec2(5.0, 5.0); // Offset, in pixel coordinate [0, 1, 2, and so on] uniform vec4 shadow_color : source_color = vec4(0.08, 0.08, 0.08, 0.63); -uniform sampler2D selection; +uniform sampler2D selection : filter_nearest; void fragment() { diff --git a/src/Shaders/Effects/GradientMap.gdshader b/src/Shaders/Effects/GradientMap.gdshader index 0e9c56c2d..47565d4fd 100644 --- a/src/Shaders/Effects/GradientMap.gdshader +++ b/src/Shaders/Effects/GradientMap.gdshader @@ -2,7 +2,7 @@ shader_type canvas_item; render_mode unshaded; uniform sampler2D gradient_map : filter_nearest; // GradientTexture -uniform sampler2D selection; +uniform sampler2D selection : filter_nearest; void fragment() { vec4 original_color = texture(TEXTURE, UV); diff --git a/src/Shaders/Effects/Gradients/Linear.gdshader b/src/Shaders/Effects/Gradients/Linear.gdshader index d1704945e..6579bbaa5 100644 --- a/src/Shaders/Effects/Gradients/Linear.gdshader +++ b/src/Shaders/Effects/Gradients/Linear.gdshader @@ -1,8 +1,8 @@ shader_type canvas_item; render_mode unshaded; -uniform sampler2D selection; -uniform sampler2D gradient_texture; +uniform sampler2D selection : filter_nearest; +uniform sampler2D gradient_texture : filter_nearest; uniform float position : hint_range(-0.5, 0.5) = 0.0; uniform float size : hint_range(0.01, 2.0) = 1.0; uniform float angle : hint_range(0.0, 360.0) = 0.0; diff --git a/src/Shaders/Effects/Gradients/LinearDithering.gdshader b/src/Shaders/Effects/Gradients/LinearDithering.gdshader index 4c8026970..dcb1ed9d1 100644 --- a/src/Shaders/Effects/Gradients/LinearDithering.gdshader +++ b/src/Shaders/Effects/Gradients/LinearDithering.gdshader @@ -1,10 +1,10 @@ shader_type canvas_item; render_mode unshaded; -uniform sampler2D selection; -uniform sampler2D gradient_texture; -uniform sampler2D dither_texture : repeat_enable; -uniform sampler2D offset_texture; +uniform sampler2D selection : filter_nearest; +uniform sampler2D gradient_texture : filter_nearest; +uniform sampler2D dither_texture : filter_nearest, repeat_enable; +uniform sampler2D offset_texture : filter_nearest; uniform float position : hint_range(-0.5, 0.5) = 0.0; uniform float size : hint_range(0.01, 2.0) = 1.0; uniform float angle : hint_range(0.0, 360.0) = 0.0; @@ -69,9 +69,9 @@ void fragment() { modified_uv = mirror_fract(modified_uv); int n_of_colors = textureSize(offset_texture, 0).x; + float colors_minus = float(n_of_colors - 1); vec4 output; for (int i = 1; i <= n_of_colors; i++) { - float colors_minus = float(n_of_colors - 1); float off = texture(offset_texture, vec2(float(i) / colors_minus)).r; float off_prev = texture(offset_texture, vec2(float(i - 1) / colors_minus)).r; vec4 first = texture(gradient_texture, vec2(float((i - 1)) / colors_minus)); diff --git a/src/Shaders/Effects/HSV.gdshader b/src/Shaders/Effects/HSV.gdshader index cb0595551..e3f70bdc6 100644 --- a/src/Shaders/Effects/HSV.gdshader +++ b/src/Shaders/Effects/HSV.gdshader @@ -4,7 +4,7 @@ render_mode unshaded; uniform float hue : hint_range(-1, 1); uniform float saturation : hint_range(-1, 1); uniform float value : hint_range(-1, 1); -uniform sampler2D selection; +uniform sampler2D selection : filter_nearest; vec3 rgb2hsb(vec3 c){ vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); diff --git a/src/Shaders/Effects/Invert.gdshader b/src/Shaders/Effects/Invert.gdshader index 3d87425bb..c23ef4a61 100644 --- a/src/Shaders/Effects/Invert.gdshader +++ b/src/Shaders/Effects/Invert.gdshader @@ -5,7 +5,7 @@ uniform bool red = true; uniform bool blue = true; uniform bool green = true; uniform bool alpha = false; -uniform sampler2D selection; +uniform sampler2D selection : filter_nearest; void fragment() { diff --git a/src/Shaders/Effects/OffsetPixels.gdshader b/src/Shaders/Effects/OffsetPixels.gdshader index e0b3b2d35..b0a3d9501 100644 --- a/src/Shaders/Effects/OffsetPixels.gdshader +++ b/src/Shaders/Effects/OffsetPixels.gdshader @@ -1,6 +1,6 @@ shader_type canvas_item; -uniform sampler2D selection; +uniform sampler2D selection : filter_nearest; uniform vec2 offset = vec2(0.0); // In pixels uniform bool wrap_around = false; diff --git a/src/Shaders/Effects/OutlineInline.gdshader b/src/Shaders/Effects/OutlineInline.gdshader index d1a6e766c..91491d817 100644 --- a/src/Shaders/Effects/OutlineInline.gdshader +++ b/src/Shaders/Effects/OutlineInline.gdshader @@ -6,7 +6,7 @@ uniform vec4 color : source_color = vec4(1.0); uniform float width : hint_range(0, 10, 1) = 1.0; uniform int pattern : hint_range(0, 2) = 0; // diamond, circle, square uniform bool inside = false; -uniform sampler2D selection; +uniform sampler2D selection : filter_nearest; bool has_contrary_neighbour(vec2 uv, vec2 texture_pixel_size, sampler2D tex) { diff --git a/src/Shaders/Effects/Palettize.gdshader b/src/Shaders/Effects/Palettize.gdshader index b812aa945..74eb78835 100644 --- a/src/Shaders/Effects/Palettize.gdshader +++ b/src/Shaders/Effects/Palettize.gdshader @@ -3,7 +3,7 @@ shader_type canvas_item; uniform sampler2D palette_texture : filter_nearest; -uniform sampler2D selection; +uniform sampler2D selection : filter_nearest; vec4 swap_color(vec4 color) { if (color.a <= 0.01) { diff --git a/src/Shaders/Effects/Pixelize.gdshader b/src/Shaders/Effects/Pixelize.gdshader index 02e9dfbc2..88a7efb36 100644 --- a/src/Shaders/Effects/Pixelize.gdshader +++ b/src/Shaders/Effects/Pixelize.gdshader @@ -7,7 +7,7 @@ This shader is under MIT license shader_type canvas_item; uniform uvec2 pixel_size = uvec2(4); -uniform sampler2D selection; +uniform sampler2D selection : filter_nearest; void fragment() { vec4 original_color = texture(TEXTURE, UV); diff --git a/src/Shaders/Effects/Posterize.gdshader b/src/Shaders/Effects/Posterize.gdshader index 886dfed78..47ef388e9 100644 --- a/src/Shaders/Effects/Posterize.gdshader +++ b/src/Shaders/Effects/Posterize.gdshader @@ -1,7 +1,7 @@ // https://godotshaders.com/shader/color-reduction-and-dither/ shader_type canvas_item; -uniform sampler2D selection; +uniform sampler2D selection : filter_nearest; uniform float colors : hint_range(1.0, 255.0) = 2.0; uniform float dither_intensity : hint_range(0.0, 0.5) = 0.0; diff --git a/src/Shaders/Effects/Rotation/CommonRotation.gdshaderinc b/src/Shaders/Effects/Rotation/CommonRotation.gdshaderinc index 43d7dbd31..14da839d4 100644 --- a/src/Shaders/Effects/Rotation/CommonRotation.gdshaderinc +++ b/src/Shaders/Effects/Rotation/CommonRotation.gdshaderinc @@ -1,4 +1,4 @@ -uniform sampler2D selection_tex; +uniform sampler2D selection_tex : filter_nearest; uniform vec2 pivot_pixel; uniform float angle; diff --git a/src/Shaders/Effects/Rotation/SmearRotxel.gdshader b/src/Shaders/Effects/Rotation/SmearRotxel.gdshader index 69dae3d78..cd3caa4e0 100644 --- a/src/Shaders/Effects/Rotation/SmearRotxel.gdshader +++ b/src/Shaders/Effects/Rotation/SmearRotxel.gdshader @@ -2,7 +2,7 @@ shader_type canvas_item; render_mode unshaded; -uniform sampler2D selection_tex; +uniform sampler2D selection_tex : filter_nearest; uniform float initial_angle = 0.0; uniform float ending_angle = 0.0; uniform float tolerance : hint_range(0.0, 255.0) = 100.0; diff --git a/src/Shaders/PatternFill.gdshader b/src/Shaders/PatternFill.gdshader index 586b27ed2..2912290ac 100644 --- a/src/Shaders/PatternFill.gdshader +++ b/src/Shaders/PatternFill.gdshader @@ -1,8 +1,8 @@ shader_type canvas_item; render_mode unshaded; -uniform sampler2D selection; -uniform sampler2D pattern: repeat_enable; +uniform sampler2D selection : filter_nearest; +uniform sampler2D pattern : filter_nearest, repeat_enable; uniform vec2 size; uniform vec2 pattern_size; uniform vec2 pattern_uv_offset;