Rebuild particles when occlusion changes

This commit is contained in:
Evil Eye
2026-10-23 22:12:21 +02:00
parent 9b09db41a4
commit 39dec54485
2 changed files with 7 additions and 4 deletions
+6 -4
View File
@@ -638,10 +638,12 @@ namespace MWRender
if (mIsStorm)
mStormDirection = weather.mStormDirection;
if (mDirtyParticlesEffect || (mCurrentParticleEffect != weather.getParticleEffect()))
if (mDirtyParticlesEffect || mCurrentParticleEffect != weather.getParticleEffect()
|| mParticleOcclusion != weather.getOcclusionEnabled())
{
mDirtyParticlesEffect = false;
mCurrentParticleEffect = weather.getParticleEffect();
mParticleOcclusion = weather.getOcclusionEnabled();
// cleanup old particles
if (mParticleEffect)
@@ -691,7 +693,7 @@ namespace MWRender
= static_cast<osgParticle::ParticleSystem*>(findPSVisitor.mFoundNodes[i]);
osg::ref_ptr<osgParticle::ModularProgram> program = new osgParticle::ModularProgram;
if (weather.getOcclusionEnabled())
if (mParticleOcclusion)
program->addOperator(new WrapAroundOperator(mCamera, defaultWrapRange));
program->addOperator(new WeatherAlphaOperator(mPrecipitationAlpha, false));
program->setParticleSystem(ps);
@@ -706,13 +708,13 @@ namespace MWRender
ps->setUserValue("simpleLighting", true);
if (weather.getOcclusionEnabled())
if (mParticleOcclusion)
ps->setUserValue("particleOcclusion", true);
}
mSceneManager->recreateShaders(mParticleNode);
if (mPrecipitationOcclusion && weather.getOcclusionEnabled())
if (mPrecipitationOcclusion && mParticleOcclusion)
{
mPrecipitationOccluder->enable();
mPrecipitationOccluder->updateRange(defaultWrapRange);
+1
View File
@@ -187,6 +187,7 @@ namespace MWRender
osg::ref_ptr<SceneUtil::RTTNode> mSkyRTT;
bool mPrecipitationOcclusion = false;
bool mParticleOcclusion = false;
bool mCreated = false;
bool mIsStorm = false;
bool mTimescaleClouds;