diff --git a/source/OverlayShader.hx b/source/OverlayShader.hx deleted file mode 100644 index 4de9a555e..000000000 --- a/source/OverlayShader.hx +++ /dev/null @@ -1,33 +0,0 @@ -package; - -import flixel.system.FlxAssets.FlxShader; - -class OverlayShader extends FlxShader -{ - @:glFragmentSource(' - #pragma header - uniform vec4 uBlendColor; - - vec3 blendLighten(base:Vec3, blend:Vec3) : Vec3 { - return mix( - 1.0 - 2.0 * (1.0 - base) * (1.0 - blend), - 2.0 * base * blend, - step( base, vec3(0.5) ) - ); - } - - vec4 blendLighten(vec4 base, vec4 blend, float opacity) - { - return (blendLighten(base, blend) * opacity + base * (1.0 - opacity)); - } - - void main() - { - vec4 base = texture2D(bitmap, openfl_TextureCoordv); - gl_FragColor = blendLighten(base, uBlendColor, uBlendColor.a); - }') - public function new() - { - super(); - } -} diff --git a/source/PlayState.hx b/source/PlayState.hx index 090f6fdc4..a802345dd 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -48,6 +48,7 @@ import openfl.utils.ByteArray; import shaderslmfao.BuildingShaders.BuildingShader; import shaderslmfao.BuildingShaders; import shaderslmfao.ColorSwap; +import shaderslmfao.OverlayBlend; import ui.PreferencesMenu; using StringTools; @@ -290,6 +291,14 @@ class PlayState extends MusicBeatState defaultCamZoom *= 0.90; var skyBG:FlxSprite = new FlxSprite(-120, -50).loadGraphic(Paths.image('limo/limoSunset')); + + var overlayShader:OverlayBlend = new OverlayBlend(); + var sunOverlay:FlxSprite = new FlxSprite().loadGraphic(Paths.image('limo/limoOverlay')); + sunOverlay.setGraphicSize(Std.int(sunOverlay.width * 2)); + sunOverlay.updateHitbox(); + overlayShader.funnyShit.input = sunOverlay.pixels; + skyBG.shader = overlayShader; + skyBG.scrollFactor.set(0.1, 0.1); add(skyBG); diff --git a/source/shaderslmfao/BuildingShaders.hx b/source/shaderslmfao/BuildingShaders.hx index 8106967d1..a89a3b0df 100644 --- a/source/shaderslmfao/BuildingShaders.hx +++ b/source/shaderslmfao/BuildingShaders.hx @@ -35,6 +35,8 @@ class BuildingShader extends FlxShader { vec4 color = flixel_texture2D(bitmap, openfl_TextureCoordv); + + if (color.a > 0.0) color -= alphaShit; diff --git a/source/shaderslmfao/OverlayBlend.hx b/source/shaderslmfao/OverlayBlend.hx index 1cf74a02e..78e03fb6d 100644 --- a/source/shaderslmfao/OverlayBlend.hx +++ b/source/shaderslmfao/OverlayBlend.hx @@ -3,7 +3,7 @@ package shaderslmfao; import flixel.math.FlxPoint; import flixel.system.FlxAssets.FlxShader; -class TitleOutline extends FlxShader +class OverlayBlend extends FlxShader { // these r copypaste public var funnyX(default, set):Float = 0; @@ -27,13 +27,15 @@ class TitleOutline extends FlxShader #pragma header uniform float alphaShit; + uniform float yPos; + uniform float xPos; uniform sampler2D funnyShit; - vec3 blendOverlay(vec3 base, vec3 blend) + vec4 blendOverlay(vec4 base, vec4 blend) { - return mix(1.0 - 2.0 * (1.0 - base) * (1.0 - blend), 2.0 * base * blend, step(base, vec3(0.5))); + return mix(1.0 - 2.0 * (1.0 - base) * (1.0 - blend), 2.0 * base * blend, step(base, vec4(0.5))); } void main() @@ -41,12 +43,14 @@ class TitleOutline extends FlxShader vec2 funnyUv = openfl_TextureCoordv; vec4 color = flixel_texture2D(bitmap, funnyUv); - vec4 gf = flixel_texture2D(funnyShit, openfl_TextureCoordv); + vec2 reallyFunnyUv = vec2(vec2(0.0, 0.0) - gl_FragCoord.xy / openfl_TextureSize.xy); + + vec4 gf = flixel_texture2D(funnyShit, openfl_TextureCoordv.xy + vec2(0.1, 0.2)); - vec3 mixedCol = blendOverlay(color.rgb, gf.rgb); + vec4 mixedCol = blendOverlay(gf, color); - gl_FragColor = vec4(mixedCol, color.a); + gl_FragColor = mixedCol; } ')