Skip to content

Commit

Permalink
FIX SHADERS
Browse files Browse the repository at this point in the history
  • Loading branch information
haya3218 committed Sep 25, 2021
1 parent 320f1f7 commit 2691f5d
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 50 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);
}
}
74 changes: 36 additions & 38 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 Expand Up @@ -417,50 +417,48 @@ class PlayState extends MusicBeatState
updateRPC(true);
}

/*
for (i in 0...uEffects.length)
for (i in 0...uEffects.length)
{
if (pr.P)
{
if (pr.P)
{
uEffects[i].rotX += 1;
}
uEffects[i].rotX += 1;
}

if (pr.I)
{
uEffects[i].rotX -= 1;
}
if (pr.I)
{
uEffects[i].rotX -= 1;
}

if (pr.U)
{
uEffects[i].rotY += 1;
}
if (pr.U)
{
uEffects[i].rotY += 1;
}

if (pr.T)
{
uEffects[i].rotY -= 1;
}
if (pr.T)
{
uEffects[i].rotY -= 1;
}

if (pr.Y)
{
uEffects[i].skewX += 1;
}
if (pr.Y)
{
uEffects[i].skewX += 1;
}

if (pr.R)
{
uEffects[i].skewX -= 1;
}
if (pr.R)
{
uEffects[i].skewX -= 1;
}

if (pr.E)
{
uEffects[i].skewY += 1;
}
if (pr.E)
{
uEffects[i].skewY += 1;
}

if (pr.Q)
{
uEffects[i].skewY -= 1;
}
if (pr.Q)
{
uEffects[i].skewY -= 1;
}
*/
}

// make sure you're not cheating lol
if (!isStoryMode)
Expand Down

0 comments on commit 2691f5d

Please sign in to comment.