|
@@ -253,9 +253,9 @@ THREE.OBJLoader = ( function () {
|
|
|
var src = this.colors;
|
|
|
var dst = this.object.geometry.colors;
|
|
|
|
|
|
- dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] );
|
|
|
- dst.push( src[ b + 0 ], src[ b + 1 ], src[ b + 2 ] );
|
|
|
- dst.push( src[ c + 0 ], src[ c + 1 ], src[ c + 2 ] );
|
|
|
+ if ( src[ a ] !== undefined ) dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] );
|
|
|
+ if ( src[ b ] !== undefined ) dst.push( src[ b + 0 ], src[ b + 1 ], src[ b + 2 ] );
|
|
|
+ if ( src[ c ] !== undefined ) dst.push( src[ c + 0 ], src[ c + 1 ], src[ c + 2 ] );
|
|
|
|
|
|
},
|
|
|
|
|
@@ -288,12 +288,7 @@ THREE.OBJLoader = ( function () {
|
|
|
var ic = this.parseVertexIndex( c, vLen );
|
|
|
|
|
|
this.addVertex( ia, ib, ic );
|
|
|
-
|
|
|
- if ( this.colors.length > 0 ) {
|
|
|
-
|
|
|
- this.addColor( ia, ib, ic );
|
|
|
-
|
|
|
- }
|
|
|
+ this.addColor( ia, ib, ic );
|
|
|
|
|
|
if ( ua !== undefined && ua !== '' ) {
|
|
|
|
|
@@ -461,6 +456,12 @@ THREE.OBJLoader = ( function () {
|
|
|
|
|
|
);
|
|
|
|
|
|
+ } else {
|
|
|
+
|
|
|
+ // if no colors are defined, add placeholders so color and vertex indices match
|
|
|
+
|
|
|
+ state.colors.push( undefined, undefined, undefined );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
break;
|