ShaderGenerator: fix error with normal map and only ambient light

Closes #331
This commit is contained in:
rdb 2018-06-03 22:30:15 +02:00
parent e0245d2777
commit c08339e8ce
1 changed files with 4 additions and 4 deletions

View File

@ -353,7 +353,7 @@ analyze_renderstate(ShaderKey &key, const RenderState *rs) {
if (parallax_mapping_samples == 0) {
info._mode = TextureStage::M_normal;
} else if (!shader_attrib->auto_normal_on() ||
(!key._lighting && (key._outputs & AuxBitplaneAttrib::ABO_aux_normal) == 0)) {
(key._lights.empty() && (key._outputs & AuxBitplaneAttrib::ABO_aux_normal) == 0)) {
info._mode = TextureStage::M_height;
info._flags = ShaderKey::TF_has_alpha;
} else {
@ -362,7 +362,7 @@ analyze_renderstate(ShaderKey &key, const RenderState *rs) {
break;
case TextureStage::M_normal_gloss:
if (!shader_attrib->auto_gloss_on() || !key._lighting) {
if (!shader_attrib->auto_gloss_on() || key._lights.empty()) {
info._mode = TextureStage::M_normal;
} else if (!shader_attrib->auto_normal_on()) {
info._mode = TextureStage::M_gloss;
@ -411,7 +411,7 @@ analyze_renderstate(ShaderKey &key, const RenderState *rs) {
switch (info._mode) {
case TextureStage::M_normal:
if (!shader_attrib->auto_normal_on() ||
(!key._lighting && (key._outputs & AuxBitplaneAttrib::ABO_aux_normal) == 0)) {
(key._lights.empty() && (key._outputs & AuxBitplaneAttrib::ABO_aux_normal) == 0)) {
skip = true;
} else {
info._flags = ShaderKey::TF_map_normal;
@ -425,7 +425,7 @@ analyze_renderstate(ShaderKey &key, const RenderState *rs) {
}
break;
case TextureStage::M_gloss:
if (key._lighting && shader_attrib->auto_gloss_on()) {
if (!key._lights.empty() && shader_attrib->auto_gloss_on()) {
info._flags = ShaderKey::TF_map_gloss;
} else {
skip = true;