mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-27 01:55:52 -05:00
shader bullshit
This commit is contained in:
parent
671046a6d5
commit
c80d8cc09e
2 changed files with 26 additions and 3 deletions
|
@ -42,12 +42,16 @@ class TitleState extends MusicBeatState
|
|||
|
||||
var lastBeat:Int = 0;
|
||||
|
||||
// var swagShader:ColorSwap;
|
||||
|
||||
override public function create():Void
|
||||
{
|
||||
#if polymod
|
||||
polymod.Polymod.init({modRoot: "mods", dirs: ['introMod'], framework: OPENFL});
|
||||
#end
|
||||
|
||||
// swagShader = new ColorSwap();
|
||||
|
||||
FlxG.sound.muteKeys = [ZERO];
|
||||
|
||||
PlayerSettings.init();
|
||||
|
@ -150,6 +154,8 @@ class TitleState extends MusicBeatState
|
|||
logoBl.animation.play('bump');
|
||||
logoBl.updateHitbox();
|
||||
|
||||
// logoBl.shader = swagShader.shader;
|
||||
|
||||
// trace();
|
||||
// logoBl.screenCenter();
|
||||
// logoBl.color = FlxColor.BLACK;
|
||||
|
@ -161,7 +167,7 @@ class TitleState extends MusicBeatState
|
|||
gfDance.antialiasing = true;
|
||||
add(gfDance);
|
||||
|
||||
gfDance.shader = new ColorSwap().shader;
|
||||
// gfDance.shader = swagShader.shader;
|
||||
|
||||
add(logoBl);
|
||||
|
||||
|
@ -364,6 +370,8 @@ class TitleState extends MusicBeatState
|
|||
{
|
||||
super.beatHit();
|
||||
|
||||
// swagShader.update(FlxG.random.float(0.1, 0.7));
|
||||
|
||||
logoBl.animation.play('bump', true);
|
||||
|
||||
danceLeft = !danceLeft;
|
||||
|
|
|
@ -8,10 +8,17 @@ class ColorSwap
|
|||
public var shader(default, null):ColorSwapShader;
|
||||
public var colorToReplace(default, set):FlxColor;
|
||||
public var newColor(default, set):FlxColor;
|
||||
public var daTime(default, set):Float;
|
||||
|
||||
public function new():Void
|
||||
{
|
||||
shader = new ColorSwapShader();
|
||||
shader.uTime.value = [0];
|
||||
}
|
||||
|
||||
public function update(elapsed:Float):Void
|
||||
{
|
||||
shader.uTime.value[0] += elapsed;
|
||||
}
|
||||
|
||||
function set_colorToReplace(color:FlxColor):FlxColor
|
||||
|
@ -21,6 +28,11 @@ class ColorSwap
|
|||
return color;
|
||||
}
|
||||
|
||||
function set_daTime(daTime:Float):Float
|
||||
{
|
||||
return daTime;
|
||||
}
|
||||
|
||||
function set_newColor(color:FlxColor):FlxColor
|
||||
{
|
||||
newColor = color;
|
||||
|
@ -34,6 +46,9 @@ class ColorSwapShader extends FlxShader
|
|||
@:glFragmentSource('
|
||||
#pragma header
|
||||
|
||||
|
||||
uniform float uTime;
|
||||
|
||||
vec3 normalizeColor(vec3 color)
|
||||
{
|
||||
return vec3(
|
||||
|
@ -68,8 +83,8 @@ class ColorSwapShader extends FlxShader
|
|||
vec4 swagColor = vec4(rgb2hsv(vec3(color[0], color[1], color[2])), color[3]);
|
||||
|
||||
// [0] is the hue???
|
||||
swagColor[0] += 2;
|
||||
// swagColor[1] += 0.5;
|
||||
swagColor[0] += uTime;
|
||||
// swagColor[1] += uTime;
|
||||
|
||||
color = vec4(hsv2rgb(vec3(swagColor[0], swagColor[1], swagColor[2])), swagColor[3]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue