Hey everyone,
as I work quite a lot with shaders in GMS2, I've found it really a pitty that there was no easy way to reuse shader functions between projects or even multiple shaders in a single project, that would not require copy-pasting them all over the place. In HLSL, it is possible to use #include preprocessor command, but that takes files from god knows which directory (in GMS1 it was the included files) and GLSL specification does not support includes at all (except for some extension that didn't seem to work).
And so I decided to create my own tool that solves this problem. It is called Xpanda and it is available for free on the GameMakerDiscord github, including a growing library of handy functions. With this tool you can just write #pragma include("SomeCoolFunctions.sh") (almost) anywhere in your shaders (both GLSL and HLSL) and run the tool to copy the contents of the specified file to the shader. I've also made it in a way that it has a translation table (like Mat3 will translate to mat3 in GLSL and float3x3 in HLSL etc.), so you can easier make functions compatible and reusable in both GLSL and HLSL. Well, you can find more info and full how-to at the repo.
So if you are interested, you can just check it out and also I would really welcome if you let me know whether you like it or not and what you think I could improve.
Cheers,
Patrik
PS: I have a history of making threads in wrong sections, so pardon me if this is another case.
as I work quite a lot with shaders in GMS2, I've found it really a pitty that there was no easy way to reuse shader functions between projects or even multiple shaders in a single project, that would not require copy-pasting them all over the place. In HLSL, it is possible to use #include preprocessor command, but that takes files from god knows which directory (in GMS1 it was the included files) and GLSL specification does not support includes at all (except for some extension that didn't seem to work).
And so I decided to create my own tool that solves this problem. It is called Xpanda and it is available for free on the GameMakerDiscord github, including a growing library of handy functions. With this tool you can just write #pragma include("SomeCoolFunctions.sh") (almost) anywhere in your shaders (both GLSL and HLSL) and run the tool to copy the contents of the specified file to the shader. I've also made it in a way that it has a translation table (like Mat3 will translate to mat3 in GLSL and float3x3 in HLSL etc.), so you can easier make functions compatible and reusable in both GLSL and HLSL. Well, you can find more info and full how-to at the repo.
So if you are interested, you can just check it out and also I would really welcome if you let me know whether you like it or not and what you think I could improve.
Cheers,
Patrik
PS: I have a history of making threads in wrong sections, so pardon me if this is another case.