Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could still make this much simpler :D
I'm not sure if we even need a custom config format that needs parsing. If we do placeholder replacement, we can skip most of the parsing logic while supporting even more use cases.
Example
Template: shader.template
#version 330 uniform float template_local; // PLACEHOLDER: unifs_code.snippet void main() { // PLACEHOLDER: x_code.snippet // PLACEHOLDER: y_code.snippet gl_Position = move * vec4(x, y, 0.0, 1.0); }
Snippet: unifs_code.snippet
uniform float value;
Snippet: x_code.snippet
float x = value + 1.0
Snippet: y_code.snippet
float y = value - 1.0
End result:
#version 330 uniform float template_local; uniform float value; void main() { float x = value + 1.0 float y = value - 1.0 gl_Position = move * vec4(x, y, 0.0, 1.0); }