Sfoglia il codice sorgente

Support `material === null`. See #6959.

Mr.doob 10 anni fa
parent
commit
7255458091

+ 1 - 1
examples/js/renderers/Projector.js

@@ -349,7 +349,7 @@ THREE.Projector = function () {
 
 				var material = object.material;
 
-				if ( material.visible === false ) return;
+				if ( material === null || material.visible === false ) return;
 
 				if ( object.frustumCulled === false || _frustum.intersectsObject( object ) === true ) {
 

+ 2 - 2
src/renderers/WebGLRenderer.js

@@ -879,7 +879,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				material = materials[ i ];
 
-				if ( material.visible === false ) continue;
+				if ( material === null || material.visible === false ) continue;
 
 				_this.renderBufferDirect( camera, lights, fog, material, object );
 
@@ -1770,7 +1770,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 					var material = object.material;
 
-					if ( material.visible === true ) {
+					if ( material !== null && material.visible === true ) {
 
 						if ( properties.get( material ) ) {
 

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

@@ -215,7 +215,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
 
 					objectMaterial = object.material.materials[ 0 ];
 
-					if ( objectMaterial.visible === false ) continue;
+					if ( objectMaterial === null || objectMaterial.visible === false ) continue;
 
 				}
 
@@ -276,7 +276,7 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
 
 			var material = object.material;
 
-			if ( material.visible === true ) {
+			if ( material !== null && material.visible === true ) {
 
 				object._modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
 				_renderList.push( webglObject );