Explorar o código

OBJLoader: Only add color attribute if necessary.

Mugen87 %!s(int64=4) %!d(string=hai) anos
pai
achega
e72497fbad
Modificáronse 2 ficheiros con 2 adicións e 2 borrados
  1. 1 1
      examples/js/loaders/OBJLoader.js
  2. 1 1
      examples/jsm/loaders/OBJLoader.js

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

@@ -875,7 +875,7 @@ THREE.OBJLoader = ( function () {
 
 					buffergeometry.setAttribute( 'position', new THREE.Float32BufferAttribute( state.vertices, 3 ) );
 
-					if ( state.colors.length > 0 ) {
+					if ( state.colors.length > 0 && state.colors[ 0 ] !== undefined ) {
 
 						buffergeometry.setAttribute( 'color', new THREE.Float32BufferAttribute( state.colors, 3 ) );
 						material.vertexColors = true;

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

@@ -891,7 +891,7 @@ var OBJLoader = ( function () {
 
 					buffergeometry.setAttribute( 'position', new Float32BufferAttribute( state.vertices, 3 ) );
 
-					if ( state.colors.length > 0 ) {
+					if ( state.colors.length > 0 && state.colors[ 0 ] !== undefined ) {
 
 						buffergeometry.setAttribute( 'color', new Float32BufferAttribute( state.colors, 3 ) );
 						material.vertexColors = true;