Skip to content

Commit

Permalink
DUMMY HAYA gimme one sec
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoshubs authored Sep 25, 2021
2 parents 320f1f7 + 2074801 commit 47739a0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
26 changes: 14 additions & 12 deletions source/gameFolder/meta/shaders/PerspectiveShader.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package gameFolder.meta.shaders;

import flixel.math.FlxAngle;
import flixel.system.FlxAssets.FlxShader;
import openfl.display.GraphicsShader;

class PerspectiveHelper
{
Expand All @@ -13,48 +14,48 @@ class PerspectiveHelper

public function new()
{
shader.rotX.value = [0];
shader.rotY.value = [0];
shader.skewX.value = [0];
shader.skewY.value = [0];
shader.data.rotX.value = [0];
shader.data.rotY.value = [0];
shader.data.skewX.value = [0];
shader.data.skewY.value = [0];
}

function set_rotX(value:Float):Float
{
rotX = value;
shader.rotX.value = [value * FlxAngle.TO_RAD];
shader.data.rotX.value = [value * FlxAngle.TO_RAD];

return value;
}

function set_rotY(value:Float):Float
{
rotY = value;
shader.rotY.value = [value * FlxAngle.TO_RAD];
shader.data.rotY.value = [value * FlxAngle.TO_RAD];

return value;
}

function set_skewX(value:Float):Float
{
skewX = value;
shader.skewX.value = [value * FlxAngle.TO_RAD];
shader.data.skewX.value = [value * FlxAngle.TO_RAD];

return value;
}

function set_skewY(value:Float):Float
{
skewY = value;
shader.skewY.value = [value * FlxAngle.TO_RAD];
shader.data.skewY.value = [value * FlxAngle.TO_RAD];

return value;
}
}

class PerspectiveShader extends FlxShader
class PerspectiveShader extends GraphicsShader
{
@:glFragmentSource('
var frag = '
#pragma header

uniform float rotX;
Expand Down Expand Up @@ -124,9 +125,10 @@ class PerspectiveShader extends FlxShader
gl_FragColor = vec4(texture(bitmap, uv) + vec4(uv.x, uv.y, 0.0, 0.1) * 0.0);
//gl_FragColor = vec4(uv.x, uv.y, 0.0, 1.0);
}
}')
}';

public function new()
{
super();
super("", frag);
}
}
6 changes: 3 additions & 3 deletions source/gameFolder/meta/state/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,9 @@ class PlayState extends MusicBeatState
// Uncomment the code below to apply the effect

/*
var shader:GraphicsShader = new GraphicsShader("", File.getContent("./assets/shaders/vhs.frag"));
FlxG.camera.setFilters([new ShaderFilter(shader)]);
*/
var shader:GraphicsShader = new GraphicsShader("", File.getContent("./assets/shaders/vhs.frag"));
FlxG.camera.setFilters([new ShaderFilter(shader)]);
*/
}

var staticDisplace:Int = 0;
Expand Down

0 comments on commit 47739a0

Please sign in to comment.