Skip to content

Commit 94a9eb9

Browse files
committed
Merge pull request #7827 from WestLangley/dev-emissive
Added emissiveMapIntensity
2 parents 9b7b3b9 + 0152dfb commit 94a9eb9

File tree

8 files changed

+17
-1
lines changed

8 files changed

+17
-1
lines changed

src/loaders/MaterialLoader.js

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

119119
if ( json.emissiveMap !== undefined ) material.emissiveMap = this.getTexture( json.emissiveMap );
120+
if ( json.emissiveMapIntensity !== undefined ) material.emissiveMapIntensity = json.emissiveMapIntensity;
121+
120122
if ( json.specularMap !== undefined ) material.specularMap = this.getTexture( json.specularMap );
121123

122124
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
@@ -2025,6 +2025,7 @@ THREE.WebGLRenderer = function ( parameters ) {
20252025
if ( material.emissiveMap ) {
20262026

20272027
uniforms.emissiveMap.value = material.emissiveMap;
2028+
uniforms.emissiveMapIntensity.value = material.emissiveMapIntensity;
20282029

20292030
}
20302031

@@ -2045,6 +2046,7 @@ THREE.WebGLRenderer = function ( parameters ) {
20452046
if ( material.emissiveMap ) {
20462047

20472048
uniforms.emissiveMap.value = material.emissiveMap;
2049+
uniforms.emissiveMapIntensity.value = material.emissiveMapIntensity;
20482050

20492051
}
20502052

@@ -2099,6 +2101,7 @@ THREE.WebGLRenderer = function ( parameters ) {
20992101
if ( material.emissiveMap ) {
21002102

21012103
uniforms.emissiveMap.value = material.emissiveMap;
2104+
uniforms.emissiveMapIntensity.value = material.emissiveMapIntensity;
21022105

21032106
}
21042107

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)