Browse Source

Merge pull request #7827 from WestLangley/dev-emissive

Added emissiveMapIntensity
Mr.doob 9 years ago
parent
commit
94a9eb9e68

+ 2 - 0
src/loaders/MaterialLoader.js

@@ -117,6 +117,8 @@ THREE.MaterialLoader.prototype = {
 		if ( json.metalnessMap !== undefined ) material.metalnessMap = this.getTexture( json.metalnessMap );
 		if ( json.metalnessMap !== undefined ) material.metalnessMap = this.getTexture( json.metalnessMap );
 
 
 		if ( json.emissiveMap !== undefined ) material.emissiveMap = this.getTexture( json.emissiveMap );
 		if ( json.emissiveMap !== undefined ) material.emissiveMap = this.getTexture( json.emissiveMap );
+		if ( json.emissiveMapIntensity !== undefined ) material.emissiveMapIntensity = json.emissiveMapIntensity;
+
 		if ( json.specularMap !== undefined ) material.specularMap = this.getTexture( json.specularMap );
 		if ( json.specularMap !== undefined ) material.specularMap = this.getTexture( json.specularMap );
 
 
 		if ( json.envMap !== undefined ) {
 		if ( json.envMap !== undefined ) {

+ 3 - 0
src/materials/MeshLambertMaterial.js

@@ -16,6 +16,7 @@
  *  aoMapIntensity: <float>
  *  aoMapIntensity: <float>
  *
  *
  *  emissiveMap: new THREE.Texture( <Image> ),
  *  emissiveMap: new THREE.Texture( <Image> ),
+ *  emissiveMapIntensity: <float>
  *
  *
  *  specularMap: new THREE.Texture( <Image> ),
  *  specularMap: new THREE.Texture( <Image> ),
  *
  *
@@ -61,6 +62,7 @@ THREE.MeshLambertMaterial = function ( parameters ) {
 	this.aoMapIntensity = 1.0;
 	this.aoMapIntensity = 1.0;
 
 
 	this.emissiveMap = null;
 	this.emissiveMap = null;
+	this.emissiveMapIntensity = 1.0;
 
 
 	this.specularMap = null;
 	this.specularMap = null;
 
 
@@ -107,6 +109,7 @@ THREE.MeshLambertMaterial.prototype.copy = function ( source ) {
 	this.aoMapIntensity = source.aoMapIntensity;
 	this.aoMapIntensity = source.aoMapIntensity;
 
 
 	this.emissiveMap = source.emissiveMap;
 	this.emissiveMap = source.emissiveMap;
+	this.emissiveMapIntensity = source.emissiveMapIntensity;
 
 
 	this.specularMap = source.specularMap;
 	this.specularMap = source.specularMap;
 
 

+ 3 - 0
src/materials/MeshPhongMaterial.js

@@ -18,6 +18,7 @@
  *  aoMapIntensity: <float>
  *  aoMapIntensity: <float>
  *
  *
  *  emissiveMap: new THREE.Texture( <Image> ),
  *  emissiveMap: new THREE.Texture( <Image> ),
+ *  emissiveMapIntensity: <float>
  *
  *
  *  bumpMap: new THREE.Texture( <Image> ),
  *  bumpMap: new THREE.Texture( <Image> ),
  *  bumpScale: <float>,
  *  bumpScale: <float>,
@@ -76,6 +77,7 @@ THREE.MeshPhongMaterial = function ( parameters ) {
 	this.aoMapIntensity = 1.0;
 	this.aoMapIntensity = 1.0;
 
 
 	this.emissiveMap = null;
 	this.emissiveMap = null;
+	this.emissiveMapIntensity = 1.0;
 
 
 	this.bumpMap = null;
 	this.bumpMap = null;
 	this.bumpScale = 1;
 	this.bumpScale = 1;
@@ -136,6 +138,7 @@ THREE.MeshPhongMaterial.prototype.copy = function ( source ) {
 	this.aoMapIntensity = source.aoMapIntensity;
 	this.aoMapIntensity = source.aoMapIntensity;
 
 
 	this.emissiveMap = source.emissiveMap;
 	this.emissiveMap = source.emissiveMap;
+	this.emissiveMapIntensity = source.emissiveMapIntensity;
 
 
 	this.bumpMap = source.bumpMap;
 	this.bumpMap = source.bumpMap;
 	this.bumpScale = source.bumpScale;
 	this.bumpScale = source.bumpScale;

+ 3 - 0
src/materials/MeshStandardMaterial.js

@@ -18,6 +18,7 @@
  *  aoMapIntensity: <float>
  *  aoMapIntensity: <float>
  *
  *
  *  emissiveMap: new THREE.Texture( <Image> ),
  *  emissiveMap: new THREE.Texture( <Image> ),
+ *  emissiveMapIntensity: <float>
  *
  *
  *  bumpMap: new THREE.Texture( <Image> ),
  *  bumpMap: new THREE.Texture( <Image> ),
  *  bumpScale: <float>,
  *  bumpScale: <float>,
@@ -79,6 +80,7 @@ THREE.MeshStandardMaterial = function ( parameters ) {
 	this.aoMapIntensity = 1.0;
 	this.aoMapIntensity = 1.0;
 
 
 	this.emissiveMap = null;
 	this.emissiveMap = null;
+	this.emissiveMapIntensity = 1.0;
 
 
 	this.bumpMap = null;
 	this.bumpMap = null;
 	this.bumpScale = 1;
 	this.bumpScale = 1;
@@ -142,6 +144,7 @@ THREE.MeshStandardMaterial.prototype.copy = function ( source ) {
 	this.aoMapIntensity = source.aoMapIntensity;
 	this.aoMapIntensity = source.aoMapIntensity;
 
 
 	this.emissiveMap = source.emissiveMap;
 	this.emissiveMap = source.emissiveMap;
+	this.emissiveMapIntensity = source.emissiveMapIntensity;
 
 
 	this.bumpMap = source.bumpMap;
 	this.bumpMap = source.bumpMap;
 	this.bumpScale = source.bumpScale;
 	this.bumpScale = source.bumpScale;

+ 3 - 0
src/renderers/WebGLRenderer.js

@@ -2025,6 +2025,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		if ( material.emissiveMap ) {
 		if ( material.emissiveMap ) {
 
 
 			uniforms.emissiveMap.value = material.emissiveMap;
 			uniforms.emissiveMap.value = material.emissiveMap;
+			uniforms.emissiveMapIntensity.value = material.emissiveMapIntensity;
 
 
 		}
 		}
 
 
@@ -2045,6 +2046,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		if ( material.emissiveMap ) {
 		if ( material.emissiveMap ) {
 
 
 			uniforms.emissiveMap.value = material.emissiveMap;
 			uniforms.emissiveMap.value = material.emissiveMap;
+			uniforms.emissiveMapIntensity.value = material.emissiveMapIntensity;
 
 
 		}
 		}
 
 
@@ -2099,6 +2101,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		if ( material.emissiveMap ) {
 		if ( material.emissiveMap ) {
 
 
 			uniforms.emissiveMap.value = material.emissiveMap;
 			uniforms.emissiveMap.value = material.emissiveMap;
+			uniforms.emissiveMapIntensity.value = material.emissiveMapIntensity;
 
 
 		}
 		}
 
 

+ 1 - 1
src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl

@@ -4,6 +4,6 @@
 
 
 	emissiveColor.rgb = inputToLinear( emissiveColor.rgb );
 	emissiveColor.rgb = inputToLinear( emissiveColor.rgb );
 
 
-	totalEmissiveLight *= emissiveColor.rgb;
+	totalEmissiveLight *= emissiveColor.rgb * emissiveMapIntensity;
 
 
 #endif
 #endif

+ 1 - 0
src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl

@@ -1,5 +1,6 @@
 #ifdef USE_EMISSIVEMAP
 #ifdef USE_EMISSIVEMAP
 
 
 	uniform sampler2D emissiveMap;
 	uniform sampler2D emissiveMap;
+	uniform float emissiveMapIntensity;
 
 
 #endif
 #endif

+ 1 - 0
src/renderers/shaders/UniformsLib.js

@@ -39,6 +39,7 @@ THREE.UniformsLib = {
 	emissivemap: {
 	emissivemap: {
 
 
 		"emissiveMap" : { type: "t", value: null },
 		"emissiveMap" : { type: "t", value: null },
+		"emissiveMapIntensity" : { type: "f", value: 1 },
 
 
 	},
 	},