Fix the blend code to record the amount of the blend and to store what is being blended towards.

meow-7.2.2
Rider Linden 2018-05-15 17:17:51 -07:00
parent 885853b417
commit 3925e37532
7 changed files with 129 additions and 14 deletions

View File

@ -58,14 +58,16 @@ const F64Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01);
LLSettingsBase::LLSettingsBase():
mSettings(LLSD::emptyMap()),
mDirty(true),
mAssetID()
mAssetID(),
mBlendedFactor(0.0)
{
}
LLSettingsBase::LLSettingsBase(const LLSD setting) :
mSettings(setting),
mDirty(true),
mAssetID()
mAssetID(),
mBlendedFactor(0.0)
{
}
@ -224,9 +226,12 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F
break;
case LLSD::TypeUUID:
newSettings[key_name] = value.asUUID();
break;
// case LLSD::TypeBoolean:
// case LLSD::TypeString:
// case LLSD::TypeUUID:
// case LLSD::TypeURI:
// case LLSD::TypeBinary:
// case LLSD::TypeDate:

View File

@ -96,6 +96,7 @@ public:
inline void replaceSettings(LLSD settings)
{
mSettings = settings;
mBlendedFactor = 0.0;
setDirtyFlag(true);
}
@ -146,6 +147,11 @@ public:
setValue(name, value.getValue());
}
inline F64 getBlendFactor() const
{
return mBlendedFactor;
}
// Note this method is marked const but may modify the settings object.
// (note the internal const cast). This is so that it may be called without
// special consideration from getters.
@ -237,11 +243,17 @@ protected:
LLSD cloneSettings() const;
inline void setBlendFactor(F64 blendfactor)
{
mBlendedFactor = blendfactor;
}
private:
bool mDirty;
LLSD combineSDMaps(const LLSD &first, const LLSD &other) const;
F64 mBlendedFactor;
};

View File

@ -106,6 +106,10 @@ const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR("exp_s
const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM("linear_term");
const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM("constant_term");
const LLUUID LLSettingsSky::DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver
const LLUUID LLSettingsSky::DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver
const LLUUID LLSettingsSky::DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b");
namespace
{
@ -310,12 +314,18 @@ bool validateMieLayers(LLSD &value)
//=========================================================================
LLSettingsSky::LLSettingsSky(const LLSD &data) :
LLSettingsBase(data)
LLSettingsBase(data),
mNextSunTextureId(),
mNextMoonTextureId(),
mNextCloudTextureId()
{
}
LLSettingsSky::LLSettingsSky():
LLSettingsBase()
LLSettingsBase(),
mNextSunTextureId(),
mNextMoonTextureId(),
mNextCloudTextureId()
{
}
@ -325,6 +335,10 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf);
replaceSettings(blenddata);
setBlendFactor(blendf);
mNextSunTextureId = other->getSunTextureId();
mNextMoonTextureId = other->getMoonTextureId();
mNextCloudTextureId = other->getCloudNoiseTextureId();
}
@ -557,9 +571,9 @@ LLSD LLSettingsSky::defaults()
dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue();
dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1;
dfltsetting[SETTING_CLOUD_TEXTUREID] = LLUUID::null;
dfltsetting[SETTING_MOON_TEXTUREID] = IMG_MOON; // gMoonTextureID; // These two are returned by the login... wow!
dfltsetting[SETTING_SUN_TEXTUREID] = IMG_SUN; // gSunTextureID;
dfltsetting[SETTING_CLOUD_TEXTUREID] = DEFAULT_CLOUD_ID;
dfltsetting[SETTING_MOON_TEXTUREID] = DEFAULT_MOON_ID; // gMoonTextureID; // These two are returned by the login... wow!
dfltsetting[SETTING_SUN_TEXTUREID] = DEFAULT_SUN_ID; // gSunTextureID;
dfltsetting[SETTING_TYPE] = "sky";

View File

@ -79,6 +79,10 @@ public:
static const std::string SETTING_DENSITY_PROFILE_CONSTANT_TERM;
static const std::string SETTING_MIE_ANISOTROPY_FACTOR;
static const LLUUID DEFAULT_SUN_ID;
static const LLUUID DEFAULT_MOON_ID;
static const LLUUID DEFAULT_CLOUD_ID;
typedef std::shared_ptr<LLSettingsSky> ptr_t;
typedef std::pair<F32, F32> azimalt_t;
@ -449,10 +453,31 @@ public:
return mTotalAmbient;
}
virtual validation_list_t getValidationList() const override;
static validation_list_t validationList();
//=====================================================================
virtual void loadTextures() { };
static LLSD translateLegacySettings(LLSD legacy);
//=====================================================================
virtual validation_list_t getValidationList() const override;
static validation_list_t validationList();
static LLSD translateLegacySettings(LLSD legacy);
//=====================================================================
// transient properties used in animations.
LLUUID getNextSunTextureId() const
{
return mNextSunTextureId;
}
LLUUID getNextMoonTextureId() const
{
return mNextMoonTextureId;
}
LLUUID getNextCloudNoiseTextureId() const
{
return mNextCloudTextureId;
}
protected:
static const std::string SETTING_LEGACY_EAST_ANGLE;
@ -492,6 +517,10 @@ private:
LLColor4 mTotalAmbient;
LLUUID mNextSunTextureId;
LLUUID mNextMoonTextureId;
LLUUID mNextCloudTextureId;
typedef std::map<std::string, S32> mapNameToUniformId_t;
static mapNameToUniformId_t sNameToUniformMapping;

View File

@ -72,12 +72,14 @@ const LLUUID LLSettingsWater::DEFAULT_WATER_NORMAL_ID(DEFAULT_WATER_NORMAL);
//=========================================================================
LLSettingsWater::LLSettingsWater(const LLSD &data) :
LLSettingsBase(data)
LLSettingsBase(data),
mNextNormalMapID()
{
}
LLSettingsWater::LLSettingsWater() :
LLSettingsBase()
LLSettingsBase(),
mNextNormalMapID()
{
}
@ -167,6 +169,8 @@ void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf);
replaceSettings(blenddata);
setBlendFactor(blendf);
mNextNormalMapID = other->getNormalMapID();
}
LLSettingsWater::validation_list_t LLSettingsWater::getValidationList() const

View File

@ -199,6 +199,13 @@ public:
return mWaterFogKS;
}
//-------------------------------------------
LLUUID getNextNormalMapID() const
{
return mNextNormalMapID;
}
virtual validation_list_t getValidationList() const override;
static validation_list_t validationList();
@ -224,7 +231,7 @@ protected:
F32 mWaterFogKS;
private:
LLUUID mNextNormalMapID;
};
#endif

View File

@ -2105,6 +2105,50 @@ void LLVOSky::setSunDirection(const LLVector3 &sun_dir, const LLVector3 &moon_di
}
}
// void LLVOSky::checkAndLoadSkyTextures(LLDrawPoolWLSky *pskypool)
// {
// LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
//
// if (mMoonCurrentId != psky->getMoonTextureId())
// {
// mMoonCurrentId = psky->getMoonTextureId();
// if (mMoonCurrentId.isNull())
// {
// mMoonTexturep = NULL;
// mMoon.setDraw(FALSE);
// }
// else
// {
// mMoonTexturep = LLViewerTextureManager::getFetchedTexture(mMoonCurrentId, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
// if (mMoonTexturep)
// {
// mMoonTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
// }
// mMoon.setDraw(TRUE);
// }
// mFace[FACE_MOON] = mDrawable->addFace(pskypool, mMoonTexturep);
// }
//
// if (mSunCurrentId != psky->getSunTextureId())
// {
// mSunCurrentId = psky->getSunTextureId();
// if (mSunCurrentId.isNull())
// {
// mSunTexturep = NULL;
// mSun.setDraw(FALSE);
// }
// else
// {
// mSunTexturep = LLViewerTextureManager::getFetchedTexture(mSunCurrentId, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
// if (mSunTexturep)
// {
// mSunTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
// }
// mSun.setDraw(TRUE);
// }
// mFace[FACE_SUN] = mDrawable->addFace(pskypool, mSunTexturep);
// }
// }
LLColor4U LLVOSky::getFadeColor() const
{