1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-29 04:06:40 +00:00

Make CSM shader changes controllable by the setting.

This commit is contained in:
AnyOldName3 2018-05-17 17:35:55 +01:00
parent 5d05aadb37
commit 84284a60a7
4 changed files with 58 additions and 33 deletions

View file

@ -96,6 +96,11 @@ namespace SceneUtil
// remove extra comma // remove extra comma
definesWithShadows["shadow_texture_unit_list"] = definesWithShadows["shadow_texture_unit_list"].substr(0, definesWithShadows["shadow_texture_unit_list"].length() - 1); definesWithShadows["shadow_texture_unit_list"] = definesWithShadows["shadow_texture_unit_list"].substr(0, definesWithShadows["shadow_texture_unit_list"].length() - 1);
if (Settings::Manager::getBool("allow shadow map overlap", "Shadows"))
definesWithShadows["shadowMapsOverlap"] = "1";
else
definesWithShadows["shadowMapsOverlap"] = "0";
return definesWithShadows; return definesWithShadows;
} }
@ -105,6 +110,8 @@ namespace SceneUtil
definesWithShadows.insert(std::make_pair(std::string("shadows_enabled"), std::string("0"))); definesWithShadows.insert(std::make_pair(std::string("shadows_enabled"), std::string("0")));
definesWithShadows["shadow_texture_unit_list"] = ""; definesWithShadows["shadow_texture_unit_list"] = "";
definesWithShadows["shadowMapsOverlap"] = "0";
return definesWithShadows; return definesWithShadows;
} }
void ShadowManager::enableIndoorMode() void ShadowManager::enableIndoorMode()

View file

@ -124,6 +124,7 @@ void main()
float shadowing = 1.0; float shadowing = 1.0;
#if SHADOWS #if SHADOWS
#if @shadowMapsOverlap
bool doneShadows = false; bool doneShadows = false;
@foreach shadow_texture_unit_index @shadow_texture_unit_list @foreach shadow_texture_unit_index @shadow_texture_unit_list
if (!doneShadows) if (!doneShadows)
@ -138,6 +139,11 @@ void main()
} }
} }
@endforeach @endforeach
#else
@foreach shadow_texture_unit_index @shadow_texture_unit_list
shadowing *= shadow2DProj(shadowTexture@shadow_texture_unit_index, shadowSpaceCoords@shadow_texture_unit_index).r;
@endforeach
#endif
#endif // SHADOWS #endif // SHADOWS
#if !PER_PIXEL_LIGHTING #if !PER_PIXEL_LIGHTING

View file

@ -76,6 +76,7 @@ void main()
float shadowing = 1.0; float shadowing = 1.0;
#if SHADOWS #if SHADOWS
#if @shadowMapsOverlap
bool doneShadows = false; bool doneShadows = false;
@foreach shadow_texture_unit_index @shadow_texture_unit_list @foreach shadow_texture_unit_index @shadow_texture_unit_list
if (!doneShadows) if (!doneShadows)
@ -90,6 +91,11 @@ void main()
} }
} }
@endforeach @endforeach
#else
@foreach shadow_texture_unit_index @shadow_texture_unit_list
shadowing *= shadow2DProj(shadowTexture@shadow_texture_unit_index, shadowSpaceCoords@shadow_texture_unit_index).r;
@endforeach
#endif
#endif // SHADOWS #endif // SHADOWS
#if !PER_PIXEL_LIGHTING #if !PER_PIXEL_LIGHTING

View file

@ -168,6 +168,7 @@ void main(void)
#if SHADOWS #if SHADOWS
float shadowing = 1.0; float shadowing = 1.0;
#if @shadowMapsOverlap
bool doneShadows = false; bool doneShadows = false;
@foreach shadow_texture_unit_index @shadow_texture_unit_list @foreach shadow_texture_unit_index @shadow_texture_unit_list
if (!doneShadows) if (!doneShadows)
@ -182,6 +183,11 @@ void main(void)
} }
} }
@endforeach @endforeach
#else
@foreach shadow_texture_unit_index @shadow_texture_unit_list
shadowing *= shadow2DProj(shadowTexture@shadow_texture_unit_index, shadowSpaceCoords@shadow_texture_unit_index).r;
@endforeach
#endif
float shadow = shadowing; float shadow = shadowing;
#else // NOT SHADOWS #else // NOT SHADOWS