提交 e362e29d 编写于 作者: M Michael Bond

Rough update to KHR_lights support to match current spec

上级 7d6c9256
...@@ -230,7 +230,6 @@ THREE.GLTFLoader = ( function () { ...@@ -230,7 +230,6 @@ THREE.GLTFLoader = ( function () {
case 'directional': case 'directional':
lightNode = new THREE.DirectionalLight( color ); lightNode = new THREE.DirectionalLight( color );
lightNode.position.set( 0, 0, 1 );
break; break;
case 'point': case 'point':
...@@ -239,7 +238,12 @@ THREE.GLTFLoader = ( function () { ...@@ -239,7 +238,12 @@ THREE.GLTFLoader = ( function () {
case 'spot': case 'spot':
lightNode = new THREE.SpotLight( color ); lightNode = new THREE.SpotLight( color );
lightNode.position.set( 0, 0, 1 ); // Handle spotlight properties.
var spot = light.spot || {};
var innerConeAngle = spot.innerConeAngle ? spot.innerConeAngle : 0;
var outerConeAngle = spot.outerConeAngle || Math.PI / 4.0;
lightNode.angle = outerConeAngle;
lightNode.penumbra = 1.0 - innerConeAngle / outerConeAngle;
break; break;
case 'ambient': case 'ambient':
...@@ -250,33 +254,11 @@ THREE.GLTFLoader = ( function () { ...@@ -250,33 +254,11 @@ THREE.GLTFLoader = ( function () {
if ( lightNode ) { if ( lightNode ) {
if ( light.constantAttenuation !== undefined ) { lightNode.decay = 2;
lightNode.intensity = light.constantAttenuation; if ( light.intensity !== undefined ) {
} lightNode.intensity = light.intensity;
if ( light.linearAttenuation !== undefined ) {
lightNode.distance = 1 / light.linearAttenuation;
}
if ( light.quadraticAttenuation !== undefined ) {
lightNode.decay = light.quadraticAttenuation;
}
if ( light.fallOffAngle !== undefined ) {
lightNode.angle = light.fallOffAngle;
}
if ( light.fallOffExponent !== undefined ) {
console.warn( 'THREE.GLTFLoader:: light.fallOffExponent not currently supported.' );
} }
...@@ -2417,7 +2399,8 @@ THREE.GLTFLoader = ( function () { ...@@ -2417,7 +2399,8 @@ THREE.GLTFLoader = ( function () {
'mesh', 'mesh',
'skin', 'skin',
'camera' 'camera',
'light'
] ).then( function ( dependencies ) { ] ).then( function ( dependencies ) {
......
此差异已折叠。
...@@ -90,6 +90,7 @@ ...@@ -90,6 +90,7 @@
<option value="glTF-Embedded">None (Embedded)</option> <option value="glTF-Embedded">None (Embedded)</option>
<option value="glTF-Binary">None (Binary)</option> <option value="glTF-Binary">None (Binary)</option>
<option value="glTF-pbrSpecularGlossiness">Specular-Glossiness (PBR)</option> <option value="glTF-pbrSpecularGlossiness">Specular-Glossiness (PBR)</option>
<option value="glTF-lights">Lights</option>
</select> </select>
</div> </div>
</div> </div>
...@@ -457,7 +458,7 @@ ...@@ -457,7 +458,7 @@
addLights:true, addLights:true,
shadows:true, shadows:true,
addGround:true, addGround:true,
extensions: ['glTF', 'glTF-Embedded', 'glTF-pbrSpecularGlossiness', 'glTF-Binary'] extensions: ['glTF', 'glTF-Embedded', 'glTF-pbrSpecularGlossiness', 'glTF-Binary', 'glTF-lights']
}, },
{ {
name : "Cesium Man", url : "./models/gltf/CesiumMan/%s/CesiumMan.gltf", name : "Cesium Man", url : "./models/gltf/CesiumMan/%s/CesiumMan.gltf",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册