Browse Source

WebGLShadowMap: Add option to update on demand. See #6814.

Mr.doob 10 years ago
parent
commit
bccd460ac1
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/renderers/webgl/WebGLShadowMap.js

+ 7 - 0
src/renderers/webgl/WebGLShadowMap.js

@@ -63,6 +63,10 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
 	var scope = this;
 	var scope = this;
 
 
 	this.enabled = false;
 	this.enabled = false;
+
+	this.autoUpdate = true;
+	this.needsUpdate = false;
+
 	this.type = THREE.PCFShadowMap;
 	this.type = THREE.PCFShadowMap;
 	this.cullFace = THREE.CullFaceFront;
 	this.cullFace = THREE.CullFaceFront;
 	this.cascade = false;
 	this.cascade = false;
@@ -70,6 +74,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
 	this.render = function ( scene, camera ) {
 	this.render = function ( scene, camera ) {
 
 
 		if ( scope.enabled === false ) return;
 		if ( scope.enabled === false ) return;
+		if ( scope.autoUpdate === false && scope.needsUpdate === false ) return;
 
 
 		var i, il, j, jl, n,
 		var i, il, j, jl, n,
 
 
@@ -346,6 +351,8 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
 
 
 		_renderer.resetGLState();
 		_renderer.resetGLState();
 
 
+		scope.needsUpdate = false;
+
 	};
 	};
 
 
 	function projectObject( object, shadowCamera ) {
 	function projectObject( object, shadowCamera ) {