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
FragmentShader class 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;