Skip to content

Commit 04da08f

Browse files
authored
Solve issue #2161 (PBRLighting incompatible with glow) #2162
1 parent 5e99633 commit 04da08f

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#import "Common/ShaderLib/GLSLCompat.glsllib"
2+
#if defined(NEED_TEXCOORD1)
3+
varying vec2 texCoord1;
4+
#else
5+
varying vec2 texCoord;
6+
#endif
7+
8+
9+
#ifdef HAS_EMISSIVEMAP
10+
uniform sampler2D m_EmissiveMap;
11+
#endif
12+
13+
#ifdef HAS_EMISSIVECOLOR
14+
uniform vec4 m_Emissive;
15+
#endif
16+
17+
18+
void main(){
19+
#ifdef HAS_EMISSIVEMAP
20+
#ifdef HAS_EMISSIVECOLOR
21+
vec4 color = m_Emissive;
22+
#else
23+
vec4 color = vec4(1.0);
24+
#endif
25+
26+
#if defined(NEED_TEXCOORD1)
27+
gl_FragColor = texture2D(m_EmissiveMap, texCoord1) * color;
28+
#else
29+
gl_FragColor = texture2D(m_EmissiveMap, texCoord) * color;
30+
#endif
31+
#else
32+
#ifdef HAS_EMISSIVECOLOR
33+
gl_FragColor = m_Emissive;
34+
#else
35+
gl_FragColor = vec4(0.0);
36+
#endif
37+
#endif
38+
}

jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.j3md

+3-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ MaterialDef PBR Lighting {
280280
Technique Glow {
281281

282282
VertexShader GLSL300 GLSL150 GLSL100: Common/MatDefs/Misc/Unshaded.vert
283-
FragmentShader GLSL300 GLSL150 GLSL100: Common/MatDefs/Light/Glow.frag
283+
FragmentShader GLSL300 GLSL150 GLSL100: Common/MatDefs/Light/PBRGlow.frag
284284

285285
WorldParameters {
286286
WorldViewProjectionMatrix
@@ -289,6 +289,8 @@ MaterialDef PBR Lighting {
289289
}
290290

291291
Defines {
292+
HAS_EMISSIVEMAP : EmissiveMap
293+
HAS_EMISSIVECOLOR : Emissive
292294
BOUND_DRAW_BUFFER: BoundDrawBuffer
293295
NEED_TEXCOORD1
294296
NUM_BONES : NumberOfBones

0 commit comments

Comments
 (0)