mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Read the Sun Glare Fader ini settings
This commit is contained in:
parent
3b39572274
commit
a88d56148b
1 changed files with 16 additions and 14 deletions
|
@ -724,7 +724,17 @@ private:
|
|||
, mTimeOfDayFade(1.f)
|
||||
, mGlareView(1.f)
|
||||
{
|
||||
const MWWorld::Fallback* fallback = MWBase::Environment::get().getWorld()->getFallback();
|
||||
mColor = fallback->getFallbackColour("Weather_Sun_Glare_Fader_Color");
|
||||
mSunGlareFaderMax = fallback->getFallbackFloat("Weather_Sun_Glare_Fader_Max");
|
||||
mSunGlareFaderAngleMax = fallback->getFallbackFloat("Weather_Sun_Glare_Fader_Angle_Max");
|
||||
|
||||
// Replicating a design flaw in MW. The color was being set on both ambient and emissive properties, which multiplies the result by two,
|
||||
// then finally gets clamped by the fixed function pipeline. With the default INI settings, only the red component gets clamped,
|
||||
// so the resulting color looks more orange than red.
|
||||
mColor *= 2;
|
||||
for (int i=0; i<3; ++i)
|
||||
mColor[i] = std::min(1.f, mColor[i]);
|
||||
}
|
||||
|
||||
virtual void operator ()(osg::Node* node, osg::NodeVisitor* nv)
|
||||
|
@ -734,12 +744,10 @@ private:
|
|||
float angleRadians = getAngleToSunInRadians(cv->getCurrentCamera());
|
||||
float visibleRatio = getVisibleRatio(cv->getCurrentCamera());
|
||||
|
||||
const float angleMaxRadians = osg::DegreesToRadians(30.f); // Sun Glare Fader Angle Max
|
||||
const float angleMaxRadians = osg::DegreesToRadians(mSunGlareFaderAngleMax);
|
||||
|
||||
float value = 1.f - std::min(1.f, angleRadians / angleMaxRadians);
|
||||
|
||||
const float sunGlareFaderMax = 0.5f;
|
||||
float fade = value * sunGlareFaderMax;
|
||||
float fade = value * mSunGlareFaderMax;
|
||||
|
||||
fade *= mTimeOfDayFade * mGlareView * visibleRatio;
|
||||
|
||||
|
@ -754,17 +762,8 @@ private:
|
|||
|
||||
osg::ref_ptr<osg::Material> mat (createUnlitMaterial());
|
||||
|
||||
osg::Vec4f sunGlareFaderColor (222/255.f, 95/255.f, 39/255.f, 1);
|
||||
|
||||
// Replicating a design flaw in MW. The color was being set on both ambient and emissive properties, which multiplies the result by two,
|
||||
// then finally gets clamped by the fixed function pipeline. With the default INI settings, only the red component gets clamped,
|
||||
// so the resulting color looks more orange than red.
|
||||
sunGlareFaderColor *= 2;
|
||||
for (int i=0; i<3; ++i)
|
||||
sunGlareFaderColor[i] = std::min(1.f, sunGlareFaderColor[i]);
|
||||
|
||||
mat->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4f(0,0,0,fade));
|
||||
mat->setEmission(osg::Material::FRONT_AND_BACK, sunGlareFaderColor);
|
||||
mat->setEmission(osg::Material::FRONT_AND_BACK, mColor);
|
||||
|
||||
stateset->setAttributeAndModes(mat, osg::StateAttribute::ON);
|
||||
|
||||
|
@ -802,6 +801,9 @@ private:
|
|||
osg::ref_ptr<osg::PositionAttitudeTransform> mSunTransform;
|
||||
float mTimeOfDayFade;
|
||||
float mGlareView;
|
||||
osg::Vec4f mColor;
|
||||
float mSunGlareFaderMax;
|
||||
float mSunGlareFaderAngleMax;
|
||||
};
|
||||
|
||||
osg::ref_ptr<Updater> mUpdater;
|
||||
|
|
Loading…
Reference in a new issue