I am trying to write an geometry translator from one CAD package to ThreeJS through JSON. I can use the JSONLoader to bring in the geometry I am writing to a js file, but it seems the vertex index do not match the original faces. Let me show you: http://i.imgur.com/oVCUynr.png
This is a simple cube on the left. I've added some number tags so you can see the face index as well as the vertex index of the underlying information which forms the cube. On the right, is how I see it in the ThreeJS Editor.
The editor verifies the correct number of faces and vertices, but it seems the faces are not composed of the correct vertices.
Here is a link to the json file:https://gist.github.com/fraguada/8ea243744961d72d61de
Essentially what I am doing is creating a list of vertex coordinates
vertex[0].x,vertex[0].y,vertex[0].z, ...vertex[n].x,vertex[n].y,vertex[n].z....
similar for normals and faces
faces[0].a,faces[0].b,faces[0].c,...faces[n].a,faces[n].b,faces[n].c,...
Am I not understanding the manner in which to construct the ThreeJS? I've referred to the JSON format for ThreeJS but I am obviously not exporting the data correctly. Any pointers for what I may be doing wrong would be greatly appreciated. With more complex meshes, there are even faces missing.