Browse Source

GLTFLoader: add KHR_lights_punctual range support

06wj 7 years ago
parent
commit
5c1cc3dc10
1 changed files with 7 additions and 0 deletions
  1. 7 0
      examples/js/loaders/GLTFLoader.js

+ 7 - 0
examples/js/loaders/GLTFLoader.js

@@ -288,6 +288,11 @@ THREE.GLTFLoader = ( function () {
 				color.fromArray( light.color )
 			}
 
+			var range = 0;
+			if ( light.range !== undefined ) {
+				range = light.range;
+			}
+
 			switch ( light.type ) {
 
 				case 'directional':
@@ -298,10 +303,12 @@ THREE.GLTFLoader = ( function () {
 
 				case 'point':
 					lightNode = new THREE.PointLight( color );
+					lightNode.distance = range;
 					break;
 
 				case 'spot':
 					lightNode = new THREE.SpotLight( color );
+					lightNode.distance = range;
 					// Handle spotlight properties.
 					light.spot = light.spot || {};
 					light.spot.innerConeAngle = light.spot.innerConeAngle !== undefined ? light.spot.innerConeAngle : 0;