1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 03:53:52 +00:00

Give meaningful name to the mEffectFade

This commit is contained in:
Andrei Kortunov 2021-03-10 19:10:17 +04:00
parent d805886de7
commit 38679013fe
4 changed files with 14 additions and 14 deletions

View file

@ -657,7 +657,7 @@ namespace MWRender
mUnrefQueue->flush(mWorkQueue.get()); mUnrefQueue->flush(mWorkQueue.get());
float rainIntensity = mSky->getEffectFade(); float rainIntensity = mSky->getPrecipitationAlpha();
mWater->setRainIntensity(rainIntensity); mWater->setRainIntensity(rainIntensity);
if (!paused) if (!paused)

View file

@ -1138,7 +1138,7 @@ SkyManager::SkyManager(osg::Group* parentNode, Resource::SceneManager* sceneMana
, mBaseWindSpeed(0.f) , mBaseWindSpeed(0.f)
, mEnabled(true) , mEnabled(true)
, mSunEnabled(true) , mSunEnabled(true)
, mEffectFade(0.f) , mPrecipitationAlpha(0.f)
{ {
osg::ref_ptr<CameraRelativeTransform> skyroot (new CameraRelativeTransform); osg::ref_ptr<CameraRelativeTransform> skyroot (new CameraRelativeTransform);
skyroot->setName("Sky Root"); skyroot->setName("Sky Root");
@ -1516,7 +1516,7 @@ void SkyManager::createRain()
osg::ref_ptr<osgParticle::ModularProgram> program (new osgParticle::ModularProgram); osg::ref_ptr<osgParticle::ModularProgram> program (new osgParticle::ModularProgram);
program->addOperator(new WrapAroundOperator(mCamera,rainRange)); program->addOperator(new WrapAroundOperator(mCamera,rainRange));
program->addOperator(new WeatherAlphaOperator(mEffectFade, true)); program->addOperator(new WeatherAlphaOperator(mPrecipitationAlpha, true));
program->setParticleSystem(mRainParticleSystem); program->setParticleSystem(mRainParticleSystem);
mRainNode->addChild(program); mRainNode->addChild(program);
@ -1575,10 +1575,10 @@ bool SkyManager::hasRain() const
return mRainNode != nullptr; return mRainNode != nullptr;
} }
float SkyManager::getEffectFade() const float SkyManager::getPrecipitationAlpha() const
{ {
if (mEnabled && !mIsStorm && (hasRain() || mParticleNode)) if (mEnabled && !mIsStorm && (hasRain() || mParticleNode))
return mEffectFade; return mPrecipitationAlpha;
return 0.f; return 0.f;
} }
@ -1722,7 +1722,7 @@ void SkyManager::setWeather(const WeatherResult& weather)
SceneUtil::AssignControllerSourcesVisitor assignVisitor(std::shared_ptr<SceneUtil::ControllerSource>(new SceneUtil::FrameTimeSource)); SceneUtil::AssignControllerSourcesVisitor assignVisitor(std::shared_ptr<SceneUtil::ControllerSource>(new SceneUtil::FrameTimeSource));
mParticleEffect->accept(assignVisitor); mParticleEffect->accept(assignVisitor);
AlphaFader::SetupVisitor alphaFaderSetupVisitor(mEffectFade); AlphaFader::SetupVisitor alphaFaderSetupVisitor(mPrecipitationAlpha);
mParticleEffect->accept(alphaFaderSetupVisitor); mParticleEffect->accept(alphaFaderSetupVisitor);
@ -1739,7 +1739,7 @@ void SkyManager::setWeather(const WeatherResult& weather)
osg::ref_ptr<osgParticle::ModularProgram> program (new osgParticle::ModularProgram); osg::ref_ptr<osgParticle::ModularProgram> program (new osgParticle::ModularProgram);
if (!mIsStorm) if (!mIsStorm)
program->addOperator(new WrapAroundOperator(mCamera,osg::Vec3(1024,1024,800))); program->addOperator(new WrapAroundOperator(mCamera,osg::Vec3(1024,1024,800)));
program->addOperator(new WeatherAlphaOperator(mEffectFade, false)); program->addOperator(new WeatherAlphaOperator(mPrecipitationAlpha, false));
program->setParticleSystem(ps); program->setParticleSystem(ps);
mParticleNode->addChild(program); mParticleNode->addChild(program);
} }
@ -1828,7 +1828,7 @@ void SkyManager::setWeather(const WeatherResult& weather)
mAtmosphereNightNode->setNodeMask(weather.mNight ? ~0 : 0); mAtmosphereNightNode->setNodeMask(weather.mNight ? ~0 : 0);
mEffectFade = weather.mEffectFade; mPrecipitationAlpha = weather.mPrecipitationAlpha;
} }
float SkyManager::getBaseWindSpeed() const float SkyManager::getBaseWindSpeed() const

View file

@ -87,7 +87,7 @@ namespace MWRender
std::string mParticleEffect; std::string mParticleEffect;
std::string mRainEffect; std::string mRainEffect;
float mEffectFade; float mPrecipitationAlpha;
float mRainDiameter; float mRainDiameter;
float mRainMinHeight; float mRainMinHeight;
@ -158,7 +158,7 @@ namespace MWRender
bool hasRain() const; bool hasRain() const;
float getEffectFade() const; float getPrecipitationAlpha() const;
void setRainSpeed(float speed); void setRainSpeed(float speed);
@ -269,7 +269,7 @@ namespace MWRender
bool mEnabled; bool mEnabled;
bool mSunEnabled; bool mSunEnabled;
float mEffectFade; float mPrecipitationAlpha;
osg::Vec4f mMoonScriptColor; osg::Vec4f mMoonScriptColor;
}; };

View file

@ -1129,7 +1129,7 @@ inline void WeatherManager::calculateResult(const int weatherID, const float gam
mResult.mGlareView = current.mGlareView; mResult.mGlareView = current.mGlareView;
mResult.mAmbientLoopSoundID = current.mAmbientLoopSoundID; mResult.mAmbientLoopSoundID = current.mAmbientLoopSoundID;
mResult.mAmbientSoundVolume = 1.f; mResult.mAmbientSoundVolume = 1.f;
mResult.mEffectFade = 1.f; mResult.mPrecipitationAlpha = 1.f;
mResult.mIsStorm = current.mIsStorm; mResult.mIsStorm = current.mIsStorm;
@ -1236,7 +1236,7 @@ inline void WeatherManager::calculateTransitionResult(const float factor, const
mResult.mRainSpeed = current.mRainSpeed; mResult.mRainSpeed = current.mRainSpeed;
mResult.mRainEntranceSpeed = current.mRainEntranceSpeed; mResult.mRainEntranceSpeed = current.mRainEntranceSpeed;
mResult.mAmbientSoundVolume = 1 - factor / threshold; mResult.mAmbientSoundVolume = 1 - factor / threshold;
mResult.mEffectFade = mResult.mAmbientSoundVolume; mResult.mPrecipitationAlpha = mResult.mAmbientSoundVolume;
mResult.mAmbientLoopSoundID = current.mAmbientLoopSoundID; mResult.mAmbientLoopSoundID = current.mAmbientLoopSoundID;
mResult.mRainDiameter = current.mRainDiameter; mResult.mRainDiameter = current.mRainDiameter;
mResult.mRainMinHeight = current.mRainMinHeight; mResult.mRainMinHeight = current.mRainMinHeight;
@ -1251,7 +1251,7 @@ inline void WeatherManager::calculateTransitionResult(const float factor, const
mResult.mRainSpeed = other.mRainSpeed; mResult.mRainSpeed = other.mRainSpeed;
mResult.mRainEntranceSpeed = other.mRainEntranceSpeed; mResult.mRainEntranceSpeed = other.mRainEntranceSpeed;
mResult.mAmbientSoundVolume = (factor - threshold) / (1 - threshold); mResult.mAmbientSoundVolume = (factor - threshold) / (1 - threshold);
mResult.mEffectFade = mResult.mAmbientSoundVolume; mResult.mPrecipitationAlpha = mResult.mAmbientSoundVolume;
mResult.mAmbientLoopSoundID = other.mAmbientLoopSoundID; mResult.mAmbientLoopSoundID = other.mAmbientLoopSoundID;
mResult.mRainDiameter = other.mRainDiameter; mResult.mRainDiameter = other.mRainDiameter;