@@ -252,7 +252,8 @@ THREE.GLTFLoader = ( function () {
252
252
253
253
case 'directional' :
254
254
lightNode = new THREE . DirectionalLight ( color ) ;
255
- lightNode . position . set ( 0 , 0 , 1 ) ;
255
+ lightNode . target . position . set ( 0 , 0 , 1 ) ;
256
+ lightNode . add ( lightNode . target ) ;
256
257
break ;
257
258
258
259
case 'point' :
@@ -261,7 +262,14 @@ THREE.GLTFLoader = ( function () {
261
262
262
263
case 'spot' :
263
264
lightNode = new THREE . SpotLight ( color ) ;
264
- lightNode . position . set ( 0 , 0 , 1 ) ;
265
+ // Handle spotlight properties.
266
+ light . spot = light . spot || { } ;
267
+ light . spot . innerConeAngle = light . spot . innerConeAngle !== undefined ? light . spot . innerConeAngle : 0 ;
268
+ light . spot . outerConeAngle = light . spot . outerConeAngle !== undefined ? light . spot . outerConeAngle : Math . PI / 4.0 ;
269
+ lightNode . angle = light . spot . outerConeAngle ;
270
+ lightNode . penumbra = 1.0 - light . spot . innerConeAngle / light . spot . outerConeAngle ;
271
+ lightNode . target . position . set ( 0 , 0 , 1 ) ;
272
+ lightNode . add ( lightNode . target ) ;
265
273
break ;
266
274
267
275
case 'ambient' :
@@ -272,33 +280,11 @@ THREE.GLTFLoader = ( function () {
272
280
273
281
if ( lightNode ) {
274
282
275
- if ( light . constantAttenuation !== undefined ) {
283
+ lightNode . decay = 2 ;
276
284
277
- lightNode . intensity = light . constantAttenuation ;
285
+ if ( light . intensity !== undefined ) {
278
286
279
- }
280
-
281
- if ( light . linearAttenuation !== undefined ) {
282
-
283
- lightNode . distance = 1 / light . linearAttenuation ;
284
-
285
- }
286
-
287
- if ( light . quadraticAttenuation !== undefined ) {
288
-
289
- lightNode . decay = light . quadraticAttenuation ;
290
-
291
- }
292
-
293
- if ( light . fallOffAngle !== undefined ) {
294
-
295
- lightNode . angle = light . fallOffAngle ;
296
-
297
- }
298
-
299
- if ( light . fallOffExponent !== undefined ) {
300
-
301
- console . warn ( 'THREE.GLTFLoader:: light.fallOffExponent not currently supported.' ) ;
287
+ lightNode . intensity = light . intensity ;
302
288
303
289
}
304
290
@@ -2595,7 +2581,8 @@ THREE.GLTFLoader = ( function () {
2595
2581
2596
2582
'mesh' ,
2597
2583
'skin' ,
2598
- 'camera'
2584
+ 'camera' ,
2585
+ 'light'
2599
2586
2600
2587
] ) . then ( function ( dependencies ) {
2601
2588
0 commit comments