mrdoob/three.js — pull request #4433 by bbeausej (2014-02-13 04:19:49+00:00)
Title: CTMLoader - BufferGeometry - Proper fix for loading large (>65k vertices) models 

The following changeset introduce 2 new methods to BufferGeometry:
- computeOffsets( CHUNK_SIZE ) - Reorder the geometry index buffer and attributes so that all indices are drawn by offsets of a CHUNK_SIZE items max. (Defaults to 16-bits to respect WebGL max). This is done by properly reordering the index buffer and duplicating vertices that would be in different offsets.

- reorderBuffers() - Reorder and/or grow all vertex attributes in the geometry to adhere to a new index map. (Used by computeOffsets).

This patch set also includes a change to the CTMLoader to remove the previous chunking/reordering algorithm that was flawed for complex and large meshes that heavily reuse vertices where it would generate an insane amount of offsets. (Over 8,000 on our test mesh with 1.5M faces)

This patch with the same mesh generated a perfect output with only 12 draw offsets.

This was tested with production models with over 6 million triangles.

Hope this helps!