After stumbling across some old code, I discovered that it was mostly functional.
var geom = new THREE.Geometry();
geom.vertices = testRect.verts();
for ( var i = 0; i < verts.length; i+=4 ) {
geom.faceVertexUvs[0].push([
new THREE.Vector2(1.0 - ((verts[i].x - testRect.x) / testRect.width), 1.0 - ((verts[i].z - testRect.y) / testRect.height)),
new THREE.Vector2(1.0 - ((verts[i+1].x - testRect.x) / testRect.width), 1.0 - ((verts[i+1].z - testRect.y) / testRect.height)),
new THREE.Vector2(1.0 - ((verts[i+2].x - testRect.x) / testRect.width), 1.0 - ((verts[i+2].z - testRect.y) / testRect.height)),
new THREE.Vector2(1.0 - ((verts[i+3].x - testRect.x) / testRect.width), 1.0 - ((verts[i+3].z - testRect.y) / testRect.height))
]);
}
for ( var i=0, vl=verts.length; i<vl; i+=4) {
geom.faces.push(new THREE.Face4(i, i+1, i+2, i+3));
}
Figured out what needed to be fixed (Face4
changed to Face3
)
THREE.Face4 = function ( a, b, c, d, normal, color, materialIndex ) {
return new THREE.Face3( a, b, c, normal, color, materialIndex );
};
However, I noticed that there were insufficient polygons in the model
Attempted to address this issue
for ( var i=0, vl=verts.length; i<vl; i+=4) {
geom.faces.push(new THREE.Face4(i, i+1, i+2, i+3));
geom.faces.push(new THREE.Face4(i, i+3, i+2, i+1));
}
Unfortunately, no progress was made with this approach (
Looking for assistance in solving this problem)