Shader parser doesn't support comments
For lines like
// #if @normalMap
parser produces an error: Undefined normalMap
. Basically the /
character is not handled at all. Also the parser code doesn't look like very reliable. So instead of adding one more while
and some more if
s. I'd suggest to use some existing template engine like https://github.com/jinja2cpp/Jinja2Cpp or if we don't want to break compatibility (:sigh) write our own based at least on a tokenizer.
From the GLSL spec:
3.4 Comments
Comments are delimited by /* and /, or by // and a new-line. The begin comment delimiters (/ or //) are not recognized as comment delimiters inside of a comment, hence comments cannot be nested. If a comment resides entirely within a single line, it is treated syntactically as a single space. New-lines are not eliminated by comments.