void LLFloaterWindLight::onColorControlBMoved(LLUICtrl* ctrl, void* userData) { deactivateAnimator(); LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); WLColorControl * colorControl = static_cast<WLColorControl *>(userData); colorControl->b = sldrCtrl->getValueF32(); if(colorControl->isSunOrAmbientColor) { colorControl->b *= 3; } if(colorControl->isBlueHorizonOrDensity) { colorControl->b *= 2; } // move i if it's the max if(colorControl->b >= colorControl->r && colorControl->b >= colorControl->g && colorControl->hasSliderName) { colorControl->i = colorControl->b; std::string name = colorControl->mSliderName; name.append("I"); if(colorControl->isSunOrAmbientColor) { sWindLight->childSetValue(name, colorControl->b / 3); } else if(colorControl->isBlueHorizonOrDensity) { sWindLight->childSetValue(name, colorControl->b / 2); } else { sWindLight->childSetValue(name, colorControl->b); } } colorControl->update(LLWLParamManager::instance()->mCurParams); LLWLParamManager::instance()->propagateParameters(); }
// time of day void LLFloaterWindLight::onSunMoved(LLUICtrl* ctrl, void* userData) { deactivateAnimator(); LLSliderCtrl* sunSldr = sWindLight->getChild<LLSliderCtrl>("WLSunAngle"); LLSliderCtrl* eastSldr = sWindLight->getChild<LLSliderCtrl>("WLEastAngle"); WLColorControl * colorControl = static_cast<WLColorControl *>(userData); // get the two angles LLWLParamManager * param_mgr = LLWLParamManager::instance(); param_mgr->mCurParams.setSunAngle(F_TWO_PI * sunSldr->getValueF32()); param_mgr->mCurParams.setEastAngle(F_TWO_PI * eastSldr->getValueF32()); // set the sun vector colorControl->r = -sin(param_mgr->mCurParams.getEastAngle()) * cos(param_mgr->mCurParams.getSunAngle()); colorControl->g = sin(param_mgr->mCurParams.getSunAngle()); colorControl->b = cos(param_mgr->mCurParams.getEastAngle()) * cos(param_mgr->mCurParams.getSunAngle()); colorControl->i = 1.f; colorControl->update(param_mgr->mCurParams); param_mgr->propagateParameters(); }
void FloaterQuickPrefs::onClickSkyNext() { LLWLParamManager& mgr = LLWLParamManager::instance(); std::map<LLWLParamKey, LLWLParamSet> param_list = mgr.getParamList(); // find place of current param std::map<LLWLParamKey, LLWLParamSet>::iterator mIt; mIt = param_list.find(LLWLParamKey(mgr.mCurParams.mName, LLEnvKey::SCOPE_LOCAL)); // shouldn't happen unless you delete every preset but Default if (mIt == param_list.end()) { llwarns << "No more presets left!" << llendl; return; } // if at the end, loop std::map<LLWLParamKey, LLWLParamSet>::iterator last = param_list.end(); last--; if (mIt == last) { mIt = param_list.begin(); } else { mIt++; } deactivateAnimator(); mWLPresetsCombo->setSimple(mIt->first.name); LLEnvManagerNew::instance().setUseSkyPreset(mIt->first.name, (bool)gSavedSettings.getBOOL("FSInterpolateSky")); mgr.getParamSet(mIt->first, mgr.mCurParams); }
void LLFloaterWindLight::onColorControlGMoved(LLUICtrl* ctrl, WLColorControl* colorControl) { deactivateAnimator(); LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); colorControl->g = sldrCtrl->getValueF32(); if(colorControl->isSunOrAmbientColor) { colorControl->g *= 3; } if(colorControl->isBlueHorizonOrDensity) { colorControl->g *= 2; } // move i if it's the max if(colorControl->g >= colorControl->r && colorControl->g >= colorControl->b && colorControl->hasSliderName) { colorControl->i = colorControl->g; std::string name = colorControl->mSliderName; name.append("I"); if(colorControl->isSunOrAmbientColor) { getChild<LLUICtrl>(name)->setValue(colorControl->g / 3); } else if(colorControl->isBlueHorizonOrDensity) { getChild<LLUICtrl>(name)->setValue(colorControl->g / 2); } else { getChild<LLUICtrl>(name)->setValue(colorControl->g); } } colorControl->update(LLWLParamManager::instance()->mCurParams); LLWLParamManager::instance()->propagateParameters(); }
void FloaterQuickPrefs::onClickWaterPrev() { LLWaterParamManager& mgr = LLWaterParamManager::instance(); LLWaterParamSet& currentParams = mgr.mCurParams; std::map<std::string, LLWaterParamSet> param_list = LLWaterParamManager::instance().getPresets(); // find place of current param std::map<std::string, LLWaterParamSet>::iterator mIt = param_list.find(currentParams.mName); // shouldn't happen unless you delete every preset but Default if (mIt == param_list.end()) { llwarns << "No more presets left!" << llendl; return; } // if at the beginning, loop if (mIt == param_list.begin()) { std::map<std::string, LLWaterParamSet>::iterator last = param_list.end(); last--; mIt = last; } else { mIt--; } deactivateAnimator(); mWaterPresetsCombo->setSimple(mIt->first); LLEnvManagerNew::instance().setUseWaterPreset(mIt->first, (bool)gSavedSettings.getBOOL("FSInterpolateWater")); mgr.getParamSet(mIt->first, mgr.mCurParams); }
void LLFloaterWindLight::onStarAlphaMoved(LLUICtrl* ctrl, void* userData) { deactivateAnimator(); LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); LLWLParamManager::instance()->mCurParams.setStarBrightness(sldrCtrl->getValueF32()); }
// Clouds void LLFloaterWindLight::onCloudScrollXMoved(LLUICtrl* ctrl, void* userData) { deactivateAnimator(); LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); // *HACK all cloud scrolling is off by an additive of 10. LLWLParamManager::instance()->mCurParams.setCloudScrollX(sldrCtrl->getValueF32() + 10.0f); }
void LLFloaterWindLight::onBoolToggle(LLUICtrl* ctrl, void* userData) { deactivateAnimator(); LLCheckBoxCtrl* cbCtrl = static_cast<LLCheckBoxCtrl*>(ctrl); bool value = cbCtrl->get(); (*(static_cast<BOOL *>(userData))) = value; }
void LLFloaterWindLight::onFloatTweakMoved(LLUICtrl* ctrl, void* userData) { deactivateAnimator(); LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); F32 * tweak = static_cast<F32 *>(userData); (*tweak) = sldrCtrl->getValueF32(); LLWLParamManager::instance()->propagateParameters(); }
void LLFloaterWindLight::onChangePresetName(LLUICtrl* ctrl) { deactivateAnimator(); std::string data = ctrl->getValue().asString(); if(!data.empty()) { LLWLParamManager::instance()->loadPreset( data); syncMenu(); } }
void LLFloaterWindLight::onFloatControlMoved(LLUICtrl* ctrl, WLFloatControl* floatControl) { deactivateAnimator(); LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); floatControl->x = sldrCtrl->getValueF32() / floatControl->mult; floatControl->update(LLWLParamManager::instance()->mCurParams); LLWLParamManager::instance()->propagateParameters(); }
void LLFloaterWindLight::onChangePresetName(LLUICtrl* ctrl) { deactivateAnimator(); std::string data = ctrl->getValue().asString(); if(!data.empty()) { LLWLParamManager::instance()->loadPreset( data); LL_INFOS("WindLight") << "Current inventory ID: " << LLWLParamManager::instance()->mCurParams.mInventoryID << LL_ENDL; syncMenu(); } }
/// GLOW SPECIFIC CODE void LLFloaterWindLight::onGlowRMoved(LLUICtrl* ctrl, WLColorControl* colorControl) { deactivateAnimator(); LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); // scaled by 20 colorControl->r = (2 - sldrCtrl->getValueF32()) * 20; colorControl->update(LLWLParamManager::instance()->mCurParams); LLWLParamManager::instance()->propagateParameters(); }
/// \NOTE that we want NEGATIVE (-) B void LLFloaterWindLight::onGlowBMoved(LLUICtrl* ctrl, WLColorControl* colorControl) { deactivateAnimator(); LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); /// \NOTE that we want NEGATIVE (-) B and NOT by 20 as 20 is too big colorControl->b = -sldrCtrl->getValueF32() * 5; colorControl->update(LLWLParamManager::instance()->mCurParams); LLWLParamManager::instance()->propagateParameters(); }
void LLFloaterWindLight::onChangePresetName(LLUICtrl* ctrl, void * userData) { deactivateAnimator(); LLComboBox * combo_box = static_cast<LLComboBox*>(ctrl); if(combo_box->getSimple() == "") { return; } LLWLParamManager::instance()->loadPreset( combo_box->getSelectedValue().asString()); sWindLight->syncMenu(); }
void LLFloaterWindLight::onCloudScrollYToggled(LLUICtrl* ctrl, void* userData) { deactivateAnimator(); LLCheckBoxCtrl* cbCtrl = static_cast<LLCheckBoxCtrl*>(ctrl); bool lock = cbCtrl->get(); LLWLParamManager::instance()->mCurParams.setEnableCloudScrollY(!lock); LLSliderCtrl* sldr = sWindLight->getChild<LLSliderCtrl>( "WLCloudScrollY"); if(cbCtrl->get()) { sldr->setEnabled(false); } else { sldr->setEnabled(true); } }
void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, void* userData) { deactivateAnimator(); LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); WLColorControl * colorControl = static_cast<WLColorControl *>(userData); colorControl->i = sldrCtrl->getValueF32(); // only for sliders where we pass a name if(colorControl->hasSliderName) { // set it to the top F32 maxVal = std::max(std::max(colorControl->r, colorControl->g), colorControl->b); F32 iVal; if(colorControl->isSunOrAmbientColor) { iVal = colorControl->i * 3; } else if(colorControl->isBlueHorizonOrDensity) { iVal = colorControl->i * 2; } else { iVal = colorControl->i; } // get the names of the other sliders std::string rName = colorControl->mSliderName; rName.append("R"); std::string gName = colorControl->mSliderName; gName.append("G"); std::string bName = colorControl->mSliderName; bName.append("B"); // handle if at 0 if(iVal == 0) { colorControl->r = 0; colorControl->g = 0; colorControl->b = 0; // if all at the start // set them all to the intensity } else if (maxVal == 0) { colorControl->r = iVal; colorControl->g = iVal; colorControl->b = iVal; } else { // add delta amounts to each F32 delta = (iVal - maxVal) / maxVal; colorControl->r *= (1.0f + delta); colorControl->g *= (1.0f + delta); colorControl->b *= (1.0f + delta); } // divide sun color vals by three if(colorControl->isSunOrAmbientColor) { sWindLight->childSetValue(rName, colorControl->r/3); sWindLight->childSetValue(gName, colorControl->g/3); sWindLight->childSetValue(bName, colorControl->b/3); } else if(colorControl->isBlueHorizonOrDensity) { sWindLight->childSetValue(rName, colorControl->r/2); sWindLight->childSetValue(gName, colorControl->g/2); sWindLight->childSetValue(bName, colorControl->b/2); } else { // set the sliders to the new vals sWindLight->childSetValue(rName, colorControl->r); sWindLight->childSetValue(gName, colorControl->g); sWindLight->childSetValue(bName, colorControl->b); } } // now update the current parameters and send them to shaders colorControl->update(LLWLParamManager::instance()->mCurParams); LLWLParamManager::instance()->propagateParameters(); }