mikolalysenko/mikolalysenko.github.com — pull request #2 by nsf (2013-10-12 09:52:13+00:00)
Title: Fix problem with black triangles in isosurface demo.

The reason why it happens is because some quad faces have merged vertices. And Three.js uses only 3 first vertices to calculate the normal of the quad. But if two of these 3 first vertices are equal, the normal becomes (0, 0, 0) which leads to broken color as a result.

The solution is simple - replace the routine that calculates the normals for faces in the geometry with our own. We take "merged vertices in quads" case into account and use the opposite triangle of the quad to do the job in the first triangle results in a broken zero normal.

P.S. Sorry for removed trailing spaces in the commit, my editor does it automatically and yours should too.