- internal : rewrite of the @getenv_XXX and @setenv_XXX Windlight commands
--HG-- branch : RLVameow-7.2.2
parent
ec797db6aa
commit
e8d4c2f5f0
|
|
@ -484,7 +484,10 @@ void LLEnvManagerNew::onRegionSettingsResponse(const LLSD& content)
|
|||
LLWLParamManager::instance().refreshRegionPresets();
|
||||
|
||||
// If using server settings, update managers.
|
||||
if (getUseRegionSettings())
|
||||
// if (getUseRegionSettings())
|
||||
// [RLVa:KB] - Checked: 2011-08-29 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
|
||||
if ( (getUseRegionSettings()) && (LLWLParamManager::getInstance()->mAnimator.getIsRunning()) )
|
||||
// [/RLVa:KB]
|
||||
{
|
||||
updateManagersFromPrefs(mInterpNextChangeMessage);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,351 @@
|
|||
|
||||
// ============================================================================
|
||||
|
||||
class RlvWindLightControl
|
||||
{
|
||||
public:
|
||||
enum EType { TYPE_COLOR, TYPE_COLOR_R, TYPE_FLOAT, TYPE_UNKNOWN };
|
||||
enum EColorComponent { COMPONENT_R, COMPONENT_G, COMPONENT_B, COMPONENT_I, COMPONENT_NONE };
|
||||
public:
|
||||
RlvWindLightControl(WLColorControl* pCtrl, bool fColorR) : m_eType((!fColorR) ? TYPE_COLOR: TYPE_COLOR_R), m_pColourCtrl(pCtrl), m_pFloatCtrl(NULL) {}
|
||||
RlvWindLightControl(WLFloatControl* pCtrl) : m_eType(TYPE_FLOAT), m_pColourCtrl(NULL), m_pFloatCtrl(pCtrl) {}
|
||||
|
||||
EType getControlType() const { return m_eType; }
|
||||
bool isColorType() const { return (TYPE_COLOR == m_eType) || (TYPE_COLOR_R == m_eType); }
|
||||
bool isFloatType() const { return (TYPE_FLOAT == m_eType); }
|
||||
// TYPE_COLOR and TYPE_COLOR_R
|
||||
F32 getColorComponent(EColorComponent eComponent, bool& fError) const;
|
||||
LLVector4 getColorVector(bool& fError) const;
|
||||
bool setColorComponent(EColorComponent eComponent, F32 nValue);
|
||||
// TYPE_FLOAT
|
||||
F32 getFloat(bool& fError) const;
|
||||
bool setFloat(F32 nValue);
|
||||
|
||||
static EColorComponent getComponentFromCharacter(char ch);
|
||||
protected:
|
||||
EType m_eType; // Type of the WindLight control
|
||||
WLColorControl* m_pColourCtrl;
|
||||
WLFloatControl* m_pFloatCtrl;
|
||||
};
|
||||
|
||||
// Checked: 2011-08-29 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
|
||||
static F32 get_intensity_from_color(const LLVector4& v)
|
||||
{
|
||||
return llmax(v.mV[0], v.mV[1], v.mV[2]);
|
||||
}
|
||||
|
||||
// Checked: 2011-08-29 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
|
||||
F32 RlvWindLightControl::getColorComponent(EColorComponent eComponent, bool& fError) const
|
||||
{
|
||||
switch (eComponent)
|
||||
{
|
||||
case COMPONENT_R: return getColorVector(fError).mV[0];
|
||||
case COMPONENT_G: return getColorVector(fError).mV[1];
|
||||
case COMPONENT_B: return getColorVector(fError).mV[2];
|
||||
case COMPONENT_I: return get_intensity_from_color(getColorVector(fError)); // SL-2.8: Always seems to be 1.0 so get it manually
|
||||
default : RLV_ASSERT(false); fError = true; return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
// Checked: 2011-08-29 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
|
||||
RlvWindLightControl::EColorComponent RlvWindLightControl::getComponentFromCharacter(char ch)
|
||||
{
|
||||
if (('r' == ch) || ('x' == ch))
|
||||
return COMPONENT_R;
|
||||
else if (('g' == ch) || ('y' == ch))
|
||||
return COMPONENT_G;
|
||||
else if (('b' == ch) || ('d' == ch))
|
||||
return COMPONENT_B;
|
||||
else if ('i' == ch)
|
||||
return COMPONENT_I;
|
||||
return COMPONENT_NONE;
|
||||
}
|
||||
|
||||
// Checked: 2011-08-29 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
|
||||
LLVector4 RlvWindLightControl::getColorVector(bool& fError) const
|
||||
{
|
||||
if ((fError = !isColorType()))
|
||||
return LLVector4(0, 0, 0, 0);
|
||||
F32 nMult = (m_pColourCtrl->isSunOrAmbientColor) ? 3.0f : ((m_pColourCtrl->isBlueHorizonOrDensity) ? 2.0f : 1.0f);
|
||||
return LLWLParamManager::getInstance()->mCurParams.getVector(m_pColourCtrl->mName, fError) / nMult;
|
||||
}
|
||||
|
||||
// Checked: 2011-08-28 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
|
||||
bool RlvWindLightControl::setColorComponent(EColorComponent eComponent, F32 nValue)
|
||||
{
|
||||
if (isColorType())
|
||||
{
|
||||
nValue *= (m_pColourCtrl->isSunOrAmbientColor) ? 3.0f : ((m_pColourCtrl->isBlueHorizonOrDensity) ? 2.0f : 1.0f);
|
||||
if (COMPONENT_I == eComponent) // (See: LLFloaterWindLight::onColorControlIMoved)
|
||||
{
|
||||
if (m_pColourCtrl->hasSliderName)
|
||||
{
|
||||
F32 curMax = llmax(m_pColourCtrl->r, m_pColourCtrl->g, m_pColourCtrl->b);
|
||||
if ( (0.0f == nValue) || (0.0f == curMax) )
|
||||
{
|
||||
m_pColourCtrl->r = m_pColourCtrl->g = m_pColourCtrl->b = m_pColourCtrl->i = nValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
F32 nDelta = (nValue - curMax) / curMax;
|
||||
m_pColourCtrl->r *= (1.0f + nDelta);
|
||||
m_pColourCtrl->g *= (1.0f + nDelta);
|
||||
m_pColourCtrl->b *= (1.0f + nDelta);
|
||||
m_pColourCtrl->i = nValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // (See: LLFloaterWindLight::onColorControlRMoved)
|
||||
{
|
||||
F32* pnValue = (COMPONENT_R == eComponent) ? &m_pColourCtrl->r : (COMPONENT_G == eComponent) ? &m_pColourCtrl->g : (COMPONENT_B == eComponent) ? &m_pColourCtrl->b : NULL;
|
||||
if (pnValue)
|
||||
*pnValue = nValue;
|
||||
if (m_pColourCtrl->hasSliderName)
|
||||
m_pColourCtrl->i = llmax(m_pColourCtrl->r, m_pColourCtrl->g, m_pColourCtrl->b);
|
||||
}
|
||||
m_pColourCtrl->update(LLWLParamManager::getInstance()->mCurParams);
|
||||
LLWLParamManager::getInstance()->propagateParameters();
|
||||
}
|
||||
return isColorType();
|
||||
}
|
||||
|
||||
// Checked: 2011-08-29 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
|
||||
F32 RlvWindLightControl::getFloat(bool& fError) const
|
||||
{
|
||||
return (!(fError = (TYPE_FLOAT != m_eType))) ? LLWLParamManager::getInstance()->mCurParams.getVector(m_pFloatCtrl->mName, fError).mV[0] * m_pFloatCtrl->mult : 0.0;
|
||||
}
|
||||
|
||||
// Checked: 2011-08-28 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
|
||||
bool RlvWindLightControl::setFloat(F32 nValue)
|
||||
{
|
||||
if (TYPE_FLOAT == m_eType)
|
||||
{
|
||||
m_pFloatCtrl->x = nValue / m_pFloatCtrl->mult;
|
||||
m_pFloatCtrl->update(LLWLParamManager::getInstance()->mCurParams);
|
||||
LLWLParamManager::getInstance()->propagateParameters();
|
||||
}
|
||||
return (TYPE_FLOAT == m_eType);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
class RlvWindLight : public LLSingleton<RlvWindLight>
|
||||
{
|
||||
friend class LLSingleton<RlvWindLight>;
|
||||
public:
|
||||
RlvWindLight::RlvWindLight();
|
||||
|
||||
std::string getValue(const std::string& strSetting, bool& fError);
|
||||
bool setValue(const std::string& strRlvName, const std::string& strValue);
|
||||
|
||||
protected:
|
||||
std::map<std::string, RlvWindLightControl> m_ControlLookupMap;
|
||||
};
|
||||
|
||||
// Checked: 2011-08-29 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
|
||||
RlvWindLight::RlvWindLight()
|
||||
{
|
||||
LLWLParamManager* pWLParamMgr = LLWLParamManager::getInstance();
|
||||
|
||||
// TYPE_FLOAT
|
||||
m_ControlLookupMap.insert(std::pair<std::string, RlvWindLightControl>("cloudcoverage", RlvWindLightControl(&pWLParamMgr->mCloudCoverage)));
|
||||
m_ControlLookupMap.insert(std::pair<std::string, RlvWindLightControl>("cloudscale", RlvWindLightControl(&pWLParamMgr->mCloudScale)));
|
||||
m_ControlLookupMap.insert(std::pair<std::string, RlvWindLightControl>("densitymultiplier", RlvWindLightControl(&pWLParamMgr->mDensityMult)));
|
||||
m_ControlLookupMap.insert(std::pair<std::string, RlvWindLightControl>("distancemultiplier", RlvWindLightControl(&pWLParamMgr->mDistanceMult)));
|
||||
m_ControlLookupMap.insert(std::pair<std::string, RlvWindLightControl>("maxaltitude", RlvWindLightControl(&pWLParamMgr->mMaxAlt)));
|
||||
m_ControlLookupMap.insert(std::pair<std::string, RlvWindLightControl>("scenegamma", RlvWindLightControl(&pWLParamMgr->mWLGamma)));
|
||||
// TYPE_COLOR_R
|
||||
m_ControlLookupMap.insert(std::pair<std::string, RlvWindLightControl>("hazedensity", RlvWindLightControl(&pWLParamMgr->mHazeDensity, true)));
|
||||
m_ControlLookupMap.insert(std::pair<std::string, RlvWindLightControl>("hazehorizon", RlvWindLightControl(&pWLParamMgr->mHazeHorizon, true)));
|
||||
// TYPE_COLOR
|
||||
m_ControlLookupMap.insert(std::pair<std::string, RlvWindLightControl>("ambient", RlvWindLightControl(&pWLParamMgr->mAmbient, false)));
|
||||
m_ControlLookupMap.insert(std::pair<std::string, RlvWindLightControl>("bluedensity", RlvWindLightControl(&pWLParamMgr->mBlueDensity, false)));
|
||||
m_ControlLookupMap.insert(std::pair<std::string, RlvWindLightControl>("bluehorizon", RlvWindLightControl(&pWLParamMgr->mBlueHorizon, false)));
|
||||
m_ControlLookupMap.insert(std::pair<std::string, RlvWindLightControl>("cloud", RlvWindLightControl(&pWLParamMgr->mCloudMain, false)));
|
||||
m_ControlLookupMap.insert(std::pair<std::string, RlvWindLightControl>("cloudcolor", RlvWindLightControl(&pWLParamMgr->mCloudColor, false)));
|
||||
m_ControlLookupMap.insert(std::pair<std::string, RlvWindLightControl>("clouddetail", RlvWindLightControl(&pWLParamMgr->mCloudDetail, false)));
|
||||
m_ControlLookupMap.insert(std::pair<std::string, RlvWindLightControl>("sunmooncolor", RlvWindLightControl(&pWLParamMgr->mSunlight, false)));
|
||||
}
|
||||
|
||||
// Checked: 2011-08-29 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
|
||||
std::string RlvWindLight::getValue(const std::string& strSetting, bool& fError)
|
||||
{
|
||||
LLWLParamManager* pWLParams = LLWLParamManager::getInstance();
|
||||
LLEnvManagerNew* pEnvMgr = LLEnvManagerNew::getInstance();
|
||||
|
||||
fError = false; // Assume we won't fail
|
||||
if ("preset" == strSetting)
|
||||
return (pEnvMgr->getUseFixedSky()) ? pEnvMgr->getSkyPresetName() : std::string();
|
||||
else if ("daycycle" == strSetting)
|
||||
return (pEnvMgr->getUseDayCycle()) ? pEnvMgr->getDayCycleName() : std::string();
|
||||
|
||||
F32 nValue = 0.0f;
|
||||
if ("daytime" == strSetting)
|
||||
{
|
||||
nValue = (pEnvMgr->getUseFixedSky()) ? pWLParams->mCurParams.getFloat("sun_angle", fError) / F_TWO_PI : -1.0f;
|
||||
}
|
||||
else if (("sunglowfocus" == strSetting) || ("sunglowsize" == strSetting))
|
||||
{
|
||||
pWLParams->mGlow = pWLParams->mCurParams.getVector(pWLParams->mGlow.mName, fError);
|
||||
RLV_ASSERT_DBG(!fError);
|
||||
|
||||
if ("sunglowfocus" == strSetting)
|
||||
nValue = -pWLParams->mGlow.b / 5.0f;
|
||||
else
|
||||
nValue = 2 - pWLParams->mGlow.r / 20.0f;
|
||||
}
|
||||
else if ("starbrightness" == strSetting) nValue = pWLParams->mCurParams.getStarBrightness();
|
||||
else if ("eastangle" == strSetting) nValue = pWLParams->mCurParams.getEastAngle() / F_TWO_PI;
|
||||
else if ("sunmoonposition" == strSetting) nValue = pWLParams->mCurParams.getSunAngle() / F_TWO_PI;
|
||||
else if ("cloudscrollx" == strSetting) nValue = pWLParams->mCurParams.getCloudScrollX() - 10.0f;
|
||||
else if ("cloudscrolly" == strSetting) nValue = pWLParams->mCurParams.getCloudScrollY() - 10.0f;
|
||||
else
|
||||
{
|
||||
std::map<std::string, RlvWindLightControl>::const_iterator itControl = m_ControlLookupMap.find(strSetting);
|
||||
if (m_ControlLookupMap.end() != itControl)
|
||||
{
|
||||
switch (itControl->second.getControlType())
|
||||
{
|
||||
case RlvWindLightControl::TYPE_FLOAT:
|
||||
nValue = itControl->second.getFloat(fError);
|
||||
break;
|
||||
case RlvWindLightControl::TYPE_COLOR_R:
|
||||
nValue = itControl->second.getColorComponent(RlvWindLightControl::COMPONENT_R, fError);
|
||||
break;
|
||||
default:
|
||||
fError = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Couldn't find the exact name, check for a color control name
|
||||
RlvWindLightControl::EColorComponent eComponent = RlvWindLightControl::getComponentFromCharacter(strSetting[strSetting.length() - 1]);
|
||||
if (RlvWindLightControl::COMPONENT_NONE != eComponent)
|
||||
itControl = m_ControlLookupMap.find(strSetting.substr(0, strSetting.length() - 1));
|
||||
if ( (m_ControlLookupMap.end() != itControl) && (itControl->second.isColorType()) )
|
||||
nValue = itControl->second.getColorComponent(eComponent, fError);
|
||||
else
|
||||
fError = true;
|
||||
}
|
||||
}
|
||||
return llformat("%f", nValue);
|
||||
}
|
||||
|
||||
// Checked: 2011-08-29 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
|
||||
bool RlvWindLight::setValue(const std::string& strRlvName, const std::string& strValue)
|
||||
{
|
||||
F32 nValue = 0.0f;
|
||||
// Sanity check - make sure strValue specifies a number for all settings except "preset" and "daycycle"
|
||||
if ( (RlvSettings::getNoSetEnv()) ||
|
||||
( (!LLStringUtil::convertToF32(strValue, nValue)) && (("preset" != strRlvName) || ("daycycle" != strRlvName)) ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
LLWLParamManager* pWLParams = LLWLParamManager::getInstance();
|
||||
LLEnvManagerNew* pEnvMgr = LLEnvManagerNew::getInstance();
|
||||
|
||||
if ("daytime" == strRlvName)
|
||||
{
|
||||
if (0.0f <= nValue)
|
||||
{
|
||||
pWLParams->mAnimator.deactivate();
|
||||
pWLParams->mAnimator.setDayTime(nValue);
|
||||
pWLParams->mAnimator.update(pWLParams->mCurParams);
|
||||
}
|
||||
else
|
||||
{
|
||||
pEnvMgr->useRegionSettings();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if ("preset" == strRlvName)
|
||||
{
|
||||
pEnvMgr->useSkyPreset(strValue);
|
||||
return true;
|
||||
}
|
||||
else if ("daycycle" == strRlvName)
|
||||
{
|
||||
pEnvMgr->useDayCycle(strValue, LLEnvKey::SCOPE_LOCAL);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool fError = false;
|
||||
pWLParams->mAnimator.deactivate();
|
||||
if (("sunglowfocus" == strRlvName) || ("sunglowsize" == strRlvName))
|
||||
{
|
||||
pWLParams->mGlow = pWLParams->mCurParams.getVector(pWLParams->mGlow.mName, fError);
|
||||
RLV_ASSERT_DBG(!fError);
|
||||
|
||||
if ("sunglowfocus" == strRlvName)
|
||||
pWLParams->mGlow.b = -nValue * 5;
|
||||
else
|
||||
pWLParams->mGlow.r = (2 - nValue) * 20;
|
||||
|
||||
pWLParams->mGlow.update(pWLParams->mCurParams);
|
||||
pWLParams->propagateParameters();
|
||||
return true;
|
||||
}
|
||||
else if ("starbrightness" == strRlvName)
|
||||
{
|
||||
pWLParams->mCurParams.setStarBrightness(nValue);
|
||||
return true;
|
||||
}
|
||||
else if (("eastangle" == strRlvName) || ("sunmoonposition" == strRlvName))
|
||||
{
|
||||
if ("eastangle" == strRlvName)
|
||||
pWLParams->mCurParams.setEastAngle(F_TWO_PI * nValue);
|
||||
else
|
||||
pWLParams->mCurParams.setSunAngle(F_TWO_PI * nValue);
|
||||
|
||||
// Set the sun vector
|
||||
pWLParams->mLightnorm.r = -sin(pWLParams->mCurParams.getEastAngle()) * cos(pWLParams->mCurParams.getSunAngle());
|
||||
pWLParams->mLightnorm.g = sin(pWLParams->mCurParams.getSunAngle());
|
||||
pWLParams->mLightnorm.b = cos(pWLParams->mCurParams.getEastAngle()) * cos(pWLParams->mCurParams.getSunAngle());
|
||||
pWLParams->mLightnorm.i = 1.f;
|
||||
|
||||
pWLParams->propagateParameters();
|
||||
return true;
|
||||
}
|
||||
else if ("cloudscrollx" == strRlvName)
|
||||
{
|
||||
pWLParams->mCurParams.setCloudScrollX(nValue + 10.0f);
|
||||
return true;
|
||||
}
|
||||
else if ("cloudscrolly" == strRlvName)
|
||||
{
|
||||
pWLParams->mCurParams.setCloudScrollY(nValue + 10.0f);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::map<std::string, RlvWindLightControl>::iterator itControl = m_ControlLookupMap.find(strRlvName);
|
||||
if (m_ControlLookupMap.end() != itControl)
|
||||
{
|
||||
switch (itControl->second.getControlType())
|
||||
{
|
||||
case RlvWindLightControl::TYPE_FLOAT:
|
||||
return itControl->second.setFloat(nValue);
|
||||
case RlvWindLightControl::TYPE_COLOR_R:
|
||||
return itControl->second.setColorComponent(RlvWindLightControl::COMPONENT_R, nValue);
|
||||
default:
|
||||
RLV_ASSERT(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Couldn't find the exact name, check for a color control name
|
||||
RlvWindLightControl::EColorComponent eComponent = RlvWindLightControl::getComponentFromCharacter(strRlvName[strRlvName.length() - 1]);
|
||||
if (RlvWindLightControl::COMPONENT_NONE != eComponent)
|
||||
itControl = m_ControlLookupMap.find(strRlvName.substr(0, strRlvName.length() - 1));
|
||||
if ( (m_ControlLookupMap.end() != itControl) && (itControl->second.isColorType()) )
|
||||
return itControl->second.setColorComponent(eComponent, nValue);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
std::map<std::string, S16> RlvExtGetSet::m_DbgAllowed;
|
||||
std::map<std::string, std::string> RlvExtGetSet::m_PseudoDebug;
|
||||
|
||||
|
|
@ -97,16 +442,17 @@ bool RlvExtGetSet::processCommand(const RlvCommand& rlvCmd, ERlvCmdRet& eRet)
|
|||
}
|
||||
else if ("env" == strBehaviour)
|
||||
{
|
||||
bool fError = false;
|
||||
if ( ("get" == strGetSet) && (RLV_TYPE_REPLY == rlvCmd.getParamType()) )
|
||||
{
|
||||
RlvUtil::sendChatReply(rlvCmd.getParam(), onGetEnv(strSetting));
|
||||
eRet = RLV_RET_SUCCESS;
|
||||
RlvUtil::sendChatReply(rlvCmd.getParam(), RlvWindLight::instance().getValue(strSetting, fError));
|
||||
eRet = (!fError) ? RLV_RET_SUCCESS : RLV_RET_FAILED_UNKNOWN;
|
||||
return true;
|
||||
}
|
||||
else if ( ("set" == strGetSet) && (RLV_TYPE_FORCE == rlvCmd.getParamType()) )
|
||||
{
|
||||
if (!gRlvHandler.hasBehaviourExcept(RLV_BHVR_SETENV, rlvCmd.getObjectID()))
|
||||
eRet = onSetEnv(strSetting, rlvCmd.getOption());
|
||||
eRet = (RlvWindLight::instance().setValue(strSetting, rlvCmd.getOption())) ? RLV_RET_SUCCESS : RLV_RET_FAILED_UNKNOWN;
|
||||
else
|
||||
eRet = RLV_RET_FAILED_LOCK;
|
||||
return true;
|
||||
|
|
@ -290,270 +636,4 @@ ERlvCmdRet RlvExtGetSet::onSetPseudoDebug(const std::string& strSetting, const s
|
|||
return eRet;
|
||||
}
|
||||
|
||||
// Checked: 2010-04-18 (RLVa-1.2.0e) | Modified: RLVa-1.2.0e
|
||||
std::string RlvExtGetSet::onGetEnv(std::string strSetting)
|
||||
{
|
||||
// LLWLParamManager* pWLParams = LLWLParamManager::instance(); bool fErr;
|
||||
// WLFloatControl* pFloat = NULL;
|
||||
// WLColorControl* pColour = NULL;
|
||||
//
|
||||
// F32 nValue = 0.0f;
|
||||
// if ("daytime" == strSetting)
|
||||
// {
|
||||
// nValue = (pWLParams->mAnimator.mIsRunning && pWLParams->mAnimator.mUseLindenTime) ? -1.0f : pWLParams->mAnimator.getDayTime();
|
||||
// }
|
||||
// else if ("preset" == strSetting)
|
||||
// {
|
||||
// return (pWLParams->mAnimator.mIsRunning && pWLParams->mAnimator.mUseLindenTime) ? std::string() : pWLParams->mCurParams.mName;
|
||||
// }
|
||||
// else if ( ("sunglowfocus" == strSetting) || ("sunglowsize" == strSetting) )
|
||||
// {
|
||||
// pWLParams->mGlow = pWLParams->mCurParams.getVector(pWLParams->mGlow.mName, fErr);
|
||||
// RLV_ASSERT_DBG(!fErr);
|
||||
//
|
||||
// if ("sunglowfocus" == strSetting)
|
||||
// nValue = -pWLParams->mGlow.b / 5.0f;
|
||||
// else
|
||||
// nValue = 2 - pWLParams->mGlow.r / 20.0f;
|
||||
// }
|
||||
// else if ("starbrightness" == strSetting) nValue = pWLParams->mCurParams.getStarBrightness();
|
||||
// else if ("eastangle" == strSetting) nValue = pWLParams->mCurParams.getEastAngle() / F_TWO_PI;
|
||||
// else if ("sunmoonposition" == strSetting) nValue = pWLParams->mCurParams.getSunAngle() / F_TWO_PI;
|
||||
// else if ("cloudscrollx" == strSetting) nValue = pWLParams->mCurParams.getCloudScrollX() - 10.0f;
|
||||
// else if ("cloudscrolly" == strSetting) nValue = pWLParams->mCurParams.getCloudScrollY() - 10.0f;
|
||||
// // Float controls
|
||||
// else if ("cloudcoverage" == strSetting) pFloat = &pWLParams->mCloudCoverage;
|
||||
// else if ("cloudscale" == strSetting) pFloat = &pWLParams->mCloudScale;
|
||||
// else if ("densitymultiplier" == strSetting) pFloat = &pWLParams->mDensityMult;
|
||||
// else if ("distancemultiplier" == strSetting) pFloat = &pWLParams->mDistanceMult;
|
||||
// else if ("maxaltitude" == strSetting) pFloat = &pWLParams->mMaxAlt;
|
||||
// else if ("scenegamma" == strSetting) pFloat = &pWLParams->mWLGamma;
|
||||
// // Colour controls
|
||||
// else if ("hazedensity" == strSetting) pColour = &pWLParams->mHazeDensity;
|
||||
// else if ("hazehorizon" == strSetting) pColour = &pWLParams->mHazeHorizon;
|
||||
// else
|
||||
// {
|
||||
// char ch = strSetting[strSetting.length() - 1];
|
||||
// // HACK-RLVa: not entirely proper (creates new synonyms)
|
||||
// if ('x' == ch) ch = 'r';
|
||||
// else if ('y' == ch) ch = 'g';
|
||||
// else if ('d' == ch) ch = 'b';
|
||||
//
|
||||
// if ( ('r' == ch) || ('g' == ch) || ('b' == ch) || ('i' == ch) )
|
||||
// {
|
||||
// strSetting.erase(strSetting.length() - 1, 1);
|
||||
//
|
||||
// if ("ambient" == strSetting) pColour = &pWLParams->mAmbient;
|
||||
// else if ("bluedensity" == strSetting) pColour = &pWLParams->mBlueDensity;
|
||||
// else if ("bluehorizon" == strSetting) pColour = &pWLParams->mBlueHorizon;
|
||||
// else if ("sunmooncolor" == strSetting) pColour = &pWLParams->mSunlight;
|
||||
// else if ("cloudcolor" == strSetting) pColour = &pWLParams->mCloudColor;
|
||||
// else if ("cloud" == strSetting) pColour = &pWLParams->mCloudMain;
|
||||
// else if ("clouddetail" == strSetting) pColour = &pWLParams->mCloudDetail;
|
||||
//
|
||||
// if (pColour)
|
||||
// {
|
||||
// *pColour = pWLParams->mCurParams.getVector(pColour->mName, fErr);
|
||||
// RLV_ASSERT_DBG(!fErr);
|
||||
//
|
||||
// if ('r' == ch) nValue = pColour->r;
|
||||
// else if ('g' == ch) nValue = pColour->g;
|
||||
// else if ('b' == ch) nValue = pColour->b;
|
||||
// else if (('i' == ch) && (pColour->hasSliderName)) nValue = llmax(pColour->r, pColour->g, pColour->b);
|
||||
//
|
||||
// if (pColour->isBlueHorizonOrDensity) nValue /= 2.0f;
|
||||
// else if (pColour->isSunOrAmbientColor) nValue /= 3.0f;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (pFloat)
|
||||
// {
|
||||
// *pFloat = pWLParams->mCurParams.getVector(pFloat->mName, fErr);
|
||||
// RLV_ASSERT_DBG(!fErr);
|
||||
// nValue = pFloat->x * pFloat->mult;;
|
||||
// }
|
||||
// else if (pColour)
|
||||
// {
|
||||
// *pColour = pWLParams->mCurParams.getVector(pColour->mName, fErr);
|
||||
// RLV_ASSERT_DBG(!fErr);
|
||||
// nValue = pColour->r;
|
||||
// }
|
||||
// return llformat("%f", nValue);
|
||||
return "";
|
||||
}
|
||||
|
||||
// Checked: 2010-04-18 (RLVa-1.2.0e) | Modified: RLVa-1.2.0e
|
||||
ERlvCmdRet RlvExtGetSet::onSetEnv(std::string strSetting, const std::string& strValue)
|
||||
{
|
||||
// LLWLParamManager* pWLParams = LLWLParamManager::instance(); bool fErr;
|
||||
// WLFloatControl* pFloat = NULL;
|
||||
// WLColorControl* pColour = NULL;
|
||||
//
|
||||
// F32 nValue = 0.0f;
|
||||
// // Sanity check - make sure strValue specifies a number for all settings except "preset"
|
||||
// if ( (RlvSettings::getNoSetEnv()) || ( (!LLStringUtil::convertToF32(strValue, nValue)) && ("preset" != strSetting) ))
|
||||
// return RLV_RET_FAILED_OPTION;
|
||||
//
|
||||
// // Not quite correct, but RLV-1.16.0 will halt the default daytime cycle on invalid commands so we need to as well
|
||||
// pWLParams->mAnimator.mIsRunning = false;
|
||||
// pWLParams->mAnimator.mUseLindenTime = false;
|
||||
//
|
||||
// // See LLWorldEnvSettings::handleEvent()
|
||||
// if ("daytime" == strSetting)
|
||||
// {
|
||||
// if (0.0f <= nValue)
|
||||
// {
|
||||
// pWLParams->mAnimator.setDayTime(llmin(nValue, 1.0f));
|
||||
// pWLParams->mAnimator.update(pWLParams->mCurParams);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// pWLParams->mAnimator.mIsRunning = true;
|
||||
// pWLParams->mAnimator.mUseLindenTime = true;
|
||||
// }
|
||||
// return RLV_RET_SUCCESS;
|
||||
// }
|
||||
// // See LLFloaterWindLight::onChangePresetName()
|
||||
// else if ("preset" == strSetting)
|
||||
// {
|
||||
// pWLParams->loadPreset(strValue, true);
|
||||
// return RLV_RET_SUCCESS;
|
||||
// }
|
||||
// // See LLFloaterWindLight::onGlowRMoved() / LLFloaterWindLight::onGlowBMoved()
|
||||
// else if ( ("sunglowfocus" == strSetting) || ("sunglowsize" == strSetting) )
|
||||
// {
|
||||
// pWLParams->mGlow = pWLParams->mCurParams.getVector(pWLParams->mGlow.mName, fErr);
|
||||
// RLV_ASSERT_DBG(!fErr);
|
||||
//
|
||||
// if ("sunglowfocus" == strSetting)
|
||||
// pWLParams->mGlow.b = -nValue * 5;
|
||||
// else
|
||||
// pWLParams->mGlow.r = (2 - nValue) * 20;
|
||||
// pWLParams->mGlow.update(pWLParams->mCurParams);
|
||||
//
|
||||
// pWLParams->propagateParameters();
|
||||
// return RLV_RET_SUCCESS;
|
||||
// }
|
||||
// // See LLFloaterWindLight::onStarAlphaMoved
|
||||
// else if ("starbrightness" == strSetting)
|
||||
// {
|
||||
// pWLParams->mCurParams.setStarBrightness(nValue);
|
||||
// return RLV_RET_SUCCESS;
|
||||
// }
|
||||
// // See LLFloaterWindLight::onSunMoved()
|
||||
// else if ( ("eastangle" == strSetting) || ("sunmoonposition" == strSetting) )
|
||||
// {
|
||||
// if ("eastangle" == strSetting)
|
||||
// pWLParams->mCurParams.setEastAngle(F_TWO_PI * nValue);
|
||||
// else
|
||||
// pWLParams->mCurParams.setSunAngle(F_TWO_PI * nValue);
|
||||
//
|
||||
// pWLParams->propagateParameters();
|
||||
// return RLV_RET_SUCCESS;
|
||||
// }
|
||||
// // See LLFloaterWindLight::onCloudScrollXMoved() / LLFloaterWindLight::onCloudScrollYMoved()
|
||||
// else if ("cloudscrollx" == strSetting)
|
||||
// {
|
||||
// pWLParams->mCurParams.setCloudScrollX(nValue + 10.0f);
|
||||
// return RLV_RET_SUCCESS;
|
||||
// }
|
||||
// else if ("cloudscrolly" == strSetting)
|
||||
// {
|
||||
// pWLParams->mCurParams.setCloudScrollY(nValue + 10.0f);
|
||||
// return RLV_RET_SUCCESS;
|
||||
// }
|
||||
// // See LLFloaterWindLight::onFloatControlMoved()
|
||||
// else if ("cloudcoverage" == strSetting) pFloat = &pWLParams->mCloudCoverage;
|
||||
// else if ("cloudscale" == strSetting) pFloat = &pWLParams->mCloudScale;
|
||||
// else if ("densitymultiplier" == strSetting) pFloat = &pWLParams->mDensityMult;
|
||||
// else if ("distancemultiplier" == strSetting) pFloat = &pWLParams->mDistanceMult;
|
||||
// else if ("maxaltitude" == strSetting) pFloat = &pWLParams->mMaxAlt;
|
||||
// else if ("scenegamma" == strSetting) pFloat = &pWLParams->mWLGamma;
|
||||
// // See LLFloaterWindLight::onColorControlRMoved()
|
||||
// else if ("hazedensity" == strSetting) pColour = &pWLParams->mHazeDensity;
|
||||
// else if ("hazehorizon" == strSetting) pColour = &pWLParams->mHazeHorizon;
|
||||
//
|
||||
// if (pFloat)
|
||||
// {
|
||||
// *pFloat = pWLParams->mCurParams.getVector(pFloat->mName, fErr);
|
||||
// RLV_ASSERT_DBG(!fErr);
|
||||
//
|
||||
// pFloat->x = nValue / pFloat->mult;
|
||||
// pFloat->update(pWLParams->mCurParams);
|
||||
// pWLParams->propagateParameters();
|
||||
// return RLV_RET_SUCCESS;
|
||||
// }
|
||||
// else if (pColour)
|
||||
// {
|
||||
// *pColour = pWLParams->mCurParams.getVector(pColour->mName, fErr);
|
||||
// RLV_ASSERT_DBG(!fErr);
|
||||
//
|
||||
// pColour->r = nValue;
|
||||
// pColour->update(pWLParams->mCurParams);
|
||||
// pWLParams->propagateParameters();
|
||||
// return RLV_RET_SUCCESS;
|
||||
// }
|
||||
//
|
||||
// // RGBI settings
|
||||
// char ch = strSetting[strSetting.length() - 1];
|
||||
// if ('x' == ch) ch = 'r';
|
||||
// else if ('y' == ch) ch = 'g';
|
||||
// else if ('d' == ch) ch = 'b';
|
||||
//
|
||||
// if ( ('r' == ch) || ('g' == ch) || ('b' == ch) || ('i' == ch) )
|
||||
// {
|
||||
// strSetting.erase(strSetting.length() - 1, 1);
|
||||
//
|
||||
// if ("ambient" == strSetting) pColour = &pWLParams->mAmbient;
|
||||
// else if ("bluedensity" == strSetting) pColour = &pWLParams->mBlueDensity;
|
||||
// else if ("bluehorizon" == strSetting) pColour = &pWLParams->mBlueHorizon;
|
||||
// else if ("sunmooncolor" == strSetting) pColour = &pWLParams->mSunlight;
|
||||
// else if ("cloudcolor" == strSetting) pColour = &pWLParams->mCloudColor;
|
||||
// else if ("cloud" == strSetting) pColour = &pWLParams->mCloudMain;
|
||||
// else if ("clouddetail" == strSetting) pColour = &pWLParams->mCloudDetail;
|
||||
//
|
||||
// if (pColour)
|
||||
// {
|
||||
// *pColour = pWLParams->mCurParams.getVector(pColour->mName, fErr);
|
||||
// RLV_ASSERT_DBG(!fErr);
|
||||
//
|
||||
// if (pColour->isBlueHorizonOrDensity) nValue *= 2.0f;
|
||||
// else if (pColour->isSunOrAmbientColor) nValue *= 3.0f;
|
||||
//
|
||||
// if ('i' == ch) // (See: LLFloaterWindLight::onColorControlIMoved)
|
||||
// {
|
||||
// if (!pColour->hasSliderName)
|
||||
// return RLV_RET_FAILED_UNKNOWN;
|
||||
//
|
||||
// F32 curMax = llmax(pColour->r, pColour->g, pColour->b);
|
||||
// if ( (0.0f == nValue) || (0.0f == curMax) )
|
||||
// pColour->r = pColour->g = pColour->b = pColour->i = nValue;
|
||||
// else
|
||||
// {
|
||||
// F32 nDelta = (nValue - curMax) / curMax;
|
||||
// pColour->r *= (1.0f + nDelta);
|
||||
// pColour->g *= (1.0f + nDelta);
|
||||
// pColour->b *= (1.0f + nDelta);
|
||||
// pColour->i = nValue;
|
||||
// }
|
||||
// }
|
||||
// else // (See: LLFloaterWindLight::onColorControlRMoved)
|
||||
// {
|
||||
// F32* pnValue = ('r' == ch) ? &pColour->r : ('g' == ch) ? &pColour->g : ('b' == ch) ? &pColour->b : NULL;
|
||||
// if (pnValue)
|
||||
// *pnValue = nValue;
|
||||
// pColour->i = llmax(pColour->r, pColour->g, pColour->b);
|
||||
// }
|
||||
//
|
||||
// pColour->update(pWLParams->mCurParams);
|
||||
// pWLParams->propagateParameters();
|
||||
//
|
||||
// return RLV_RET_SUCCESS;
|
||||
// }
|
||||
// }
|
||||
// return RLV_RET_FAILED_UNKNOWN;
|
||||
return RLV_RET_FAILED_UNKNOWN;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
|
|
|||
|
|
@ -41,9 +41,6 @@ protected:
|
|||
ERlvCmdRet onSetDebug(std::string strSetting, const std::string& strValue);
|
||||
ERlvCmdRet onSetPseudoDebug(const std::string& strSetting, const std::string& strValue);
|
||||
|
||||
std::string onGetEnv(std::string strSetting);
|
||||
ERlvCmdRet onSetEnv(std::string strSetting, const std::string& strValue);
|
||||
|
||||
bool processCommand(const RlvCommand& rlvCmd, ERlvCmdRet& eRet);
|
||||
|
||||
public:
|
||||
|
|
|
|||
Loading…
Reference in New Issue