提交 3460f251 编写于 作者: M Mr.doob

WebGLShadowMap: Added layers support.

上级 b4fc0241
......@@ -1119,7 +1119,7 @@ THREE.WebGLRenderer = function ( parameters ) {
//
shadowMap.render( scene );
shadowMap.render( scene, camera );
//
......
......@@ -94,7 +94,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
this.type = THREE.PCFShadowMap;
this.cullFace = THREE.CullFaceFront;
this.render = function ( scene ) {
this.render = function ( scene, camera ) {
var faceCount, isPointLight;
......@@ -246,7 +246,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
_renderList.length = 0;
projectObject( scene, shadowCamera );
projectObject( scene, camera, shadowCamera );
// render shadow map
// render regular objects
......@@ -365,11 +365,11 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
}
function projectObject( object, camera ) {
function projectObject( object, camera, shadowCamera ) {
if ( object.visible === false ) return;
if ( object instanceof THREE.Mesh || object instanceof THREE.Line || object instanceof THREE.Points ) {
if ( object.layers.test( camera.layers ) && ( object instanceof THREE.Mesh || object instanceof THREE.Line || object instanceof THREE.Points ) ) {
if ( object.castShadow && ( object.frustumCulled === false || _frustum.intersectsObject( object ) === true ) ) {
......@@ -377,7 +377,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
if ( material.visible === true ) {
object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
object.modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld );
_renderList.push( object );
}
......@@ -390,7 +390,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
for ( var i = 0, l = children.length; i < l; i ++ ) {
projectObject( children[ i ], camera );
projectObject( children[ i ], camera, shadowCamera );
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册