|
@@ -9188,12 +9188,13 @@ function WebGLShadowMap( _renderer, _lights, _objects, capabilities ) {
|
|
|
|
|
|
// render depth map
|
|
// render depth map
|
|
|
|
|
|
- var faceCount, isPointLight;
|
|
|
|
|
|
+ var faceCount;
|
|
|
|
|
|
for ( var i = 0, il = _lightShadows.length; i < il; i ++ ) {
|
|
for ( var i = 0, il = _lightShadows.length; i < il; i ++ ) {
|
|
|
|
|
|
var light = _lightShadows[ i ];
|
|
var light = _lightShadows[ i ];
|
|
var shadow = light.shadow;
|
|
var shadow = light.shadow;
|
|
|
|
+ var isPointLight = light && light.isPointLight;
|
|
|
|
|
|
if ( shadow === undefined ) {
|
|
if ( shadow === undefined ) {
|
|
|
|
|
|
@@ -9202,25 +9203,12 @@ function WebGLShadowMap( _renderer, _lights, _objects, capabilities ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- if ( shadow.isSpotLightShadow ) {
|
|
|
|
-
|
|
|
|
- shadow.update( light );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
var shadowCamera = shadow.camera;
|
|
var shadowCamera = shadow.camera;
|
|
- var shadowMatrix = shadow.matrix;
|
|
|
|
-
|
|
|
|
- _lightPositionWorld.setFromMatrixPosition( light.matrixWorld );
|
|
|
|
- shadowCamera.position.copy( _lightPositionWorld );
|
|
|
|
|
|
|
|
_shadowMapSize.copy( shadow.mapSize );
|
|
_shadowMapSize.copy( shadow.mapSize );
|
|
_shadowMapSize.min( _maxShadowMapSize );
|
|
_shadowMapSize.min( _maxShadowMapSize );
|
|
|
|
|
|
- if ( light && light.isPointLight ) {
|
|
|
|
-
|
|
|
|
- faceCount = 6;
|
|
|
|
- isPointLight = true;
|
|
|
|
|
|
+ if ( isPointLight ) {
|
|
|
|
|
|
var vpWidth = _shadowMapSize.x;
|
|
var vpWidth = _shadowMapSize.x;
|
|
var vpHeight = _shadowMapSize.y;
|
|
var vpHeight = _shadowMapSize.y;
|
|
@@ -9254,6 +9242,34 @@ function WebGLShadowMap( _renderer, _lights, _objects, capabilities ) {
|
|
_shadowMapSize.x *= 4.0;
|
|
_shadowMapSize.x *= 4.0;
|
|
_shadowMapSize.y *= 2.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
|
|
// for point lights we set the shadow matrix to be a translation-only matrix
|
|
// equal to inverse of the light's position
|
|
// equal to inverse of the light's position
|
|
@@ -9263,7 +9279,6 @@ function WebGLShadowMap( _renderer, _lights, _objects, capabilities ) {
|
|
} else {
|
|
} else {
|
|
|
|
|
|
faceCount = 1;
|
|
faceCount = 1;
|
|
- isPointLight = false;
|
|
|
|
|
|
|
|
_lookTarget.setFromMatrixPosition( light.target.matrixWorld );
|
|
_lookTarget.setFromMatrixPosition( light.target.matrixWorld );
|
|
shadowCamera.lookAt( _lookTarget );
|
|
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.setRenderTarget( shadowMap );
|
|
_renderer.clear();
|
|
_renderer.clear();
|
|
|
|
|
|
@@ -10527,10 +10529,6 @@ function Object3D() {
|
|
this.renderOrder = 0;
|
|
this.renderOrder = 0;
|
|
|
|
|
|
this.userData = {};
|
|
this.userData = {};
|
|
-
|
|
|
|
- this.onBeforeRender = function () {};
|
|
|
|
- this.onAfterRender = function () {};
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
Object3D.DefaultUp = new Vector3( 0, 1, 0 );
|
|
Object3D.DefaultUp = new Vector3( 0, 1, 0 );
|
|
@@ -10540,6 +10538,9 @@ Object.assign( Object3D.prototype, EventDispatcher.prototype, {
|
|
|
|
|
|
isObject3D: true,
|
|
isObject3D: true,
|
|
|
|
|
|
|
|
+ onBeforeRender: function () {},
|
|
|
|
+ onAfterRender: function () {},
|
|
|
|
+
|
|
applyMatrix: function ( matrix ) {
|
|
applyMatrix: function ( matrix ) {
|
|
|
|
|
|
this.matrix.multiplyMatrices( matrix, this.matrix );
|
|
this.matrix.multiplyMatrices( matrix, this.matrix );
|