提交 bf6b6d3c 编写于 作者: A alteredq

Modified SpotLight to cast light as PointLight (to be consistent with casted shadow).

Before SpotLight was a weird mix of shadow casted from PointLight and light casted from DirectionalLight.
上级 6b0edfdd
因为 它太大了无法显示 source diff 。你可以改为 查看blob
此差异已折叠。
......@@ -179,7 +179,7 @@
// GROUND
var geometry = new THREE.PlaneGeometry( 100, 100 );
var planeMaterial = new THREE.MeshLambertMaterial( { color: 0xffdd99 } );
var planeMaterial = new THREE.MeshPhongMaterial( { color: 0xffdd99 } );
THREE.ColorUtils.adjustHSV( planeMaterial.color, 0, 0, 0.9 );
planeMaterial.ambient = planeMaterial.color;
......
......@@ -4764,35 +4764,7 @@ THREE.WebGLRenderer = function ( parameters ) {
dlength += 1;
} else if ( light instanceof THREE.SpotLight ) { // hack, not a proper spotlight
doffset = dlength * 3;
if ( _this.gammaInput ) {
dcolors[ doffset ] = color.r * color.r * intensity * intensity;
dcolors[ doffset + 1 ] = color.g * color.g * intensity * intensity;
dcolors[ doffset + 2 ] = color.b * color.b * intensity * intensity;
} else {
dcolors[ doffset ] = color.r * intensity;
dcolors[ doffset + 1 ] = color.g * intensity;
dcolors[ doffset + 2 ] = color.b * intensity;
}
position = light.matrixWorld.getPosition();
n = 1 / position.length();
dpositions[ doffset ] = position.x * n;
dpositions[ doffset + 1 ] = position.y * n;
dpositions[ doffset + 2 ] = position.z * n;
dlength += 1;
} else if( light instanceof THREE.PointLight ) {
} else if( light instanceof THREE.PointLight || light instanceof THREE.SpotLight ) {
poffset = plength * 3;
......@@ -5756,9 +5728,9 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( light.onlyShadow ) continue;
if ( light instanceof THREE.SpotLight ) dirLights ++; // hack, not a proper spotlight
if ( light instanceof THREE.DirectionalLight ) dirLights ++;
if ( light instanceof THREE.PointLight ) pointLights ++;
if ( light instanceof THREE.SpotLight ) pointLights ++;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册