kovasb / gamma

glsl shaders made simple
Eclipse Public License 1.0
306 stars 20 forks source link

Support statements at top level, for e.g. discard #39

Open emnh opened 7 years ago

emnh commented 7 years ago

As it looks gamma only supports assignments at the top level, since the "ast" function in program.cljs maps to g/set k v over the top level dictionary. The discard statement is needed for proper transparency sorting, as described in https://www.khronos.org/opengl/wiki/Transparency_Sorting .

I resorted to putting a magic vector vec4(0.0, 1.0, 2.0, 3.0) and then doing a search/replace on the glsl string to insert a discard later, but that's not very robust to changes in the gamma compiler. Is there a better temporary hack? And is support for imperative statements expected in the future or completely out of scope?

skrat commented 7 years ago

+1