Przeglądaj źródła

Clean up color setting in GLTF2Loader

Takahiro 8 lat temu
rodzic
commit
f94562b56a
1 zmienionych plików z 3 dodań i 11 usunięć
  1. 3 11
      examples/js/loaders/GLTF2Loader.js

+ 3 - 11
examples/js/loaders/GLTF2Loader.js

@@ -1201,7 +1201,8 @@ THREE.GLTF2Loader = ( function () {
 
 							var metallicRoughness = material.pbrMetallicRoughness;
 
-							materialParams.color = new THREE.Color();
+							materialParams.color = new THREE.Color( 1.0, 1.0, 1.0 );
+							materialParams.opacity = 1.0;
 
 							if ( Array.isArray( metallicRoughness.baseColorFactor ) ) {
 
@@ -1210,11 +1211,6 @@ THREE.GLTF2Loader = ( function () {
 								materialParams.color.fromArray( array );
 								materialParams.opacity = array[ 3 ];
 
-							} else {
-
-								materialParams.color.setRGB( 1.0, 1.0, 1.0 );
-								materialParams.opacity = 1.0;
-
 							}
 
 							if ( metallicRoughness.baseColorTexture !== undefined ) {
@@ -1265,16 +1261,12 @@ THREE.GLTF2Loader = ( function () {
 
 					}
 
-					materialParams.emissive = new THREE.Color();
+					materialParams.emissive = new THREE.Color( 0.0, 0.0, 0.0 );
 
 					if ( material.emissiveFactor !== undefined ) {
 
 						materialParams.emissive.fromArray( material.emissiveFactor );
 
-					} else {
-
-						materialParams.emissive.setRGB( 0.0, 0.0, 0.0 );
-
 					}
 
 					Object.assign( materialValues, material.values );