Selaa lähdekoodia

OBJLoader: Fix color attribute.

Mugen87 5 vuotta sitten
vanhempi
commit
9b9b6877d3
2 muutettua tiedostoa jossa 12 lisäystä ja 12 poistoa
  1. 6 6
      examples/js/loaders/OBJLoader.js
  2. 6 6
      examples/jsm/loaders/OBJLoader.js

+ 6 - 6
examples/js/loaders/OBJLoader.js

@@ -286,6 +286,12 @@ THREE.OBJLoader = ( function () {
 
 
 				this.addVertex( ia, ib, ic );
 				this.addVertex( ia, ib, ic );
 
 
+				if ( this.colors.length > 0 ) {
+
+					this.addColor( ia, ib, ic );
+
+				}
+
 				if ( ua !== undefined && ua !== '' ) {
 				if ( ua !== undefined && ua !== '' ) {
 
 
 					var uvLen = this.uvs.length;
 					var uvLen = this.uvs.length;
@@ -309,12 +315,6 @@ THREE.OBJLoader = ( function () {
 
 
 				}
 				}
 
 
-				if ( this.colors.length > 0 ) {
-
-					this.addColor( ia, ib, ic );
-
-				}
-
 			},
 			},
 
 
 			addPointGeometry: function ( vertices ) {
 			addPointGeometry: function ( vertices ) {

+ 6 - 6
examples/jsm/loaders/OBJLoader.js

@@ -303,6 +303,12 @@ var OBJLoader = ( function () {
 
 
 				this.addVertex( ia, ib, ic );
 				this.addVertex( ia, ib, ic );
 
 
+				if ( this.colors.length > 0 ) {
+
+					this.addColor( ia, ib, ic );
+
+				}
+
 				if ( ua !== undefined && ua !== '' ) {
 				if ( ua !== undefined && ua !== '' ) {
 
 
 					var uvLen = this.uvs.length;
 					var uvLen = this.uvs.length;
@@ -326,12 +332,6 @@ var OBJLoader = ( function () {
 
 
 				}
 				}
 
 
-				if ( this.colors.length > 0 ) {
-
-					this.addColor( ia, ib, ic );
-
-				}
-
 			},
 			},
 
 
 			addPointGeometry: function ( vertices ) {
 			addPointGeometry: function ( vertices ) {