mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:23:52 +00:00
Merge branch 'sewer-water-isn't-that-clear' into 'master'
Set dummy state when disabling shadows indoors Closes #5688 See merge request OpenMW/openmw!412
This commit is contained in:
commit
8f2701c24b
4 changed files with 29 additions and 3 deletions
|
@ -65,6 +65,7 @@
|
|||
Bug #5644: Summon effects running on the player during game initialization cause crashes
|
||||
Bug #5656: Sneaking characters block hits while standing
|
||||
Bug #5661: Region sounds don't play at the right interval
|
||||
Bug #5688: Water shader broken indoors with enable indoor shadows = false
|
||||
Feature #390: 3rd person look "over the shoulder"
|
||||
Feature #2386: Distant Statics in the form of Object Paging
|
||||
Feature #2404: Levelled List can not be placed into a container
|
||||
|
|
|
@ -820,9 +820,10 @@ void MWShadowTechnique::enableShadows()
|
|||
_enableShadows = true;
|
||||
}
|
||||
|
||||
void MWShadowTechnique::disableShadows()
|
||||
void MWShadowTechnique::disableShadows(bool setDummyState)
|
||||
{
|
||||
_enableShadows = false;
|
||||
mSetDummyStateWhenDisabled = setDummyState;
|
||||
}
|
||||
|
||||
void SceneUtil::MWShadowTechnique::enableDebugHUD()
|
||||
|
@ -914,7 +915,28 @@ void MWShadowTechnique::cull(osgUtil::CullVisitor& cv)
|
|||
{
|
||||
if (!_enableShadows)
|
||||
{
|
||||
if (mSetDummyStateWhenDisabled)
|
||||
{
|
||||
osg::ref_ptr<osg::StateSet> dummyState = new osg::StateSet();
|
||||
|
||||
ShadowSettings* settings = getShadowedScene()->getShadowSettings();
|
||||
int baseUnit = settings->getBaseShadowTextureUnit();
|
||||
int endUnit = baseUnit + settings->getNumShadowMapsPerLight();
|
||||
for (int i = baseUnit; i < endUnit; ++i)
|
||||
{
|
||||
dummyState->setTextureAttributeAndModes(i, _fallbackShadowMapTexture, osg::StateAttribute::ON);
|
||||
dummyState->addUniform(new osg::Uniform(("shadowTexture" + std::to_string(i - baseUnit)).c_str(), i));
|
||||
dummyState->addUniform(new osg::Uniform(("shadowTextureUnit" + std::to_string(i - baseUnit)).c_str(), i));
|
||||
}
|
||||
|
||||
cv.pushStateSet(dummyState);
|
||||
}
|
||||
|
||||
_shadowedScene->osg::Group::traverse(cv);
|
||||
|
||||
if (mSetDummyStateWhenDisabled)
|
||||
cv.popStateSet();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1577,6 +1599,8 @@ void MWShadowTechnique::createShaders()
|
|||
_fallbackShadowMapTexture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::REPEAT);
|
||||
_fallbackShadowMapTexture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST);
|
||||
_fallbackShadowMapTexture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST);
|
||||
_fallbackShadowMapTexture->setShadowComparison(true);
|
||||
_fallbackShadowMapTexture->setShadowCompareFunc(osg::Texture::ShadowCompareFunc::ALWAYS);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace SceneUtil {
|
|||
|
||||
virtual void enableShadows();
|
||||
|
||||
virtual void disableShadows();
|
||||
virtual void disableShadows(bool setDummyState = false);
|
||||
|
||||
virtual void enableDebugHUD();
|
||||
|
||||
|
@ -252,6 +252,7 @@ namespace SceneUtil {
|
|||
osg::ref_ptr<osg::Program> _program;
|
||||
|
||||
bool _enableShadows;
|
||||
bool mSetDummyStateWhenDisabled;
|
||||
|
||||
double _splitPointUniformLogRatio = 0.5;
|
||||
double _splitPointDeltaBias = 0.0;
|
||||
|
|
|
@ -168,7 +168,7 @@ namespace SceneUtil
|
|||
if (Settings::Manager::getBool("enable indoor shadows", "Shadows"))
|
||||
mShadowSettings->setCastsShadowTraversalMask(mIndoorShadowCastingMask);
|
||||
else
|
||||
mShadowTechnique->disableShadows();
|
||||
mShadowTechnique->disableShadows(true);
|
||||
}
|
||||
|
||||
void ShadowManager::enableOutdoorMode()
|
||||
|
|
Loading…
Reference in a new issue