Преглед на файлове

Reverted 4439d901e0e3e9b8a6dd3559a665062ad1988344. Implemented material.visible in Projector. See #5256.

Mr.doob преди 11 години
родител
ревизия
c353d166c2
променени са 3 файла, в които са добавени 10 реда и са изтрити 0 реда
  1. 2 0
      src/core/Projector.js
  2. 4 0
      src/materials/Material.js
  3. 4 0
      src/renderers/WebGLRenderer.js

+ 2 - 0
src/core/Projector.js

@@ -273,6 +273,8 @@ THREE.Projector = function () {
 
 			} else if ( object instanceof THREE.Mesh || object instanceof THREE.Line || object instanceof THREE.Sprite ) {
 
+				if ( object.material.visible === false ) return;
+
 				if ( object.frustumCulled === false || _frustum.intersectsObject( object ) === true ) {
 
 					_object = getNextObjectInPool();

+ 4 - 0
src/materials/Material.js

@@ -33,6 +33,8 @@ THREE.Material = function () {
 
 	this.overdraw = 0; // Overdrawn pixels (typically between 0 and 1) for fixing antialiasing gaps in CanvasRenderer
 
+	this.visible = true;
+
 	this.needsUpdate = true;
 
 };
@@ -185,6 +187,8 @@ THREE.Material.prototype = {
 
 		material.overdraw = this.overdraw;
 
+		material.visible = this.visible;
+
 		return material;
 
 	},

+ 4 - 0
src/renderers/WebGLRenderer.js

@@ -2466,6 +2466,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	this.renderBufferDirect = function ( camera, lights, fog, material, geometry, object ) {
 
+		if ( material.visible === false ) return;
+
 		var linewidth, a, attribute;
 		var attributeItem, attributeName, attributePointer, attributeSize;
 
@@ -2698,6 +2700,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	this.renderBuffer = function ( camera, lights, fog, material, geometryGroup, object ) {
 
+		if ( material.visible === false ) return;
+
 		var linewidth, a, attribute, i, il;
 
 		var program = setProgram( camera, lights, fog, material, object );