Is there a way to list folders and files in Krom? I'm targeting Krom and I need to be able to list the directories in a "Mods" folder and execute the
krom.jsfile in every mod. As far as I can tell, the Kha API allows you to load blobs from a path, but it doesn't allow you to list directories or files within a path. I suppose that makes a certain amount of sense because that wouldn't work on all platforms, such as web, but I do need a way to do it on the Krom platform.
@robert Thanks! That will be perfect. I am only planning on targeting Krom at the moment and I am going to be compiling the shaders ahead of time for it, but what is the difference between using
new FragmentShader(sources:Array<Blob>, Files:Array<String>)to get a
Hi everybody, I am trying to work a modding system into Armory and I'm in need of a way to load shaders dynamically from mods.
The way Kha games normally load shaders, as far as I understand, is:
- The Shaders in the project are located by Khamake.
- Khamake writes out a
files.jsonfile with references to all of the compiled shaders, which are stored in a
kha.internal.ShadersBuilder.build()macro is used to build the
kha.Shadersclass and provide a field in that class for every shader found by Khamake.
This workflow hardcodes the shaders available to the game at build-time, which is fine for most circumstances, but not if I need to dynamically load mods.
I found this function in the
FragmentShaderclass and I was wondering if this would let me load a shader at runtime, but it has a warning about the function not being portable.
- Does anybody know what "not portable" means exactly?
- Would it work if I loaded the Shader data blob at runtime from a file and created a
FragmentShaderinstance with the
- Are there any better ways to do this that I am not aware of?
/** Beware: This function is not portable. **/ public static function fromSource(source: String): FragmentShader;