瀏覽代碼

Materials: Promoted lights.

Mr.doob 9 年之前
父節點
當前提交
3524fdcab4

+ 1 - 0
src/materials/LineBasicMaterial.js

@@ -24,6 +24,7 @@ THREE.LineBasicMaterial = function ( parameters ) {
 	this.linecap = 'round';
 	this.linejoin = 'round';
 
+	this.lights = false;
 
 	this.setValues( parameters );
 

+ 2 - 0
src/materials/LineDashedMaterial.js

@@ -27,6 +27,8 @@ THREE.LineDashedMaterial = function ( parameters ) {
 	this.dashSize = 3;
 	this.gapSize = 1;
 
+	this.lights = false;
+
 	this.setValues( parameters );
 
 };

+ 2 - 0
src/materials/Material.js

@@ -13,6 +13,7 @@ THREE.Material = function () {
 	this.type = 'Material';
 
 	this.fog = true;
+	this.lights = true;
 
 	this.blending = THREE.NormalBlending;
 	this.side = THREE.FrontSide;
@@ -249,6 +250,7 @@ THREE.Material.prototype = {
 		this.name = source.name;
 
 		this.fog = source.fog;
+		this.lights = source.lights;
 
 		this.blending = source.blending;
 		this.side = source.side;

+ 2 - 0
src/materials/MeshBasicMaterial.js

@@ -61,6 +61,8 @@ THREE.MeshBasicMaterial = function ( parameters ) {
 	this.skinning = false;
 	this.morphTargets = false;
 
+	this.lights = false;
+
 	this.setValues( parameters );
 
 };

+ 1 - 0
src/materials/MeshDepthMaterial.js

@@ -44,6 +44,7 @@ THREE.MeshDepthMaterial = function ( parameters ) {
 	this.wireframeLinewidth = 1;
 
 	this.fog = false;
+	this.lights = false;
 
 	this.setValues( parameters );
 

+ 1 - 0
src/materials/MeshNormalMaterial.js

@@ -19,6 +19,7 @@ THREE.MeshNormalMaterial = function ( parameters ) {
 	this.wireframeLinewidth = 1;
 
 	this.fog = false;
+	this.lights = false;
 	this.morphTargets = false;
 
 	this.setValues( parameters );

+ 2 - 0
src/materials/PointsMaterial.js

@@ -25,6 +25,8 @@ THREE.PointsMaterial = function ( parameters ) {
 	this.size = 1;
 	this.sizeAttenuation = true;
 
+	this.lights = false;
+
 	this.setValues( parameters );
 
 };

+ 0 - 1
src/materials/ShaderMaterial.js

@@ -41,7 +41,6 @@ THREE.ShaderMaterial = function ( parameters ) {
 	this.clipping = false; // set to use user-defined clipping planes
 
 	this.skinning = false; // set to use skinning attribute streams
-
 	this.morphTargets = false; // set to use morph targets
 	this.morphNormals = false; // set to use morph normals
 

+ 1 - 0
src/materials/SpriteMaterial.js

@@ -23,6 +23,7 @@ THREE.SpriteMaterial = function ( parameters ) {
 	this.rotation = 0;
 
 	this.fog = false;
+	this.lights = false;
 
 	this.setValues( parameters );
 

+ 2 - 8
src/renderers/WebGLRenderer.js

@@ -1653,10 +1653,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		if ( material instanceof THREE.MeshPhongMaterial ||
-				material instanceof THREE.MeshLambertMaterial ||
-				material instanceof THREE.MeshStandardMaterial ||
-				material.lights ) {
+		if ( material.lights ) {
 
 			// store the light setup it was created for
 
@@ -1886,10 +1883,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		if ( refreshMaterial ) {
 
-			if ( material instanceof THREE.MeshPhongMaterial ||
-				 material instanceof THREE.MeshLambertMaterial ||
-				 material instanceof THREE.MeshStandardMaterial ||
-				 material.lights ) {
+			if ( material.lights ) {
 
 				// the current material requires lighting info