mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-27 01:55:52 -05:00
multiply shader in progres
This commit is contained in:
parent
0308de6110
commit
f6729592bf
3 changed files with 97 additions and 1 deletions
|
@ -283,7 +283,6 @@ class TitleState extends MusicBeatState
|
|||
outlineShaderShit = new TitleOutline();
|
||||
// logoBl.shader = swagShader.shader;
|
||||
// logoBl.shader = outlineShaderShit;
|
||||
// logoBl.shader = alphaShader.shader;
|
||||
|
||||
// trace();
|
||||
// logoBl.screenCenter();
|
||||
|
@ -296,6 +295,12 @@ class TitleState extends MusicBeatState
|
|||
gfDance.antialiasing = true;
|
||||
add(gfDance);
|
||||
|
||||
// alphaShader.shader.funnyShit.input = gfDance.pixels; // old shit
|
||||
|
||||
logoBl.shader = alphaShader.shader;
|
||||
|
||||
// trace(alphaShader.shader.glFragmentSource)
|
||||
|
||||
// gfDance.shader = swagShader.shader;
|
||||
|
||||
// gfDance.shader = new TitleOutline();
|
||||
|
|
31
source/shaderslmfao/MultiplyShader.hx
Normal file
31
source/shaderslmfao/MultiplyShader.hx
Normal file
|
@ -0,0 +1,31 @@
|
|||
package;
|
||||
|
||||
import flixel.system.FlxAssets.FlxShader;
|
||||
|
||||
class MultiplyShader extends FlxShader
|
||||
{
|
||||
@:glFragmentSource('
|
||||
#pragma header
|
||||
uniform sampler2D funnyImage;
|
||||
uniform vec4 uBlendColor;
|
||||
|
||||
vec4 blendMultiply(vec4 base, vec4 blend)
|
||||
{
|
||||
return base * blend;
|
||||
}
|
||||
|
||||
vec4 blendMultiply(vec4 base, vec4 blend, float opacity)
|
||||
{
|
||||
return (blendMultiply(base, blend) * opacity + base * (1.0 - opacity));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 base = texture2D(bitmap, openfl_TextureCoordv);
|
||||
gl_FragColor = blendMultiply(base, uBlendColor, uBlendColor.a);
|
||||
}')
|
||||
public function new()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
60
source/shaderslmfao/OverlayBlend.hx
Normal file
60
source/shaderslmfao/OverlayBlend.hx
Normal file
|
@ -0,0 +1,60 @@
|
|||
package shaderslmfao;
|
||||
|
||||
import flixel.math.FlxPoint;
|
||||
import flixel.system.FlxAssets.FlxShader;
|
||||
|
||||
class TitleOutline extends FlxShader
|
||||
{
|
||||
// these r copypaste
|
||||
public var funnyX(default, set):Float = 0;
|
||||
public var funnyY(default, set):Float = 0;
|
||||
|
||||
function set_funnyX(x:Float):Float
|
||||
{
|
||||
xPos.value[0] = x;
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
function set_funnyY(y:Float):Float
|
||||
{
|
||||
yPos.value[0] = y;
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
@:glFragmentSource('
|
||||
#pragma header
|
||||
|
||||
uniform float alphaShit;
|
||||
|
||||
uniform sampler2D funnyShit;
|
||||
|
||||
|
||||
vec3 blendOverlay(vec3 base, vec3 blend)
|
||||
{
|
||||
return mix(1.0 - 2.0 * (1.0 - base) * (1.0 - blend), 2.0 * base * blend, step(base, vec3(0.5)));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 funnyUv = openfl_TextureCoordv;
|
||||
vec4 color = flixel_texture2D(bitmap, funnyUv);
|
||||
|
||||
vec4 gf = flixel_texture2D(funnyShit, openfl_TextureCoordv);
|
||||
|
||||
|
||||
vec3 mixedCol = blendOverlay(color.rgb, gf.rgb);
|
||||
|
||||
gl_FragColor = vec4(mixedCol, color.a);
|
||||
}
|
||||
|
||||
')
|
||||
public function new()
|
||||
{
|
||||
super();
|
||||
|
||||
xPos.value = [0];
|
||||
yPos.value = [0];
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue