Explorar el Código

SceneLoader: Rescued lost DirectionalLight handler.

Mr.doob hace 12 años
padre
commit
b66d8b01c5
Se han modificado 1 ficheros con 8 adiciones y 1 borrados
  1. 8 1
      src/loaders/SceneLoader.js

+ 8 - 1
src/loaders/SceneLoader.js

@@ -361,7 +361,9 @@ THREE.SceneLoader.prototype = {
 
 					// lights
 
-					} else if (objJSON.type === "PointLight" || objJSON.type === "AmbientLight" || objJSON.type === "SpotLight" || objJSON.type === "HemisphereLight" || objJSON.type === "AreaLight") {
+					} else if ( objJSON.type === "AmbientLight" || objJSON.type === "PointLight" ||
+						objJSON.type === "DirectionalLight" || objJSON.type === "SpotLight" ||
+						objJSON.type === "HemisphereLight" || objJSON.type === "AreaLight" ) {
 
 						var color = objJSON.color;
 						var intensity = objJSON.intensity;
@@ -380,6 +382,11 @@ THREE.SceneLoader.prototype = {
 								light.position.fromArray( position );
 								break;
 
+							case 'DirectionalLight':
+								light = new THREE.DirectionalLight( color, intensity );
+								light.position.fromArray( objJSON.direction );
+								break;
+
 							case 'SpotLight':
 								light = new THREE.SpotLight( color, intensity, distance, 1 );
 								light.angle = objJSON.angle;