提交 c3768568 编写于 作者: M Mr.doob

Merge remote-tracking branch 'WestLangley/dev-spotlight' into dev

......@@ -67,8 +67,8 @@ scene.add( spotLight );</code>
<h3>.[page:Float angle]</h3>
<div>
Maximum extent of the spotlight, in radians, from its direction.<br />
Default — *Math.PI/2*.
Maximum extent of the spotlight, in radians, from its direction. Should be no more than *Math.PI/2*.<br />
Default — *Math.PI/3*.
</div>
<h3>.[page:Float exponent]</h3>
......
......@@ -99,7 +99,7 @@
var ambient = new THREE.AmbientLight( 0x080808 );
//scene.add( ambient );
var light = new THREE.SpotLight( 0xffeedd, 1.2, 650, 2.5, 3 );
var light = new THREE.SpotLight( 0xffeedd, 1.2, 650, Math.PI/2, 3 );
light.position.set( 0, -100, 500 );
light.castShadow = true;
......
......@@ -170,7 +170,7 @@
ambientLight = new THREE.AmbientLight( 0x555555 );
scene.add( ambientLight );
spotLight = new THREE.SpotLight( 0xffffff, 1, 0, Math.PI, 1 );
spotLight = new THREE.SpotLight( 0xffffff, 1, 0, Math.PI/2, 1 );
spotLight.position.set( 0, 1800, 1500 );
spotLight.target.position.set( 0, 0, 0 );
spotLight.castShadow = true;
......
......@@ -316,7 +316,7 @@
pointLight.position.set( 0, 0, 0 );
scene.add( pointLight );
sunLight = new THREE.SpotLight( 0xffffff, sunIntensity, 0, Math.PI, 1 );
sunLight = new THREE.SpotLight( 0xffffff, sunIntensity, 0, Math.PI/2, 1 );
sunLight.position.set( 1000, 2000, 1000 );
sunLight.castShadow = true;
......
......@@ -103,7 +103,7 @@
var ambient = new THREE.AmbientLight( 0x444444 );
scene.add( ambient );
light = new THREE.SpotLight( 0xffffff, 1, 0, Math.PI, 1 );
light = new THREE.SpotLight( 0xffffff, 1, 0, Math.PI/2, 1 );
light.position.set( 0, 1500, 1000 );
light.target.position.set( 0, 0, 0 );
......
/**
* @author alteredq / http://alteredqualia.com/
* @author mrdoob / http://mrdoob.com/
*/
* @author WestLangley / http://github.com/WestLangley
*/
THREE.SpotLightHelper = function ( light, sphereSize ) {
......@@ -31,7 +32,7 @@ THREE.SpotLightHelper = function ( light, sphereSize ) {
this.lightCone.position = this.light.position;
var coneLength = light.distance ? light.distance : 10000;
var coneWidth = coneLength * Math.tan( light.angle * 0.5 ) * 2;
var coneWidth = coneLength * Math.tan( light.angle );
this.lightCone.scale.set( coneWidth, coneWidth, coneLength );
this.lightCone.lookAt( this.light.target.position );
......@@ -45,7 +46,7 @@ THREE.SpotLightHelper.prototype = Object.create( THREE.Object3D.prototype );
THREE.SpotLightHelper.prototype.update = function () {
var coneLength = this.light.distance ? this.light.distance : 10000;
var coneWidth = coneLength * Math.tan( this.light.angle * 0.5 ) * 2;
var coneWidth = coneLength * Math.tan( this.light.angle );
this.lightCone.scale.set( coneWidth, coneWidth, coneLength );
this.lightCone.lookAt( this.light.target.position );
......
......@@ -11,7 +11,7 @@ THREE.SpotLight = function ( hex, intensity, distance, angle, exponent ) {
this.intensity = ( intensity !== undefined ) ? intensity : 1;
this.distance = ( distance !== undefined ) ? distance : 0;
this.angle = ( angle !== undefined ) ? angle : Math.PI / 2;
this.angle = ( angle !== undefined ) ? angle : Math.PI / 3;
this.exponent = ( exponent !== undefined ) ? exponent : 10;
this.castShadow = false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册