WebGL-threeJS icon indicating copy to clipboard operation
WebGL-threeJS copied to clipboard

suggestion: implement colors

Open dlabz opened this issue 9 years ago • 0 comments

as @aothms suggested in another thread, there is a fairly simple way to implement colors. It would require to change the output format a bit, though.

First step would be to use geometryData.getMaterialIndices to split the vertex stream of an object in parts with same material, and export each piece as a separate geometry.

ThreeJS handles geometry without indices quite fine, so index stream can be omitted. On a side note, I see no reason why each triangle is exported two times in the current version.

Second step would be to change the "objects" part of the stream, so that it can support segmented objects. The easiest way would be to attach them as children to the Mesh3D objects, and assign individual materials. Each material can be accessed from the 'geometryData.getMaterials'. I'm guessing stream is four float values per material (RGBA).

dlabz avatar Feb 23 '16 18:02 dlabz