Quellcode durchsuchen

Merge pull request #14775 from MiiBond/khr_lights_punctual_direction_update

Reverse direction of glTF lights to comply with spec changes
Mr.doob vor 6 Jahren
Ursprung
Commit
869e8b3866

+ 2 - 2
examples/js/loaders/GLTFLoader.js

@@ -311,7 +311,7 @@ THREE.GLTFLoader = ( function () {
 
 				case 'directional':
 					lightNode = new THREE.DirectionalLight( color );
-					lightNode.target.position.set( 0, 0, 1 );
+					lightNode.target.position.set( 0, 0, -1 );
 					lightNode.add( lightNode.target );
 					break;
 
@@ -329,7 +329,7 @@ THREE.GLTFLoader = ( function () {
 					lightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== undefined ? lightDef.spot.outerConeAngle : Math.PI / 4.0;
 					lightNode.angle = lightDef.spot.outerConeAngle;
 					lightNode.penumbra = 1.0 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle;
-					lightNode.target.position.set( 0, 0, 1 );
+					lightNode.target.position.set( 0, 0, -1 );
 					lightNode.add( lightNode.target );
 					break;
 

+ 4 - 4
examples/models/gltf/monster/glTF-lights/Monster.gltf

@@ -746,12 +746,12 @@
                 0.0,
                 0.0,
                 0.0,
-                1.0,
+                -1.0,
                 0.0,
                 0.0,
                 0.0,
                 0.0,
-                1.0,
+                -1.0,
                 0.0,
                 0.0,
                 0.0,
@@ -765,7 +765,7 @@
                     "light": 2
                 }
             },
-            "matrix": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 50, -100, 1],
+            "matrix": [1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 50, -100, 1],
             "name": "spot light"
         }
     ],
@@ -4539,7 +4539,7 @@
                 },
                 {
                     "type": "directional",
-                    "intensity": 0.5,
+                    "intensity": 1.5,
                     "color": [
                         0.0,
                         1.0,