-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
137 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ school | |
schoolEvil | ||
exe | ||
bopcity | ||
fnaf | ||
fnaf | ||
ikea |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
package; | ||
|
||
import flixel.system.FlxAssets.FlxShader; | ||
|
||
/* VS DAVE AND BAMBI SHADERS IMPLEMENTATION | ||
ALL OF THIS CODE WAS WROTE BY MTM101, ERIZUR AND T5MPLER (BUGFIXES) | ||
*/ | ||
|
||
class GlitchEffect | ||
{ | ||
public var shader(default,null):GlitchShader = new GlitchShader(); | ||
|
||
#if SHADERS_ENABLED | ||
public var waveSpeed(default, set):Float = 0; | ||
public var waveFrequency(default, set):Float = 0; | ||
public var waveAmplitude(default, set):Float = 0; | ||
public var Enabled(default, set):Bool = true; | ||
|
||
public function new():Void | ||
{ | ||
shader.uTime.value = [0]; | ||
} | ||
|
||
public function update(elapsed:Float):Void | ||
{ | ||
shader.uTime.value[0] += elapsed; | ||
} | ||
|
||
function set_waveSpeed(v:Float):Float | ||
{ | ||
waveSpeed = v; | ||
shader.uSpeed.value = [waveSpeed]; | ||
return v; | ||
} | ||
function set_Enabled(v:Bool):Bool | ||
{ | ||
Enabled = v; | ||
shader.uEnabled.value = [Enabled]; | ||
return v; | ||
} | ||
|
||
function set_waveFrequency(v:Float):Float | ||
{ | ||
waveFrequency = v; | ||
shader.uFrequency.value = [waveFrequency]; | ||
return v; | ||
} | ||
|
||
function set_waveAmplitude(v:Float):Float | ||
{ | ||
waveAmplitude = v; | ||
shader.uWaveAmplitude.value = [waveAmplitude]; | ||
return v; | ||
} | ||
#end | ||
} | ||
|
||
|
||
class GlitchShader extends FlxShader | ||
{ | ||
#if SHADERS_ENABLED | ||
@:glFragmentSource(' | ||
#pragma header | ||
//uniform float tx, ty; // x,y waves phase | ||
|
||
//modified version of the wave shader to create weird garbled corruption like messes | ||
uniform float uTime; | ||
/** | ||
* How fast the waves move over time | ||
*/ | ||
uniform float uSpeed; | ||
/** | ||
* Number of waves over time | ||
*/ | ||
uniform float uFrequency; | ||
|
||
uniform bool uEnabled; | ||
/** | ||
* How much the pixels are going to stretch over the waves | ||
*/ | ||
uniform float uWaveAmplitude; | ||
|
||
vec2 sineWave(vec2 pt) | ||
{ | ||
float x = 0.0; | ||
float y = 0.0; | ||
float offsetX = sin(pt.y * uFrequency + uTime * uSpeed) * (uWaveAmplitude / pt.x * pt.y); | ||
float offsetY = sin(pt.x * uFrequency - uTime * uSpeed) * (uWaveAmplitude / pt.y * pt.x); | ||
pt.x += offsetX; // * (pt.y - 1.0); // <- Uncomment to stop bottom part of the screen from moving | ||
pt.y += offsetY; | ||
|
||
return vec2(pt.x + x, pt.y + y); | ||
} | ||
|
||
void main() | ||
{ | ||
vec2 uv = sineWave(openfl_TextureCoordv); | ||
gl_FragColor = texture2D(bitmap, uv); | ||
}') | ||
#end | ||
|
||
public function new() | ||
{ | ||
super(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters