From 943b1ad8a10e6c88966b3610d43791a8ea2a4666 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Mon, 23 Jan 2017 08:20:07 -0800 Subject: [PATCH] lots of weird changes to frag shader. --- desktop/last-release | 2 +- desktop/src-common/advent/screens/scene.clj | 49 +++++++++++---------- ios/Info.plist.xml | 4 +- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/desktop/last-release b/desktop/last-release index b8626c4c..7ed6ff82 100644 --- a/desktop/last-release +++ b/desktop/last-release @@ -1 +1 @@ -4 +5 diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index 494e168d..e4d99b03 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -113,29 +113,30 @@ vec3 HUEtoRGB(float H) return clamp(vec3(R,G,B), 0.0, 1.0); } -vec3 HSLtoRGB(vec3 HSL) +vec4 HSLtoRGB(vec3 HSL) { vec3 RGB = HUEtoRGB(HSL.x); float C = (1.0 - abs(2.0 * HSL.z - 1.0)) * HSL.y; - return (RGB - 0.5) * C + HSL.z; + vec3 result = (RGB - 0.5) * C + HSL.z; + return vec4(result[0], result[1], result[2], 0.0); } -vec3 RGBtoHSL(vec3 RGB) +vec4 RGBtoHSL(vec4 RGB) { - vec3 HCV = RGBtoHCV(RGB); + vec3 HCV = RGBtoHCV(RGB.rgb); float L = HCV.z - HCV.y * 0.5; float S = HCV.y / (1.0 - abs(L * 2.0 - 1.0) + Epsilon); - return vec3(HCV.x, S, L); + return vec4(HCV.x, S, L, 0.0); } -vec3 BlendHue(vec3 base, vec3 blend) +vec4 BlendHue(vec4 base, vec4 blend) { if (blend.r == blend.g && blend.g == blend.b) { return base; } else { - vec3 baseHSL = RGBtoHSL(base); + vec4 baseHSL = RGBtoHSL(base); return HSLtoRGB(vec3(RGBtoHSL(blend).r, baseHSL.g, baseHSL.b)); } } @@ -150,27 +151,27 @@ void main () vec2 sz = vec2 (2048.0, 2048.0); vec3 step = vec3 (1.0 / 4.0, 1.0 / 4.0, 0.0); vec2 tex_pixel = sz * v_texCoords - step.xy / 2.0; + float a = texture2D (u_texture, v_texCoords).w; - vec2 corner = floor (tex_pixel) + 1.0; - vec2 frac = min ((corner - tex_pixel) * vec2 (4.0, 4.0), vec2 (1.0, 1.0)); + vec2 corner = floor (tex_pixel) + 1.0; + vec2 frac = min ((corner - tex_pixel) * vec2 (4.0, 4.0), vec2 (1.0, 1.0)); - vec4 c1 = texture2D (u_texture, (floor (tex_pixel + step.zz) + 0.5) / sz); - vec4 c2 = texture2D (u_texture, (floor (tex_pixel + step.xz) + 0.5) / sz); - vec4 c3 = texture2D (u_texture, (floor (tex_pixel + step.zy) + 0.5) / sz); - vec4 c4 = texture2D (u_texture, (floor (tex_pixel + step.xy) + 0.5) / sz); + vec4 c1 = texture2D (u_texture, (floor (tex_pixel + step.zz) + 0.5) / sz); + vec4 c2 = texture2D (u_texture, (floor (tex_pixel + step.xz) + 0.5) / sz); + vec4 c3 = texture2D (u_texture, (floor (tex_pixel + step.zy) + 0.5) / sz); + vec4 c4 = texture2D (u_texture, (floor (tex_pixel + step.xy) + 0.5) / sz); - c1 *= frac.x * frac.y; - c2 *= (1.0 - frac.x) * frac.y; - c3 *= frac.x * (1.0 - frac.y); - c4 *= (1.0 - frac.x) * (1.0 - frac.y); + c1 *= frac.x * frac.y; + c2 *= (1.0 - frac.x) * frac.y; + c3 *= frac.x * (1.0 - frac.y); + c4 *= (1.0 - frac.x) * (1.0 - frac.y); + vec4 scaledColor = (c1 + c2 + c3 + c4); - vec4 scaledColor = (c1 + c2 + c3 + c4); + vec4 multiplied = mix(scaledColor.rgba, v_color.rgba * scaledColor.rgba, multiply_amount * 0.67 ); + vec4 hued = mix(multiplied, BlendHue(multiplied.rgba, v_color.rgba), hue_amount * 0.67); + vec4 final = hued; - vec3 multiplied = mix(scaledColor.rgb, v_color.rgb * scaledColor.rgb, multiply_amount * 0.67 ); - vec3 hued = mix(multiplied, BlendHue(multiplied.rgb, v_color.rgb), hue_amount * 0.67); - vec3 final = hued; - - gl_FragColor = vec4(final[0], final[1], final[2], scaledColor.a * v_color.a); + gl_FragColor = vec4(final.xyz, a); } ") @@ -1434,7 +1435,7 @@ void main () [last-pos-x last-pos-y] (utils/unproject screen nil last-pos) last-pos-x (double last-pos-x) last-pos-y (double last-pos-y) - #_#_entities (if (and (@utils/settings :camera-man? true) + entities (if (and (@utils/settings :camera-man? true) (not (get-in entities [:cam :paused?])) (nil? (get-in entities [:tweens :cam-x])) (= 1 (rand-int 20))) diff --git a/ios/Info.plist.xml b/ios/Info.plist.xml index 05c8aebc..6d37ef2f 100644 --- a/ios/Info.plist.xml +++ b/ios/Info.plist.xml @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.0.4 + 2.0.5 CFBundleSignature ???? CFBundleVersion - 1 + 19 MinimumOSVersion 8.0 LSRequiresIPhoneOS