I'm currently using Three.js to load a mesh and I am attempting to texture each quad individually. At the moment, I am able to texture each face (triangle), but I am unsure of how to determine if the current triangle and the last triangle are part of a quad (as they will share two vertices, but which ones?).
Is there a way for me to identify if two triangles actually form a quad?
var last = null;
for(var i in geometry.faces)
{
var face = geometry.faces[i];
var normal = face.normal.clone().normalize();
if(normal.y >= 0.9999)
{
face.materialIndex = 1;
//Check if face & last are part of a quad
if(face && last == same quad)
{
face.color = last.color;
}
else
{
face.color = new THREE.Color(Math.random() * 0xFFFFFF);
}
last = face;
}
}