Skip to content

Commit

Permalink
shaders now work
Browse files Browse the repository at this point in the history
  • Loading branch information
justaguy6 committed Oct 3, 2024
1 parent d093e0a commit 03e869d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 28 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion source/backend/Mods.hx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Mods
{
var foldersToCheck:Array<String> = [];
#if sys
if(FileSystem.exists(path + fileToFind))
if(openfl.utils.Assets.exists(path + fileToFind))
#end
foldersToCheck.push(path + fileToFind);

Expand Down
61 changes: 34 additions & 27 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3710,40 +3710,47 @@ class PlayState extends MusicBeatState
return true;
}

for (folder in Assets.list().filter(file -> file.contains('assets/shared/shaders/'))) {
var frag:String = folder + name + '.frag';
var vert:String = folder + name + '.vert';
var found:Bool = false;
if(Assets.exists(frag))
{
frag = Assets.getText(frag);
found = true;
}
else frag = null;
// for (folder in Assets.list().filter(file -> file.contains('assets/shared/shaders/'))) {

if(Assets.exists(vert))
var foldersToCheck:Array<String> = [Paths.getSharedPath('shaders/')]; // cheese burguer
for (folder in foldersToCheck)
{
for (file in Assets.list())
{
vert = Assets.getText(vert);
found = true;
}
else vert = null;

if(found)
{
runtimeShaders.set(name, [frag, vert]);
//trace('Found shader $name!');
return true;
}
}
var frag:String = folder + name + '.frag';
var vert:String = folder + name + '.vert';
var found:Bool = false;
if(Assets.exists(frag))
{
frag = Assets.getText(frag);
found = true;
}
else frag = null;

if(Assets.exists(vert))
{
vert = Assets.getText(vert);
found = true;
}
else vert = null;

if(found)
{
runtimeShaders.set(name, [frag, vert]);
return true;
}
}
}
#if (LUA_ALLOWED || HSCRIPT_ALLOWED)
addTextToDebug('Missing shader $name .frag AND .vert files!', FlxColor.RED);
#else
FlxG.log.warn('Missing shader $name .frag AND .vert files!');
#end
#else
FlxG.log.warn('This platform doesn\'t support Runtime Shaders!');
#end
return false;
}
#else
FlxG.log.warn('This platform doesn\'t support Runtime Shaders!');
#end
return false;
}
#end
}

0 comments on commit 03e869d

Please sign in to comment.