mrdoob/three.js — Issue #1194: Geometry format
Author: HowCome
Created: 2012-01-26 22:43:27+00:00
State: open

I understand that geometry can be created from popular graphics formats such as obj.
However I am in a need to create a json file from a ++ application.
By looking at other js file I figured out that the format is the following:

{
"metadata": { "formatVersion" : 3, "generatedBy":...},
"scale" : 100.000000,
"materials": [],
"vertices": [-1306,2788,-842,...],
"morphTargets": [],
"normals": [],
"colors": [],
"uvs": [[]],
"faces": [],
"edges" : []
}

I understand about scale and vertices.
What about faces ?

In my C++ application has have colors and normals of all vertices/ Aso I have an integer index array that implements the order of the vertices.

So how would I generate the geometry.faces array ? The mesh is blended meaning that each vertex has its own color and normal rather than one normal and color for each triangle..