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

Updated builds.

上级 89df8c67
......@@ -9194,12 +9194,13 @@
// render depth map
var faceCount, isPointLight;
var faceCount;
for ( var i = 0, il = _lightShadows.length; i < il; i ++ ) {
var light = _lightShadows[ i ];
var shadow = light.shadow;
var isPointLight = light && light.isPointLight;
if ( shadow === undefined ) {
......@@ -9208,25 +9209,12 @@
}
if ( shadow.isSpotLightShadow ) {
shadow.update( light );
}
var shadowCamera = shadow.camera;
var shadowMatrix = shadow.matrix;
_lightPositionWorld.setFromMatrixPosition( light.matrixWorld );
shadowCamera.position.copy( _lightPositionWorld );
_shadowMapSize.copy( shadow.mapSize );
_shadowMapSize.min( _maxShadowMapSize );
if ( light && light.isPointLight ) {
faceCount = 6;
isPointLight = true;
if ( isPointLight ) {
var vpWidth = _shadowMapSize.x;
var vpHeight = _shadowMapSize.y;
......@@ -9260,6 +9248,34 @@
_shadowMapSize.x *= 4.0;
_shadowMapSize.y *= 2.0;
}
if ( shadow.map === null ) {
var pars = { minFilter: NearestFilter, magFilter: NearestFilter, format: RGBAFormat };
shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );
shadow.map.texture.name = light.name + ".shadowMap";
shadowCamera.updateProjectionMatrix();
}
if ( shadow.isSpotLightShadow ) {
shadow.update( light );
}
var shadowMap = shadow.map;
var shadowMatrix = shadow.matrix;
_lightPositionWorld.setFromMatrixPosition( light.matrixWorld );
shadowCamera.position.copy( _lightPositionWorld );
if ( isPointLight ) {
faceCount = 6;
// for point lights we set the shadow matrix to be a translation-only matrix
// equal to inverse of the light's position
......@@ -9269,7 +9285,6 @@
} else {
faceCount = 1;
isPointLight = false;
_lookTarget.setFromMatrixPosition( light.target.matrixWorld );
shadowCamera.lookAt( _lookTarget );
......@@ -9290,19 +9305,6 @@
}
if ( shadow.map === null ) {
var pars = { minFilter: NearestFilter, magFilter: NearestFilter, format: RGBAFormat };
shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );
shadow.map.texture.name = light.name + ".shadowMap";
shadowCamera.updateProjectionMatrix();
}
var shadowMap = shadow.map;
_renderer.setRenderTarget( shadowMap );
_renderer.clear();
......@@ -10533,10 +10535,6 @@
this.renderOrder = 0;
this.userData = {};
this.onBeforeRender = function () {};
this.onAfterRender = function () {};
}
Object3D.DefaultUp = new Vector3( 0, 1, 0 );
......@@ -10546,6 +10544,9 @@
isObject3D: true,
onBeforeRender: function () {},
onAfterRender: function () {},
applyMatrix: function ( matrix ) {
this.matrix.multiplyMatrices( matrix, this.matrix );
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -9188,12 +9188,13 @@ function WebGLShadowMap( _renderer, _lights, _objects, capabilities ) {
// render depth map
var faceCount, isPointLight;
var faceCount;
for ( var i = 0, il = _lightShadows.length; i < il; i ++ ) {
var light = _lightShadows[ i ];
var shadow = light.shadow;
var isPointLight = light && light.isPointLight;
if ( shadow === undefined ) {
......@@ -9202,25 +9203,12 @@ function WebGLShadowMap( _renderer, _lights, _objects, capabilities ) {
}
if ( shadow.isSpotLightShadow ) {
shadow.update( light );
}
var shadowCamera = shadow.camera;
var shadowMatrix = shadow.matrix;
_lightPositionWorld.setFromMatrixPosition( light.matrixWorld );
shadowCamera.position.copy( _lightPositionWorld );
_shadowMapSize.copy( shadow.mapSize );
_shadowMapSize.min( _maxShadowMapSize );
if ( light && light.isPointLight ) {
faceCount = 6;
isPointLight = true;
if ( isPointLight ) {
var vpWidth = _shadowMapSize.x;
var vpHeight = _shadowMapSize.y;
......@@ -9254,6 +9242,34 @@ function WebGLShadowMap( _renderer, _lights, _objects, capabilities ) {
_shadowMapSize.x *= 4.0;
_shadowMapSize.y *= 2.0;
}
if ( shadow.map === null ) {
var pars = { minFilter: NearestFilter, magFilter: NearestFilter, format: RGBAFormat };
shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );
shadow.map.texture.name = light.name + ".shadowMap";
shadowCamera.updateProjectionMatrix();
}
if ( shadow.isSpotLightShadow ) {
shadow.update( light );
}
var shadowMap = shadow.map;
var shadowMatrix = shadow.matrix;
_lightPositionWorld.setFromMatrixPosition( light.matrixWorld );
shadowCamera.position.copy( _lightPositionWorld );
if ( isPointLight ) {
faceCount = 6;
// for point lights we set the shadow matrix to be a translation-only matrix
// equal to inverse of the light's position
......@@ -9263,7 +9279,6 @@ function WebGLShadowMap( _renderer, _lights, _objects, capabilities ) {
} else {
faceCount = 1;
isPointLight = false;
_lookTarget.setFromMatrixPosition( light.target.matrixWorld );
shadowCamera.lookAt( _lookTarget );
......@@ -9284,19 +9299,6 @@ function WebGLShadowMap( _renderer, _lights, _objects, capabilities ) {
}
if ( shadow.map === null ) {
var pars = { minFilter: NearestFilter, magFilter: NearestFilter, format: RGBAFormat };
shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );
shadow.map.texture.name = light.name + ".shadowMap";
shadowCamera.updateProjectionMatrix();
}
var shadowMap = shadow.map;
_renderer.setRenderTarget( shadowMap );
_renderer.clear();
......@@ -10527,10 +10529,6 @@ function Object3D() {
this.renderOrder = 0;
this.userData = {};
this.onBeforeRender = function () {};
this.onAfterRender = function () {};
}
Object3D.DefaultUp = new Vector3( 0, 1, 0 );
......@@ -10540,6 +10538,9 @@ Object.assign( Object3D.prototype, EventDispatcher.prototype, {
isObject3D: true,
onBeforeRender: function () {},
onAfterRender: function () {},
applyMatrix: function ( matrix ) {
this.matrix.multiplyMatrices( matrix, this.matrix );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册