本文整理汇总了C++中WLColorControl类的典型用法代码示例。如果您正苦于以下问题:C++ WLColorControl类的具体用法?C++ WLColorControl怎么用?C++ WLColorControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WLColorControl类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: if
// Checked: 2009-09-16 (RLVa-1.0.3c) | Modified: RLVa-1.0.3c
ERlvCmdRet RlvExtGetSet::onSetEnv(std::string strSetting, const std::string& strValue)
{
// HACK: see RlvExtGetSet::onGetEnv
if (!LLFloaterWindLight::isOpen())
{
LLFloaterWindLight::instance()->close();
LLFloaterWindLight::instance()->syncMenu();
}
LLWLParamManager* pWLParams = LLWLParamManager::instance();
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.deactivate();
//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.activate(LLWLAnimator::TIME_LINDEN);
}
return RLV_RET_SUCCESS;
}
// See LLFloaterWindLight::onChangePresetName()
else if ("preset" == strSetting)
{
// LLEnvManagerNew manages using presets now -KC
//pWLParams->loadPreset(strValue, true);
LLEnvManagerNew::instance().useSkyPreset(strValue);
return RLV_RET_SUCCESS;
}
// See LLFloaterWindLight::onStarAlphaMoved
else if ("starbrightness" == strSetting)
{
pWLParams->mCurParams.setStarBrightness(nValue);
return RLV_RET_SUCCESS;
}
// See LLFloaterWindLight::onGlowRMoved() / LLFloaterWindLight::onGlowBMoved()
else if ( ("sunglowfocus" == strSetting) || ("sunglowsize" == strSetting) )
{
WLColorControl *pColour = &pWLParams->mGlow;
if ("sunglowfocus" == strSetting)
pColour->b = -nValue * 5;
else
pColour->r = (2 - nValue) * 20;
pColour->update(pWLParams->mCurParams);
pWLParams->propagateParameters();
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);
// TODO-RLVa: it looks like propagateParameters() will actually take care of this for us, making this redundant?
WLColorControl* pColour = &pWLParams->mLightnorm;
pColour->r = -sin(pWLParams->mCurParams.getEastAngle()) * cos(pWLParams->mCurParams.getSunAngle());
pColour->g = sin(pWLParams->mCurParams.getSunAngle());
pColour->b = cos(pWLParams->mCurParams.getEastAngle()) * cos(pWLParams->mCurParams.getSunAngle());
pColour->i = 1.f;
pColour->update(pWLParams->mCurParams);
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;
//.........这里部分代码省略.........
开发者ID:VirtualReality,项目名称:Viewer,代码行数:101,代码来源:rlvextensions.cpp
示例2: setColorComponent
// 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();
}
开发者ID:Krazy-Bish-Margie,项目名称:SingularityViewer,代码行数:38,代码来源:rlvextensions.cpp
注:本文中的WLColorControl类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论