Fixed a crash in the PBR shader when adding a light map.

fix-456
Nehon 8 years ago
parent 09ce6205c7
commit 0610f703d7
  1. 23
      jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.frag

@ -148,18 +148,6 @@ void main(){
vec3 normal = normalize(wNormal);
#endif
#ifdef LIGHTMAP
vec3 lightMapColor;
#ifdef SEPARATE_TEXCOORD
lightMapColor = texture2D(m_LightMap, texCoord2).rgb;
#else
lightMapColor = texture2D(m_LightMap, texCoord).rgb;
#endif
specularColor.rgb *= lightMapColor;
albedo.rgb *= lightMapColor;
#endif
float specular = 0.5;
#ifdef SPECGLOSSPIPELINE
vec4 specularColor = texture2D(m_SpecularMap, newTexCoord);
@ -171,6 +159,17 @@ void main(){
vec4 diffuseColor = albedo - albedo * Metallic;
#endif
#ifdef LIGHTMAP
vec3 lightMapColor;
#ifdef SEPARATE_TEXCOORD
lightMapColor = texture2D(m_LightMap, texCoord2).rgb;
#else
lightMapColor = texture2D(m_LightMap, texCoord).rgb;
#endif
specularColor.rgb *= lightMapColor;
albedo.rgb *= lightMapColor;
#endif
gl_FragColor.rgb = vec3(0.0);
float ndotv = max( dot( normal, viewDir ),0.0);
for( int i = 0;i < NB_LIGHTS; i+=3){

Loading…
Cancel
Save