Browse Source

ShadowMapPlugin to WebGLShadowMap.

Mr.doob 10 years ago
parent
commit
c9f312d5de

+ 11 - 12
src/renderers/WebGLRenderer.js

@@ -65,14 +65,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 	this.gammaInput = false;
 	this.gammaOutput = false;
 
-	// shadow map
-
-	this.shadowMapEnabled = false;
-	this.shadowMapType = THREE.PCFShadowMap;
-	this.shadowMapCullFace = THREE.CullFaceFront;
-	this.shadowMapDebug = false;
-	this.shadowMapCascade = false;
-
 	// morphs
 
 	this.maxMorphTargets = 8;
@@ -290,6 +282,15 @@ THREE.WebGLRenderer = function ( parameters ) {
 	this.extensions = extensions;
 	this.state = state;
 
+	// shadow map
+
+	this.shadowMap = new THREE.WebGLShadowMap( this, lights, _webglObjects, _webglObjectsImmediate );
+	this.shadowMapEnabled = false;
+	this.shadowMapType = THREE.PCFShadowMap;
+	this.shadowMapCullFace = THREE.CullFaceFront;
+	this.shadowMapDebug = false;
+	this.shadowMapCascade = false;
+
 	// GPU capabilities
 
 	var _maxTextures = _gl.getParameter( _gl.MAX_TEXTURE_IMAGE_UNITS );
@@ -370,8 +371,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	// Plugins
 
-	var shadowMapPlugin = new THREE.ShadowMapPlugin( this, lights, _webglObjects, _webglObjectsImmediate );
-
 	var spritePlugin = new THREE.SpritePlugin( this, sprites );
 	var lensFlarePlugin = new THREE.LensFlarePlugin( this, lensFlares );
 
@@ -1889,9 +1888,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		// custom render plugins (pre pass)
+		//
 
-		shadowMapPlugin.render( scene, camera );
+		this.shadowMap.render( scene, camera );
 
 		//
 

+ 2 - 1
src/renderers/webgl/plugins/ShadowMapPlugin.js → src/renderers/webgl/WebGLShadowMap.js

@@ -1,8 +1,9 @@
 /**
  * @author alteredq / http://alteredqualia.com/
+ * @author mrdoob / http://mrdoob.com/
  */
 
-THREE.ShadowMapPlugin = function ( _renderer, _lights, _webglObjects, _webglObjectsImmediate ) {
+THREE.WebGLShadowMap = function ( _renderer, _lights, _webglObjects, _webglObjectsImmediate ) {
 
 	var _gl = _renderer.context;
 

+ 1 - 1
utils/build/includes/common.json

@@ -151,9 +151,9 @@
 	"src/renderers/webgl/WebGLExtensions.js",
 	"src/renderers/webgl/WebGLProgram.js",
 	"src/renderers/webgl/WebGLShader.js",
+	"src/renderers/webgl/WebGLShadowMap.js",
 	"src/renderers/webgl/WebGLState.js",
 	"src/renderers/webgl/plugins/LensFlarePlugin.js",
-	"src/renderers/webgl/plugins/ShadowMapPlugin.js",
 	"src/renderers/webgl/plugins/SpritePlugin.js"
 
 ]