• Zicklag

    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.js file 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.

    posted in Kode read more
  • Zicklag

    @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 FragmentShader.fromSource(source:String) and new FragmentShader(sources:Array<Blob>, Files:Array<String>) to get a FragmentShader instance?

    posted in Kode read more
  • Zicklag

    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.json file with references to all of the compiled shaders, which are stored in a <target>-resources directory.
    • The kha.internal.ShadersBuilder.build() macro is used to build the kha.Shaders class 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.

    My Questions:

    • 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 FragmentShader instance with the fromSource function?
    • 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;

    posted in Kode read more

Looks like your connection to Kode Forum was lost, please wait while we try to reconnect.