Skip to content

Commit 0152dfb

Browse files
committed
Added emissiveMapIntensity
1 parent 2b03cbc commit 0152dfb

8 files changed

Lines changed: 17 additions & 1 deletion

File tree

src/loaders/MaterialLoader.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ THREE.MaterialLoader.prototype = {
116116
if ( json.metalnessMap !== undefined ) material.metalnessMap = this.getTexture( json.metalnessMap );
117117

118118
if ( json.emissiveMap !== undefined ) material.emissiveMap = this.getTexture( json.emissiveMap );
119+
if ( json.emissiveMapIntensity !== undefined ) material.emissiveMapIntensity = json.emissiveMapIntensity;
120+
119121
if ( json.specularMap !== undefined ) material.specularMap = this.getTexture( json.specularMap );
120122

121123
if ( json.envMap !== undefined ) {

src/materials/MeshLambertMaterial.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* aoMapIntensity: <float>
1717
*
1818
* emissiveMap: new THREE.Texture( <Image> ),
19+
* emissiveMapIntensity: <float>
1920
*
2021
* specularMap: new THREE.Texture( <Image> ),
2122
*
@@ -61,6 +62,7 @@ THREE.MeshLambertMaterial = function ( parameters ) {
6162
this.aoMapIntensity = 1.0;
6263

6364
this.emissiveMap = null;
65+
this.emissiveMapIntensity = 1.0;
6466

6567
this.specularMap = null;
6668

@@ -107,6 +109,7 @@ THREE.MeshLambertMaterial.prototype.copy = function ( source ) {
107109
this.aoMapIntensity = source.aoMapIntensity;
108110

109111
this.emissiveMap = source.emissiveMap;
112+
this.emissiveMapIntensity = source.emissiveMapIntensity;
110113

111114
this.specularMap = source.specularMap;
112115

src/materials/MeshPhongMaterial.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* aoMapIntensity: <float>
1919
*
2020
* emissiveMap: new THREE.Texture( <Image> ),
21+
* emissiveMapIntensity: <float>
2122
*
2223
* bumpMap: new THREE.Texture( <Image> ),
2324
* bumpScale: <float>,
@@ -76,6 +77,7 @@ THREE.MeshPhongMaterial = function ( parameters ) {
7677
this.aoMapIntensity = 1.0;
7778

7879
this.emissiveMap = null;
80+
this.emissiveMapIntensity = 1.0;
7981

8082
this.bumpMap = null;
8183
this.bumpScale = 1;
@@ -136,6 +138,7 @@ THREE.MeshPhongMaterial.prototype.copy = function ( source ) {
136138
this.aoMapIntensity = source.aoMapIntensity;
137139

138140
this.emissiveMap = source.emissiveMap;
141+
this.emissiveMapIntensity = source.emissiveMapIntensity;
139142

140143
this.bumpMap = source.bumpMap;
141144
this.bumpScale = source.bumpScale;

src/materials/MeshStandardMaterial.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* aoMapIntensity: <float>
1919
*
2020
* emissiveMap: new THREE.Texture( <Image> ),
21+
* emissiveMapIntensity: <float>
2122
*
2223
* bumpMap: new THREE.Texture( <Image> ),
2324
* bumpScale: <float>,
@@ -79,6 +80,7 @@ THREE.MeshStandardMaterial = function ( parameters ) {
7980
this.aoMapIntensity = 1.0;
8081

8182
this.emissiveMap = null;
83+
this.emissiveMapIntensity = 1.0;
8284

8385
this.bumpMap = null;
8486
this.bumpScale = 1;
@@ -142,6 +144,7 @@ THREE.MeshStandardMaterial.prototype.copy = function ( source ) {
142144
this.aoMapIntensity = source.aoMapIntensity;
143145

144146
this.emissiveMap = source.emissiveMap;
147+
this.emissiveMapIntensity = source.emissiveMapIntensity;
145148

146149
this.bumpMap = source.bumpMap;
147150
this.bumpScale = source.bumpScale;

src/renderers/WebGLRenderer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2027,6 +2027,7 @@ THREE.WebGLRenderer = function ( parameters ) {
20272027
if ( material.emissiveMap ) {
20282028

20292029
uniforms.emissiveMap.value = material.emissiveMap;
2030+
uniforms.emissiveMapIntensity.value = material.emissiveMapIntensity;
20302031

20312032
}
20322033

@@ -2047,6 +2048,7 @@ THREE.WebGLRenderer = function ( parameters ) {
20472048
if ( material.emissiveMap ) {
20482049

20492050
uniforms.emissiveMap.value = material.emissiveMap;
2051+
uniforms.emissiveMapIntensity.value = material.emissiveMapIntensity;
20502052

20512053
}
20522054

@@ -2101,6 +2103,7 @@ THREE.WebGLRenderer = function ( parameters ) {
21012103
if ( material.emissiveMap ) {
21022104

21032105
uniforms.emissiveMap.value = material.emissiveMap;
2106+
uniforms.emissiveMapIntensity.value = material.emissiveMapIntensity;
21042107

21052108
}
21062109

src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
emissiveColor.rgb = inputToLinear( emissiveColor.rgb );
66

7-
totalEmissiveLight *= emissiveColor.rgb;
7+
totalEmissiveLight *= emissiveColor.rgb * emissiveMapIntensity;
88

99
#endif
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#ifdef USE_EMISSIVEMAP
22

33
uniform sampler2D emissiveMap;
4+
uniform float emissiveMapIntensity;
45

56
#endif

src/renderers/shaders/UniformsLib.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ THREE.UniformsLib = {
3939
emissivemap: {
4040

4141
"emissiveMap" : { type: "t", value: null },
42+
"emissiveMapIntensity" : { type: "f", value: 1 },
4243

4344
},
4445

0 commit comments

Comments
 (0)