indigo
indigo copied to clipboard
Add support for GLSL #define statements (and other preprocessors?)
Sometimes we need to be able to make use of preprocessors, for example if we need to set the length of UBO arrays.
The way JavaScript folks seem to do this is by doing string replacement to generate shaders as needed.
Given that we have fixed ways of adding shaders into Indigo, we could allow for either an arbitrary preprocessor block to be defined, or for shaders to be parameterised with arguments that are converted to define statements. Can we do better?
I've actually added support for this in the Roguelike-starterkit, however those are for generated shaders, not custom shaders a user has written. Still, might offer a clue...
I'm confident this is now doable using Ultraviolet shaders.