mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-05 06:14:36 +00:00
pico stage shader
This commit is contained in:
parent
8f2b147d58
commit
2f63837430
|
@ -43,6 +43,8 @@ import openfl.display.BitmapData;
|
||||||
import openfl.display.BlendMode;
|
import openfl.display.BlendMode;
|
||||||
import openfl.display.StageQuality;
|
import openfl.display.StageQuality;
|
||||||
import openfl.filters.ShaderFilter;
|
import openfl.filters.ShaderFilter;
|
||||||
|
import shaderslmfao.BuildingShaders.BuildingShader;
|
||||||
|
import shaderslmfao.BuildingShaders;
|
||||||
import shaderslmfao.ColorSwap;
|
import shaderslmfao.ColorSwap;
|
||||||
import ui.PreferencesMenu;
|
import ui.PreferencesMenu;
|
||||||
|
|
||||||
|
@ -157,6 +159,7 @@ class PlayState extends MusicBeatState
|
||||||
#end
|
#end
|
||||||
|
|
||||||
var camPos:FlxPoint;
|
var camPos:FlxPoint;
|
||||||
|
var lightFadeShader:BuildingShaders;
|
||||||
|
|
||||||
override public function create()
|
override public function create()
|
||||||
{
|
{
|
||||||
|
@ -254,7 +257,9 @@ class PlayState extends MusicBeatState
|
||||||
city.updateHitbox();
|
city.updateHitbox();
|
||||||
add(city);
|
add(city);
|
||||||
|
|
||||||
|
lightFadeShader = new BuildingShaders();
|
||||||
phillyCityLights = new FlxTypedGroup<FlxSprite>();
|
phillyCityLights = new FlxTypedGroup<FlxSprite>();
|
||||||
|
|
||||||
add(phillyCityLights);
|
add(phillyCityLights);
|
||||||
|
|
||||||
for (i in 0...5)
|
for (i in 0...5)
|
||||||
|
@ -265,6 +270,7 @@ class PlayState extends MusicBeatState
|
||||||
light.setGraphicSize(Std.int(light.width * 0.85));
|
light.setGraphicSize(Std.int(light.width * 0.85));
|
||||||
light.updateHitbox();
|
light.updateHitbox();
|
||||||
light.antialiasing = true;
|
light.antialiasing = true;
|
||||||
|
light.shader = lightFadeShader.shader;
|
||||||
phillyCityLights.add(light);
|
phillyCityLights.add(light);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -936,6 +942,7 @@ class PlayState extends MusicBeatState
|
||||||
var vid:FlxVideo = new FlxVideo('music/ughCutscene.mp4');
|
var vid:FlxVideo = new FlxVideo('music/ughCutscene.mp4');
|
||||||
vid.finishCallback = function()
|
vid.finishCallback = function()
|
||||||
{
|
{
|
||||||
|
FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom}, (Conductor.crochet / 1000) * 5, {ease: FlxEase.quadInOut});
|
||||||
startCountdown();
|
startCountdown();
|
||||||
cameraMovement();
|
cameraMovement();
|
||||||
};
|
};
|
||||||
|
@ -1942,7 +1949,8 @@ class PlayState extends MusicBeatState
|
||||||
trainFrameTiming = 0;
|
trainFrameTiming = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// phillyCityLights.members[curLight].alpha -= (Conductor.crochet / 1000) * FlxG.elapsed;
|
|
||||||
|
lightFadeShader.update((Conductor.crochet / 1000) * FlxG.elapsed * 1.5); // phillyCityLights.members[curLight].alpha -= (Conductor.crochet / 1000) * FlxG.elapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
|
@ -3002,6 +3010,8 @@ class PlayState extends MusicBeatState
|
||||||
|
|
||||||
if (curBeat % 4 == 0)
|
if (curBeat % 4 == 0)
|
||||||
{
|
{
|
||||||
|
lightFadeShader.reset();
|
||||||
|
|
||||||
phillyCityLights.forEach(function(light:FlxSprite)
|
phillyCityLights.forEach(function(light:FlxSprite)
|
||||||
{
|
{
|
||||||
light.visible = false;
|
light.visible = false;
|
||||||
|
|
|
@ -29,6 +29,8 @@ import openfl.events.NetStatusEvent;
|
||||||
import openfl.media.Video;
|
import openfl.media.Video;
|
||||||
import openfl.net.NetConnection;
|
import openfl.net.NetConnection;
|
||||||
import openfl.net.NetStream;
|
import openfl.net.NetStream;
|
||||||
|
import shaderslmfao.BuildingShaders.BuildingShader;
|
||||||
|
import shaderslmfao.BuildingShaders;
|
||||||
import shaderslmfao.ColorSwap;
|
import shaderslmfao.ColorSwap;
|
||||||
import ui.PreferencesMenu;
|
import ui.PreferencesMenu;
|
||||||
|
|
||||||
|
@ -57,6 +59,7 @@ class TitleState extends MusicBeatState
|
||||||
var wackyImage:FlxSprite;
|
var wackyImage:FlxSprite;
|
||||||
var lastBeat:Int = 0;
|
var lastBeat:Int = 0;
|
||||||
var swagShader:ColorSwap;
|
var swagShader:ColorSwap;
|
||||||
|
var alphaShader:BuildingShaders;
|
||||||
var thingie:FlxSprite;
|
var thingie:FlxSprite;
|
||||||
|
|
||||||
var video:Video;
|
var video:Video;
|
||||||
|
@ -73,6 +76,7 @@ class TitleState extends MusicBeatState
|
||||||
FlxG.game.focusLostFramerate = 60;
|
FlxG.game.focusLostFramerate = 60;
|
||||||
|
|
||||||
swagShader = new ColorSwap();
|
swagShader = new ColorSwap();
|
||||||
|
alphaShader = new BuildingShaders();
|
||||||
|
|
||||||
FlxG.sound.muteKeys = [ZERO];
|
FlxG.sound.muteKeys = [ZERO];
|
||||||
|
|
||||||
|
@ -249,6 +253,7 @@ class TitleState extends MusicBeatState
|
||||||
logoBl.updateHitbox();
|
logoBl.updateHitbox();
|
||||||
|
|
||||||
logoBl.shader = swagShader.shader;
|
logoBl.shader = swagShader.shader;
|
||||||
|
// logoBl.shader = alphaShader.shader;
|
||||||
|
|
||||||
// trace();
|
// trace();
|
||||||
// logoBl.screenCenter();
|
// logoBl.screenCenter();
|
||||||
|
@ -465,11 +470,13 @@ class TitleState extends MusicBeatState
|
||||||
if (controls.UI_LEFT)
|
if (controls.UI_LEFT)
|
||||||
{
|
{
|
||||||
swagShader.update(-elapsed * 0.1);
|
swagShader.update(-elapsed * 0.1);
|
||||||
|
// alphaShader.update(-elapsed * 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (controls.UI_RIGHT)
|
if (controls.UI_RIGHT)
|
||||||
{
|
{
|
||||||
swagShader.update(elapsed * 0.1);
|
swagShader.update(elapsed * 0.1);
|
||||||
|
// alphaShader.update(elapsed * 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
|
|
49
source/shaderslmfao/BuildingShaders.hx
Normal file
49
source/shaderslmfao/BuildingShaders.hx
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
package shaderslmfao;
|
||||||
|
|
||||||
|
import flixel.system.FlxAssets.FlxShader;
|
||||||
|
|
||||||
|
class BuildingShaders
|
||||||
|
{
|
||||||
|
public var shader(default, null):BuildingShader;
|
||||||
|
public var daAlpha:Float = 1;
|
||||||
|
|
||||||
|
public function new():Void
|
||||||
|
{
|
||||||
|
shader = new BuildingShader();
|
||||||
|
shader.alphaShit.value = [0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(elapsed:Float):Void
|
||||||
|
{
|
||||||
|
shader.alphaShit.value[0] += elapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reset()
|
||||||
|
{
|
||||||
|
shader.alphaShit.value[0] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class BuildingShader extends FlxShader
|
||||||
|
{
|
||||||
|
@:glFragmentSource('
|
||||||
|
#pragma header
|
||||||
|
|
||||||
|
uniform float alphaShit;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 color = flixel_texture2D(bitmap, openfl_TextureCoordv);
|
||||||
|
|
||||||
|
if (color.a > 0.0)
|
||||||
|
color -= alphaShit;
|
||||||
|
|
||||||
|
gl_FragColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
')
|
||||||
|
public function new()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue