diff --git a/buildapp/terrarumlinux_arm/AppRun b/buildapp/terrarumlinux_arm/AppRun index 410dafd05..69f74acdd 100755 --- a/buildapp/terrarumlinux_arm/AppRun +++ b/buildapp/terrarumlinux_arm/AppRun @@ -1,3 +1,3 @@ #!/bin/bash cd "${0%/*}" -./runtime-linux-arm/bin/java -Xms1G -Xmx6G -jar ./assets/TerrarumBuild.jar +./runtime-linux-arm/bin/java -Xms1G -Xmx6G -Dswing.aatext=true -Dawt.useSystemAAFontSettings=lcd -jar ./assets/TerrarumBuild.jar diff --git a/buildapp/terrarumlinux_x86/AppRun b/buildapp/terrarumlinux_x86/AppRun index 798aa9835..353f3ab90 100755 --- a/buildapp/terrarumlinux_x86/AppRun +++ b/buildapp/terrarumlinux_x86/AppRun @@ -1,3 +1,3 @@ #!/bin/bash cd "${0%/*}" -./runtime-linux-x86/bin/java -Xms1G -Xmx6G -jar ./assets/TerrarumBuild.jar +./runtime-linux-x86/bin/java -Xms1G -Xmx6G -Dswing.aatext=true -Dawt.useSystemAAFontSettings=lcd -jar ./assets/TerrarumBuild.jar diff --git a/buildapp/terrarummac_arm/Terrarum.sh b/buildapp/terrarummac_arm/Terrarum.sh index f03de8e4f..82ba524c9 100755 --- a/buildapp/terrarummac_arm/Terrarum.sh +++ b/buildapp/terrarummac_arm/Terrarum.sh @@ -1,3 +1,3 @@ #!/bin/bash cd "${0%/*}" -./runtime-arm-x86/bin/java -Xms1G -Xmx6G -jar ./assets/TerrarumBuild.jar +./runtime-arm-x86/bin/java -XstartOnFirstThread -Xms1G -Xmx6G -jar ./assets/TerrarumBuild.jar diff --git a/buildapp/terrarummac_x86/Terrarum.sh b/buildapp/terrarummac_x86/Terrarum.sh index 6e87bdaa2..5bcf6f94f 100755 --- a/buildapp/terrarummac_x86/Terrarum.sh +++ b/buildapp/terrarummac_x86/Terrarum.sh @@ -1,3 +1,3 @@ #!/bin/bash cd "${0%/*}" -./runtime-osx-x86/bin/java -Xms1G -Xmx6G -jar ./assets/TerrarumBuild.jar +./runtime-osx-x86/bin/java -XstartOnFirstThread -Xms1G -Xmx6G -jar ./assets/TerrarumBuild.jar diff --git a/src/net/torvald/terrarum/ui/UIHandler.kt b/src/net/torvald/terrarum/ui/UIHandler.kt index 32da5cd54..ef9fa9168 100644 --- a/src/net/torvald/terrarum/ui/UIHandler.kt +++ b/src/net/torvald/terrarum/ui/UIHandler.kt @@ -36,36 +36,41 @@ class UIHandler(//var UI: UICanvas, companion object { private val SHADER_PROG_FRAG = """ -#version 130 +#version 150 #ifdef GL_ES precision mediump float; #endif -varying vec4 v_color; -varying vec2 v_texCoords; +in vec4 v_color; +in vec2 v_texCoords; uniform sampler2D u_texture; uniform float opacity; +out vec4 fragColor; + void main(void) { - vec4 color = texture2D(u_texture, v_texCoords).rgba; + vec4 color = texture(u_texture, v_texCoords).rgba; - gl_FragColor = v_color * vec4(color.rgb, color.a * opacity); + fragColor = v_color * vec4(color.rgb, color.a * opacity); } """.trimIndent() private val SHADER_PROG_VERT = """ -attribute vec4 a_position; -attribute vec4 a_color; -attribute vec2 a_texCoord0; +#version 150 + +in vec4 a_position; +in vec4 a_color; +in vec2 a_texCoord0; uniform mat4 u_projTrans; -varying vec4 v_color; -varying vec2 v_texCoords; +out vec4 v_color; +out vec2 v_texCoords; void main() { v_color = a_color; + v_color.a = v_color.a * (255.0/254.0); v_texCoords = a_texCoord0; gl_Position = u_projTrans * a_position; } diff --git a/src/shaders/aaaxmul.frag b/src/shaders/aaaxmul.frag index 0cce13177..0c786aa25 100644 --- a/src/shaders/aaaxmul.frag +++ b/src/shaders/aaaxmul.frag @@ -12,8 +12,8 @@ uniform vec2 tex1Offset; out vec4 fragColor; void main() { - vec4 colorTex0 = texture2D(u_texture, v_texCoords); // world texture - vec4 colorTex1 = texture2D(tex1, v_texCoords); // lightmap (RGBA) + vec4 colorTex0 = texture(u_texture, v_texCoords); // world texture + vec4 colorTex1 = texture(tex1, v_texCoords); // lightmap (RGBA) colorTex1 = vec4(colorTex1.www, 1.0); diff --git a/src/shaders/actors.frag b/src/shaders/actors.frag index 379fb579a..ddecc8d7f 100644 --- a/src/shaders/actors.frag +++ b/src/shaders/actors.frag @@ -22,7 +22,7 @@ vec2 boolean = vec2(0.0, 1.0); out vec4 fragColor; void main() { - vec4 inColor = v_color * (texture2D(u_texture, v_texCoords)); + vec4 inColor = v_color * (texture(u_texture, v_texCoords)); vec2 entry = mod(gl_FragCoord.xy, vec2(bayerSize, bayerSize)); float bayerThreshold = float(bayer[int(entry.y) * int(bayerSize) + int(entry.x)]) / bayerDivider; diff --git a/src/shaders/aonly.frag b/src/shaders/aonly.frag index 4eff6b76a..e97460f1d 100644 --- a/src/shaders/aonly.frag +++ b/src/shaders/aonly.frag @@ -8,5 +8,5 @@ vec2 boolean = vec2(0.0, 1.0); out vec4 fragColor; void main(void) { - fragColor = texture2D(u_texture, v_texCoords).aaaa * boolean.yyyx + boolean.xxxy; + fragColor = texture(u_texture, v_texCoords).aaaa * boolean.yyyx + boolean.xxxy; } \ No newline at end of file diff --git a/src/shaders/blendGlow.frag b/src/shaders/blendGlow.frag index f9c525d69..7e3098a52 100644 --- a/src/shaders/blendGlow.frag +++ b/src/shaders/blendGlow.frag @@ -12,8 +12,8 @@ uniform sampler2D tex1; // glow texture, SHOULD contain alpha of all 1.0 out vec4 fragColor; void main(void) { - vec4 colorTex0 = texture2D(u_texture, v_texCoords); // lightmap (RGB) pre-mixed - vec4 colorTex1 = texture2D(tex1, v_texCoords); // lightmap (A) pre-mixed + vec4 colorTex0 = texture(u_texture, v_texCoords); // lightmap (RGB) pre-mixed + vec4 colorTex1 = texture(tex1, v_texCoords); // lightmap (A) pre-mixed fragColor = vec4(max(colorTex0.rgb, colorTex1.rgb), colorTex0.a); } \ No newline at end of file diff --git a/src/shaders/blur.frag b/src/shaders/blur.frag index ce1919faa..76a7e7f0f 100644 --- a/src/shaders/blur.frag +++ b/src/shaders/blur.frag @@ -18,11 +18,11 @@ vec4 blur(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) { vec4 color = vec4(0.0); vec2 off1 = vec2(1.3846153846) * direction; vec2 off2 = vec2(3.2307692308) * direction; - color += texture2D(image, uv) * 0.2270270270; - color += texture2D(image, uv + (off1 / resolution)) * 0.3162162162; - color += texture2D(image, uv - (off1 / resolution)) * 0.3162162162; - color += texture2D(image, uv + (off2 / resolution)) * 0.0702702703; - color += texture2D(image, uv - (off2 / resolution)) * 0.0702702703; + color += texture(image, uv) * 0.2270270270; + color += texture(image, uv + (off1 / resolution)) * 0.3162162162; + color += texture(image, uv - (off1 / resolution)) * 0.3162162162; + color += texture(image, uv + (off2 / resolution)) * 0.0702702703; + color += texture(image, uv - (off2 / resolution)) * 0.0702702703; return color; } diff --git a/src/shaders/blur2.frag b/src/shaders/blur2.frag index cd7cc9a04..0f89ac1bd 100644 --- a/src/shaders/blur2.frag +++ b/src/shaders/blur2.frag @@ -19,13 +19,13 @@ vec4 blur(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) { vec2 off1 = vec2(1.411764705882353) * direction; vec2 off2 = vec2(3.2941176470588234) * direction; vec2 off3 = vec2(5.176470588235294) * direction; - color += texture2D(image, uv) * 0.1964825501511404; - color += texture2D(image, uv + (off1 / resolution)) * 0.2969069646728344; - color += texture2D(image, uv - (off1 / resolution)) * 0.2969069646728344; - color += texture2D(image, uv + (off2 / resolution)) * 0.09447039785044732; - color += texture2D(image, uv - (off2 / resolution)) * 0.09447039785044732; - color += texture2D(image, uv + (off3 / resolution)) * 0.010381362401148057; - color += texture2D(image, uv - (off3 / resolution)) * 0.010381362401148057; + color += texture(image, uv) * 0.1964825501511404; + color += texture(image, uv + (off1 / resolution)) * 0.2969069646728344; + color += texture(image, uv - (off1 / resolution)) * 0.2969069646728344; + color += texture(image, uv + (off2 / resolution)) * 0.09447039785044732; + color += texture(image, uv - (off2 / resolution)) * 0.09447039785044732; + color += texture(image, uv + (off3 / resolution)) * 0.010381362401148057; + color += texture(image, uv - (off3 / resolution)) * 0.010381362401148057; return color; } diff --git a/src/shaders/boxdown.frag b/src/shaders/boxdown.frag index 0400d3edb..1b453ed12 100644 --- a/src/shaders/boxdown.frag +++ b/src/shaders/boxdown.frag @@ -18,15 +18,15 @@ vec2 twister = vec2(1.0, -1.0); vec2 boolean = vec2(1.0, 0.0); void main() { - vec4 sum = texture2D(u_texture, v_texCoords) + - texture2D(u_texture, v_texCoords + halfpixel) + - texture2D(u_texture, v_texCoords - halfpixel) + - texture2D(u_texture, v_texCoords + halfpixel * twister) + - texture2D(u_texture, v_texCoords - halfpixel * twister) + - texture2D(u_texture, v_texCoords + halfpixel * boolean.xy) + - texture2D(u_texture, v_texCoords - halfpixel * boolean.xy) + - texture2D(u_texture, v_texCoords + halfpixel * boolean.yx) + - texture2D(u_texture, v_texCoords - halfpixel * boolean.yx) ; + vec4 sum = texture(u_texture, v_texCoords) + + texture(u_texture, v_texCoords + halfpixel) + + texture(u_texture, v_texCoords - halfpixel) + + texture(u_texture, v_texCoords + halfpixel * twister) + + texture(u_texture, v_texCoords - halfpixel * twister) + + texture(u_texture, v_texCoords + halfpixel * boolean.xy) + + texture(u_texture, v_texCoords - halfpixel * boolean.xy) + + texture(u_texture, v_texCoords + halfpixel * boolean.yx) + + texture(u_texture, v_texCoords - halfpixel * boolean.yx) ; gl_FragColor = sum / 9.0; } \ No newline at end of file diff --git a/src/shaders/boxup.frag b/src/shaders/boxup.frag index adab12175..2ca3f931c 100644 --- a/src/shaders/boxup.frag +++ b/src/shaders/boxup.frag @@ -19,15 +19,15 @@ vec2 boolean = vec2(1.0, 0.0); out vec4 fragColor; void main() { - vec4 sum = texture2D(u_texture, v_texCoords) + - texture2D(u_texture, v_texCoords + halfpixel) + - texture2D(u_texture, v_texCoords - halfpixel) + - texture2D(u_texture, v_texCoords + halfpixel * twister) + - texture2D(u_texture, v_texCoords - halfpixel * twister) + - texture2D(u_texture, v_texCoords + halfpixel * boolean.xy) + - texture2D(u_texture, v_texCoords - halfpixel * boolean.xy) + - texture2D(u_texture, v_texCoords + halfpixel * boolean.yx) + - texture2D(u_texture, v_texCoords - halfpixel * boolean.yx) ; + vec4 sum = texture(u_texture, v_texCoords) + + texture(u_texture, v_texCoords + halfpixel) + + texture(u_texture, v_texCoords - halfpixel) + + texture(u_texture, v_texCoords + halfpixel * twister) + + texture(u_texture, v_texCoords - halfpixel * twister) + + texture(u_texture, v_texCoords + halfpixel * boolean.xy) + + texture(u_texture, v_texCoords - halfpixel * boolean.xy) + + texture(u_texture, v_texCoords + halfpixel * boolean.yx) + + texture(u_texture, v_texCoords - halfpixel * boolean.yx) ; fragColor = sum / 9.0; } \ No newline at end of file diff --git a/src/shaders/crt.frag b/src/shaders/crt.frag index dc6d38116..6ab432b26 100644 --- a/src/shaders/crt.frag +++ b/src/shaders/crt.frag @@ -20,9 +20,9 @@ uniform float blur_blend = 0.5; out vec4 fragColor; void main(void) { - vec4 color = texture2D(u_texture, v_texCoords).rgba; - vec4 color_pre = texture2D(u_texture, (v_texCoords + (vec2(-1.0, 0.0) / resolution))).rgba; - vec4 color_next = texture2D(u_texture, (v_texCoords + (vec2( 1.0, 0.0) / resolution))).rgba; + vec4 color = texture(u_texture, v_texCoords).rgba; + vec4 color_pre = texture(u_texture, (v_texCoords + (vec2(-1.0, 0.0) / resolution))).rgba; + vec4 color_next = texture(u_texture, (v_texCoords + (vec2( 1.0, 0.0) / resolution))).rgba; color = color * (1.0 - blur_blend) + color_pre * (blur_blend / 2.0) + color_next * (blur_blend / 2.0); @@ -42,5 +42,5 @@ void main(void) { } fragColor = vec4(out_color, 1); - //fragColor = texture2D(u_texture, v_texCoords); + //fragColor = texture(u_texture, v_texCoords); } \ No newline at end of file diff --git a/src/shaders/demultiply.frag b/src/shaders/demultiply.frag index f29fc7b02..eebc1e038 100644 --- a/src/shaders/demultiply.frag +++ b/src/shaders/demultiply.frag @@ -11,7 +11,7 @@ vec2 boolean = vec2(0.0, 1.0); out vec4 fragColor; void main() { - vec4 inColor = v_color * (texture2D(u_texture, v_texCoords)); + vec4 inColor = v_color * (texture(u_texture, v_texCoords)); vec4 divided = inColor / pow(inColor.aaaa, vec4(2.0)); fragColor = divided * boolean.yyyx + inColor * boolean.xxxy; diff --git a/src/shaders/diff.frag b/src/shaders/diff.frag index dcdc744a6..9bca23eaa 100644 --- a/src/shaders/diff.frag +++ b/src/shaders/diff.frag @@ -10,7 +10,7 @@ uniform sampler2D u_texture; out vec4 fragColor; void main(void) { - vec4 inColor = texture2D(u_texture, v_texCoords); + vec4 inColor = texture(u_texture, v_texCoords); ivec4 bytes = ivec4(255.0 * inColor); ivec4 mask = ivec4(0x55); fragColor = (bytes ^ mask) / 255.0; diff --git a/src/shaders/float_to_disp_dither_static.frag b/src/shaders/float_to_disp_dither_static.frag index 902610cf3..66e5c8fd6 100644 --- a/src/shaders/float_to_disp_dither_static.frag +++ b/src/shaders/float_to_disp_dither_static.frag @@ -35,7 +35,7 @@ vec4 nearestColour(vec4 inColor) { } vec4 getDitherredDot(vec4 inColor) { - vec4 bayerThreshold = vec4(texture2D(u_pattern, gl_FragCoord.xy * patternsize) - 0.5); + vec4 bayerThreshold = vec4(texture(u_pattern, gl_FragCoord.xy * patternsize) - 0.5); return nearestColour(inColor + bayerThreshold * quantiserDivider); } diff --git a/src/shaders/ghastlywhite.frag b/src/shaders/ghastlywhite.frag index 9c9d45bdf..ffd5dd327 100644 --- a/src/shaders/ghastlywhite.frag +++ b/src/shaders/ghastlywhite.frag @@ -8,7 +8,7 @@ vec4 desaturate = vec4(0.2126, 0.7152, 0.0722, 0.0); out vec4 fragColor; void main(void) { - vec4 incolour = texture2D(u_texture, v_texCoords); + vec4 incolour = texture(u_texture, v_texCoords); float lum = dot(incolour * desaturate, boolean.yyyx) * 0.5 + 0.5; fragColor = v_color * (vec4(lum) * boolean.yyyx + incolour * boolean.xxxy); diff --git a/src/shaders/hicolour.frag b/src/shaders/hicolour.frag index ae5782a69..8c143267e 100644 --- a/src/shaders/hicolour.frag +++ b/src/shaders/hicolour.frag @@ -53,7 +53,7 @@ void main(void) { // create texture coordinates based on pixelSize // - vec4 inColor = (texture2D(u_texture, v_texCoords)); + vec4 inColor = (texture(u_texture, v_texCoords)); vec2 entry = mod(gl_FragCoord.xy, vec2(bayerSize, bayerSize)); diff --git a/src/shaders/kawasedown.frag b/src/shaders/kawasedown.frag index ecf350c69..2f730c943 100644 --- a/src/shaders/kawasedown.frag +++ b/src/shaders/kawasedown.frag @@ -16,12 +16,12 @@ out vec4 fragColor; vec2 twister = vec2(1.0, -1.0); void main() { - vec4 sum = texture2D(u_texture, v_texCoords) * 4.0; - sum += texture2D(u_texture, v_texCoords - halfpixel); - sum += texture2D(u_texture, v_texCoords + halfpixel); - sum += texture2D(u_texture, v_texCoords - halfpixel * twister); - sum += texture2D(u_texture, v_texCoords + halfpixel * twister); + vec4 sum = texture(u_texture, v_texCoords) * 4.0; + sum += texture(u_texture, v_texCoords - halfpixel); + sum += texture(u_texture, v_texCoords + halfpixel); + sum += texture(u_texture, v_texCoords - halfpixel * twister); + sum += texture(u_texture, v_texCoords + halfpixel * twister); fragColor = sum / 8.0; -// gl_FragColor = texture2D(u_texture, v_texCoords); +// gl_FragColor = texture(u_texture, v_texCoords); } \ No newline at end of file diff --git a/src/shaders/kawaseup.frag b/src/shaders/kawaseup.frag index f13b2a48a..0494a4b43 100644 --- a/src/shaders/kawaseup.frag +++ b/src/shaders/kawaseup.frag @@ -18,15 +18,15 @@ vec2 doubley = vec2(0.0, 2.0); vec2 twister = vec2(1.0, -1.0); void main() { - vec4 sum = texture2D(u_texture, v_texCoords - halfpixel * doublex); - sum += texture2D(u_texture, v_texCoords - halfpixel * twister) * 2.0; - sum += texture2D(u_texture, v_texCoords + halfpixel * doubley); - sum += texture2D(u_texture, v_texCoords + halfpixel) * 2.0; - sum += texture2D(u_texture, v_texCoords + halfpixel * doublex); - sum += texture2D(u_texture, v_texCoords + halfpixel * twister) * 2.0; - sum += texture2D(u_texture, v_texCoords - halfpixel * doubley); - sum += texture2D(u_texture, v_texCoords - halfpixel) * 2.0; + vec4 sum = texture(u_texture, v_texCoords - halfpixel * doublex); + sum += texture(u_texture, v_texCoords - halfpixel * twister) * 2.0; + sum += texture(u_texture, v_texCoords + halfpixel * doubley); + sum += texture(u_texture, v_texCoords + halfpixel) * 2.0; + sum += texture(u_texture, v_texCoords + halfpixel * doublex); + sum += texture(u_texture, v_texCoords + halfpixel * twister) * 2.0; + sum += texture(u_texture, v_texCoords - halfpixel * doubley); + sum += texture(u_texture, v_texCoords - halfpixel) * 2.0; fragColor = sum / 12.0; -// fragColor = texture2D(u_texture, v_texCoords); +// fragColor = texture(u_texture, v_texCoords); } \ No newline at end of file diff --git a/src/shaders/passthrurgb.frag b/src/shaders/passthrurgb.frag index 5b2df0473..b09893c8f 100644 --- a/src/shaders/passthrurgb.frag +++ b/src/shaders/passthrurgb.frag @@ -12,5 +12,5 @@ uniform sampler2D u_texture; out vec4 fragColor; void main(void) { - fragColor = vec4(texture2D(u_texture, v_texCoords).rgb, 1.0); + fragColor = vec4(texture(u_texture, v_texCoords).rgb, 1.0); } \ No newline at end of file diff --git a/src/shaders/postproc_dither.frag b/src/shaders/postproc_dither.frag index 855afddf5..2364ab621 100644 --- a/src/shaders/postproc_dither.frag +++ b/src/shaders/postproc_dither.frag @@ -58,7 +58,7 @@ vec4 nearestColour(vec4 inColor) { } vec4 getDitherredDot(vec4 inColor) { - vec4 bayerThreshold = swizzler * vec4(matrixNormaliser + texture2D(u_pattern, (gl_FragCoord.xy + rnd) * patternsize)); + vec4 bayerThreshold = swizzler * vec4(matrixNormaliser + texture(u_pattern, (gl_FragCoord.xy + rnd) * patternsize)); return nearestColour(bayerThreshold * vec4(1.0 / quant) + inColor); } @@ -67,7 +67,7 @@ uniform vec4 vibrancy = vec4(1.0);//vec4(1.0, 1.4, 1.2, 1.0); void main(void) { // convert input RGB into YCoCg - vec4 incolour = texture2D(u_texture, v_texCoords); + vec4 incolour = texture(u_texture, v_texCoords); vec4 yog = rgb_to_ycocg * incolour; // vec4(Y, Co, Cg, A) where Y,A=[0,1]; Co,Cg=[-1,1] // Do colour-grading magic diff --git a/src/shaders/postproc_nodither.frag b/src/shaders/postproc_nodither.frag index 3d18c32dd..65069ff42 100644 --- a/src/shaders/postproc_nodither.frag +++ b/src/shaders/postproc_nodither.frag @@ -49,7 +49,7 @@ out vec4 fragColor; void main(void) { // convert input RGB into YCoCg - vec4 incolour = texture2D(u_texture, v_texCoords); + vec4 incolour = texture(u_texture, v_texCoords); vec4 yog = rgb_to_ycocg * incolour; // vec4(Y, Co, Cg, A) where Y,A=[0,1]; Co,Cg=[-1,1] // Do colour-grading magic diff --git a/src/shaders/quickgreyscale.frag b/src/shaders/quickgreyscale.frag index 09799fa9c..71deada66 100644 --- a/src/shaders/quickgreyscale.frag +++ b/src/shaders/quickgreyscale.frag @@ -12,7 +12,7 @@ uniform mat4 u_projTrans; out vec4 fragColor; void main() { - vec3 color = texture2D(u_texture, v_texCoords).rgb; + vec3 color = texture(u_texture, v_texCoords).rgb; float gray = (3.0 * color.r + 4.0 * color.g + color.b) / 8.0; vec3 grayscale = vec3(gray); diff --git a/src/shaders/reflect.frag b/src/shaders/reflect.frag index 5e96142fc..a6dc858cd 100644 --- a/src/shaders/reflect.frag +++ b/src/shaders/reflect.frag @@ -6,7 +6,7 @@ uniform sampler2D u_texture; out vec4 fragColor; void main(void) { - vec4 color = texture2D(u_texture, vec2(v_texCoords.x, 1.0 - v_texCoords.y)); + vec4 color = texture(u_texture, vec2(v_texCoords.x, 1.0 - v_texCoords.y)); vec4 alphamul = vec4(1.0, 1.0, 1.0, 0.5 * (1.0 - v_texCoords.y)); fragColor = color * alphamul; } \ No newline at end of file diff --git a/src/shaders/rgbonly.frag b/src/shaders/rgbonly.frag index 7ede12cab..9cc745088 100644 --- a/src/shaders/rgbonly.frag +++ b/src/shaders/rgbonly.frag @@ -8,5 +8,5 @@ vec2 boolean = vec2(0.0, 1.0); out vec4 fragColor; void main(void) { - fragColor = texture2D(u_texture, v_texCoords).rgba * boolean.yyyx + boolean.xxxy; + fragColor = texture(u_texture, v_texCoords).rgba * boolean.yyyx + boolean.xxxy; } \ No newline at end of file diff --git a/src/shaders/rgbxmul.frag b/src/shaders/rgbxmul.frag index c9e6cfecc..15c3a9a3a 100644 --- a/src/shaders/rgbxmul.frag +++ b/src/shaders/rgbxmul.frag @@ -15,8 +15,8 @@ uniform vec2 tex1Resolution; out vec4 fragColor; void main() { - vec4 colorTex0 = texture2D(u_texture, v_texCoords + vec2(0.5, 0.5)); // world texture - vec4 colorTex1 = texture2D(tex1, v_texCoords); // lightmap (RGBA) + vec4 colorTex0 = texture(u_texture, v_texCoords + vec2(0.5, 0.5)); // world texture + vec4 colorTex1 = texture(tex1, v_texCoords); // lightmap (RGBA) colorTex1 = vec4(colorTex1.xyz, 1.0); diff --git a/src/shaders/tiling.frag b/src/shaders/tiling.frag index 5a847e9f5..70dcf0ad0 100644 --- a/src/shaders/tiling.frag +++ b/src/shaders/tiling.frag @@ -80,7 +80,7 @@ void main() { // get required tile numbers // - vec4 tileFromMap = texture2D(tilemap, flippedFragCoord / overscannedScreenDimension); // raw tile number + vec4 tileFromMap = texture(tilemap, flippedFragCoord / overscannedScreenDimension); // raw tile number int tile = getTileFromColor(tileFromMap); int breakage = getBreakageFromColor(tileFromMap); ivec2 tileXY = getTileXY(tile); @@ -100,12 +100,12 @@ void main() { // blending a breakage tex with main tex // - vec4 tileCol = texture2D(tilesAtlas, finalUVCoordForTile); - vec4 tileAltCol = texture2D(tilesBlendAtlas, finalUVCoordForTile); + vec4 tileCol = texture(tilesAtlas, finalUVCoordForTile); + vec4 tileAltCol = texture(tilesBlendAtlas, finalUVCoordForTile); vec4 finalTile = mix(tileCol, tileAltCol, tilesBlend); - vec4 finalBreakage = drawBreakage * texture2D(tilesAtlas, finalUVCoordForBreakage); // drawBreakeage = 0 to not draw, = 1 to draw + vec4 finalBreakage = drawBreakage * texture(tilesAtlas, finalUVCoordForBreakage); // drawBreakeage = 0 to not draw, = 1 to draw vec4 finalColor =mix(finalTile, finalBreakage, finalBreakage.a) * bc.xxxy + (finalTile * bc.yyyx); diff --git a/src/shaders/tiling_dither.frag b/src/shaders/tiling_dither.frag index 3001214cb..672d25e70 100644 --- a/src/shaders/tiling_dither.frag +++ b/src/shaders/tiling_dither.frag @@ -87,7 +87,7 @@ void main() { // get required tile numbers // - vec4 tileFromMap = texture2D(tilemap, flippedFragCoord / overscannedScreenDimension); // raw tile number + vec4 tileFromMap = texture(tilemap, flippedFragCoord / overscannedScreenDimension); // raw tile number int tile = getTileFromColor(tileFromMap); int breakage = getBreakageFromColor(tileFromMap); ivec2 tileXY = getTileXY(tile); @@ -107,12 +107,12 @@ void main() { // blending a breakage tex with main tex // - vec4 tileCol = texture2D(tilesAtlas, finalUVCoordForTile); - vec4 tileAltCol = texture2D(tilesBlendAtlas, finalUVCoordForTile); + vec4 tileCol = texture(tilesAtlas, finalUVCoordForTile); + vec4 tileAltCol = texture(tilesBlendAtlas, finalUVCoordForTile); vec4 finalTile = mix(tileCol, tileAltCol, tilesBlend); - vec4 finalBreakage = drawBreakage * texture2D(tilesAtlas, finalUVCoordForBreakage); // drawBreakeage = 0 to not draw, = 1 to draw + vec4 finalBreakage = drawBreakage * texture(tilesAtlas, finalUVCoordForBreakage); // drawBreakeage = 0 to not draw, = 1 to draw vec4 finalColor =mix(finalTile, finalBreakage, finalBreakage.a) * bc.xxxy + (finalTile * bc.yyyx); diff --git a/src/shaders/ycocg_grading.frag b/src/shaders/ycocg_grading.frag index 1b4756f9e..a610d7bac 100644 --- a/src/shaders/ycocg_grading.frag +++ b/src/shaders/ycocg_grading.frag @@ -27,7 +27,7 @@ mat4 ycocg_to_rgb = mat4( vec2 boolean = vec2(0.0, 1.0); void main() { - vec4 incolour = texture2D(u_texture, v_texCoords); + vec4 incolour = texture(u_texture, v_texCoords); vec4 yog = rgb_to_ycocg * incolour; // vec4(Y, Co, Cg, A) where Y,A=[0,1]; Co,Cg=[-1,1] vec4 scalar = vec4(1.0, 2.0, 2.0, 1.0);