Browse Source

WebGLShadowMap: Clamp mapSize to maxTextureSize. See #9289

Mr.doob 9 years ago
parent
commit
d3501d9c93
2 changed files with 3 additions and 2 deletions
  1. 1 1
      src/renderers/WebGLRenderer.js
  2. 2 1
      src/renderers/webgl/WebGLShadowMap.js

+ 1 - 1
src/renderers/WebGLRenderer.js

@@ -334,7 +334,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	// shadow map
 
-	var shadowMap = new THREE.WebGLShadowMap( this, _lights, objects );
+	var shadowMap = new THREE.WebGLShadowMap( this, _lights, objects, capabilities );
 
 	this.shadowMap = shadowMap;
 

+ 2 - 1
src/renderers/webgl/WebGLShadowMap.js

@@ -3,7 +3,7 @@
  * @author mrdoob / http://mrdoob.com/
  */
 
-THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
+THREE.WebGLShadowMap = function ( _renderer, _lights, _objects, capabilities ) {
 
 	var _gl = _renderer.context,
 	_state = _renderer.state,
@@ -126,6 +126,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
 			var shadowCamera = shadow.camera;
 
 			_shadowMapSize.copy( shadow.mapSize );
+			_shadowMapSize.min( capabilities.maxTextureSize, capabilities.maxTextureSize );
 
 			if ( light instanceof THREE.PointLight ) {