https://github.com/mrdoob/three.js/blob/1769fbfc6c994b51a54c...
I also don't see any heuristic processing of shaders as described for ZyGL.
https://github.com/mrdoob/three.js/blob/master/src/core/Face...
https://github.com/mrdoob/three.js/blob/88092284cbe07723fe2b...
And the relevant issue: https://github.com/mrdoob/three.js/issues/3663
Reconstructing quads from pairs of triangles is just about doable in a one-liner. The harder part in my opinion is applying texture mapping to the resulting triangle, but it's not unreasonably difficult.
// this depends on your winding
triangles = [1, 2, 4, 2, 3, 4]
quads = []
for i in xrange(len(triangles), 6):
t = triangles[i:i+6]
quads += [t[0], t[1], t[4], t[2]]
The only things I think are interesting here are their heuristics on shaders to apply color maps, and the fact they shipped a game with it.So, what about that arbitrary shader code? In practice, the shaders used in 2D games tend to be fairly simple. ZyGL applies a series of heuristics to the shader code to try to infer its intent. It then uses these heuristics to map the draw calls through to some approximations of common shader code that we wrote in JavaScript.
I'm not aware of any prior art that is (a) a polyfill for WebGL using canvas that also (b) reconstructs triangle strips into canvas quads and (c) attempts to mimic shader effects by scanning the shader code for common techniques.