|
@@ -15,6 +15,8 @@ THREE.OBJExporter.prototype = {
|
|
var indexVertex = 0;
|
|
var indexVertex = 0;
|
|
var indexVertexUvs = 0;
|
|
var indexVertexUvs = 0;
|
|
var indexNormals = 0;
|
|
var indexNormals = 0;
|
|
|
|
+
|
|
|
|
+ var faceVertexKeys = ["a", "b", "c"];
|
|
|
|
|
|
var parseMesh = function ( mesh ) {
|
|
var parseMesh = function ( mesh ) {
|
|
|
|
|
|
@@ -112,18 +114,19 @@ THREE.OBJExporter.prototype = {
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// faces
|
|
// faces
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
for ( var i = 0, j = 1, l = faces.length; i < l; i ++, j += 3 ) {
|
|
for ( var i = 0, j = 1, l = faces.length; i < l; i ++, j += 3 ) {
|
|
|
|
|
|
var face = faces[ i ];
|
|
var face = faces[ i ];
|
|
|
|
|
|
output += 'f ';
|
|
output += 'f ';
|
|
- output += ( indexVertex + face.a + 1 ) + '/' + ( hasVertexUvs ? ( indexVertexUvs + j + 0 + 1 ) : '' ) + '/' + ( indexNormals + j + 0 + 1 ) + ' ';
|
|
|
|
- output += ( indexVertex + face.b + 1 ) + '/' + ( hasVertexUvs ? ( indexVertexUvs + j + 1 + 1 ) : '' ) + '/' + ( indexNormals + j + 1 + 1 ) + ' ';
|
|
|
|
- output += ( indexVertex + face.c + 1 ) + '/' + ( hasVertexUvs ? ( indexVertexUvs + j + 2 + 1 ) : '' ) + '/' + ( indexNormals + j + 2 + 1 ) + '\n';
|
|
|
|
|
|
+
|
|
|
|
+ for ( var m = 0; m < 3; m ++ ) {
|
|
|
|
+ output += ( indexVertex + face[ faceVertexKeys[ m ] ] + 1 ) + '/' + ( hasVertexUvs ? ( indexVertexUvs + j + m + 1 ) : '' ) + '/' + ( indexNormals + j + m + 1 );
|
|
|
|
+ output += m === 2 ? "\n" : " ";
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|