From d7dd10b88bc3fda88f6528ecc5936e4889f019f3 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 30 Nov 2017 11:32:22 -0800 Subject: Split for viewer/simhost sync LLSD with simhost. --- indra/llinventory/llsettingssky.cpp | 561 ++++++++++++++++++++++++++++++++++++ 1 file changed, 561 insertions(+) create mode 100644 indra/llinventory/llsettingssky.cpp (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp new file mode 100644 index 0000000000..ecc89165e8 --- /dev/null +++ b/indra/llinventory/llsettingssky.cpp @@ -0,0 +1,561 @@ +/** +* @file llsettingssky.cpp +* @author optional +* @brief A base class for asset based settings groups. +* +* $LicenseInfo:2011&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2017, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llsettingssky.h" +#include "indra_constants.h" +#include +#include "lltrace.h" +#include "llfasttimer.h" +#include "v3colorutil.h" + +//========================================================================= +namespace +{ + const LLVector3 DUE_EAST(0.0f, 0.0f, 1.0); + const LLVector3 VECT_ZENITH(0.f, 1.f, 0.f); + const LLVector3 VECT_NORTHSOUTH(1.f, 0.f, 0.f); + + LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment"); + LLTrace::BlockTimerStatHandle FTM_UPDATE_SKYVALUES("Update Sky Environment"); + + LLQuaternion body_position_from_angles(F32 azimuth, F32 altitude); + void angles_from_rotation(LLQuaternion quat, F32 &azimuth, F32 &altitude); +} + +const F32 LLSettingsSky::DOME_OFFSET(0.96f); +const F32 LLSettingsSky::DOME_RADIUS(15000.f); + +const F32 LLSettingsSky::NIGHTTIME_ELEVATION(-8.0f); // degrees +const F32 LLSettingsSky::NIGHTTIME_ELEVATION_COS((F32)sin(NIGHTTIME_ELEVATION*DEG_TO_RAD)); + +//========================================================================= +const std::string LLSettingsSky::SETTING_AMBIENT("ambient"); +const std::string LLSettingsSky::SETTING_BLOOM_TEXTUREID("bloom_id"); +const std::string LLSettingsSky::SETTING_BLUE_DENSITY("blue_density"); +const std::string LLSettingsSky::SETTING_BLUE_HORIZON("blue_horizon"); +const std::string LLSettingsSky::SETTING_CLOUD_COLOR("cloud_color"); +const std::string LLSettingsSky::SETTING_CLOUD_POS_DENSITY1("cloud_pos_density1"); +const std::string LLSettingsSky::SETTING_CLOUD_POS_DENSITY2("cloud_pos_density2"); +const std::string LLSettingsSky::SETTING_CLOUD_SCALE("cloud_scale"); +const std::string LLSettingsSky::SETTING_CLOUD_SCROLL_RATE("cloud_scroll_rate"); +const std::string LLSettingsSky::SETTING_CLOUD_SHADOW("cloud_shadow"); +const std::string LLSettingsSky::SETTING_CLOUD_TEXTUREID("cloud_id"); +const std::string LLSettingsSky::SETTING_DENSITY_MULTIPLIER("density_multiplier"); +const std::string LLSettingsSky::SETTING_DISTANCE_MULTIPLIER("distance_multiplier"); +const std::string LLSettingsSky::SETTING_DOME_OFFSET("dome_offset"); +const std::string LLSettingsSky::SETTING_DOME_RADIUS("dome_radius"); +const std::string LLSettingsSky::SETTING_GAMMA("gamma"); +const std::string LLSettingsSky::SETTING_GLOW("glow"); +const std::string LLSettingsSky::SETTING_HAZE_DENSITY("haze_density"); +const std::string LLSettingsSky::SETTING_HAZE_HORIZON("haze_horizon"); +const std::string LLSettingsSky::SETTING_LIGHT_NORMAL("lightnorm"); +const std::string LLSettingsSky::SETTING_MAX_Y("max_y"); +const std::string LLSettingsSky::SETTING_MOON_ROTATION("moon_rotation"); +const std::string LLSettingsSky::SETTING_MOON_TEXTUREID("moon_id"); +const std::string LLSettingsSky::SETTING_STAR_BRIGHTNESS("star_brightness"); +const std::string LLSettingsSky::SETTING_SUNLIGHT_COLOR("sunlight_color"); +const std::string LLSettingsSky::SETTING_SUN_ROTATION("sun_rotation"); +const std::string LLSettingsSky::SETTING_SUN_TEXUTUREID("sun_id"); + +const std::string LLSettingsSky::SETTING_LEGACY_EAST_ANGLE("east_angle"); +const std::string LLSettingsSky::SETTING_LEGACY_ENABLE_CLOUD_SCROLL("enable_cloud_scroll"); +const std::string LLSettingsSky::SETTING_LEGACY_SUN_ANGLE("sun_angle"); + +//========================================================================= +LLSettingsSky::LLSettingsSky(const LLSD &data) : + LLSettingsBase(data) +{ +} + +LLSettingsSky::LLSettingsSky(): + LLSettingsBase() +{ +} + +void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F32 blendf) +{ + LLSettingsSky::ptr_t other = boost::static_pointer_cast(end); + LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); + + replaceSettings(blenddata); +} + + +void LLSettingsSky::setMoonRotation(F32 azimuth, F32 altitude) +{ + setValue(SETTING_MOON_ROTATION, ::body_position_from_angles(azimuth, altitude)); +} + +LLSettingsSky::azimalt_t LLSettingsSky::getMoonRotationAzAl() const +{ + azimalt_t res; + ::angles_from_rotation(getMoonRotation(), res.first, res.second); + + return res; +} + +void LLSettingsSky::setSunRotation(F32 azimuth, F32 altitude) +{ + setValue(SETTING_SUN_ROTATION, ::body_position_from_angles(azimuth, altitude)); +} + +LLSettingsSky::azimalt_t LLSettingsSky::getSunRotationAzAl() const +{ + azimalt_t res; + ::angles_from_rotation(getSunRotation(), res.first, res.second); + + return res; +} + +LLSettingsSky::stringset_t LLSettingsSky::getSlerpKeys() const +{ + static stringset_t slepSet; + + if (slepSet.empty()) + { + slepSet.insert(SETTING_SUN_ROTATION); + slepSet.insert(SETTING_MOON_ROTATION); + } + + return slepSet; +} + +LLSettingsSky::validation_list_t LLSettingsSky::getValidationList() const +{ + static validation_list_t validation; + + if (validation.empty()) + { // Note the use of LLSD(LLSDArray()()()...) This is due to an issue with the + // copy constructor for LLSDArray. Directly binding the LLSDArray as + // a parameter without first wrapping it in a pure LLSD object will result + // in deeply nested arrays like this [[[[[[[[[[v1,v2,v3]]]]]]]]]] + + validation.push_back(Validator(SETTING_AMBIENT, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); + validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_BLUE_DENSITY, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); + validation.push_back(Validator(SETTING_BLUE_HORIZON, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); + validation.push_back(Validator(SETTING_CLOUD_COLOR, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(1.0f)(1.0f)(1.0f)("*"))))); + validation.push_back(Validator(SETTING_CLOUD_POS_DENSITY1, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(1.68841f)(1.0f)(1.0f)("*"))))); + validation.push_back(Validator(SETTING_CLOUD_POS_DENSITY2, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(1.68841f)(1.0f)(1.0f)("*"))))); + validation.push_back(Validator(SETTING_CLOUD_SCALE, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.001f)(0.999f))))); + validation.push_back(Validator(SETTING_CLOUD_SCROLL_RATE, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)), + LLSD(LLSDArray(20.0f)(20.0f))))); + validation.push_back(Validator(SETTING_CLOUD_SHADOW, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_CLOUD_TEXTUREID, false, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); + validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); + validation.push_back(Validator(SETTING_DOME_OFFSET, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_DOME_RADIUS, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(2000.0f))))); + validation.push_back(Validator(SETTING_GAMMA, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(10.0f))))); + validation.push_back(Validator(SETTING_GLOW, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.2f)("*")(-2.5f)("*")), + LLSD(LLSDArray(20.0f)("*")(0.0f)("*"))))); + validation.push_back(Validator(SETTING_HAZE_DENSITY, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); + validation.push_back(Validator(SETTING_HAZE_HORIZON, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_LIGHT_NORMAL, false, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorNormalized, _1, 3))); + validation.push_back(Validator(SETTING_MAX_Y, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4000.0f))))); + validation.push_back(Validator(SETTING_MOON_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); + validation.push_back(Validator(SETTING_MOON_TEXTUREID, false, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_STAR_BRIGHTNESS, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + validation.push_back(Validator(SETTING_SUNLIGHT_COLOR, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); + validation.push_back(Validator(SETTING_SUN_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); + validation.push_back(Validator(SETTING_SUN_TEXUTUREID, false, LLSD::TypeUUID)); + } + + return validation; +} + + +LLSD LLSettingsSky::defaults() +{ + LLSD dfltsetting; + + + LLQuaternion sunquat; + sunquat.setEulerAngles(1.39626, 0.0, 0.0); // 80deg Azumith/0deg East + LLQuaternion moonquat = ~sunquat; + + // Magic constants copied form dfltsetting.xml + dfltsetting[SETTING_AMBIENT] = LLColor4::white.getValue(); + dfltsetting[SETTING_BLUE_DENSITY] = LLColor4(0.2447, 0.4487, 0.7599, 0.0).getValue(); + dfltsetting[SETTING_BLUE_HORIZON] = LLColor4(0.4954, 0.4954, 0.6399, 0.0).getValue(); + dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); + dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); + dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); + dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199); + dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(10.1999)(10.0109); + dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699); + dfltsetting[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(0.0001); + dfltsetting[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(0.8000); + dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f); + dfltsetting[SETTING_DOME_RADIUS] = LLSD::Real(15000.f); + dfltsetting[SETTING_GAMMA] = LLSD::Real(1.0); + dfltsetting[SETTING_GLOW] = LLColor4(5.000, 0.0010, -0.4799, 1.0).getValue(); + dfltsetting[SETTING_HAZE_DENSITY] = LLSD::Real(0.6999); + dfltsetting[SETTING_HAZE_HORIZON] = LLSD::Real(0.1899); + dfltsetting[SETTING_LIGHT_NORMAL] = LLVector3(0.0000, 0.9126, -0.4086).getValue(); + dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); + dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); + dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(0.0000); + dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); + dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); + + dfltsetting[SETTING_BLOOM_TEXTUREID] = LLUUID::null; + dfltsetting[SETTING_CLOUD_TEXTUREID] = LLUUID::null; + dfltsetting[SETTING_MOON_TEXTUREID] = IMG_MOON; // gMoonTextureID; // These two are returned by the login... wow! + dfltsetting[SETTING_SUN_TEXUTUREID] = IMG_SUN; // gSunTextureID; + + return dfltsetting; +} + +LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) +{ + LLSD newsettings(defaults()); + + if (legacy.has(SETTING_AMBIENT)) + { + newsettings[SETTING_AMBIENT] = LLColor3(legacy[SETTING_AMBIENT]).getValue(); + } + if (legacy.has(SETTING_BLUE_DENSITY)) + { + newsettings[SETTING_BLUE_DENSITY] = LLColor3(legacy[SETTING_BLUE_DENSITY]).getValue(); + } + if (legacy.has(SETTING_BLUE_HORIZON)) + { + newsettings[SETTING_BLUE_HORIZON] = LLColor3(legacy[SETTING_BLUE_HORIZON]).getValue(); + } + if (legacy.has(SETTING_CLOUD_COLOR)) + { + newsettings[SETTING_CLOUD_COLOR] = LLColor3(legacy[SETTING_CLOUD_COLOR]).getValue(); + } + if (legacy.has(SETTING_CLOUD_POS_DENSITY1)) + { + newsettings[SETTING_CLOUD_POS_DENSITY1] = LLColor3(legacy[SETTING_CLOUD_POS_DENSITY1]).getValue(); + } + if (legacy.has(SETTING_CLOUD_POS_DENSITY2)) + { + newsettings[SETTING_CLOUD_POS_DENSITY2] = LLColor3(legacy[SETTING_CLOUD_POS_DENSITY2]).getValue(); + } + if (legacy.has(SETTING_CLOUD_SCALE)) + { + newsettings[SETTING_CLOUD_SCALE] = LLSD::Real(legacy[SETTING_CLOUD_SCALE][0].asReal()); + } + if (legacy.has(SETTING_CLOUD_SCROLL_RATE)) + { + LLVector2 cloud_scroll(legacy[SETTING_CLOUD_SCROLL_RATE]); + + if (legacy.has(SETTING_LEGACY_ENABLE_CLOUD_SCROLL)) + { + LLSD enabled = legacy[SETTING_LEGACY_ENABLE_CLOUD_SCROLL]; + if (!enabled[0].asBoolean()) + cloud_scroll.mV[0] = 0.0f; + if (!enabled[1].asBoolean()) + cloud_scroll.mV[1] = 0.0f; + } + + newsettings[SETTING_CLOUD_SCROLL_RATE] = cloud_scroll.getValue(); + } + if (legacy.has(SETTING_CLOUD_SHADOW)) + { + newsettings[SETTING_CLOUD_SHADOW] = LLSD::Real(legacy[SETTING_CLOUD_SHADOW][0].asReal()); + } + if (legacy.has(SETTING_DENSITY_MULTIPLIER)) + { + newsettings[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(legacy[SETTING_DENSITY_MULTIPLIER][0].asReal()); + } + if (legacy.has(SETTING_DISTANCE_MULTIPLIER)) + { + newsettings[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(legacy[SETTING_DISTANCE_MULTIPLIER][0].asReal()); + } + if (legacy.has(SETTING_GAMMA)) + { + newsettings[SETTING_GAMMA] = legacy[SETTING_GAMMA][0].asReal(); + } + if (legacy.has(SETTING_GLOW)) + { + newsettings[SETTING_GLOW] = LLColor3(legacy[SETTING_GLOW]).getValue(); + } + if (legacy.has(SETTING_HAZE_DENSITY)) + { + newsettings[SETTING_HAZE_DENSITY] = LLSD::Real(legacy[SETTING_HAZE_DENSITY][0].asReal()); + } + if (legacy.has(SETTING_HAZE_HORIZON)) + { + newsettings[SETTING_HAZE_HORIZON] = LLSD::Real(legacy[SETTING_HAZE_HORIZON][0].asReal()); + } + if (legacy.has(SETTING_LIGHT_NORMAL)) + { + newsettings[SETTING_LIGHT_NORMAL] = LLVector3(legacy[SETTING_LIGHT_NORMAL]).getValue(); + } + if (legacy.has(SETTING_MAX_Y)) + { + newsettings[SETTING_MAX_Y] = LLSD::Real(legacy[SETTING_MAX_Y][0].asReal()); + } + if (legacy.has(SETTING_STAR_BRIGHTNESS)) + { + newsettings[SETTING_STAR_BRIGHTNESS] = LLSD::Real(legacy[SETTING_STAR_BRIGHTNESS].asReal()); + } + if (legacy.has(SETTING_SUNLIGHT_COLOR)) + { + newsettings[SETTING_SUNLIGHT_COLOR] = LLColor4(legacy[SETTING_SUNLIGHT_COLOR]).getValue(); + } + + if (legacy.has(SETTING_LEGACY_EAST_ANGLE) && legacy.has(SETTING_LEGACY_SUN_ANGLE)) + { // convert the east and sun angles into a quaternion. + F32 azimuth = legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); + F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal(); + + LLQuaternion sunquat = ::body_position_from_angles(azimuth, altitude); + LLQuaternion moonquat = ::body_position_from_angles(azimuth + F_PI, -altitude); + + F32 az(0), al(0); + ::angles_from_rotation(sunquat, az, al); + + newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); + newsettings[SETTING_MOON_ROTATION] = moonquat.getValue(); + } + + return newsettings; +} + +void LLSettingsSky::updateSettings() +{ + LL_RECORD_BLOCK_TIME(FTM_UPDATE_SKYVALUES); + //LL_INFOS("WINDLIGHT", "SKY", "EEP") << "WL Parameters are dirty. Reticulating Splines..." << LL_ENDL; + + // base class clears dirty flag so as to not trigger recursive update + LLSettingsBase::updateSettings(); + + calculateHeavnlyBodyPositions(); + calculateLightSettings(); +} + +void LLSettingsSky::calculateHeavnlyBodyPositions() +{ + mSunDirection = DUE_EAST * getSunRotation(); + mSunDirection.normalize(); + mMoonDirection = DUE_EAST * getMoonRotation(); + mMoonDirection.normalize(); + + // is the normal from the sun or the moon + if (mSunDirection.mV[1] >= 0.0) + { + mLightDirection = mSunDirection; + } + else if (mSunDirection.mV[1] < 0.0 && mSunDirection.mV[1] > NIGHTTIME_ELEVATION_COS) + { + // clamp v1 to 0 so sun never points up and causes weirdness on some machines + LLVector3 vec(mSunDirection); + vec.mV[1] = 0.0; + vec.normalize(); + mLightDirection = vec; + } + else + { + mLightDirection = mMoonDirection; + } + + // calculate the clamp lightnorm for sky (to prevent ugly banding in sky + // when haze goes below the horizon + mClampedLightDirection = mLightDirection; + + if (mClampedLightDirection.mV[1] < -0.1f) + { + mClampedLightDirection.mV[1] = -0.1f; + mClampedLightDirection.normalize(); + } +} + +void LLSettingsSky::calculateLightSettings() +{ + LLColor3 vary_HazeColor; + LLColor3 vary_SunlightColor; + LLColor3 vary_AmbientColor; + { + // Initialize temp variables + LLColor3 sunlight = getSunlightColor(); + LLColor3 ambient = getAmbientColor(); + F32 gamma = getGamma(); + LLColor3 blue_density = getBlueDensity(); + LLColor3 blue_horizon = getBlueHorizon(); + F32 haze_density = getHazeDensity(); + F32 haze_horizon = getHazeHorizon(); + F32 density_multiplier = getDensityMultiplier(); + F32 max_y = getMaxY(); + F32 cloud_shadow = getCloudShadow(); + LLVector3 lightnorm = getLightDirection(); + + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes + LLColor3 light_atten = + (blue_density * 1.0 + smear(haze_density * 0.25f)) * (density_multiplier * max_y); + + // Calculate relative weights + LLColor3 temp2(0.f, 0.f, 0.f); + LLColor3 temp1 = blue_density + smear(haze_density); + LLColor3 blue_weight = componentDiv(blue_density, temp1); + LLColor3 haze_weight = componentDiv(smear(haze_density), temp1); + + // Compute sunlight from P & lightnorm (for long rays like sky) + /// USE only lightnorm. + // temp2[1] = llmax(0.f, llmax(0.f, Pn[1]) * 1.0f + lightnorm[1] ); + + // and vary_sunlight will work properly with moon light + F32 lighty = lightnorm[1]; + if (lighty < NIGHTTIME_ELEVATION_COS) + { + lighty = -lighty; + } + + temp2.mV[1] = llmax(0.f, lighty); + if(temp2.mV[1] > 0.f) + { + temp2.mV[1] = 1.f / temp2.mV[1]; + } + componentMultBy(sunlight, componentExp((light_atten * -1.f) * temp2.mV[1])); + + // Distance + temp2.mV[2] = density_multiplier; + + // Transparency (-> temp1) + temp1 = componentExp((temp1 * -1.f) * temp2.mV[2]); + + // vary_AtmosAttenuation = temp1; + + //increase ambient when there are more clouds + LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; + + //haze color + vary_HazeColor = + (blue_horizon * blue_weight * (sunlight*(1.f - cloud_shadow) + tmpAmbient) + + componentMult(haze_horizon * haze_weight, sunlight*(1.f - cloud_shadow) * temp2.mV[0] + tmpAmbient) + ); + + //brightness of surface both sunlight and ambient + vary_SunlightColor = componentMult(sunlight, temp1) * 1.f; + vary_SunlightColor.clamp(); + vary_SunlightColor = smear(1.0f) - vary_SunlightColor; + vary_SunlightColor = componentPow(vary_SunlightColor, gamma); + vary_SunlightColor = smear(1.0f) - vary_SunlightColor; + vary_AmbientColor = componentMult(tmpAmbient, temp1) * 0.5; + vary_AmbientColor.clamp(); + vary_AmbientColor = smear(1.0f) - vary_AmbientColor; + vary_AmbientColor = componentPow(vary_AmbientColor, gamma); + vary_AmbientColor = smear(1.0f) - vary_AmbientColor; + + componentMultBy(vary_HazeColor, LLColor3(1.f, 1.f, 1.f) - temp1); + + } + + mSunDiffuse = vary_SunlightColor; + mSunAmbient = vary_AmbientColor; + mMoonDiffuse = vary_SunlightColor; + mMoonAmbient = vary_AmbientColor; + + mTotalAmbient = LLColor4(vary_AmbientColor, 1.0f); + + mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; + mFadeColor.setAlpha(0); +} + + +//========================================================================= +namespace +{ + LLQuaternion body_position_from_angles(F32 azimuth, F32 altitude) + { + // Azimuth is traditionally calculated from North, we are going from East. + LLQuaternion rot_azi; + LLQuaternion rot_alt; + + rot_azi.setAngleAxis(azimuth, VECT_ZENITH); + rot_alt.setAngleAxis(-altitude, VECT_NORTHSOUTH); + + LLQuaternion body_quat = rot_alt * rot_azi; + body_quat.normalize(); + + //LLVector3 sun_vector = (DUE_EAST * body_quat); + //_WARNS("RIDER") << "Azimuth=" << azimuth << " Altitude=" << altitude << " Body Vector=" << sun_vector.getValue() << LL_ENDL; + return body_quat; + } + + void angles_from_rotation(LLQuaternion quat, F32 &azimuth, F32 &altitude) + { + LLVector3 body_vector = (DUE_EAST * quat); + + LLVector3 body_az(body_vector[0], 0.f, body_vector[2]); + LLVector3 body_al(0.f, body_vector[1], body_vector[2]); + + if (fabs(body_az.normalize()) > 0.001) + azimuth = angle_between(DUE_EAST, body_az); + else + azimuth = 0.0f; + + if (fabs(body_al.normalize()) > 0.001) + altitude = angle_between(DUE_EAST, body_al); + else + altitude = 0.0f; + } +} + + -- cgit v1.2.3 From 8211f57205f0008d8ffb9bfcd465ca26d906e19c Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 8 Jan 2018 15:10:25 -0800 Subject: MAINT-7699: Deliver new settings to viewer via cap --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index ecc89165e8..7fc9d83cae 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -96,7 +96,7 @@ LLSettingsSky::LLSettingsSky(): { } -void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F32 blendf) +void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { LLSettingsSky::ptr_t other = boost::static_pointer_cast(end); LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); -- cgit v1.2.3 From 1b8c2b5ebbe0d42f147730bc9b6528fa8c6796ce Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 23 Jan 2018 08:54:34 -0800 Subject: MAINT-8052: Initial support for new EEP cap --- indra/llinventory/llsettingssky.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 7fc9d83cae..14024cf4f7 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -145,6 +145,11 @@ LLSettingsSky::stringset_t LLSettingsSky::getSlerpKeys() const } LLSettingsSky::validation_list_t LLSettingsSky::getValidationList() const +{ + return LLSettingsSky::validationList(); +} + +LLSettingsSky::validation_list_t LLSettingsSky::validationList() { static validation_list_t validation; -- cgit v1.2.3 From 536aeb54a6130f3d1e20405c8f6cbd29201de26d Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 23 Jan 2018 17:34:25 -0800 Subject: MAINT-8052: One more step towards parcel environments. --- indra/llinventory/llsettingssky.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 14024cf4f7..c02d99fb67 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -270,6 +270,8 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_MOON_TEXTUREID] = IMG_MOON; // gMoonTextureID; // These two are returned by the login... wow! dfltsetting[SETTING_SUN_TEXUTUREID] = IMG_SUN; // gSunTextureID; + dfltsetting[SETTING_TYPE] = "sky"; + return dfltsetting; } -- cgit v1.2.3 From 0bf50e2f8cfa5f3ccd6165ce935cf0fd9c174ced Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 30 Jan 2018 16:42:34 -0800 Subject: Cleanup on daycyle selection and stack. Move blenders into environment. (Transition bronken, instant only. Shaddows moved based on region, not parcel) --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index c02d99fb67..32b292e384 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -265,7 +265,7 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); - dfltsetting[SETTING_BLOOM_TEXTUREID] = LLUUID::null; + 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_TEXUTUREID] = IMG_SUN; // gSunTextureID; -- cgit v1.2.3 From 7838189843ff3b9c800e458b2452943edbc202ea Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 6 Feb 2018 17:27:56 -0800 Subject: boost->std & same level interp --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 32b292e384..572b5703b3 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -98,7 +98,7 @@ LLSettingsSky::LLSettingsSky(): void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { - LLSettingsSky::ptr_t other = boost::static_pointer_cast(end); + LLSettingsSky::ptr_t other = std::static_pointer_cast(end); LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); -- cgit v1.2.3 From 6cc4a091b3ba4dd4842cc06e3b34af3d04dc5796 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Thu, 22 Feb 2018 00:35:24 +0000 Subject: Add settings/validations for new advanced atmo settings. --- indra/llinventory/llsettingssky.cpp | 287 +++++++++++++++++++++++++++++++++++- 1 file changed, 284 insertions(+), 3 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 572b5703b3..ff3f5224dd 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -79,12 +79,28 @@ const std::string LLSettingsSky::SETTING_MOON_TEXTUREID("moon_id"); const std::string LLSettingsSky::SETTING_STAR_BRIGHTNESS("star_brightness"); const std::string LLSettingsSky::SETTING_SUNLIGHT_COLOR("sunlight_color"); const std::string LLSettingsSky::SETTING_SUN_ROTATION("sun_rotation"); -const std::string LLSettingsSky::SETTING_SUN_TEXUTUREID("sun_id"); +const std::string LLSettingsSky::SETTING_SUN_TEXTUREID("sun_id"); const std::string LLSettingsSky::SETTING_LEGACY_EAST_ANGLE("east_angle"); const std::string LLSettingsSky::SETTING_LEGACY_ENABLE_CLOUD_SCROLL("enable_cloud_scroll"); const std::string LLSettingsSky::SETTING_LEGACY_SUN_ANGLE("sun_angle"); +// these are new settings for the advanced atmospherics model +const std::string LLSettingsSky::SETTING_PLANET_RADIUS("planet_radius"); +const std::string LLSettingsSky::SETTING_SKY_BOTTOM_RADIUS("sky_bottom_radius"); +const std::string LLSettingsSky::SETTING_SKY_TOP_RADIUS("sky_top_radius"); +const std::string LLSettingsSky::SETTING_RAYLEIGH_CONFIG("rayleigh"); +const std::string LLSettingsSky::SETTING_MIE_CONFIG("mie"); +const std::string LLSettingsSky::SETTING_ABSORPTION_CONFIG("absorption"); +const std::string LLSettingsSky::KEY_DENSITY_PROFILE("density"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH("width"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM("exp_term"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR("exp_scale"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM("linear_term"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM("constant_term"); +const std::string LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR("anisotropy"); +const std::string LLSettingsSky::SETTING_SUN_ARC_RADIANS("sun_arc_radians"); + //========================================================================= LLSettingsSky::LLSettingsSky(const LLSD &data) : LLSettingsBase(data) @@ -144,6 +160,78 @@ LLSettingsSky::stringset_t LLSettingsSky::getSlerpKeys() const return slepSet; } +LLSettingsSky::validation_list_t LLSettingsSky::rayleighValidationList() +{ + static validation_list_t rayleighValidation; + if (rayleighValidation.empty()) + { + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); + + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); + + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + } + return rayleighValidation; +} + +LLSettingsSky::validation_list_t LLSettingsSky::absorptionValidationList() +{ + static validation_list_t absorptionValidation; + if (absorptionValidation.empty()) + { + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); + + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); + + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + } + return absorptionValidation; +} + +LLSettingsSky::validation_list_t LLSettingsSky::mieValidationList() +{ + static validation_list_t mieValidation; + if (mieValidation.empty()) + { + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); + + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); + + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + + mieValidation.push_back(Validator(SETTING_MIE_ANISOTROPY_FACTOR, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + } + return mieValidation; +} + LLSettingsSky::validation_list_t LLSettingsSky::getValidationList() const { return LLSettingsSky::validationList(); @@ -224,7 +312,19 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); validation.push_back(Validator(SETTING_SUN_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); - validation.push_back(Validator(SETTING_SUN_TEXUTUREID, false, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_SUN_TEXTUREID, false, LLSD::TypeUUID)); + + validation.push_back(Validator(SETTING_PLANET_RADIUS, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(32768.0f))))); + + validation.push_back(Validator(SETTING_SKY_BOTTOM_RADIUS, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(32768.0f))))); + + validation.push_back(Validator(SETTING_SKY_TOP_RADIUS, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(32768.0f))))); + + validation.push_back(Validator(SETTING_SUN_ARC_RADIANS, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.1f))))); } return validation; @@ -268,13 +368,194 @@ LLSD LLSettingsSky::defaults() 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_TEXUTUREID] = IMG_SUN; // gSunTextureID; + dfltsetting[SETTING_SUN_TEXTUREID] = IMG_SUN; // gSunTextureID; dfltsetting[SETTING_TYPE] = "sky"; + // defaults are for earth... + dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; + dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; + + LLSD dflt_rayleigh; + dflt_rayleigh[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; + dflt_rayleigh[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_rayleigh[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + + dfltsetting[SETTING_RAYLEIGH_CONFIG] = dflt_rayleigh; + + LLSD dflt_mie; + dflt_mie[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_mie[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_mie[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f; + dflt_mie[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_mie[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + dflt_mie[SETTING_MIE_ANISOTROPY_FACTOR] = 0.9f; + + dfltsetting[SETTING_MIE_CONFIG] = dflt_mie; + + // absorption (ozone) has two linear ramping zones + LLSD dflt_absorption_a; + dflt_absorption_a[SETTING_DENSITY_PROFILE_WIDTH] = 25000.0f; // 0 -> the entire atmosphere + dflt_absorption_a[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; + dflt_absorption_a[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; + dflt_absorption_a[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 25000.0f; + dflt_absorption_a[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = -2.0f / 3.0f; + + LLSD dflt_absorption_b; + dflt_absorption_b[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> remainder of the atmosphere + dflt_absorption_b[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; + dflt_absorption_b[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; + dflt_absorption_b[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 15000.0f; + dflt_absorption_b[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 8.0f / 3.0f; + + LLSD wtf; + wtf.append(dflt_absorption_a); + wtf.append(dflt_absorption_b); + + dfltsetting[SETTING_ABSORPTION_CONFIG] = wtf; + return dfltsetting; } +#pragma optimize("", off) + +LLSD LLSettingsSky::settingValidation(LLSD &settingsIn, validation_list_t &validations) +{ + // Make a copy we can safely modify + LLSD settings = settingsIn; + + validation_list_t& rayleighValidations = rayleighValidationList(); + validation_list_t& absorptionValidations = absorptionValidationList(); + validation_list_t& mieValidations = mieValidationList(); + + bool isValid = true; + + LLSD& rayleighConfigs = settings[SETTING_RAYLEIGH_CONFIG]; + LLSD& mieConfigs = settings[SETTING_MIE_CONFIG]; + LLSD& absorptionConfigs = settings[SETTING_ABSORPTION_CONFIG]; + +// this is an attempt to handle a single defined layer (w/o array elem) +// but also handle an array of density profiles if they are specified thus. + if (rayleighConfigs.isArray()) + { + for (LLSD::array_iterator it = rayleighConfigs.beginArray(); it != rayleighConfigs.endArray(); ++it) + { + LLSD rayleighResults = LLSettingsBase::settingValidation(*it, rayleighValidations); + if (!rayleighResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + } + else + { + LLSD rayleighResults = LLSettingsBase::settingValidation(rayleighConfigs, rayleighValidations); + if (!rayleighResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + + if (mieConfigs.isArray()) + { + for (LLSD::array_iterator it = mieConfigs.beginArray(); it != mieConfigs.endArray(); ++it) + { + LLSD mieResults = LLSettingsBase::settingValidation(*it, mieValidations); + if (!mieResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + } + else + { + LLSD mieResults = LLSettingsBase::settingValidation(mieConfigs, mieValidations); + if (!mieResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + + if (absorptionConfigs.isArray()) + { + for (LLSD::array_iterator it = absorptionConfigs.beginArray(); it != absorptionConfigs.endArray(); ++it) + { + LLSD absorptionResults = LLSettingsBase::settingValidation(*it, absorptionValidations); + if (!absorptionResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + } + else + { + LLSD absorptionResults = LLSettingsBase::settingValidation(absorptionConfigs, absorptionValidations); + if (!absorptionResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + +#if 0 + LLSD& rayleigh = settings[SETTING_RAYLEIGH_CONFIG]; + LLSD& absorption = settings[SETTING_ABSORPTION_CONFIG]; + LLSD& mie = settings[SETTING_MIE_CONFIG]; + LLSD rayleighResults = LLSettingsBase::settingValidation(rayleigh, rayleighValidations); + LLSD absorptionResults = LLSettingsBase::settingValidation(absorption, absorptionValidations); + LLSD mieResults = LLSettingsBase::settingValidation(mie, mieValidations); + + if (!rayleighResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + + if (!absorptionResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + + if (!mieResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } +#endif + + settings.erase(SETTING_RAYLEIGH_CONFIG); + settings.erase(SETTING_ABSORPTION_CONFIG); + settings.erase(SETTING_MIE_CONFIG); + + if (isValid) + { + return LLSettingsBase::settingValidation(settings, validations); + } + + return LLSDMap("success", LLSD::Boolean(false)); +} + +#pragma optimize("", on) + LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { LLSD newsettings(defaults()); -- cgit v1.2.3 From 72270213f5eebd019b10bdd6ec15020ba3d2ecf5 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Wed, 28 Feb 2018 21:46:30 +0000 Subject: Add 3p package for adv atmospherics to autobuild. Mark legacy atmospherics code with ifdefs. Fix up legacy uplift to include new atmospherics settings. --- indra/llinventory/llsettingssky.cpp | 237 ++++++++++++++++++++++++------------ 1 file changed, 162 insertions(+), 75 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index ff3f5224dd..c2d92fdd38 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -54,9 +54,14 @@ const F32 LLSettingsSky::NIGHTTIME_ELEVATION_COS((F32)sin(NIGHTTIME_ELEVATION*DE //========================================================================= const std::string LLSettingsSky::SETTING_AMBIENT("ambient"); -const std::string LLSettingsSky::SETTING_BLOOM_TEXTUREID("bloom_id"); const std::string LLSettingsSky::SETTING_BLUE_DENSITY("blue_density"); const std::string LLSettingsSky::SETTING_BLUE_HORIZON("blue_horizon"); +const std::string LLSettingsSky::SETTING_DENSITY_MULTIPLIER("density_multiplier"); +const std::string LLSettingsSky::SETTING_DISTANCE_MULTIPLIER("distance_multiplier"); +const std::string LLSettingsSky::SETTING_HAZE_DENSITY("haze_density"); +const std::string LLSettingsSky::SETTING_HAZE_HORIZON("haze_horizon"); + +const std::string LLSettingsSky::SETTING_BLOOM_TEXTUREID("bloom_id"); const std::string LLSettingsSky::SETTING_CLOUD_COLOR("cloud_color"); const std::string LLSettingsSky::SETTING_CLOUD_POS_DENSITY1("cloud_pos_density1"); const std::string LLSettingsSky::SETTING_CLOUD_POS_DENSITY2("cloud_pos_density2"); @@ -64,14 +69,12 @@ const std::string LLSettingsSky::SETTING_CLOUD_SCALE("cloud_scale"); const std::string LLSettingsSky::SETTING_CLOUD_SCROLL_RATE("cloud_scroll_rate"); const std::string LLSettingsSky::SETTING_CLOUD_SHADOW("cloud_shadow"); const std::string LLSettingsSky::SETTING_CLOUD_TEXTUREID("cloud_id"); -const std::string LLSettingsSky::SETTING_DENSITY_MULTIPLIER("density_multiplier"); -const std::string LLSettingsSky::SETTING_DISTANCE_MULTIPLIER("distance_multiplier"); + const std::string LLSettingsSky::SETTING_DOME_OFFSET("dome_offset"); const std::string LLSettingsSky::SETTING_DOME_RADIUS("dome_radius"); const std::string LLSettingsSky::SETTING_GAMMA("gamma"); const std::string LLSettingsSky::SETTING_GLOW("glow"); -const std::string LLSettingsSky::SETTING_HAZE_DENSITY("haze_density"); -const std::string LLSettingsSky::SETTING_HAZE_HORIZON("haze_horizon"); + const std::string LLSettingsSky::SETTING_LIGHT_NORMAL("lightnorm"); const std::string LLSettingsSky::SETTING_MAX_Y("max_y"); const std::string LLSettingsSky::SETTING_MOON_ROTATION("moon_rotation"); @@ -246,12 +249,12 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() // copy constructor for LLSDArray. Directly binding the LLSDArray as // a parameter without first wrapping it in a pure LLSD object will result // in deeply nested arrays like this [[[[[[[[[[v1,v2,v3]]]]]]]]]] - + +#if SUPPORT_LEGACY_ATMOSPHERICS validation.push_back(Validator(SETTING_AMBIENT, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); - validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_BLUE_DENSITY, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), @@ -260,6 +263,18 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); + validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); + validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); + validation.push_back(Validator(SETTING_HAZE_DENSITY, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); + validation.push_back(Validator(SETTING_HAZE_HORIZON, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + +#endif + + validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_CLOUD_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), @@ -281,10 +296,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_CLOUD_SHADOW, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); validation.push_back(Validator(SETTING_CLOUD_TEXTUREID, false, LLSD::TypeUUID)); - validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); - validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); + validation.push_back(Validator(SETTING_DOME_OFFSET, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); validation.push_back(Validator(SETTING_DOME_RADIUS, false, LLSD::TypeReal, @@ -295,10 +307,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.2f)("*")(-2.5f)("*")), LLSD(LLSDArray(20.0f)("*")(0.0f)("*"))))); - validation.push_back(Validator(SETTING_HAZE_DENSITY, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); - validation.push_back(Validator(SETTING_HAZE_HORIZON, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_LIGHT_NORMAL, false, LLSD::TypeArray, boost::bind(&Validator::verifyVectorNormalized, _1, 3))); validation.push_back(Validator(SETTING_MAX_Y, true, LLSD::TypeReal, @@ -330,6 +339,51 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() return validation; } +LLSD LLSettingsSky::rayleighConfigDefault() +{ + LLSD dflt_rayleigh; + dflt_rayleigh[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; + dflt_rayleigh[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_rayleigh[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + return dflt_rayleigh; +} + +LLSD LLSettingsSky::absorptionConfigDefault() +{ +// absorption (ozone) has two linear ramping zones + LLSD dflt_absorption_layer_a; + dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_WIDTH] = 25000.0f; // 0 -> the entire atmosphere + dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; + dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; + dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 25000.0f; + dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = -2.0f / 3.0f; + + LLSD dflt_absorption_layer_b; + dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> remainder of the atmosphere + dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; + dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; + dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 15000.0f; + dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 8.0f / 3.0f; + + LLSD dflt_absorption; + dflt_absorption.append(dflt_absorption_layer_a); + dflt_absorption.append(dflt_absorption_layer_b); + return dflt_absorption; +} + +LLSD LLSettingsSky::mieConfigDefault() +{ + LLSD dflt_mie; + dflt_mie[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_mie[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_mie[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f; + dflt_mie[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_mie[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + dflt_mie[SETTING_MIE_ANISOTROPY_FACTOR] = 0.9f; + return dflt_mie; +} LLSD LLSettingsSky::defaults() { @@ -341,23 +395,28 @@ LLSD LLSettingsSky::defaults() LLQuaternion moonquat = ~sunquat; // Magic constants copied form dfltsetting.xml +#if SUPPORT_LEGACY_ATMOSPHERICS dfltsetting[SETTING_AMBIENT] = LLColor4::white.getValue(); dfltsetting[SETTING_BLUE_DENSITY] = LLColor4(0.2447, 0.4487, 0.7599, 0.0).getValue(); dfltsetting[SETTING_BLUE_HORIZON] = LLColor4(0.4954, 0.4954, 0.6399, 0.0).getValue(); + dfltsetting[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(0.0001); + dfltsetting[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(0.8000); + dfltsetting[SETTING_HAZE_DENSITY] = LLSD::Real(0.6999); + dfltsetting[SETTING_HAZE_HORIZON] = LLSD::Real(0.1899); +#endif + dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199); dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(10.1999)(10.0109); dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699); - dfltsetting[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(0.0001); - dfltsetting[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(0.8000); + dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f); dfltsetting[SETTING_DOME_RADIUS] = LLSD::Real(15000.f); dfltsetting[SETTING_GAMMA] = LLSD::Real(1.0); dfltsetting[SETTING_GLOW] = LLColor4(5.000, 0.0010, -0.4799, 1.0).getValue(); - dfltsetting[SETTING_HAZE_DENSITY] = LLSD::Real(0.6999); - dfltsetting[SETTING_HAZE_HORIZON] = LLSD::Real(0.1899); + dfltsetting[SETTING_LIGHT_NORMAL] = LLVector3(0.0000, 0.9126, -0.4086).getValue(); dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); @@ -377,46 +436,9 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; - - LLSD dflt_rayleigh; - dflt_rayleigh[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; - dflt_rayleigh[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_rayleigh[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; - - dfltsetting[SETTING_RAYLEIGH_CONFIG] = dflt_rayleigh; - - LLSD dflt_mie; - dflt_mie[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_mie[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_mie[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f; - dflt_mie[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_mie[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; - dflt_mie[SETTING_MIE_ANISOTROPY_FACTOR] = 0.9f; - - dfltsetting[SETTING_MIE_CONFIG] = dflt_mie; - - // absorption (ozone) has two linear ramping zones - LLSD dflt_absorption_a; - dflt_absorption_a[SETTING_DENSITY_PROFILE_WIDTH] = 25000.0f; // 0 -> the entire atmosphere - dflt_absorption_a[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; - dflt_absorption_a[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; - dflt_absorption_a[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 25000.0f; - dflt_absorption_a[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = -2.0f / 3.0f; - - LLSD dflt_absorption_b; - dflt_absorption_b[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> remainder of the atmosphere - dflt_absorption_b[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; - dflt_absorption_b[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; - dflt_absorption_b[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 15000.0f; - dflt_absorption_b[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 8.0f / 3.0f; - - LLSD wtf; - wtf.append(dflt_absorption_a); - wtf.append(dflt_absorption_b); - - dfltsetting[SETTING_ABSORPTION_CONFIG] = wtf; + dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); + dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); + dfltsetting[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); return dfltsetting; } @@ -560,6 +582,9 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { LLSD newsettings(defaults()); +// AdvancedAtmospherics TODO +// These need to be translated into density profile info in the new settings format... +#if SUPPORT_LEGACY_ATMOSPHERICS if (legacy.has(SETTING_AMBIENT)) { newsettings[SETTING_AMBIENT] = LLColor3(legacy[SETTING_AMBIENT]).getValue(); @@ -572,6 +597,39 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { newsettings[SETTING_BLUE_HORIZON] = LLColor3(legacy[SETTING_BLUE_HORIZON]).getValue(); } + if (legacy.has(SETTING_DENSITY_MULTIPLIER)) + { + newsettings[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(legacy[SETTING_DENSITY_MULTIPLIER][0].asReal()); + } + if (legacy.has(SETTING_DISTANCE_MULTIPLIER)) + { + newsettings[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(legacy[SETTING_DISTANCE_MULTIPLIER][0].asReal()); + } + if (legacy.has(SETTING_HAZE_DENSITY)) + { + newsettings[SETTING_HAZE_DENSITY] = LLSD::Real(legacy[SETTING_HAZE_DENSITY][0].asReal()); + } + if (legacy.has(SETTING_HAZE_HORIZON)) + { + newsettings[SETTING_HAZE_HORIZON] = LLSD::Real(legacy[SETTING_HAZE_HORIZON][0].asReal()); + } +#endif + + if (!legacy.has(SETTING_RAYLEIGH_CONFIG)) + { + newsettings[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); + } + + if (!legacy.has(SETTING_ABSORPTION_CONFIG)) + { + newsettings[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); + } + + if (!legacy.has(SETTING_MIE_CONFIG)) + { + newsettings[SETTING_MIE_CONFIG] = mieConfigDefault(); + } + if (legacy.has(SETTING_CLOUD_COLOR)) { newsettings[SETTING_CLOUD_COLOR] = LLColor3(legacy[SETTING_CLOUD_COLOR]).getValue(); @@ -607,14 +665,8 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { newsettings[SETTING_CLOUD_SHADOW] = LLSD::Real(legacy[SETTING_CLOUD_SHADOW][0].asReal()); } - if (legacy.has(SETTING_DENSITY_MULTIPLIER)) - { - newsettings[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(legacy[SETTING_DENSITY_MULTIPLIER][0].asReal()); - } - if (legacy.has(SETTING_DISTANCE_MULTIPLIER)) - { - newsettings[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(legacy[SETTING_DISTANCE_MULTIPLIER][0].asReal()); - } + + if (legacy.has(SETTING_GAMMA)) { newsettings[SETTING_GAMMA] = legacy[SETTING_GAMMA][0].asReal(); @@ -623,14 +675,7 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { newsettings[SETTING_GLOW] = LLColor3(legacy[SETTING_GLOW]).getValue(); } - if (legacy.has(SETTING_HAZE_DENSITY)) - { - newsettings[SETTING_HAZE_DENSITY] = LLSD::Real(legacy[SETTING_HAZE_DENSITY][0].asReal()); - } - if (legacy.has(SETTING_HAZE_HORIZON)) - { - newsettings[SETTING_HAZE_HORIZON] = LLSD::Real(legacy[SETTING_HAZE_HORIZON][0].asReal()); - } + if (legacy.has(SETTING_LIGHT_NORMAL)) { newsettings[SETTING_LIGHT_NORMAL] = LLVector3(legacy[SETTING_LIGHT_NORMAL]).getValue(); @@ -648,6 +693,44 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) newsettings[SETTING_SUNLIGHT_COLOR] = LLColor4(legacy[SETTING_SUNLIGHT_COLOR]).getValue(); } + if (legacy.has(SETTING_PLANET_RADIUS)) + { + newsettings[SETTING_PLANET_RADIUS] = LLSD::Real(legacy[SETTING_PLANET_RADIUS].asReal()); + } + else + { + newsettings[SETTING_PLANET_RADIUS] = 6360.0f; + } + + if (legacy.has(SETTING_SKY_BOTTOM_RADIUS)) + { + newsettings[SETTING_SKY_BOTTOM_RADIUS] = LLSD::Real(legacy[SETTING_SKY_BOTTOM_RADIUS].asReal()); + } + else + { + newsettings[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; + } + + if (legacy.has(SETTING_SKY_TOP_RADIUS)) + { + newsettings[SETTING_SKY_TOP_RADIUS] = LLSD::Real(legacy[SETTING_SKY_TOP_RADIUS].asReal()); + } + else + { + newsettings[SETTING_SKY_TOP_RADIUS] = 6420.0f; + } + + if (legacy.has(SETTING_SUN_ARC_RADIANS)) + { + newsettings[SETTING_SUN_ARC_RADIANS] = LLSD::Real(legacy[SETTING_SUN_ARC_RADIANS].asReal()); + } + else + { + newsettings[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; + } + + + if (legacy.has(SETTING_LEGACY_EAST_ANGLE) && legacy.has(SETTING_LEGACY_SUN_ANGLE)) { // convert the east and sun angles into a quaternion. F32 azimuth = legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); @@ -716,6 +799,8 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() void LLSettingsSky::calculateLightSettings() { + +#if SUPPORT_LEGACY_ATMOSPHERICS LLColor3 vary_HazeColor; LLColor3 vary_SunlightColor; LLColor3 vary_AmbientColor; @@ -804,6 +889,8 @@ void LLSettingsSky::calculateLightSettings() mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; mFadeColor.setAlpha(0); +#endif + } -- cgit v1.2.3 From 73caf6f52d672a6c11c00326b6befefd145dff1d Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Wed, 28 Feb 2018 22:34:43 +0000 Subject: Fix accidental dups/deletes from merge and remove optimize pragmas. --- indra/llinventory/llsettingssky.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index c2d92fdd38..f1124dce4b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -443,8 +443,6 @@ LLSD LLSettingsSky::defaults() return dfltsetting; } -#pragma optimize("", off) - LLSD LLSettingsSky::settingValidation(LLSD &settingsIn, validation_list_t &validations) { // Make a copy we can safely modify @@ -576,8 +574,6 @@ LLSD LLSettingsSky::settingValidation(LLSD &settingsIn, validation_list_t &valid return LLSDMap("success", LLSD::Boolean(false)); } -#pragma optimize("", on) - LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { LLSD newsettings(defaults()); -- cgit v1.2.3 From 7951001081209855178b73a0092cc18b1a192397 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Fri, 2 Mar 2018 00:58:04 +0000 Subject: Rework density profile validation, eliminate custom LLSettingsSky::settingsValidation in favor of custom validator functor for each profile type (rayleigh, mie, absorption). --- indra/llinventory/llsettingssky.cpp | 398 +++++++++++++++++------------------- 1 file changed, 186 insertions(+), 212 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index f1124dce4b..30de842e2e 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -92,17 +92,188 @@ const std::string LLSettingsSky::SETTING_LEGACY_SUN_ANGLE("sun_angle"); const std::string LLSettingsSky::SETTING_PLANET_RADIUS("planet_radius"); const std::string LLSettingsSky::SETTING_SKY_BOTTOM_RADIUS("sky_bottom_radius"); const std::string LLSettingsSky::SETTING_SKY_TOP_RADIUS("sky_top_radius"); -const std::string LLSettingsSky::SETTING_RAYLEIGH_CONFIG("rayleigh"); -const std::string LLSettingsSky::SETTING_MIE_CONFIG("mie"); -const std::string LLSettingsSky::SETTING_ABSORPTION_CONFIG("absorption"); +const std::string LLSettingsSky::SETTING_SUN_ARC_RADIANS("sun_arc_radians"); + +const std::string LLSettingsSky::SETTING_RAYLEIGH_CONFIG("rayleigh_config"); +const std::string LLSettingsSky::SETTING_MIE_CONFIG("mie_config"); +const std::string LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR("anisotropy"); +const std::string LLSettingsSky::SETTING_ABSORPTION_CONFIG("absorption_config"); + const std::string LLSettingsSky::KEY_DENSITY_PROFILE("density"); const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH("width"); const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM("exp_term"); const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR("exp_scale"); const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM("linear_term"); const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM("constant_term"); -const std::string LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR("anisotropy"); -const std::string LLSettingsSky::SETTING_SUN_ARC_RADIANS("sun_arc_radians"); + +namespace +{ + +LLSettingsSky::validation_list_t rayleighValidationList() +{ + static LLSettingsBase::validation_list_t rayleighValidation; + if (rayleighValidation.empty()) + { + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); + + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); + + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + } + return rayleighValidation; +} + +LLSettingsSky::validation_list_t absorptionValidationList() +{ + static LLSettingsBase::validation_list_t absorptionValidation; + if (absorptionValidation.empty()) + { + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); + + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); + + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + } + return absorptionValidation; +} + +LLSettingsSky::validation_list_t mieValidationList() +{ + static LLSettingsBase::validation_list_t mieValidation; + if (mieValidation.empty()) + { + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); + + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); + + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + } + return mieValidation; +} + +bool validateRayleighLayers(LLSD &value) +{ + LLSettingsSky::validation_list_t rayleighValidations = rayleighValidationList(); + if (value.isArray()) + { + bool allGood = true; + for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) + { + LLSD& layerConfig = (*itf); + if (!validateRayleighLayers(layerConfig)) + { + allGood = false; + } + } + return allGood; + } + llassert(value.type() == LLSD::Type::TypeMap); + LLSD result = LLSettingsBase::settingValidation(value, rayleighValidations); + if (result["errors"].size() > 0) + { + LL_WARNS("SETTINGS") << "Rayleigh Config Validation errors: " << result["errors"] << LL_ENDL; + return false; + } + if (result["warnings"].size() > 0) + { + LL_WARNS("SETTINGS") << "Rayleigh Config Validation warnings: " << result["errors"] << LL_ENDL; + return false; + } + return true; +} + +bool validateAbsorptionLayers(LLSD &value) +{ + LLSettingsBase::validation_list_t absorptionValidations = absorptionValidationList(); + if (value.isArray()) + { + bool allGood = true; + for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) + { + LLSD& layerConfig = (*itf); + if (!validateAbsorptionLayers(layerConfig)) + { + allGood = false; + } + } + return allGood; + } + llassert(value.type() == LLSD::Type::TypeMap); + LLSD result = LLSettingsBase::settingValidation(value, absorptionValidations); + if (result["errors"].size() > 0) + { + LL_WARNS("SETTINGS") << "Absorption Config Validation errors: " << result["errors"] << LL_ENDL; + return false; + } + if (result["warnings"].size() > 0) + { + LL_WARNS("SETTINGS") << "Absorption Config Validation warnings: " << result["errors"] << LL_ENDL; + return false; + } + return true; +} + +bool validateMieLayers(LLSD &value) +{ + LLSettingsBase::validation_list_t mieValidations = mieValidationList(); + if (value.isArray()) + { + bool allGood = true; + for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) + { + LLSD& layerConfig = (*itf); + if (!validateMieLayers(layerConfig)) + { + allGood = false; + } + } + return allGood; + } + LLSD result = LLSettingsBase::settingValidation(value, mieValidations); + if (result["errors"].size() > 0) + { + LL_WARNS("SETTINGS") << "Mie Config Validation errors: " << result["errors"] << LL_ENDL; + return false; + } + if (result["warnings"].size() > 0) + { + LL_WARNS("SETTINGS") << "Mie Config Validation warnings: " << result["errors"] << LL_ENDL; + return false; + } + return true; +} + +} //========================================================================= LLSettingsSky::LLSettingsSky(const LLSD &data) : @@ -163,77 +334,7 @@ LLSettingsSky::stringset_t LLSettingsSky::getSlerpKeys() const return slepSet; } -LLSettingsSky::validation_list_t LLSettingsSky::rayleighValidationList() -{ - static validation_list_t rayleighValidation; - if (rayleighValidation.empty()) - { - rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); - - rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - - rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); - - rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - - rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); - } - return rayleighValidation; -} - -LLSettingsSky::validation_list_t LLSettingsSky::absorptionValidationList() -{ - static validation_list_t absorptionValidation; - if (absorptionValidation.empty()) - { - absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); - - absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - - absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); - - absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - - absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); - } - return absorptionValidation; -} - -LLSettingsSky::validation_list_t LLSettingsSky::mieValidationList() -{ - static validation_list_t mieValidation; - if (mieValidation.empty()) - { - mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); - - mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - - mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); - mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - - mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); - - mieValidation.push_back(Validator(SETTING_MIE_ANISOTROPY_FACTOR, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); - } - return mieValidation; -} LLSettingsSky::validation_list_t LLSettingsSky::getValidationList() const { @@ -334,8 +435,11 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_SUN_ARC_RADIANS, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.1f))))); - } + validation.push_back(Validator(SETTING_RAYLEIGH_CONFIG, true, LLSD::TypeArray, &validateRayleighLayers)); + validation.push_back(Validator(SETTING_ABSORPTION_CONFIG, true, LLSD::TypeArray, &validateAbsorptionLayers)); + validation.push_back(Validator(SETTING_MIE_CONFIG, true, LLSD::TypeArray, &validateMieLayers)); + } return validation; } @@ -388,8 +492,6 @@ LLSD LLSettingsSky::mieConfigDefault() LLSD LLSettingsSky::defaults() { LLSD dfltsetting; - - LLQuaternion sunquat; sunquat.setEulerAngles(1.39626, 0.0, 0.0); // 80deg Azumith/0deg East LLQuaternion moonquat = ~sunquat; @@ -436,142 +538,14 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; - dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); - dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); - dfltsetting[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); - - return dfltsetting; -} - -LLSD LLSettingsSky::settingValidation(LLSD &settingsIn, validation_list_t &validations) -{ - // Make a copy we can safely modify - LLSD settings = settingsIn; - - validation_list_t& rayleighValidations = rayleighValidationList(); - validation_list_t& absorptionValidations = absorptionValidationList(); - validation_list_t& mieValidations = mieValidationList(); - - bool isValid = true; - - LLSD& rayleighConfigs = settings[SETTING_RAYLEIGH_CONFIG]; - LLSD& mieConfigs = settings[SETTING_MIE_CONFIG]; - LLSD& absorptionConfigs = settings[SETTING_ABSORPTION_CONFIG]; - -// this is an attempt to handle a single defined layer (w/o array elem) -// but also handle an array of density profiles if they are specified thus. - if (rayleighConfigs.isArray()) - { - for (LLSD::array_iterator it = rayleighConfigs.beginArray(); it != rayleighConfigs.endArray(); ++it) - { - LLSD rayleighResults = LLSettingsBase::settingValidation(*it, rayleighValidations); - if (!rayleighResults["success"].asBoolean()) - { - LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL; - LLSettingsSky::ptr_t(); - isValid = false; - } - } - } - else - { - LLSD rayleighResults = LLSettingsBase::settingValidation(rayleighConfigs, rayleighValidations); - if (!rayleighResults["success"].asBoolean()) - { - LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL; - LLSettingsSky::ptr_t(); - isValid = false; - } - } - if (mieConfigs.isArray()) - { - for (LLSD::array_iterator it = mieConfigs.beginArray(); it != mieConfigs.endArray(); ++it) - { - LLSD mieResults = LLSettingsBase::settingValidation(*it, mieValidations); - if (!mieResults["success"].asBoolean()) - { - LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL; - LLSettingsSky::ptr_t(); - isValid = false; - } - } - } - else - { - LLSD mieResults = LLSettingsBase::settingValidation(mieConfigs, mieValidations); - if (!mieResults["success"].asBoolean()) - { - LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL; - LLSettingsSky::ptr_t(); - isValid = false; - } - } + // These are technically capable of handling multiple layers of density config + // and so are expected to be an array, but we make an array of size 1 w/ each default density config + dfltsetting[SETTING_RAYLEIGH_CONFIG].append(rayleighConfigDefault()); + dfltsetting[SETTING_MIE_CONFIG].append(mieConfigDefault()); + dfltsetting[SETTING_ABSORPTION_CONFIG].append(absorptionConfigDefault()); - if (absorptionConfigs.isArray()) - { - for (LLSD::array_iterator it = absorptionConfigs.beginArray(); it != absorptionConfigs.endArray(); ++it) - { - LLSD absorptionResults = LLSettingsBase::settingValidation(*it, absorptionValidations); - if (!absorptionResults["success"].asBoolean()) - { - LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL; - LLSettingsSky::ptr_t(); - isValid = false; - } - } - } - else - { - LLSD absorptionResults = LLSettingsBase::settingValidation(absorptionConfigs, absorptionValidations); - if (!absorptionResults["success"].asBoolean()) - { - LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL; - LLSettingsSky::ptr_t(); - isValid = false; - } - } - -#if 0 - LLSD& rayleigh = settings[SETTING_RAYLEIGH_CONFIG]; - LLSD& absorption = settings[SETTING_ABSORPTION_CONFIG]; - LLSD& mie = settings[SETTING_MIE_CONFIG]; - LLSD rayleighResults = LLSettingsBase::settingValidation(rayleigh, rayleighValidations); - LLSD absorptionResults = LLSettingsBase::settingValidation(absorption, absorptionValidations); - LLSD mieResults = LLSettingsBase::settingValidation(mie, mieValidations); - - if (!rayleighResults["success"].asBoolean()) - { - LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL; - LLSettingsSky::ptr_t(); - isValid = false; - } - - if (!absorptionResults["success"].asBoolean()) - { - LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL; - LLSettingsSky::ptr_t(); - isValid = false; - } - - if (!mieResults["success"].asBoolean()) - { - LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL; - LLSettingsSky::ptr_t(); - isValid = false; - } -#endif - - settings.erase(SETTING_RAYLEIGH_CONFIG); - settings.erase(SETTING_ABSORPTION_CONFIG); - settings.erase(SETTING_MIE_CONFIG); - - if (isValid) - { - return LLSettingsBase::settingValidation(settings, validations); - } - - return LLSDMap("success", LLSD::Boolean(false)); + return dfltsetting; } LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) -- cgit v1.2.3 From acdead96cd194040f586c5a6e976beca7bb999c4 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Fri, 2 Mar 2018 23:29:28 +0000 Subject: Replace ifdefs with comments marking legacy atmo params. --- indra/llinventory/llsettingssky.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 30de842e2e..b8a45a8d89 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -351,7 +351,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() // a parameter without first wrapping it in a pure LLSD object will result // in deeply nested arrays like this [[[[[[[[[[v1,v2,v3]]]]]]]]]] -#if SUPPORT_LEGACY_ATMOSPHERICS +// LEGACY_ATMOSPHERICS validation.push_back(Validator(SETTING_AMBIENT, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), @@ -373,8 +373,6 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_HAZE_HORIZON, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); -#endif - validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_CLOUD_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, @@ -497,7 +495,7 @@ LLSD LLSettingsSky::defaults() LLQuaternion moonquat = ~sunquat; // Magic constants copied form dfltsetting.xml -#if SUPPORT_LEGACY_ATMOSPHERICS +// LEGACY_ATMOSPHERICS dfltsetting[SETTING_AMBIENT] = LLColor4::white.getValue(); dfltsetting[SETTING_BLUE_DENSITY] = LLColor4(0.2447, 0.4487, 0.7599, 0.0).getValue(); dfltsetting[SETTING_BLUE_HORIZON] = LLColor4(0.4954, 0.4954, 0.6399, 0.0).getValue(); @@ -505,7 +503,6 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(0.8000); dfltsetting[SETTING_HAZE_DENSITY] = LLSD::Real(0.6999); dfltsetting[SETTING_HAZE_HORIZON] = LLSD::Real(0.1899); -#endif dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); @@ -554,7 +551,7 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) // AdvancedAtmospherics TODO // These need to be translated into density profile info in the new settings format... -#if SUPPORT_LEGACY_ATMOSPHERICS +// LEGACY_ATMOSPHERICS if (legacy.has(SETTING_AMBIENT)) { newsettings[SETTING_AMBIENT] = LLColor3(legacy[SETTING_AMBIENT]).getValue(); @@ -583,7 +580,6 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { newsettings[SETTING_HAZE_HORIZON] = LLSD::Real(legacy[SETTING_HAZE_HORIZON][0].asReal()); } -#endif if (!legacy.has(SETTING_RAYLEIGH_CONFIG)) { @@ -770,7 +766,7 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() void LLSettingsSky::calculateLightSettings() { -#if SUPPORT_LEGACY_ATMOSPHERICS +// LEGACY_ATMOSPHERICS LLColor3 vary_HazeColor; LLColor3 vary_SunlightColor; LLColor3 vary_AmbientColor; @@ -859,8 +855,6 @@ void LLSettingsSky::calculateLightSettings() mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; mFadeColor.setAlpha(0); -#endif - } -- cgit v1.2.3 From 98862a53a77cd1ce9a2cae596a743669cc32a2af Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Sat, 3 Mar 2018 00:53:39 +0000 Subject: Fix 16F enum for compat w/ SL gl headers on Mac. Make density profile/layer parsing handle when LLSD heard you liked arrays so it put an array in your array. --- indra/llinventory/llsettingssky.cpp | 51 +++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 8 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index b8a45a8d89..91357a6e49 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,6 +32,8 @@ #include "llfasttimer.h" #include "v3colorutil.h" +#pragma optimize("", off) + //========================================================================= namespace { @@ -190,9 +192,20 @@ bool validateRayleighLayers(LLSD &value) for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) { LLSD& layerConfig = (*itf); - if (!validateRayleighLayers(layerConfig)) + if (layerConfig.type() == LLSD::Type::TypeMap) + { + if (!validateRayleighLayers(layerConfig)) + { + allGood = false; + } + } + else if (layerConfig.type() == LLSD::Type::TypeArray) { - allGood = false; + return validateRayleighLayers(layerConfig); + } + else + { + return LLSettingsBase::settingValidation(value, rayleighValidations); } } return allGood; @@ -221,9 +234,20 @@ bool validateAbsorptionLayers(LLSD &value) for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) { LLSD& layerConfig = (*itf); - if (!validateAbsorptionLayers(layerConfig)) + if (layerConfig.type() == LLSD::Type::TypeMap) + { + if (!validateAbsorptionLayers(layerConfig)) + { + allGood = false; + } + } + else if (layerConfig.type() == LLSD::Type::TypeArray) { - allGood = false; + return validateAbsorptionLayers(layerConfig); + } + else + { + return LLSettingsBase::settingValidation(value, absorptionValidations); } } return allGood; @@ -252,9 +276,20 @@ bool validateMieLayers(LLSD &value) for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) { LLSD& layerConfig = (*itf); - if (!validateMieLayers(layerConfig)) + if (layerConfig.type() == LLSD::Type::TypeMap) + { + if (!validateMieLayers(layerConfig)) + { + allGood = false; + } + } + else if (layerConfig.type() == LLSD::Type::TypeArray) { - allGood = false; + return validateMieLayers(layerConfig); + } + else + { + return LLSettingsBase::settingValidation(value, mieValidations); } } return allGood; @@ -779,6 +814,7 @@ void LLSettingsSky::calculateLightSettings() LLColor3 blue_horizon = getBlueHorizon(); F32 haze_density = getHazeDensity(); F32 haze_horizon = getHazeHorizon(); + F32 density_multiplier = getDensityMultiplier(); F32 max_y = getMaxY(); F32 cloud_shadow = getCloudShadow(); @@ -786,8 +822,7 @@ void LLSettingsSky::calculateLightSettings() // Sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes - LLColor3 light_atten = - (blue_density * 1.0 + smear(haze_density * 0.25f)) * (density_multiplier * max_y); + LLColor3 light_atten = (blue_density * 1.0 + smear(haze_density * 0.25f)) * (density_multiplier * max_y); // Calculate relative weights LLColor3 temp2(0.f, 0.f, 0.f); -- cgit v1.2.3 From 5517eb3f6f06226fba0ffe510334f519a8a7d7b7 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Sat, 3 Mar 2018 01:08:58 +0000 Subject: Remove MSVC pragmas breaking OSX build. --- indra/llinventory/llsettingssky.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 91357a6e49..5d38deb229 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,8 +32,6 @@ #include "llfasttimer.h" #include "v3colorutil.h" -#pragma optimize("", off) - //========================================================================= namespace { -- cgit v1.2.3 From 6e51714419a151dcc26e04319cc554187a905279 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Tue, 6 Mar 2018 20:16:49 +0000 Subject: Isolate atmospherics LLSD conversion code. Fix translateLegacySettings to add an array where an array is expected. --- indra/llinventory/llsettingssky.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 5d38deb229..cac363b510 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -616,17 +616,17 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) if (!legacy.has(SETTING_RAYLEIGH_CONFIG)) { - newsettings[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); + newsettings[SETTING_RAYLEIGH_CONFIG].append(rayleighConfigDefault()); } if (!legacy.has(SETTING_ABSORPTION_CONFIG)) { - newsettings[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); + newsettings[SETTING_ABSORPTION_CONFIG].append(absorptionConfigDefault()); } if (!legacy.has(SETTING_MIE_CONFIG)) { - newsettings[SETTING_MIE_CONFIG] = mieConfigDefault(); + newsettings[SETTING_MIE_CONFIG].append(mieConfigDefault()); } if (legacy.has(SETTING_CLOUD_COLOR)) @@ -728,8 +728,6 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) newsettings[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; } - - if (legacy.has(SETTING_LEGACY_EAST_ANGLE) && legacy.has(SETTING_LEGACY_SUN_ANGLE)) { // convert the east and sun angles into a quaternion. F32 azimuth = legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); -- cgit v1.2.3 From 62a0d579b5eb23ea306ade07afba76f7cba685c7 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Wed, 7 Mar 2018 18:37:09 +0000 Subject: Move legacy atmospherics code outside of llvosky (begin teasing apart). --- indra/llinventory/llsettingssky.cpp | 57 ++++++++----------------------------- 1 file changed, 12 insertions(+), 45 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index cac363b510..3366f1a20a 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -383,29 +383,27 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() // copy constructor for LLSDArray. Directly binding the LLSDArray as // a parameter without first wrapping it in a pure LLSD object will result // in deeply nested arrays like this [[[[[[[[[[v1,v2,v3]]]]]]]]]] - -// LEGACY_ATMOSPHERICS - validation.push_back(Validator(SETTING_AMBIENT, true, LLSD::TypeArray, - boost::bind(&Validator::verifyVectorMinMax, _1, - LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); - validation.push_back(Validator(SETTING_BLUE_DENSITY, true, LLSD::TypeArray, + validation.push_back(Validator(SETTING_BLUE_DENSITY, false, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); - validation.push_back(Validator(SETTING_BLUE_HORIZON, true, LLSD::TypeArray, + validation.push_back(Validator(SETTING_BLUE_HORIZON, false, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); - validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); - validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); - validation.push_back(Validator(SETTING_HAZE_DENSITY, true, LLSD::TypeReal, + validation.push_back(Validator(SETTING_HAZE_DENSITY, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); - validation.push_back(Validator(SETTING_HAZE_HORIZON, true, LLSD::TypeReal, + validation.push_back(Validator(SETTING_HAZE_HORIZON, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_AMBIENT, false, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); + validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); + validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_CLOUD_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, @@ -614,21 +612,6 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) newsettings[SETTING_HAZE_HORIZON] = LLSD::Real(legacy[SETTING_HAZE_HORIZON][0].asReal()); } - if (!legacy.has(SETTING_RAYLEIGH_CONFIG)) - { - newsettings[SETTING_RAYLEIGH_CONFIG].append(rayleighConfigDefault()); - } - - if (!legacy.has(SETTING_ABSORPTION_CONFIG)) - { - newsettings[SETTING_ABSORPTION_CONFIG].append(absorptionConfigDefault()); - } - - if (!legacy.has(SETTING_MIE_CONFIG)) - { - newsettings[SETTING_MIE_CONFIG].append(mieConfigDefault()); - } - if (legacy.has(SETTING_CLOUD_COLOR)) { newsettings[SETTING_CLOUD_COLOR] = LLColor3(legacy[SETTING_CLOUD_COLOR]).getValue(); @@ -696,37 +679,21 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { newsettings[SETTING_PLANET_RADIUS] = LLSD::Real(legacy[SETTING_PLANET_RADIUS].asReal()); } - else - { - newsettings[SETTING_PLANET_RADIUS] = 6360.0f; - } if (legacy.has(SETTING_SKY_BOTTOM_RADIUS)) { newsettings[SETTING_SKY_BOTTOM_RADIUS] = LLSD::Real(legacy[SETTING_SKY_BOTTOM_RADIUS].asReal()); } - else - { - newsettings[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; - } if (legacy.has(SETTING_SKY_TOP_RADIUS)) { newsettings[SETTING_SKY_TOP_RADIUS] = LLSD::Real(legacy[SETTING_SKY_TOP_RADIUS].asReal()); } - else - { - newsettings[SETTING_SKY_TOP_RADIUS] = 6420.0f; - } if (legacy.has(SETTING_SUN_ARC_RADIANS)) { newsettings[SETTING_SUN_ARC_RADIANS] = LLSD::Real(legacy[SETTING_SUN_ARC_RADIANS].asReal()); } - else - { - newsettings[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; - } if (legacy.has(SETTING_LEGACY_EAST_ANGLE) && legacy.has(SETTING_LEGACY_SUN_ANGLE)) { // convert the east and sun angles into a quaternion. -- cgit v1.2.3 From 0f33f0a6f356773ed69e4dcaffb7d589c9b47561 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Wed, 7 Mar 2018 18:46:40 +0000 Subject: Don't add old atmo params to new settings defaults. --- indra/llinventory/llsettingssky.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 3366f1a20a..972579b485 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -526,15 +526,6 @@ LLSD LLSettingsSky::defaults() LLQuaternion moonquat = ~sunquat; // Magic constants copied form dfltsetting.xml -// LEGACY_ATMOSPHERICS - dfltsetting[SETTING_AMBIENT] = LLColor4::white.getValue(); - dfltsetting[SETTING_BLUE_DENSITY] = LLColor4(0.2447, 0.4487, 0.7599, 0.0).getValue(); - dfltsetting[SETTING_BLUE_HORIZON] = LLColor4(0.4954, 0.4954, 0.6399, 0.0).getValue(); - dfltsetting[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(0.0001); - dfltsetting[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(0.8000); - dfltsetting[SETTING_HAZE_DENSITY] = LLSD::Real(0.6999); - dfltsetting[SETTING_HAZE_HORIZON] = LLSD::Real(0.1899); - dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); -- cgit v1.2.3 From 4235231b5adbb7f064cab732f761dd359ef4b648 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 7 Mar 2018 11:24:48 -0800 Subject: Fix for calculating azimuth and angle --- indra/llinventory/llsettingssky.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index cac363b510..7da3a336cc 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -917,12 +917,22 @@ namespace LLVector3 body_al(0.f, body_vector[1], body_vector[2]); if (fabs(body_az.normalize()) > 0.001) + { azimuth = angle_between(DUE_EAST, body_az); + if (body_az[1] < 0.0f) + azimuth = F_TWO_PI - azimuth; + } else azimuth = 0.0f; if (fabs(body_al.normalize()) > 0.001) + { altitude = angle_between(DUE_EAST, body_al); + if (body_al[2] < 0.0f) + { + altitude = F_TWO_PI - altitude; + } + } else altitude = 0.0f; } -- cgit v1.2.3 From 6d77503542216ece1eecf82dce19ebd8d6be7327 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Wed, 7 Mar 2018 23:49:37 +0000 Subject: Isolate more legacy atmo param use in sky (convert to getLightAttenuation and getLightTransmittance). Optimize sky texture creation. --- indra/llinventory/llsettingssky.cpp | 149 ++++++++++++++++-------------------- 1 file changed, 68 insertions(+), 81 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 972579b485..22f048bd0d 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -752,101 +752,88 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() } } -void LLSettingsSky::calculateLightSettings() +// Sunlight attenuation effect (hue and brightness) due to atmosphere +// this is used later for sunlight modulation at various altitudes +LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const { + LLColor3 blue_density = getBlueDensity(); + F32 haze_density = getHazeDensity(); + F32 density_multiplier = getDensityMultiplier(); + LLColor3 density = (blue_density * 1.0 + smear(haze_density * 0.25f)); + LLColor3 light_atten = density * density_multiplier * distance; + return light_atten; +} -// LEGACY_ATMOSPHERICS - LLColor3 vary_HazeColor; - LLColor3 vary_SunlightColor; - LLColor3 vary_AmbientColor; - { - // Initialize temp variables - LLColor3 sunlight = getSunlightColor(); - LLColor3 ambient = getAmbientColor(); - F32 gamma = getGamma(); - LLColor3 blue_density = getBlueDensity(); - LLColor3 blue_horizon = getBlueHorizon(); - F32 haze_density = getHazeDensity(); - F32 haze_horizon = getHazeHorizon(); - - F32 density_multiplier = getDensityMultiplier(); - F32 max_y = getMaxY(); - F32 cloud_shadow = getCloudShadow(); - LLVector3 lightnorm = getLightDirection(); - - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes - LLColor3 light_atten = (blue_density * 1.0 + smear(haze_density * 0.25f)) * (density_multiplier * max_y); - - // Calculate relative weights - LLColor3 temp2(0.f, 0.f, 0.f); - LLColor3 temp1 = blue_density + smear(haze_density); - LLColor3 blue_weight = componentDiv(blue_density, temp1); - LLColor3 haze_weight = componentDiv(smear(haze_density), temp1); - - // Compute sunlight from P & lightnorm (for long rays like sky) - /// USE only lightnorm. - // temp2[1] = llmax(0.f, llmax(0.f, Pn[1]) * 1.0f + lightnorm[1] ); - - // and vary_sunlight will work properly with moon light - F32 lighty = lightnorm[1]; - if (lighty < NIGHTTIME_ELEVATION_COS) - { - lighty = -lighty; - } - - temp2.mV[1] = llmax(0.f, lighty); - if(temp2.mV[1] > 0.f) - { - temp2.mV[1] = 1.f / temp2.mV[1]; - } - componentMultBy(sunlight, componentExp((light_atten * -1.f) * temp2.mV[1])); - - // Distance - temp2.mV[2] = density_multiplier; - - // Transparency (-> temp1) - temp1 = componentExp((temp1 * -1.f) * temp2.mV[2]); - - // vary_AtmosAttenuation = temp1; - - //increase ambient when there are more clouds - LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; +LLColor3 LLSettingsSky::getLightTransmittance() const +{ + LLColor3 blue_density = getBlueDensity(); + F32 haze_density = getHazeDensity(); + F32 density_multiplier = getDensityMultiplier(); + LLColor3 temp1 = blue_density + smear(haze_density); + // Transparency (-> temp1) + temp1 = componentExp((temp1 * -1.f) * density_multiplier); + return temp1; +} - //haze color - vary_HazeColor = - (blue_horizon * blue_weight * (sunlight*(1.f - cloud_shadow) + tmpAmbient) - + componentMult(haze_horizon * haze_weight, sunlight*(1.f - cloud_shadow) * temp2.mV[0] + tmpAmbient) - ); +LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const +{ + F32 gamma = getGamma(); + LLColor3 v(in); + v.clamp(); + v= smear(1.0f) - v; + v = componentPow(v, gamma); + v = smear(1.0f) - v; + return v; +} - //brightness of surface both sunlight and ambient - vary_SunlightColor = componentMult(sunlight, temp1) * 1.f; - vary_SunlightColor.clamp(); - vary_SunlightColor = smear(1.0f) - vary_SunlightColor; - vary_SunlightColor = componentPow(vary_SunlightColor, gamma); - vary_SunlightColor = smear(1.0f) - vary_SunlightColor; - vary_AmbientColor = componentMult(tmpAmbient, temp1) * 0.5; - vary_AmbientColor.clamp(); - vary_AmbientColor = smear(1.0f) - vary_AmbientColor; - vary_AmbientColor = componentPow(vary_AmbientColor, gamma); - vary_AmbientColor = smear(1.0f) - vary_AmbientColor; +void LLSettingsSky::calculateLightSettings() +{ +// LEGACY_ATMOSPHERICS + // Initialize temp variables + LLColor3 sunlight = getSunlightColor(); + LLColor3 ambient = getAmbientColor(); + F32 cloud_shadow = getCloudShadow(); + LLVector3 lightnorm = getLightDirection(); + + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes + F32 max_y = getMaxY(); + LLColor3 light_atten = getLightAttenuation(max_y); + LLColor3 light_transmittance = getLightTransmittance(); + + // Compute sunlight from P & lightnorm (for long rays like sky) + /// USE only lightnorm. + // temp2[1] = llmax(0.f, llmax(0.f, Pn[1]) * 1.0f + lightnorm[1] ); - componentMultBy(vary_HazeColor, LLColor3(1.f, 1.f, 1.f) - temp1); + // and vary_sunlight will work properly with moon light + F32 lighty = lightnorm[1]; + if (lighty < NIGHTTIME_ELEVATION_COS) + { + lighty = -lighty; + } + lighty = llmax(0.f, lighty); + if(lighty > 0.f) + { + lighty = 1.f / lighty; } + componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); + + //increase ambient when there are more clouds + LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; - mSunDiffuse = vary_SunlightColor; - mSunAmbient = vary_AmbientColor; - mMoonDiffuse = vary_SunlightColor; - mMoonAmbient = vary_AmbientColor; + //brightness of surface both sunlight and ambient + mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); + mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); - mTotalAmbient = LLColor4(vary_AmbientColor, 1.0f); + mMoonDiffuse = gammaCorrect(componentMult(LLColor3::white, light_transmittance)); + mMoonAmbient = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.5f); + mTotalAmbient = mSunAmbient; mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; mFadeColor.setAlpha(0); } - //========================================================================= namespace { -- cgit v1.2.3 From 087e21082512bce899e435537d7d60a09ef6eaca Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Thu, 8 Mar 2018 16:09:29 +0000 Subject: Add LLVoSky wrapper for current env sky light direction. Make LLVo classes use LLVoSky wrappers instead of direct access. Isolate more legacy haze param usage w/in settings. --- indra/llinventory/llsettingssky.cpp | 58 ++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 27 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 9b9d10718c..e84939800b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,6 +32,8 @@ #include "llfasttimer.h" #include "v3colorutil.h" +#pragma optimize("", off) + //========================================================================= namespace { @@ -574,10 +576,7 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) // AdvancedAtmospherics TODO // These need to be translated into density profile info in the new settings format... // LEGACY_ATMOSPHERICS - if (legacy.has(SETTING_AMBIENT)) - { - newsettings[SETTING_AMBIENT] = LLColor3(legacy[SETTING_AMBIENT]).getValue(); - } + if (legacy.has(SETTING_BLUE_DENSITY)) { newsettings[SETTING_BLUE_DENSITY] = LLColor3(legacy[SETTING_BLUE_DENSITY]).getValue(); @@ -603,6 +602,10 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) newsettings[SETTING_HAZE_HORIZON] = LLSD::Real(legacy[SETTING_HAZE_HORIZON][0].asReal()); } + if (legacy.has(SETTING_AMBIENT)) + { + newsettings[SETTING_AMBIENT] = LLColor3(legacy[SETTING_AMBIENT]).getValue(); + } if (legacy.has(SETTING_CLOUD_COLOR)) { newsettings[SETTING_CLOUD_COLOR] = LLColor3(legacy[SETTING_CLOUD_COLOR]).getValue(); @@ -756,6 +759,7 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() // this is used later for sunlight modulation at various altitudes LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const { +// LEGACY_ATMOSPHERICS LLColor3 blue_density = getBlueDensity(); F32 haze_density = getHazeDensity(); F32 density_multiplier = getDensityMultiplier(); @@ -766,6 +770,7 @@ LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const LLColor3 LLSettingsSky::getLightTransmittance() const { +// LEGACY_ATMOSPHERICS LLColor3 blue_density = getBlueDensity(); F32 haze_density = getHazeDensity(); F32 density_multiplier = getDensityMultiplier(); @@ -788,41 +793,40 @@ LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const void LLSettingsSky::calculateLightSettings() { -// LEGACY_ATMOSPHERICS - // Initialize temp variables - LLColor3 sunlight = getSunlightColor(); - LLColor3 ambient = getAmbientColor(); - F32 cloud_shadow = getCloudShadow(); - LLVector3 lightnorm = getLightDirection(); - - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes + // Initialize temp variables + LLColor3 sunlight = getSunlightColor(); + LLColor3 ambient = getAmbientColor(); + F32 cloud_shadow = getCloudShadow(); + LLVector3 lightnorm = getLightDirection(); + + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes F32 max_y = getMaxY(); LLColor3 light_atten = getLightAttenuation(max_y); LLColor3 light_transmittance = getLightTransmittance(); - // Compute sunlight from P & lightnorm (for long rays like sky) - /// USE only lightnorm. - // temp2[1] = llmax(0.f, llmax(0.f, Pn[1]) * 1.0f + lightnorm[1] ); + // Compute sunlight from P & lightnorm (for long rays like sky) + /// USE only lightnorm. + // temp2[1] = llmax(0.f, llmax(0.f, Pn[1]) * 1.0f + lightnorm[1] ); - // and vary_sunlight will work properly with moon light - F32 lighty = lightnorm[1]; - if (lighty < NIGHTTIME_ELEVATION_COS) - { - lighty = -lighty; - } + // and vary_sunlight will work properly with moon light + F32 lighty = lightnorm[1]; + if (lighty < NIGHTTIME_ELEVATION_COS) + { + lighty = -lighty; + } lighty = llmax(0.f, lighty); if(lighty > 0.f) - { + { lighty = 1.f / lighty; - } + } componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); - //increase ambient when there are more clouds - LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; + //increase ambient when there are more clouds + LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; - //brightness of surface both sunlight and ambient + //brightness of surface both sunlight and ambient mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); -- cgit v1.2.3 From 89d71617f08825d8def694b3b0ef337d18ee5bf9 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Thu, 8 Mar 2018 17:45:43 +0000 Subject: Prepare for validation and storage of legacy haze settings (still pass-through for now). Isolate more use of legacy haze params behind wrapper funcs. --- indra/llinventory/llsettingssky.cpp | 88 ++++++++++++++++++++++++++++++++++--- 1 file changed, 83 insertions(+), 5 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index e84939800b..0981485e25 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -108,9 +108,36 @@ 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 std::string LLSettingsSky::SETTING_LEGACY_HAZE("legacy_haze"); + namespace { +LLSettingsSky::validation_list_t legacyHazeValidationList() +{ + static LLSettingsBase::validation_list_t legacyHazeValidation; + if (legacyHazeValidation.empty()) + { + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_BLUE_DENSITY, true, LLSD::TypeArray, + boost::bind(&LLSettingsBase::Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_BLUE_HORIZON, true, LLSD::TypeArray, + boost::bind(&LLSettingsBase::Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_DENSITY, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_HORIZON, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_MULTIPLIER, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DISTANCE_MULTIPLIER, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); + } + return legacyHazeValidation; +} + LLSettingsSky::validation_list_t rayleighValidationList() { static LLSettingsBase::validation_list_t rayleighValidation; @@ -183,6 +210,24 @@ LLSettingsSky::validation_list_t mieValidationList() return mieValidation; } +bool validateLegacyHaze(LLSD &value) +{ + LLSettingsSky::validation_list_t legacyHazeValidations = legacyHazeValidationList(); + llassert(value.type() == LLSD::Type::TypeMap); + LLSD result = LLSettingsBase::settingValidation(value, legacyHazeValidations); + if (result["errors"].size() > 0) + { + LL_WARNS("SETTINGS") << "Legacy Haze Config Validation errors: " << result["errors"] << LL_ENDL; + return false; + } + if (result["warnings"].size() > 0) + { + LL_WARNS("SETTINGS") << "Legacy Haze Config Validation warnings: " << result["errors"] << LL_ENDL; + return false; + } + return true; +} + bool validateRayleighLayers(LLSD &value) { LLSettingsSky::validation_list_t rayleighValidations = rayleighValidationList(); @@ -404,8 +449,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); + + validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_CLOUD_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, @@ -470,6 +516,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_RAYLEIGH_CONFIG, true, LLSD::TypeArray, &validateRayleighLayers)); validation.push_back(Validator(SETTING_ABSORPTION_CONFIG, true, LLSD::TypeArray, &validateAbsorptionLayers)); validation.push_back(Validator(SETTING_MIE_CONFIG, true, LLSD::TypeArray, &validateMieLayers)); + validation.push_back(Validator(SETTING_LEGACY_HAZE, false, LLSD::TypeMap, &validateLegacyHaze)); } return validation; } @@ -569,14 +616,45 @@ LLSD LLSettingsSky::defaults() return dfltsetting; } -LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) +LLSD LLSettingsSky::translateLegacyHazeSettings(const LLSD& legacy) { - LLSD newsettings(defaults()); + LLSD legacyhazesettings; // AdvancedAtmospherics TODO // These need to be translated into density profile info in the new settings format... -// LEGACY_ATMOSPHERICS - +// LEGACY_ATMOSPHERICS + if (legacy.has(SETTING_BLUE_DENSITY)) + { + legacyhazesettings[SETTING_BLUE_DENSITY] = LLColor3(legacy[SETTING_BLUE_DENSITY]).getValue(); + } + if (legacy.has(SETTING_BLUE_HORIZON)) + { + legacyhazesettings[SETTING_BLUE_HORIZON] = LLColor3(legacy[SETTING_BLUE_HORIZON]).getValue(); + } + if (legacy.has(SETTING_DENSITY_MULTIPLIER)) + { + legacyhazesettings[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(legacy[SETTING_DENSITY_MULTIPLIER][0].asReal()); + } + if (legacy.has(SETTING_DISTANCE_MULTIPLIER)) + { + legacyhazesettings[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(legacy[SETTING_DISTANCE_MULTIPLIER][0].asReal()); + } + if (legacy.has(SETTING_HAZE_DENSITY)) + { + legacyhazesettings[SETTING_HAZE_DENSITY] = LLSD::Real(legacy[SETTING_HAZE_DENSITY][0].asReal()); + } + if (legacy.has(SETTING_HAZE_HORIZON)) + { + legacyhazesettings[SETTING_HAZE_HORIZON] = LLSD::Real(legacy[SETTING_HAZE_HORIZON][0].asReal()); + } + + return legacyhazesettings; +} + +LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) +{ + LLSD newsettings(defaults()); + if (legacy.has(SETTING_BLUE_DENSITY)) { newsettings[SETTING_BLUE_DENSITY] = LLColor3(legacy[SETTING_BLUE_DENSITY]).getValue(); -- cgit v1.2.3 From 54ee5bfc0557d301c0b29e45923a8ced959dbb66 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Thu, 8 Mar 2018 17:46:42 +0000 Subject: Remove MSVC-only debug pragma. --- indra/llinventory/llsettingssky.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 0981485e25..940680baab 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,8 +32,6 @@ #include "llfasttimer.h" #include "v3colorutil.h" -#pragma optimize("", off) - //========================================================================= namespace { -- cgit v1.2.3 From 057dda6afe59791f4a6fcf4c5ca8387b8aeda6a8 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Tue, 13 Mar 2018 17:21:10 +0100 Subject: Fix storing legacy haze parameters in inner map by fixing parameter update to not expect them at top level of LLSD for sky settings. --- indra/llinventory/llsettingssky.cpp | 84 +++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 23 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 940680baab..37da95b95e 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -653,29 +653,13 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) { LLSD newsettings(defaults()); - if (legacy.has(SETTING_BLUE_DENSITY)) - { - newsettings[SETTING_BLUE_DENSITY] = LLColor3(legacy[SETTING_BLUE_DENSITY]).getValue(); - } - if (legacy.has(SETTING_BLUE_HORIZON)) - { - newsettings[SETTING_BLUE_HORIZON] = LLColor3(legacy[SETTING_BLUE_HORIZON]).getValue(); - } - if (legacy.has(SETTING_DENSITY_MULTIPLIER)) - { - newsettings[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(legacy[SETTING_DENSITY_MULTIPLIER][0].asReal()); - } - if (legacy.has(SETTING_DISTANCE_MULTIPLIER)) - { - newsettings[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(legacy[SETTING_DISTANCE_MULTIPLIER][0].asReal()); - } - if (legacy.has(SETTING_HAZE_DENSITY)) - { - newsettings[SETTING_HAZE_DENSITY] = LLSD::Real(legacy[SETTING_HAZE_DENSITY][0].asReal()); - } - if (legacy.has(SETTING_HAZE_HORIZON)) + // Move legacy haze parameters to an inner map + // allowing backward compat and simple conversion to legacy format + LLSD legacyhazesettings; + legacyhazesettings = translateLegacyHazeSettings(legacy); + if (legacyhazesettings.size() > 0) { - newsettings[SETTING_HAZE_HORIZON] = LLSD::Real(legacy[SETTING_HAZE_HORIZON][0].asReal()); + newsettings[SETTING_LEGACY_HAZE] = legacyhazesettings; } if (legacy.has(SETTING_AMBIENT)) @@ -831,6 +815,60 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() } } +LLColor3 LLSettingsSky::getBlueDensity() const +{ + if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_BLUE_DENSITY)) + { + return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_DENSITY]); + } + return LLColor3(0.2447f, 0.4487f, 0.7599f); +} + +LLColor3 LLSettingsSky::getBlueHorizon() const +{ + if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_BLUE_DENSITY)) + { + return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_HORIZON]); + } + return LLColor3(0.4954f, 0.4954f, 0.6399f); +} + +F32 LLSettingsSky::getHazeDensity() const +{ + if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_HAZE_DENSITY)) + { + return mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_DENSITY].asReal(); + } + return 0.7f; +} + +F32 LLSettingsSky::getHazeHorizon() const +{ + if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_HAZE_HORIZON)) + { + return mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_HORIZON].asReal(); + } + return 0.19f; +} + +F32 LLSettingsSky::getDensityMultiplier() const +{ + if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_DENSITY_MULTIPLIER)) + { + return mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER].asReal(); + } + return 0.0001f; +} + +F32 LLSettingsSky::getDistanceMultiplier() const +{ + if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_DISTANCE_MULTIPLIER)) + { + return mSettings[SETTING_LEGACY_HAZE][SETTING_DISTANCE_MULTIPLIER].asReal(); + } + return 0.8f; +} + // Sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const @@ -838,7 +876,7 @@ LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const // LEGACY_ATMOSPHERICS LLColor3 blue_density = getBlueDensity(); F32 haze_density = getHazeDensity(); - F32 density_multiplier = getDensityMultiplier(); + F32 density_multiplier = getDensityMultiplier(); LLColor3 density = (blue_density * 1.0 + smear(haze_density * 0.25f)); LLColor3 light_atten = density * density_multiplier * distance; return light_atten; -- cgit v1.2.3 From 79e4a8c28ad29b028ddb907a6ea01f4ef71e822a Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Wed, 14 Mar 2018 00:11:19 +0100 Subject: Fix up atmospheric helpers and transport shader for adv atmo path. Basic hook-up of sky settings to llatmosphere model. Moved mie aniso to be a top-level setting instead of a per-mie-layer setting. --- indra/llinventory/llsettingssky.cpp | 52 +++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 25 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 37da95b95e..491381213f 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -200,10 +200,7 @@ LLSettingsSky::validation_list_t mieValidationList() boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); - - mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR, true, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); } return mieValidation; } @@ -511,6 +508,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_SUN_ARC_RADIANS, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.1f))))); + validation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_RAYLEIGH_CONFIG, true, LLSD::TypeArray, &validateRayleighLayers)); validation.push_back(Validator(SETTING_ABSORPTION_CONFIG, true, LLSD::TypeArray, &validateAbsorptionLayers)); validation.push_back(Validator(SETTING_MIE_CONFIG, true, LLSD::TypeArray, &validateMieLayers)); @@ -522,11 +522,13 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() LLSD LLSettingsSky::rayleighConfigDefault() { LLSD dflt_rayleigh; - dflt_rayleigh[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; - dflt_rayleigh[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_rayleigh[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + LLSD dflt_rayleigh_layer; + dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; + dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + dflt_rayleigh.append(dflt_rayleigh_layer); return dflt_rayleigh; } @@ -556,12 +558,13 @@ LLSD LLSettingsSky::absorptionConfigDefault() LLSD LLSettingsSky::mieConfigDefault() { LLSD dflt_mie; - dflt_mie[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_mie[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_mie[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f; - dflt_mie[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_mie[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; - dflt_mie[SETTING_MIE_ANISOTROPY_FACTOR] = 0.9f; + LLSD dflt_mie_layer; + dflt_mie_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_mie_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_mie_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f; + dflt_mie_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_mie_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + dflt_mie.append(dflt_mie_layer); return dflt_mie; } @@ -600,16 +603,15 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_TYPE] = "sky"; // defaults are for earth... - dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; - dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; - dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; - dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; - - // These are technically capable of handling multiple layers of density config - // and so are expected to be an array, but we make an array of size 1 w/ each default density config - dfltsetting[SETTING_RAYLEIGH_CONFIG].append(rayleighConfigDefault()); - dfltsetting[SETTING_MIE_CONFIG].append(mieConfigDefault()); - dfltsetting[SETTING_ABSORPTION_CONFIG].append(absorptionConfigDefault()); + dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; + dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; + dfltsetting[SETTING_MIE_ANISOTROPY_FACTOR] = 0.8f; + + dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); + dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); + dfltsetting[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); return dfltsetting; } -- cgit v1.2.3 From 3925e37532476c526375fd76143b2b5e1dcce9b9 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 15 May 2018 17:17:51 -0700 Subject: Fix the blend code to record the amount of the blend and to store what is being blended towards. --- indra/llinventory/llsettingssky.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 7da3a336cc..45c1ca1d7f 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -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"; -- cgit v1.2.3 From 39fb9cc9b4221b6fb715e9f59ae5512b76baa1ba Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Fri, 18 May 2018 00:23:58 +0100 Subject: Fix Mie Config validation in sky settings. Start cleanup of heavenly body rendering. --- indra/llinventory/llsettingssky.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 8cf430292b..be26439cee 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -206,7 +206,10 @@ LLSettingsSky::validation_list_t mieValidationList() boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); } return mieValidation; } @@ -348,7 +351,7 @@ bool validateMieLayers(LLSD &value) } if (result["warnings"].size() > 0) { - LL_WARNS("SETTINGS") << "Mie Config Validation warnings: " << result["errors"] << LL_ENDL; + LL_WARNS("SETTINGS") << "Mie Config Validation warnings: " << result["warnings"] << LL_ENDL; return false; } return true; @@ -421,7 +424,6 @@ LLSettingsSky::stringset_t LLSettingsSky::getSkipInterpolateKeys() const skipSet.insert(SETTING_RAYLEIGH_CONFIG); skipSet.insert(SETTING_MIE_CONFIG); skipSet.insert(SETTING_ABSORPTION_CONFIG); - skipSet.insert(SETTING_MIE_ANISOTROPY_FACTOR); } return skipSet; @@ -538,9 +540,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_SUN_ARC_RADIANS, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.1f))))); - - validation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR, true, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_RAYLEIGH_CONFIG, true, LLSD::TypeArray, &validateRayleighLayers)); validation.push_back(Validator(SETTING_ABSORPTION_CONFIG, true, LLSD::TypeArray, &validateAbsorptionLayers)); @@ -595,6 +595,7 @@ LLSD LLSettingsSky::mieConfigDefault() dflt_mie_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f; dflt_mie_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; dflt_mie_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + dflt_mie_layer[SETTING_MIE_ANISOTROPY_FACTOR] = 0.8f; dflt_mie.append(dflt_mie_layer); return dflt_mie; } @@ -637,8 +638,7 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; - dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; - dfltsetting[SETTING_MIE_ANISOTROPY_FACTOR] = 0.8f; + dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); -- cgit v1.2.3 From 8082cb86682c008389cb8127f295e6566ec368e5 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Fri, 18 May 2018 23:14:56 +0100 Subject: Make nighttime elev constant _SIN, since it uses a sin value. Put that constant in sky settings and eliminate dups. Fix up logic around when to use heavenly bodies (fix broken moon in basic sky). Remove unnecessary clip to horizon. Put in temp code to ena/dis sun/moon based on LLEnvironment::getIsDaytime(). --- indra/llinventory/llsettingssky.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index be26439cee..c5dfd765f2 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -51,9 +51,6 @@ namespace const F32 LLSettingsSky::DOME_OFFSET(0.96f); const F32 LLSettingsSky::DOME_RADIUS(15000.f); -const F32 LLSettingsSky::NIGHTTIME_ELEVATION(-8.0f); // degrees -const F32 LLSettingsSky::NIGHTTIME_ELEVATION_COS((F32)sin(NIGHTTIME_ELEVATION*DEG_TO_RAD)); - //========================================================================= const std::string LLSettingsSky::SETTING_AMBIENT("ambient"); const std::string LLSettingsSky::SETTING_BLUE_DENSITY("blue_density"); @@ -816,6 +813,7 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() { mSunDirection = DUE_EAST * getSunRotation(); mSunDirection.normalize(); + mMoonDirection = DUE_EAST * getMoonRotation(); mMoonDirection.normalize(); @@ -824,7 +822,7 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() { mLightDirection = mSunDirection; } - else if (mSunDirection.mV[1] < 0.0 && mSunDirection.mV[1] > NIGHTTIME_ELEVATION_COS) + else if (mSunDirection.mV[1] < 0.0 && mSunDirection.mV[1] > NIGHTTIME_ELEVATION_SIN) { // clamp v1 to 0 so sun never points up and causes weirdness on some machines LLVector3 vec(mSunDirection); @@ -834,7 +832,11 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() } else { - mLightDirection = mMoonDirection; + // clamp v1 to 0 so moon never points up and causes weirdness on some machines + LLVector3 vec(mMoonDirection); + vec.mV[1] = 0.0; + vec.normalize(); + mLightDirection = vec; } // calculate the clamp lightnorm for sky (to prevent ugly banding in sky @@ -993,7 +995,7 @@ void LLSettingsSky::calculateLightSettings() // and vary_sunlight will work properly with moon light F32 lighty = lightnorm[1]; - if (lighty < NIGHTTIME_ELEVATION_COS) + if (lighty < NIGHTTIME_ELEVATION_SIN) { lighty = -lighty; } -- cgit v1.2.3 From 190fa8614c5630f7f360ce028ed08879af308511 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Fri, 18 May 2018 23:16:56 +0100 Subject: Remove MSVC debug pragmas and comment out code to dump example grids.xml file w/ hard-coded grids. --- indra/llinventory/llsettingssky.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index c5dfd765f2..25d197d9be 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,8 +32,6 @@ #include "llfasttimer.h" #include "v3colorutil.h" -#pragma optimize("", off) - //========================================================================= namespace { -- cgit v1.2.3 From 13536bb273b7413aa4461c8eeaf5a6a865f4234d Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Tue, 22 May 2018 21:42:54 +0100 Subject: Remove some obsolete sky funcs. Remove Matrix3/4 funcs using LLQuat 4-float init incorrectly (they are redundant to angle/axis versions anyway). Fix up tests referring to removed funcs above. --- indra/llinventory/llsettingssky.cpp | 45 +++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 14 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 25d197d9be..6b8acac3da 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -35,6 +35,7 @@ //========================================================================= namespace { + // vectors in +x at, +y up, +z right coord sys const LLVector3 DUE_EAST(0.0f, 0.0f, 1.0); const LLVector3 VECT_ZENITH(0.f, 1.f, 0.f); const LLVector3 VECT_NORTHSOUTH(1.f, 0.f, 0.f); @@ -599,7 +600,12 @@ LLSD LLSettingsSky::defaults() { LLSD dfltsetting; LLQuaternion sunquat; + + // we're using the roll value of 80 degrees from horizon + // with an euler angle conversion meant for a +x right, +y up, +z at coord sys here sunquat.setEulerAngles(1.39626, 0.0, 0.0); // 80deg Azumith/0deg East + + // then we're using the conjugate which does not give the opposite direction LLQuaternion moonquat = ~sunquat; // Magic constants copied form dfltsetting.xml @@ -807,34 +813,41 @@ void LLSettingsSky::updateSettings() calculateLightSettings(); } +bool LLSettingsSky::getIsSunUp() const +{ + LLVector3 sunDir = getSunDirection(); + return sunDir.mV[1] > NIGHTTIME_ELEVATION_SIN; +} + +bool LLSettingsSky::getIsMoonUp() const +{ + LLVector3 moonDir = getMoonDirection(); + return moonDir.mV[1] > NIGHTTIME_ELEVATION_SIN; +} + void LLSettingsSky::calculateHeavnlyBodyPositions() { - mSunDirection = DUE_EAST * getSunRotation(); + LLQuaternion sunq = getSunRotation(); + LLQuaternion moonq = getMoonRotation(); + + mSunDirection = DUE_EAST * sunq; mSunDirection.normalize(); - mMoonDirection = DUE_EAST * getMoonRotation(); + mMoonDirection = DUE_EAST * moonq; mMoonDirection.normalize(); // is the normal from the sun or the moon - if (mSunDirection.mV[1] >= 0.0) + if (getIsSunUp()) { mLightDirection = mSunDirection; } - else if (mSunDirection.mV[1] < 0.0 && mSunDirection.mV[1] > NIGHTTIME_ELEVATION_SIN) + else if (getIsMoonUp()) { - // clamp v1 to 0 so sun never points up and causes weirdness on some machines - LLVector3 vec(mSunDirection); - vec.mV[1] = 0.0; - vec.normalize(); - mLightDirection = vec; + mLightDirection = mMoonDirection; } else { - // clamp v1 to 0 so moon never points up and causes weirdness on some machines - LLVector3 vec(mMoonDirection); - vec.mV[1] = 0.0; - vec.normalize(); - mLightDirection = vec; + mLightDirection = LLVector3::z_axis; } // calculate the clamp lightnorm for sky (to prevent ugly banding in sky @@ -846,6 +859,10 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() mClampedLightDirection.mV[1] = -0.1f; mClampedLightDirection.normalize(); } + + //LL_INFOS() << "Sun: " << mSunDirection << LL_ENDL; + //LL_INFOS() << "Moon: " << mMoonDirection << LL_ENDL; + //LL_INFOS() << "Light: " << mLightDirection << LL_ENDL; } LLColor3 LLSettingsSky::getBlueDensity() const -- cgit v1.2.3 From 64302d3000b69b31e72eb6a3bd8a981c80cb88de Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 1 Jun 2018 00:18:36 +0100 Subject: Modify use of sky settings, reduce complexity, and name funcs to indicate coord systems in use. Fix class2 softenLightF shader. --- indra/llinventory/llsettingssky.cpp | 177 +++++++++++++++++++++--------------- 1 file changed, 106 insertions(+), 71 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index e06cd7ca72..b8623c3ed3 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -42,13 +42,14 @@ namespace { LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment"); LLTrace::BlockTimerStatHandle FTM_UPDATE_SKYVALUES("Update Sky Environment"); + static const LLVector3 DUE_EAST = LLVector3::x_axis; } -static LLQuaternion body_position_from_angles(F32 azimuth, F32 altitude) +static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) { - LLQuaternion body_quat; - body_quat.setEulerAngles(0.0f, -altitude, azimuth); - return body_quat; + LLQuaternion quat; + quat.setEulerAngles(0.0f, -altitude, azimuth); + return quat; } const F32 LLSettingsSky::DOME_OFFSET(0.96f); @@ -487,8 +488,6 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() LLSD(LLSDArray(0.2f)("*")(-2.5f)("*")), LLSD(LLSDArray(20.0f)("*")(0.0f)("*"))))); - validation.push_back(Validator(SETTING_LIGHT_NORMAL, false, LLSD::TypeArray, - boost::bind(&Validator::verifyVectorNormalized, _1, 3))); validation.push_back(Validator(SETTING_MAX_Y, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4000.0f))))); validation.push_back(Validator(SETTING_MOON_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); @@ -579,8 +578,8 @@ LLSD LLSettingsSky::defaults() LLQuaternion sunquat; LLQuaternion moonquat; - sunquat.setEulerAngles(0.0f, -1.39626, 0.0f); // 80 deg pitch / 0 deg azimuth from East - moonquat.setEulerAngles(0.0f, -1.39626, F_PI); // 80 deg pitch / 180 deg azimuth from East + sunquat = convert_azimuth_and_altitude_to_quat(0.0f, 80.0f * DEG_TO_RAD); + moonquat = convert_azimuth_and_altitude_to_quat(F_PI, 80.0f * DEG_TO_RAD); // Magic constants copied form dfltsetting.xml dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); @@ -595,7 +594,6 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_GAMMA] = LLSD::Real(1.0); dfltsetting[SETTING_GLOW] = LLColor4(5.000, 0.0010, -0.4799, 1.0).getValue(); - dfltsetting[SETTING_LIGHT_NORMAL] = LLVector3(0.0000, 0.9126, -0.4086).getValue(); dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(0.0000); @@ -657,7 +655,7 @@ LLSD LLSettingsSky::translateLegacyHazeSettings(const LLSD& legacy) return legacyhazesettings; } -LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy, const std::string* name) +LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) { LLSD newsettings(defaults()); @@ -719,11 +717,7 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy, const std::strin { newsettings[SETTING_GLOW] = LLColor3(legacy[SETTING_GLOW]).getValue(); } - - if (legacy.has(SETTING_LIGHT_NORMAL)) - { - newsettings[SETTING_LIGHT_NORMAL] = LLVector3(legacy[SETTING_LIGHT_NORMAL]).getValue(); - } + if (legacy.has(SETTING_MAX_Y)) { newsettings[SETTING_MAX_Y] = LLSD::Real(legacy[SETTING_MAX_Y][0].asReal()); @@ -762,16 +756,11 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy, const std::strin F32 azimuth = legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal(); - F32 pi_over_2 = F_PI * 0.5f; - LLQuaternion sunquat = body_position_from_angles(azimuth - pi_over_2, altitude); - LLQuaternion moonquat = body_position_from_angles(azimuth + pi_over_2, altitude); + LLQuaternion sunquat = convert_azimuth_and_altitude_to_quat(azimuth, altitude); + LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, altitude); - if (name) - { - LLVector3 sundir = LLVector3::x_axis * sunquat; - LLVector3 moondir = LLVector3::x_axis * moonquat; - LL_INFOS() << *name << " sun: " << sundir << " moon: " << moondir << LL_ENDL; - } + //LLVector3 sundir = DUE_EAST * sunquat; + //LLVector3 moondir = DUE_EAST * moonquat; newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); newsettings[SETTING_MOON_ROTATION] = moonquat.getValue(); @@ -785,11 +774,11 @@ void LLSettingsSky::updateSettings() LL_RECORD_BLOCK_TIME(FTM_UPDATE_SKYVALUES); //LL_INFOS("WINDLIGHT", "SKY", "EEP") << "WL Parameters are dirty. Reticulating Splines..." << LL_ENDL; + mPositionsDirty = isDirty(); + mLightingDirty = isDirty(); + // base class clears dirty flag so as to not trigger recursive update LLSettingsBase::updateSettings(); - - calculateHeavnlyBodyPositions(); - calculateLightSettings(); } bool LLSettingsSky::getIsSunUp() const @@ -804,44 +793,42 @@ bool LLSettingsSky::getIsMoonUp() const return moonDir.mV[2] > NIGHTTIME_ELEVATION_SIN; } -void LLSettingsSky::calculateHeavnlyBodyPositions() +void LLSettingsSky::calculateHeavnlyBodyPositions() const { + if (!mPositionsDirty) + { + return; + } + + mPositionsDirty = false; + LLQuaternion sunq = getSunRotation(); LLQuaternion moonq = getMoonRotation(); - mSunDirection = LLVector3::x_axis * sunq; - mSunDirection.normalize(); + mSunDirection = DUE_EAST * sunq; + mMoonDirection = DUE_EAST * moonq; - mMoonDirection = LLVector3::x_axis * moonq; + mSunDirection.normalize(); mMoonDirection.normalize(); +} + +LLVector3 LLSettingsSky::getLightDirection() const +{ + calculateHeavnlyBodyPositions(); // is the normal from the sun or the moon if (getIsSunUp()) { - mLightDirection = mSunDirection; + llassert(mSunDirection.length() > 0.01f); + return mSunDirection; } else if (getIsMoonUp()) { - mLightDirection = mMoonDirection; + llassert(mMoonDirection.length() > 0.01f); + return mMoonDirection; } - else - { - mLightDirection = LLVector3::z_axis; - } - - // calculate the clamp lightnorm for sky (to prevent ugly banding in sky - // when haze goes below the horizon - mClampedLightDirection = mLightDirection; - if (mClampedLightDirection.mV[1] < -0.1f) - { - mClampedLightDirection.mV[1] = -0.1f; - mClampedLightDirection.normalize(); - } - - //LL_INFOS() << "Sun: " << mSunDirection << LL_ENDL; - //LL_INFOS() << "Moon: " << mMoonDirection << LL_ENDL; - //LL_INFOS() << "Light: " << mLightDirection << LL_ENDL; + return LLVector3::z_axis; } LLColor3 LLSettingsSky::getBlueDensity() const @@ -969,42 +956,91 @@ LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const return v; } -void LLSettingsSky::calculateLightSettings() +LLVector3 LLSettingsSky::getSunDirection() const +{ + calculateHeavnlyBodyPositions(); + return mSunDirection; +} + +LLVector3 LLSettingsSky::getMoonDirection() const +{ + calculateHeavnlyBodyPositions(); + return mMoonDirection; +} + +LLColor4U LLSettingsSky::getFadeColor() const +{ + calculateLightSettings(); + return mFadeColor; +} + +LLColor4 LLSettingsSky::getMoonAmbient() const +{ + calculateLightSettings(); + return mMoonAmbient; +} + +LLColor3 LLSettingsSky::getMoonDiffuse() const +{ + calculateLightSettings(); + return mMoonDiffuse; +} + +LLColor4 LLSettingsSky::getSunAmbient() const +{ + calculateLightSettings(); + return mSunAmbient; +} + +LLColor3 LLSettingsSky::getSunDiffuse() const +{ + calculateLightSettings(); + return mSunDiffuse; +} + +LLColor4 LLSettingsSky::getTotalAmbient() const { + calculateLightSettings(); + return mTotalAmbient; +} + +void LLSettingsSky::calculateLightSettings() const +{ + if (!mLightingDirty) + { + return; + } + + calculateHeavnlyBodyPositions(); + + mLightingDirty = false; + // Initialize temp variables LLColor3 sunlight = getSunlightColor(); LLColor3 ambient = getAmbientColor(); - F32 cloud_shadow = getCloudShadow(); - LLVector3 lightnorm = getLightDirection(); + F32 cloud_shadow = getCloudShadow(); + LLVector3 lightnorm = getLightDirection(); - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes F32 max_y = getMaxY(); LLColor3 light_atten = getLightAttenuation(max_y); LLColor3 light_transmittance = getLightTransmittance(); - - // Compute sunlight from P & lightnorm (for long rays like sky) - /// USE only lightnorm. - // temp2[1] = llmax(0.f, llmax(0.f, Pn[1]) * 1.0f + lightnorm[1] ); - // and vary_sunlight will work properly with moon light - F32 lighty = lightnorm[1]; - if (lighty < NIGHTTIME_ELEVATION_SIN) - { - lighty = -lighty; - } + // and vary_sunlight will work properly with moon light + F32 lighty = lightnorm[1]; lighty = llmax(0.f, lighty); if(lighty > 0.f) - { + { lighty = 1.f / lighty; - } + } componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); - //increase ambient when there are more clouds - LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; + //increase ambient when there are more clouds + LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; - //brightness of surface both sunlight and ambient + //brightness of surface both sunlight and ambient mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); @@ -1015,4 +1051,3 @@ void LLSettingsSky::calculateLightSettings() mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; mFadeColor.setAlpha(0); } - -- cgit v1.2.3 From 8dd85013865cc5b426234cd71b605d7208bcfe01 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 1 Jun 2018 15:50:25 +0100 Subject: Fix mis-merge of LLSettingsBase and remove optimize pragmas. --- indra/llinventory/llsettingssky.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index b8623c3ed3..6c5ed8f12b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,17 +32,14 @@ #include "llfasttimer.h" #include "v3colorutil.h" -#pragma optimize("", off) - static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); - +static const LLVector3 DUE_EAST = LLVector3::x_axis; //========================================================================= namespace { LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment"); - LLTrace::BlockTimerStatHandle FTM_UPDATE_SKYVALUES("Update Sky Environment"); - static const LLVector3 DUE_EAST = LLVector3::x_axis; + LLTrace::BlockTimerStatHandle FTM_UPDATE_SKYVALUES("Update Sky Environment"); } static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) -- cgit v1.2.3 From 8cfdc07e790a557e881fadaa1b6258e5b16751f4 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 1 Jun 2018 23:32:30 +0100 Subject: Code cleanup and move to using typedefs of S64Seconds/F64Seconds for ease in sync w/ sim side which has not llunits types. --- indra/llinventory/llsettingssky.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 6c5ed8f12b..b6320e0942 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -790,7 +790,7 @@ bool LLSettingsSky::getIsMoonUp() const return moonDir.mV[2] > NIGHTTIME_ELEVATION_SIN; } -void LLSettingsSky::calculateHeavnlyBodyPositions() const +void LLSettingsSky::calculateHeavenlyBodyPositions() const { if (!mPositionsDirty) { @@ -811,7 +811,7 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() const LLVector3 LLSettingsSky::getLightDirection() const { - calculateHeavnlyBodyPositions(); + calculateHeavenlyBodyPositions(); // is the normal from the sun or the moon if (getIsSunUp()) @@ -955,13 +955,13 @@ LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const LLVector3 LLSettingsSky::getSunDirection() const { - calculateHeavnlyBodyPositions(); + calculateHeavenlyBodyPositions(); return mSunDirection; } LLVector3 LLSettingsSky::getMoonDirection() const { - calculateHeavnlyBodyPositions(); + calculateHeavenlyBodyPositions(); return mMoonDirection; } @@ -1008,7 +1008,7 @@ void LLSettingsSky::calculateLightSettings() const return; } - calculateHeavnlyBodyPositions(); + calculateHeavenlyBodyPositions(); mLightingDirty = false; -- cgit v1.2.3 From 2a613d7363c4e91a7258d4f0ea3971db1569e788 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 1 Jun 2018 16:24:36 -0700 Subject: Rework preset loading and context menu from inventory. --- indra/llinventory/llsettingssky.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 45c1ca1d7f..f578660095 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -110,6 +110,9 @@ const LLUUID LLSettingsSky::DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271 const LLUUID LLSettingsSky::DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver const LLUUID LLSettingsSky::DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); +// *LAPRAS* Change when Agni! +const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("cec9af47-90d4-9093-5245-397e5c9e7749"); + namespace { @@ -572,8 +575,8 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; 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_MOON_TEXTUREID] = DEFAULT_MOON_ID; + dfltsetting[SETTING_SUN_TEXTUREID] = LLUUID::null; // DEFAULT_SUN_ID; dfltsetting[SETTING_TYPE] = "sky"; -- cgit v1.2.3 From 7136956b90614bbd236be0e30231781c04346220 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Sat, 2 Jun 2018 23:28:48 +0100 Subject: Use more typedefs to simplify sync between viewer and sim env settings code. --- indra/llinventory/llsettingssky.cpp | 40 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 21 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index cdd5b156d2..95502f47c3 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -106,12 +106,11 @@ 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"); - // *LAPRAS* Change when Agni! -const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("cec9af47-90d4-9093-5245-397e5c9e7749"); +static const LLUUID DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver +static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver +static const LLUUID DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); +static const LLUUID DEFAULT_ASSET_ID("cec9af47-90d4-9093-5245-397e5c9e7749"); const std::string LLSettingsSky::SETTING_LEGACY_HAZE("legacy_haze"); @@ -218,7 +217,7 @@ LLSettingsSky::validation_list_t mieValidationList() bool validateLegacyHaze(LLSD &value) { LLSettingsSky::validation_list_t legacyHazeValidations = legacyHazeValidationList(); - llassert(value.type() == LLSD::Type::TypeMap); + llassert(value.type() == LLSD::TypeMap); LLSD result = LLSettingsBase::settingValidation(value, legacyHazeValidations); if (result["errors"].size() > 0) { @@ -242,14 +241,14 @@ bool validateRayleighLayers(LLSD &value) for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) { LLSD& layerConfig = (*itf); - if (layerConfig.type() == LLSD::Type::TypeMap) + if (layerConfig.type() == LLSD::TypeMap) { if (!validateRayleighLayers(layerConfig)) { allGood = false; } } - else if (layerConfig.type() == LLSD::Type::TypeArray) + else if (layerConfig.type() == LLSD::TypeArray) { return validateRayleighLayers(layerConfig); } @@ -260,7 +259,7 @@ bool validateRayleighLayers(LLSD &value) } return allGood; } - llassert(value.type() == LLSD::Type::TypeMap); + llassert(value.type() == LLSD::TypeMap); LLSD result = LLSettingsBase::settingValidation(value, rayleighValidations); if (result["errors"].size() > 0) { @@ -284,14 +283,14 @@ bool validateAbsorptionLayers(LLSD &value) for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) { LLSD& layerConfig = (*itf); - if (layerConfig.type() == LLSD::Type::TypeMap) + if (layerConfig.type() == LLSD::TypeMap) { if (!validateAbsorptionLayers(layerConfig)) { allGood = false; } } - else if (layerConfig.type() == LLSD::Type::TypeArray) + else if (layerConfig.type() == LLSD::TypeArray) { return validateAbsorptionLayers(layerConfig); } @@ -302,7 +301,7 @@ bool validateAbsorptionLayers(LLSD &value) } return allGood; } - llassert(value.type() == LLSD::Type::TypeMap); + llassert(value.type() == LLSD::TypeMap); LLSD result = LLSettingsBase::settingValidation(value, absorptionValidations); if (result["errors"].size() > 0) { @@ -326,14 +325,14 @@ bool validateMieLayers(LLSD &value) for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) { LLSD& layerConfig = (*itf); - if (layerConfig.type() == LLSD::Type::TypeMap) + if (layerConfig.type() == LLSD::TypeMap) { if (!validateMieLayers(layerConfig)) { allGood = false; } } - else if (layerConfig.type() == LLSD::Type::TypeArray) + else if (layerConfig.type() == LLSD::TypeArray) { return validateMieLayers(layerConfig); } @@ -379,7 +378,7 @@ LLSettingsSky::LLSettingsSky(): void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { - LLSettingsSky::ptr_t other = std::static_pointer_cast(end); + LLSettingsSky::ptr_t other((LLSettingsSky*)end.get()); LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); @@ -416,8 +415,6 @@ LLSettingsSky::stringset_t LLSettingsSky::getSlerpKeys() const return slepSet; } - - LLSettingsSky::validation_list_t LLSettingsSky::getValidationList() const { return LLSettingsSky::validationList(); @@ -512,7 +509,6 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_SUN_ARC_RADIANS, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.1f))))); - validation.push_back(Validator(SETTING_RAYLEIGH_CONFIG, true, LLSD::TypeArray, &validateRayleighLayers)); validation.push_back(Validator(SETTING_ABSORPTION_CONFIG, true, LLSD::TypeArray, &validateAbsorptionLayers)); @@ -771,9 +767,6 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) void LLSettingsSky::updateSettings() { - LL_RECORD_BLOCK_TIME(FTM_UPDATE_SKYVALUES); - //LL_INFOS("WINDLIGHT", "SKY", "EEP") << "WL Parameters are dirty. Reticulating Splines..." << LL_ENDL; - mPositionsDirty = isDirty(); mLightingDirty = isDirty(); @@ -1051,3 +1044,8 @@ void LLSettingsSky::calculateLightSettings() const mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; mFadeColor.setAlpha(0); } + +LLUUID LLSettingsSky::GetDefaultAssetId() +{ + return DEFAULT_ASSET_ID; +} \ No newline at end of file -- cgit v1.2.3 From 6ea2847b58164f0ea315f7b2b9c34e663a07e60e Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 5 Jun 2018 17:58:09 +0100 Subject: Fix uninit data from deleting c++11-style init and not putting it in the ctor. Replace dynamic_pointer_cast so instance isn't accidentally deleted on func exit. --- indra/llinventory/llsettingssky.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 95502f47c3..a6f0d06e7d 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -364,7 +364,9 @@ LLSettingsSky::LLSettingsSky(const LLSD &data) : LLSettingsBase(data), mNextSunTextureId(), mNextMoonTextureId(), - mNextCloudTextureId() + mNextCloudTextureId(), + mPositionsDirty(true), + mLightingDirty(true) { } @@ -372,13 +374,15 @@ LLSettingsSky::LLSettingsSky(): LLSettingsBase(), mNextSunTextureId(), mNextMoonTextureId(), - mNextCloudTextureId() + mNextCloudTextureId(), + mPositionsDirty(true), + mLightingDirty(true) { } void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { - LLSettingsSky::ptr_t other((LLSettingsSky*)end.get()); + LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast(end); LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); -- cgit v1.2.3 From 610a793aa8fb9f918fc25eeab02b7415ac18b33b Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 5 Jun 2018 11:19:22 -0700 Subject: EOL in llsetingssky.cpp and llrender.cpp. const on ptr_t & in llenvironment --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index a6f0d06e7d..263e721d00 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1052,4 +1052,4 @@ void LLSettingsSky::calculateLightSettings() const LLUUID LLSettingsSky::GetDefaultAssetId() { return DEFAULT_ASSET_ID; -} \ No newline at end of file +} -- cgit v1.2.3 From caa5bd3cb9f22a42de9fc1f37bb98b17e2405b5b Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 6 Jun 2018 19:48:12 +0100 Subject: Fix legacy haze validation returning warnings as errors. Add assert that calculated spans are > 0 to avoid div by 0 NaNs. Make span calc return 1.0 for case where begin == end. Fix order of ops in LLTrackBlenderLoopingTime ctor causing skies to be init'd with water instances. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 263e721d00..4763215cff 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -226,7 +226,7 @@ bool validateLegacyHaze(LLSD &value) } if (result["warnings"].size() > 0) { - LL_WARNS("SETTINGS") << "Legacy Haze Config Validation warnings: " << result["errors"] << LL_ENDL; + LL_WARNS("SETTINGS") << "Legacy Haze Config Validation warnings: " << result["warnings"] << LL_ENDL; return false; } return true; -- cgit v1.2.3 From 8b9ff4487bdc4becef270197f86c6f0bbfd324d1 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 19 Jun 2018 12:04:35 -0700 Subject: Adding some timers for tracking --- indra/llinventory/llsettingssky.cpp | 103 ++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 47 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index c25f9a5b2c..5de8c7bad6 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -35,8 +35,7 @@ //========================================================================= namespace { - LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment"); - LLTrace::BlockTimerStatHandle FTM_UPDATE_SKYVALUES("Update Sky Environment"); + const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); @@ -51,6 +50,11 @@ namespace } +static LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment"); +static LLTrace::BlockTimerStatHandle FTM_RECALCULATE_SKYVALUES("Recalculate Sky"); +static LLTrace::BlockTimerStatHandle FTM_RECALCULATE_BODIES("Recalculate Heavenly Bodies"); +static LLTrace::BlockTimerStatHandle FTM_RECALCULATE_LIGHTING("Recalculate Lighting"); + //========================================================================= const std::string LLSettingsSky::SETTING_AMBIENT("ambient"); const std::string LLSettingsSky::SETTING_BLUE_DENSITY("blue_density"); @@ -784,6 +788,8 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) void LLSettingsSky::updateSettings() { + LL_RECORD_BLOCK_TIME(FTM_RECALCULATE_SKYVALUES); + mPositionsDirty |= isVeryDirty(); mLightingDirty |= isVeryDirty(); @@ -811,29 +817,31 @@ bool LLSettingsSky::getIsMoonUp() const void LLSettingsSky::calculateHeavenlyBodyPositions() const { - /* can't do this as it gets defeated during animation of env panel settings if (!mPositionsDirty) { return; - }*/ + } + { + LL_RECORD_BLOCK_TIME(FTM_RECALCULATE_BODIES); - mPositionsDirty = false; - mLightingDirty = true; // changes light direction + mPositionsDirty = false; + mLightingDirty = true; // changes light direction - LLQuaternion sunq = getSunRotation(); - LLQuaternion moonq = getMoonRotation(); + LLQuaternion sunq = getSunRotation(); + LLQuaternion moonq = getMoonRotation(); - mSunDirection = DUE_EAST * sunq; - mMoonDirection = DUE_EAST * moonq; + mSunDirection = DUE_EAST * sunq; + mMoonDirection = DUE_EAST * moonq; - mSunDirection.normalize(); - mMoonDirection.normalize(); + mSunDirection.normalize(); + mMoonDirection.normalize(); - LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL; - LL_WARNS("LAPRAS") << "Moon info: Rotation=" << moonq << " Vector=" << mMoonDirection << LL_ENDL; + LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL; + LL_WARNS("LAPRAS") << "Moon info: Rotation=" << moonq << " Vector=" << mMoonDirection << LL_ENDL; - llassert(mSunDirection.lengthSquared() > 0.0); - llassert(mMoonDirection.lengthSquared() > 0.0); + llassert(mSunDirection.lengthSquared() > 0.0); + llassert(mMoonDirection.lengthSquared() > 0.0); + } } LLVector3 LLSettingsSky::getLightDirection() const @@ -1037,51 +1045,52 @@ LLColor4 LLSettingsSky::getTotalAmbient() const void LLSettingsSky::calculateLightSettings() const { - /* can't do this as it gets defeated during animation of env panel settings if (!mLightingDirty) { return; } - calculateHeavenlyBodyPositions();*/ + { + LL_RECORD_BLOCK_TIME(FTM_RECALCULATE_LIGHTING); - mLightingDirty = false; + mLightingDirty = false; - // Initialize temp variables - LLColor3 sunlight = getSunlightColor(); - LLColor3 ambient = getAmbientColor(); - F32 cloud_shadow = getCloudShadow(); - LLVector3 lightnorm = getLightDirection(); + // Initialize temp variables + LLColor3 sunlight = getSunlightColor(); + LLColor3 ambient = getAmbientColor(); + F32 cloud_shadow = getCloudShadow(); + LLVector3 lightnorm = getLightDirection(); - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes - F32 max_y = getMaxY(); - LLColor3 light_atten = getLightAttenuation(max_y); - LLColor3 light_transmittance = getLightTransmittance(); + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes + F32 max_y = getMaxY(); + LLColor3 light_atten = getLightAttenuation(max_y); + LLColor3 light_transmittance = getLightTransmittance(); - // and vary_sunlight will work properly with moon light - F32 lighty = lightnorm[1]; + // and vary_sunlight will work properly with moon light + F32 lighty = lightnorm[1]; - lighty = llmax(0.f, lighty); - if(lighty > 0.f) - { - lighty = 1.f / lighty; - } - componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); + lighty = llmax(0.f, lighty); + if (lighty > 0.f) + { + lighty = 1.f / lighty; + } + componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); - //increase ambient when there are more clouds - LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; + //increase ambient when there are more clouds + LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; - //brightness of surface both sunlight and ambient - mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); - mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); + //brightness of surface both sunlight and ambient + mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); + mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); - mMoonDiffuse = gammaCorrect(componentMult(LLColor3::white, light_transmittance)); - mMoonAmbient = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.5f); - mTotalAmbient = mSunAmbient; + mMoonDiffuse = gammaCorrect(componentMult(LLColor3::white, light_transmittance)); + mMoonAmbient = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.5f); + mTotalAmbient = mSunAmbient; - mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; - mFadeColor.setAlpha(0); + mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; + mFadeColor.setAlpha(0); + } } LLUUID LLSettingsSky::GetDefaultAssetId() -- cgit v1.2.3 From a0598b12656cdcf22ba95cacd01b5ff36f8f1b26 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 11 Jun 2018 17:46:16 +0100 Subject: Fix water fog consolidation in underwater shaders. Add plumbing facilities to allow current and next moon textures to be passed to moon shader. Modify moon shader to blend between current and next moon textures by blend factor. --- indra/llinventory/llsettingssky.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 4763215cff..38574c4ef8 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -602,8 +602,8 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; 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_MOON_TEXTUREID] = GetDefaultMoonTextureId(); + dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); dfltsetting[SETTING_TYPE] = "sky"; @@ -1053,3 +1053,13 @@ LLUUID LLSettingsSky::GetDefaultAssetId() { return DEFAULT_ASSET_ID; } + +LLUUID LLSettingsSky::GetDefaultSunTextureId() +{ + return DEFAULT_SUN_ID; +} + +LLUUID LLSettingsSky::GetDefaultMoonTextureId() +{ + return DEFAULT_MOON_ID; +} -- cgit v1.2.3 From fc8d0de673da0e02915556008a365aca67472eba Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 11 Jun 2018 22:39:57 +0100 Subject: Make cloud rendering use textures defined in sky settings and add code to shaders to lerp between current and next cloud texture. --- indra/llinventory/llsettingssky.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 38574c4ef8..8034ce8f7d 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,6 +32,8 @@ #include "llfasttimer.h" #include "v3colorutil.h" +#pragma optimize("", off) + static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); static const LLVector3 DUE_EAST = LLVector3::x_axis; @@ -601,7 +603,7 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; - dfltsetting[SETTING_CLOUD_TEXTUREID] = DEFAULT_CLOUD_ID; + dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId(); dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); @@ -1063,3 +1065,13 @@ LLUUID LLSettingsSky::GetDefaultMoonTextureId() { return DEFAULT_MOON_ID; } + +LLUUID LLSettingsSky::GetDefaultCloudNoiseTextureId() +{ + return DEFAULT_CLOUD_ID; +} + +void LLSettingsSky::setMoonRotation(const LLQuaternion &val) +{ + setValue(SETTING_MOON_ROTATION, val); +} -- cgit v1.2.3 From 327ded51298599a0057c4a3baf388956ecfed2e5 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 11 Jun 2018 22:42:10 +0100 Subject: Remove debug pragma and put setMoonRotation back in the header file. --- indra/llinventory/llsettingssky.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 8034ce8f7d..f02500d61b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,8 +32,6 @@ #include "llfasttimer.h" #include "v3colorutil.h" -#pragma optimize("", off) - static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); static const LLVector3 DUE_EAST = LLVector3::x_axis; @@ -1070,8 +1068,3 @@ LLUUID LLSettingsSky::GetDefaultCloudNoiseTextureId() { return DEFAULT_CLOUD_ID; } - -void LLSettingsSky::setMoonRotation(const LLQuaternion &val) -{ - setValue(SETTING_MOON_ROTATION, val); -} -- cgit v1.2.3 From 67ab0084f87c40bf31d7fadded55cc9ea6299ca2 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 12 Jun 2018 18:42:07 +0100 Subject: Fix env panel forward action. Make env panel update environment when jumping frame to frame. Add separate funcs for sun/moon vectors in various coord systems. Make haze glow only pay attention to sun (i.e. fix sun glow when moon is near horizon in daytime). --- indra/llinventory/llsettingssky.cpp | 299 ++++++++++++++++++++++++++++++++++-- 1 file changed, 285 insertions(+), 14 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index f02500d61b..bb310806bd 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -386,6 +386,9 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); + mPositionsDirty = true; + mLightingDirty = true; + setBlendFactor(blendf); mNextSunTextureId = other->getSunTextureId(); mNextMoonTextureId = other->getMoonTextureId(); @@ -771,11 +774,14 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) void LLSettingsSky::updateSettings() { - mPositionsDirty = isDirty(); - mLightingDirty = isDirty(); - // base class clears dirty flag so as to not trigger recursive update LLSettingsBase::updateSettings(); + + // NOTE: these functions are designed to do nothing unless a dirty bit has been set + // so if you add new settings that are referenced by these update functions, + // you'll need to insure that your setter updates the dirty bits as well + calculateHeavenlyBodyPositions(); + calculateLightSettings(); } bool LLSettingsSky::getIsSunUp() const @@ -792,10 +798,11 @@ bool LLSettingsSky::getIsMoonUp() const void LLSettingsSky::calculateHeavenlyBodyPositions() const { + /* can't do this as it gets defeated during animation of env panel settings if (!mPositionsDirty) { return; - } + }*/ mPositionsDirty = false; @@ -811,7 +818,7 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const LLVector3 LLSettingsSky::getLightDirection() const { - calculateHeavenlyBodyPositions(); + update(); // is the normal from the sun or the moon if (getIsSunUp()) @@ -955,60 +962,61 @@ LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const LLVector3 LLSettingsSky::getSunDirection() const { - calculateHeavenlyBodyPositions(); + update(); return mSunDirection; } LLVector3 LLSettingsSky::getMoonDirection() const { - calculateHeavenlyBodyPositions(); + update(); return mMoonDirection; } LLColor4U LLSettingsSky::getFadeColor() const { - calculateLightSettings(); + update(); return mFadeColor; } LLColor4 LLSettingsSky::getMoonAmbient() const { - calculateLightSettings(); + update(); return mMoonAmbient; } LLColor3 LLSettingsSky::getMoonDiffuse() const { - calculateLightSettings(); + update(); return mMoonDiffuse; } LLColor4 LLSettingsSky::getSunAmbient() const { - calculateLightSettings(); + update(); return mSunAmbient; } LLColor3 LLSettingsSky::getSunDiffuse() const { - calculateLightSettings(); + update(); return mSunDiffuse; } LLColor4 LLSettingsSky::getTotalAmbient() const { - calculateLightSettings(); + update(); return mTotalAmbient; } void LLSettingsSky::calculateLightSettings() const { + /* can't do this as it gets defeated during animation of env panel settings if (!mLightingDirty) { return; } - calculateHeavenlyBodyPositions(); + calculateHeavenlyBodyPositions();*/ mLightingDirty = false; @@ -1068,3 +1076,266 @@ LLUUID LLSettingsSky::GetDefaultCloudNoiseTextureId() { return DEFAULT_CLOUD_ID; } + +F32 LLSettingsSky::getPlanetRadius() const +{ + return mSettings[SETTING_PLANET_RADIUS].asReal(); +} + +F32 LLSettingsSky::getSkyBottomRadius() const +{ + return mSettings[SETTING_SKY_BOTTOM_RADIUS].asReal(); +} + +F32 LLSettingsSky::getSkyTopRadius() const +{ + return mSettings[SETTING_SKY_TOP_RADIUS].asReal(); +} + +F32 LLSettingsSky::getSunArcRadians() const +{ + return mSettings[SETTING_SUN_ARC_RADIANS].asReal(); +} + +F32 LLSettingsSky::getMieAnisotropy() const +{ + return mSettings[SETTING_MIE_ANISOTROPY_FACTOR].asReal(); +} + +LLSD LLSettingsSky::getRayleighConfigs() const +{ + return mSettings[SETTING_RAYLEIGH_CONFIG]; +} + +LLSD LLSettingsSky::getMieConfigs() const +{ + return mSettings[SETTING_MIE_CONFIG]; +} + +LLSD LLSettingsSky::getAbsorptionConfigs() const +{ + return mSettings[SETTING_ABSORPTION_CONFIG]; +} + +LLUUID LLSettingsSky::getBloomTextureId() const +{ + return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); +} + +//--------------------------------------------------------------------- +LLColor3 LLSettingsSky::getAmbientColor() const +{ + return LLColor3(mSettings[SETTING_AMBIENT]); +} + +void LLSettingsSky::setAmbientColor(const LLColor3 &val) +{ + setValue(SETTING_AMBIENT, val); + mLightingDirty = true; +} + +LLColor3 LLSettingsSky::getCloudColor() const +{ + return LLColor3(mSettings[SETTING_CLOUD_COLOR]); +} + +void LLSettingsSky::setCloudColor(const LLColor3 &val) +{ + setValue(SETTING_CLOUD_COLOR, val); +} + +LLUUID LLSettingsSky::getCloudNoiseTextureId() const +{ + return mSettings[SETTING_CLOUD_TEXTUREID].asUUID(); +} + +void LLSettingsSky::setCloudNoiseTextureId(const LLUUID &id) +{ + setValue(SETTING_CLOUD_TEXTUREID, id); +} + +LLColor3 LLSettingsSky::getCloudPosDensity1() const +{ + return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY1]); +} + +void LLSettingsSky::setCloudPosDensity1(const LLColor3 &val) +{ + setValue(SETTING_CLOUD_POS_DENSITY1, val); +} + +LLColor3 LLSettingsSky::getCloudPosDensity2() const +{ + return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY2]); +} + +void LLSettingsSky::setCloudPosDensity2(const LLColor3 &val) +{ + setValue(SETTING_CLOUD_POS_DENSITY2, val); +} + +F32 LLSettingsSky::getCloudScale() const +{ + return mSettings[SETTING_CLOUD_SCALE].asReal(); +} + +void LLSettingsSky::setCloudScale(F32 val) +{ + setValue(SETTING_CLOUD_SCALE, val); +} + +LLVector2 LLSettingsSky::getCloudScrollRate() const +{ + return LLVector2(mSettings[SETTING_CLOUD_SCROLL_RATE]); +} + +void LLSettingsSky::setCloudScrollRate(const LLVector2 &val) +{ + setValue(SETTING_CLOUD_SCROLL_RATE, val); +} + +void LLSettingsSky::setCloudScrollRateX(F32 val) +{ + mSettings[SETTING_CLOUD_SCROLL_RATE][0] = val; + setDirtyFlag(true); +} + +void LLSettingsSky::setCloudScrollRateY(F32 val) +{ + mSettings[SETTING_CLOUD_SCROLL_RATE][1] = val; + setDirtyFlag(true); +} + +F32 LLSettingsSky::getCloudShadow() const +{ + return mSettings[SETTING_CLOUD_SHADOW].asReal(); +} + +void LLSettingsSky::setCloudShadow(F32 val) +{ + setValue(SETTING_CLOUD_SHADOW, val); + mLightingDirty = true; +} + +F32 LLSettingsSky::getDomeOffset() const +{ + //return mSettings[SETTING_DOME_OFFSET].asReal(); + return DOME_OFFSET; +} + +F32 LLSettingsSky::getDomeRadius() const +{ + //return mSettings[SETTING_DOME_RADIUS].asReal(); + return DOME_RADIUS; +} + +F32 LLSettingsSky::getGamma() const +{ + return mSettings[SETTING_GAMMA].asReal(); +} + +void LLSettingsSky::setGamma(F32 val) +{ + mSettings[SETTING_GAMMA] = LLSD::Real(val); + setDirtyFlag(true); + mLightingDirty = true; +} + +LLColor3 LLSettingsSky::getGlow() const +{ + return LLColor3(mSettings[SETTING_GLOW]); +} + +void LLSettingsSky::setGlow(const LLColor3 &val) +{ + setValue(SETTING_GLOW, val); + mLightingDirty = true; +} + +F32 LLSettingsSky::getMaxY() const +{ + return mSettings[SETTING_MAX_Y].asReal(); +} + +void LLSettingsSky::setMaxY(F32 val) +{ + setValue(SETTING_MAX_Y, val); +} + +LLQuaternion LLSettingsSky::getMoonRotation() const +{ + return LLQuaternion(mSettings[SETTING_MOON_ROTATION]); +} + +void LLSettingsSky::setMoonRotation(const LLQuaternion &val) +{ + setValue(SETTING_MOON_ROTATION, val); + mPositionsDirty = true; +} + +LLUUID LLSettingsSky::getMoonTextureId() const +{ + return mSettings[SETTING_MOON_TEXTUREID].asUUID(); +} + +void LLSettingsSky::setMoonTextureId(LLUUID id) +{ + setValue(SETTING_MOON_TEXTUREID, id); +} + +F32 LLSettingsSky::getStarBrightness() const +{ + return mSettings[SETTING_STAR_BRIGHTNESS].asReal(); +} + +void LLSettingsSky::setStarBrightness(F32 val) +{ + setValue(SETTING_STAR_BRIGHTNESS, val); +} + +LLColor3 LLSettingsSky::getSunlightColor() const +{ + return LLColor3(mSettings[SETTING_SUNLIGHT_COLOR]); +} + +void LLSettingsSky::setSunlightColor(const LLColor3 &val) +{ + setValue(SETTING_SUNLIGHT_COLOR, val); + mLightingDirty = true; +} + +LLQuaternion LLSettingsSky::getSunRotation() const +{ + return LLQuaternion(mSettings[SETTING_SUN_ROTATION]); +} + +void LLSettingsSky::setSunRotation(const LLQuaternion &val) +{ + setValue(SETTING_SUN_ROTATION, val); + mPositionsDirty = true; +} + +LLUUID LLSettingsSky::getSunTextureId() const +{ + return mSettings[SETTING_SUN_TEXTUREID].asUUID(); +} + +void LLSettingsSky::setSunTextureId(LLUUID id) +{ + setValue(SETTING_SUN_TEXTUREID, id); +} + +LLUUID LLSettingsSky::getNextSunTextureId() const +{ + return mNextSunTextureId; +} + +LLUUID LLSettingsSky::getNextMoonTextureId() const +{ + return mNextMoonTextureId; +} + +LLUUID LLSettingsSky::getNextCloudNoiseTextureId() const +{ + return mNextCloudTextureId; +} -- cgit v1.2.3 From 2add1e7abdf536b32bfbfa4b353189782df8cb19 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 12 Jun 2018 12:39:59 -0700 Subject: Time threshold on timer based updates. Editor can replace frame with one from inventory. Extra check on adding a frame type. --- indra/llinventory/llsettingssky.cpp | 81 +++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 31 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 38574c4ef8..87581e813b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,25 +32,24 @@ #include "llfasttimer.h" #include "v3colorutil.h" -static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees -static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); -static const LLVector3 DUE_EAST = LLVector3::x_axis; //========================================================================= namespace { LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment"); LLTrace::BlockTimerStatHandle FTM_UPDATE_SKYVALUES("Update Sky Environment"); -} -static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) -{ - LLQuaternion quat; - quat.setEulerAngles(0.0f, -altitude, azimuth); - return quat; -} + const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees + const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); + const LLVector3 DUE_EAST = LLVector3::x_axis; -const F32 LLSettingsSky::DOME_OFFSET(0.96f); -const F32 LLSettingsSky::DOME_RADIUS(15000.f); + LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) + { + LLQuaternion quat; + quat.setEulerAngles(0.0f, -altitude, azimuth); + return quat; + } + +} //========================================================================= const std::string LLSettingsSky::SETTING_AMBIENT("ambient"); @@ -114,6 +113,9 @@ static const LLUUID DEFAULT_ASSET_ID("cec9af47-90d4-9093-5245-397e5c9e7749"); const std::string LLSettingsSky::SETTING_LEGACY_HAZE("legacy_haze"); +const F32 LLSettingsSky::DOME_OFFSET(0.96f); +const F32 LLSettingsSky::DOME_RADIUS(15000.f); + namespace { @@ -771,11 +773,14 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) void LLSettingsSky::updateSettings() { - mPositionsDirty = isDirty(); - mLightingDirty = isDirty(); + mPositionsDirty |= isVeryDirty(); + mLightingDirty |= isVeryDirty(); // base class clears dirty flag so as to not trigger recursive update LLSettingsBase::updateSettings(); + + calculateHeavenlyBodyPositions(); + calculateLightSettings(); } bool LLSettingsSky::getIsSunUp() const @@ -798,6 +803,7 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const } mPositionsDirty = false; + mLightingDirty = true; // changes light direction LLQuaternion sunq = getSunRotation(); LLQuaternion moonq = getMoonRotation(); @@ -807,21 +813,27 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const mSunDirection.normalize(); mMoonDirection.normalize(); + + LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL; + LL_WARNS("LAPRAS") << "Moon info: Rotation=" << moonq << " Vector=" << mMoonDirection << LL_ENDL; + + llassert(mSunDirection.lengthSquared() > 0.0); + llassert(mMoonDirection.lengthSquared() > 0.0); } LLVector3 LLSettingsSky::getLightDirection() const { - calculateHeavenlyBodyPositions(); + update(); // is the normal from the sun or the moon if (getIsSunUp()) { - llassert(mSunDirection.length() > 0.01f); + llassert(mSunDirection.lengthSquared() > 0.01f); return mSunDirection; } else if (getIsMoonUp()) { - llassert(mMoonDirection.length() > 0.01f); + llassert(mMoonDirection.lengthSquared() > 0.01f); return mMoonDirection; } @@ -885,36 +897,43 @@ F32 LLSettingsSky::getDistanceMultiplier() const void LLSettingsSky::setBlueDensity(const LLColor3 &val) { mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_DENSITY] = val.getValue(); - markDirty(); + setDirtyFlag(true); + mLightingDirty = true; } void LLSettingsSky::setBlueHorizon(const LLColor3 &val) { mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_HORIZON] = val.getValue(); - markDirty(); + setDirtyFlag(true); + mLightingDirty = true; } void LLSettingsSky::setDensityMultiplier(F32 val) { mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER] = val; - markDirty(); + setDirtyFlag(true); + mLightingDirty = true; } void LLSettingsSky::setDistanceMultiplier(F32 val) { mSettings[SETTING_LEGACY_HAZE][SETTING_DISTANCE_MULTIPLIER] = val; - markDirty(); + setDirtyFlag(true); + mLightingDirty = true; } void LLSettingsSky::setHazeDensity(F32 val) { mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_DENSITY] = val; - markDirty(); + setDirtyFlag(true); + mLightingDirty = true; } + void LLSettingsSky::setHazeHorizon(F32 val) { mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_HORIZON] = val; - markDirty(); + setDirtyFlag(true); + mLightingDirty = true; } // Sunlight attenuation effect (hue and brightness) due to atmosphere @@ -955,49 +974,49 @@ LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const LLVector3 LLSettingsSky::getSunDirection() const { - calculateHeavenlyBodyPositions(); + update(); return mSunDirection; } LLVector3 LLSettingsSky::getMoonDirection() const { - calculateHeavenlyBodyPositions(); + update(); return mMoonDirection; } LLColor4U LLSettingsSky::getFadeColor() const { - calculateLightSettings(); + update(); return mFadeColor; } LLColor4 LLSettingsSky::getMoonAmbient() const { - calculateLightSettings(); + update(); return mMoonAmbient; } LLColor3 LLSettingsSky::getMoonDiffuse() const { - calculateLightSettings(); + update(); return mMoonDiffuse; } LLColor4 LLSettingsSky::getSunAmbient() const { - calculateLightSettings(); + update(); return mSunAmbient; } LLColor3 LLSettingsSky::getSunDiffuse() const { - calculateLightSettings(); + update(); return mSunDiffuse; } LLColor4 LLSettingsSky::getTotalAmbient() const { - calculateLightSettings(); + update(); return mTotalAmbient; } -- cgit v1.2.3 From 34865c4bb5cd12219606f44748159fe7cbeea264 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 13 Jun 2018 00:51:39 +0100 Subject: Mods to hook up water settings to water normals for rendering with support for current to next blending. Modify LLSettingsFoo::buildDefaultFoo to use a static and avoid re-validation of default sky/water/daycycle settings. Remove all references to gSun/MoonTextureId globals (they should come from sky settings now). --- indra/llinventory/llsettingssky.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index db574f2eec..c25f9a5b2c 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -382,8 +382,16 @@ LLSettingsSky::LLSettingsSky(): { } +void LLSettingsSky::replaceSettings(LLSD settings) +{ + LLSettingsBase::replaceSettings(settings); + +} + void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { + llassert(getSettingsType() == end->getSettingsType()); + LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast(end); LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); -- cgit v1.2.3 From 66d78ce1c73d5da3bc5bc39fe0196a9f82040105 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 15 Jun 2018 21:15:02 +0100 Subject: Make water and sky defaults take a position value to allow for default daycycle w/ multiple frames. Make default daycycle add 8 frames at 0, 0.125, 0.25 etc Merge over server-side bugfixes. Eliminate extraneous dirty bits in sky settings. --- indra/llinventory/llsettingssky.cpp | 68 ++++++++----------------------------- 1 file changed, 15 insertions(+), 53 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index c25f9a5b2c..83499cc9fc 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -366,9 +366,7 @@ LLSettingsSky::LLSettingsSky(const LLSD &data) : LLSettingsBase(data), mNextSunTextureId(), mNextMoonTextureId(), - mNextCloudTextureId(), - mPositionsDirty(true), - mLightingDirty(true) + mNextCloudTextureId() { } @@ -376,9 +374,7 @@ LLSettingsSky::LLSettingsSky(): LLSettingsBase(), mNextSunTextureId(), mNextMoonTextureId(), - mNextCloudTextureId(), - mPositionsDirty(true), - mLightingDirty(true) + mNextCloudTextureId() { } @@ -396,9 +392,7 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); - mPositionsDirty = true; - mLightingDirty = true; - + setBlendFactor(blendf); mNextSunTextureId = other->getSunTextureId(); mNextMoonTextureId = other->getMoonTextureId(); @@ -585,14 +579,19 @@ LLSD LLSettingsSky::mieConfigDefault() return dflt_mie; } -LLSD LLSettingsSky::defaults() +LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) { LLSD dfltsetting; LLQuaternion sunquat; LLQuaternion moonquat; - sunquat = convert_azimuth_and_altitude_to_quat(0.0f, 80.0f * DEG_TO_RAD); - moonquat = convert_azimuth_and_altitude_to_quat(F_PI, 80.0f * DEG_TO_RAD); + F32 azimuth = (F_PI * position) + (80.0f * DEG_TO_RAD); + F32 altitude = (F_PI * position); + + // give the sun and moon slightly different tracks through the sky + // instead of positioning them at opposite poles from each other... + sunquat = convert_azimuth_and_altitude_to_quat(altitude, azimuth); + moonquat = convert_azimuth_and_altitude_to_quat(altitude + (F_PI * 0.125f), azimuth + (F_PI * 0.125f)); // Magic constants copied form dfltsetting.xml dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); @@ -784,9 +783,6 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) void LLSettingsSky::updateSettings() { - mPositionsDirty |= isVeryDirty(); - mLightingDirty |= isVeryDirty(); - // base class clears dirty flag so as to not trigger recursive update LLSettingsBase::updateSettings(); @@ -811,15 +807,6 @@ bool LLSettingsSky::getIsMoonUp() const void LLSettingsSky::calculateHeavenlyBodyPositions() const { - /* can't do this as it gets defeated during animation of env panel settings - if (!mPositionsDirty) - { - return; - }*/ - - mPositionsDirty = false; - mLightingDirty = true; // changes light direction - LLQuaternion sunq = getSunRotation(); LLQuaternion moonq = getMoonRotation(); @@ -829,11 +816,11 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const mSunDirection.normalize(); mMoonDirection.normalize(); - LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL; - LL_WARNS("LAPRAS") << "Moon info: Rotation=" << moonq << " Vector=" << mMoonDirection << LL_ENDL; + //LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL; + //LL_WARNS("LAPRAS") << "Moon info: Rotation=" << moonq << " Vector=" << mMoonDirection << LL_ENDL; - llassert(mSunDirection.lengthSquared() > 0.0); - llassert(mMoonDirection.lengthSquared() > 0.0); + llassert(mSunDirection.lengthSquared() > 0.01f); + llassert(mMoonDirection.lengthSquared() > 0.01f); } LLVector3 LLSettingsSky::getLightDirection() const @@ -843,12 +830,10 @@ LLVector3 LLSettingsSky::getLightDirection() const // is the normal from the sun or the moon if (getIsSunUp()) { - llassert(mSunDirection.lengthSquared() > 0.01f); return mSunDirection; } else if (getIsMoonUp()) { - llassert(mMoonDirection.lengthSquared() > 0.01f); return mMoonDirection; } @@ -913,42 +898,36 @@ void LLSettingsSky::setBlueDensity(const LLColor3 &val) { mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_DENSITY] = val.getValue(); setDirtyFlag(true); - mLightingDirty = true; } void LLSettingsSky::setBlueHorizon(const LLColor3 &val) { mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_HORIZON] = val.getValue(); setDirtyFlag(true); - mLightingDirty = true; } void LLSettingsSky::setDensityMultiplier(F32 val) { mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER] = val; setDirtyFlag(true); - mLightingDirty = true; } void LLSettingsSky::setDistanceMultiplier(F32 val) { mSettings[SETTING_LEGACY_HAZE][SETTING_DISTANCE_MULTIPLIER] = val; setDirtyFlag(true); - mLightingDirty = true; } void LLSettingsSky::setHazeDensity(F32 val) { mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_DENSITY] = val; setDirtyFlag(true); - mLightingDirty = true; } void LLSettingsSky::setHazeHorizon(F32 val) { mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_HORIZON] = val; setDirtyFlag(true); - mLightingDirty = true; } // Sunlight attenuation effect (hue and brightness) due to atmosphere @@ -1037,16 +1016,6 @@ LLColor4 LLSettingsSky::getTotalAmbient() const void LLSettingsSky::calculateLightSettings() const { - /* can't do this as it gets defeated during animation of env panel settings - if (!mLightingDirty) - { - return; - } - - calculateHeavenlyBodyPositions();*/ - - mLightingDirty = false; - // Initialize temp variables LLColor3 sunlight = getSunlightColor(); LLColor3 ambient = getAmbientColor(); @@ -1158,7 +1127,6 @@ LLColor3 LLSettingsSky::getAmbientColor() const void LLSettingsSky::setAmbientColor(const LLColor3 &val) { setValue(SETTING_AMBIENT, val); - mLightingDirty = true; } LLColor3 LLSettingsSky::getCloudColor() const @@ -1241,7 +1209,6 @@ F32 LLSettingsSky::getCloudShadow() const void LLSettingsSky::setCloudShadow(F32 val) { setValue(SETTING_CLOUD_SHADOW, val); - mLightingDirty = true; } F32 LLSettingsSky::getDomeOffset() const @@ -1265,7 +1232,6 @@ void LLSettingsSky::setGamma(F32 val) { mSettings[SETTING_GAMMA] = LLSD::Real(val); setDirtyFlag(true); - mLightingDirty = true; } LLColor3 LLSettingsSky::getGlow() const @@ -1276,7 +1242,6 @@ LLColor3 LLSettingsSky::getGlow() const void LLSettingsSky::setGlow(const LLColor3 &val) { setValue(SETTING_GLOW, val); - mLightingDirty = true; } F32 LLSettingsSky::getMaxY() const @@ -1297,7 +1262,6 @@ LLQuaternion LLSettingsSky::getMoonRotation() const void LLSettingsSky::setMoonRotation(const LLQuaternion &val) { setValue(SETTING_MOON_ROTATION, val); - mPositionsDirty = true; } LLUUID LLSettingsSky::getMoonTextureId() const @@ -1328,7 +1292,6 @@ LLColor3 LLSettingsSky::getSunlightColor() const void LLSettingsSky::setSunlightColor(const LLColor3 &val) { setValue(SETTING_SUNLIGHT_COLOR, val); - mLightingDirty = true; } LLQuaternion LLSettingsSky::getSunRotation() const @@ -1339,7 +1302,6 @@ LLQuaternion LLSettingsSky::getSunRotation() const void LLSettingsSky::setSunRotation(const LLQuaternion &val) { setValue(SETTING_SUN_ROTATION, val); - mPositionsDirty = true; } LLUUID LLSettingsSky::getSunTextureId() const -- cgit v1.2.3 From 91121d113d25af570ec64564dd10c21f0d5fcb69 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 21 Jun 2018 18:37:00 +0100 Subject: Merge server side bugfixes over. --- indra/llinventory/llsettingssky.cpp | 39 ++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 83499cc9fc..3f2d55d79d 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -37,20 +37,21 @@ namespace { LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment"); LLTrace::BlockTimerStatHandle FTM_UPDATE_SKYVALUES("Update Sky Environment"); +} - const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees - const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); - const LLVector3 DUE_EAST = LLVector3::x_axis; - - LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) - { - LLQuaternion quat; - quat.setEulerAngles(0.0f, -altitude, azimuth); - return quat; - } +static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees +static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); +static const LLVector3 DUE_EAST = LLVector3::x_axis; +static const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); +static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) +{ + LLQuaternion quat; + quat.setEulerAngles(0.0f, -altitude, azimuth); + return quat; } + //========================================================================= const std::string LLSettingsSky::SETTING_AMBIENT("ambient"); const std::string LLSettingsSky::SETTING_BLUE_DENSITY("blue_density"); @@ -389,14 +390,20 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) llassert(getSettingsType() == end->getSettingsType()); LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast(end); - LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); + if (other) + { + LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); + replaceSettings(blenddata); + mNextSunTextureId = other->getSunTextureId(); + mNextMoonTextureId = other->getMoonTextureId(); + mNextCloudTextureId = other->getCloudNoiseTextureId(); + } + else + { + LL_WARNS("SETTINGS") << "Could not cast end settings to sky. No blend performed." << LL_ENDL; + } - replaceSettings(blenddata); - setBlendFactor(blendf); - mNextSunTextureId = other->getSunTextureId(); - mNextMoonTextureId = other->getMoonTextureId(); - mNextCloudTextureId = other->getCloudNoiseTextureId(); } LLSettingsSky::stringset_t LLSettingsSky::getSkipInterpolateKeys() const -- cgit v1.2.3 From 52b946fd09196989e34afd7226a82060c4f8d831 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 21 Jun 2018 21:25:15 +0100 Subject: Fix double-def of IMG_BLOOM1 from pulling over server change not needed in viewer code. Make viewer code use LLSettingsSky static func to hide indraconstants dep. --- indra/llinventory/llsettingssky.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 48ca79282e..6f1520bdfa 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -33,13 +33,9 @@ #include "v3colorutil.h" //========================================================================= -namespace -{ - static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); static const LLVector3 DUE_EAST = LLVector3::x_axis; -static const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) { @@ -1083,6 +1079,11 @@ LLUUID LLSettingsSky::GetDefaultCloudNoiseTextureId() return DEFAULT_CLOUD_ID; } +LLUUID LLSettingsSky::GetDefaultBloomTextureId() +{ + return IMG_BLOOM1; +} + F32 LLSettingsSky::getPlanetRadius() const { return mSettings[SETTING_PLANET_RADIUS].asReal(); -- cgit v1.2.3 From a02b3500b9979c10336eb13674279b3c07367445 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 22 Jun 2018 00:41:19 +0100 Subject: Make LLSettingsFoo::defaults() funcs only calculate the invariant values once (use static trick ala the validations). Fix conversion of legacy settings w/ non-zero east angles to account for those values being CW radian angles. --- indra/llinventory/llsettingssky.cpp | 108 ++++++++++++++++++++---------------- 1 file changed, 59 insertions(+), 49 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 6f1520bdfa..bf0115b80b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -40,7 +40,7 @@ static const LLVector3 DUE_EAST = LLVector3::x_axis; static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) { LLQuaternion quat; - quat.setEulerAngles(0.0f, -altitude, azimuth); + quat.setEulerAngles(0.0f, altitude, azimuth); return quat; } @@ -585,53 +585,57 @@ LLSD LLSettingsSky::mieConfigDefault() LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) { - LLSD dfltsetting; - LLQuaternion sunquat; - LLQuaternion moonquat; - - F32 azimuth = (F_PI * position) + (80.0f * DEG_TO_RAD); - F32 altitude = (F_PI * position); - - // give the sun and moon slightly different tracks through the sky - // instead of positioning them at opposite poles from each other... - sunquat = convert_azimuth_and_altitude_to_quat(altitude, azimuth); - moonquat = convert_azimuth_and_altitude_to_quat(altitude + (F_PI * 0.125f), azimuth + (F_PI * 0.125f)); - - // Magic constants copied form dfltsetting.xml - dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); - dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); - dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); - dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199); - dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(10.1999)(10.0109); - dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699); + static LLSD dfltsetting; + + if (dfltsetting.size() == 0) + { + LLQuaternion sunquat; + LLQuaternion moonquat; + + F32 azimuth = (F_PI * position) + (80.0f * DEG_TO_RAD); + F32 altitude = (F_PI * position); + + // give the sun and moon slightly different tracks through the sky + // instead of positioning them at opposite poles from each other... + sunquat = convert_azimuth_and_altitude_to_quat(altitude, azimuth); + moonquat = convert_azimuth_and_altitude_to_quat(altitude + (F_PI * 0.125f), azimuth + (F_PI * 0.125f)); + + // Magic constants copied form dfltsetting.xml + dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); + dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); + dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); + dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199); + dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(10.1999)(10.0109); + dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699); - dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f); - dfltsetting[SETTING_DOME_RADIUS] = LLSD::Real(15000.f); - dfltsetting[SETTING_GAMMA] = LLSD::Real(1.0); - dfltsetting[SETTING_GLOW] = LLColor4(5.000, 0.0010, -0.4799, 1.0).getValue(); + dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f); + dfltsetting[SETTING_DOME_RADIUS] = LLSD::Real(15000.f); + dfltsetting[SETTING_GAMMA] = LLSD::Real(1.0); + dfltsetting[SETTING_GLOW] = LLColor4(5.000, 0.0010, -0.4799, 1.0).getValue(); - dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); - dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); - dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(0.0000); - dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); - dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); - - dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; - dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId(); - dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); - dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); - - dfltsetting[SETTING_TYPE] = "sky"; - - // defaults are for earth... - dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; - dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; - dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; - dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; - - dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); - dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); - dfltsetting[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); + dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); + dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); + dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(0.0000); + dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); + dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); + + dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; + dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId(); + dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); + dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); + + dfltsetting[SETTING_TYPE] = "sky"; + + // defaults are for earth... + dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; + dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; + + dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); + dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); + dfltsetting[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); + } return dfltsetting; } @@ -769,11 +773,17 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) if (legacy.has(SETTING_LEGACY_EAST_ANGLE) && legacy.has(SETTING_LEGACY_SUN_ANGLE)) { // convert the east and sun angles into a quaternion. - F32 azimuth = legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); - F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal(); + F32 two_pi = F_PI * 2.0f; + + // get counter-clockwise radian angle from clockwise legacy WL east angle... + F32 azimuth = two_pi - legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); + F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal(); + LLQuaternion sunquat = convert_azimuth_and_altitude_to_quat(azimuth, altitude); - LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, altitude); + + // original WL moon dir was diametrically opposed to the sun dir + LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, -altitude); //LLVector3 sundir = DUE_EAST * sunquat; //LLVector3 moondir = DUE_EAST * moonquat; -- cgit v1.2.3 From 8b2d5cb6867657e98e1fd1c9e4f209e952c59474 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 25 Jun 2018 19:06:48 +0100 Subject: Better method for deriving sun/moon quaternions from east/sun angle defs in legacy sky settings XML. Avoid using static const DUE_EAST due to CRT init order issues w/ GCC. --- indra/llinventory/llsettingssky.cpp | 46 +++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 15 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index bf0115b80b..b1868fb50e 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -35,12 +35,29 @@ //========================================================================= static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); -static const LLVector3 DUE_EAST = LLVector3::x_axis; static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) { + + F32 sinTheta = sin(azimuth); + F32 cosTheta = cos(azimuth); + F32 sinPhi = sin(altitude); + F32 cosPhi = cos(altitude); + + LLVector3 dir; + // +x right, +z up, +y at... + dir.mV[0] = cosTheta * cosPhi; + dir.mV[1] = sinTheta * cosPhi; + dir.mV[2] = sinPhi; + + LLVector3 axis = LLVector3::x_axis % dir; + axis.normalize(); + + F32 angle = acos(LLVector3::x_axis * dir); + LLQuaternion quat; - quat.setEulerAngles(0.0f, altitude, azimuth); + quat.setAngleAxis(angle, axis); + return quat; } @@ -772,21 +789,15 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) } if (legacy.has(SETTING_LEGACY_EAST_ANGLE) && legacy.has(SETTING_LEGACY_SUN_ANGLE)) - { // convert the east and sun angles into a quaternion. - F32 two_pi = F_PI * 2.0f; - + { // get counter-clockwise radian angle from clockwise legacy WL east angle... - F32 azimuth = two_pi - legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); - - F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal(); + F32 azimuth = -legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); + F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal(); LLQuaternion sunquat = convert_azimuth_and_altitude_to_quat(azimuth, altitude); // original WL moon dir was diametrically opposed to the sun dir - LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, -altitude); - - //LLVector3 sundir = DUE_EAST * sunquat; - //LLVector3 moondir = DUE_EAST * moonquat; + LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, altitude + F_PI); newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); newsettings[SETTING_MOON_ROTATION] = moonquat.getValue(); @@ -826,15 +837,20 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const LLQuaternion sunq = getSunRotation(); LLQuaternion moonq = getMoonRotation(); - mSunDirection = DUE_EAST * sunq; - mMoonDirection = DUE_EAST * moonq; + mSunDirection = LLVector3::x_axis * sunq; + mMoonDirection = LLVector3::x_axis * moonq; mSunDirection.normalize(); mMoonDirection.normalize(); - //LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL; + //LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL; //LL_WARNS("LAPRAS") << "Moon info: Rotation=" << moonq << " Vector=" << mMoonDirection << LL_ENDL; + if (mSunDirection.lengthSquared() < 0.01f) + LL_WARNS("SETTINGS") << "Zero length sun direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; + if (mMoonDirection.lengthSquared() < 0.01f) + LL_WARNS("SETTINGS") << "Zero length moon direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; + llassert(mSunDirection.lengthSquared() > 0.01f); llassert(mMoonDirection.lengthSquared() > 0.01f); } -- cgit v1.2.3 From 8a2532ee55fb1c1bf78318e954bd25a0853cc2e3 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 25 Jun 2018 19:22:04 +0100 Subject: Clean up spaces vs tabs to match sim side code. --- indra/llinventory/llsettingssky.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index b1868fb50e..ad863b5671 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -38,15 +38,14 @@ static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_T static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) { - - F32 sinTheta = sin(azimuth); - F32 cosTheta = cos(azimuth); - F32 sinPhi = sin(altitude); - F32 cosPhi = cos(altitude); + F32 sinTheta = sin(azimuth); + F32 cosTheta = cos(azimuth); + F32 sinPhi = sin(altitude); + F32 cosPhi = cos(altitude); LLVector3 dir; // +x right, +z up, +y at... - dir.mV[0] = cosTheta * cosPhi; + dir.mV[0] = cosTheta * cosPhi; dir.mV[1] = sinTheta * cosPhi; dir.mV[2] = sinPhi; -- cgit v1.2.3 From d25f80181463d373c317835a219903bcdf9b91c8 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 25 Jun 2018 14:44:09 -0700 Subject: Fix cloud scroll adjustment in the editor, pause clouds method, set sun disk UUID to null. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index bf0115b80b..250af5a392 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -622,7 +622,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId(); dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); - dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); + dfltsetting[SETTING_SUN_TEXTUREID] = LLUUID::null; // GetDefaultSunTextureId(); dfltsetting[SETTING_TYPE] = "sky"; -- cgit v1.2.3 From 79570e276108c59f3384d49318835fdce35ce213 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 29 Jun 2018 10:44:08 -0700 Subject: Fix moon rotation. --- indra/llinventory/llsettingssky.cpp | 46 ++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 21 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index b797c1b715..91d2e9b23d 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -36,28 +36,32 @@ static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); -static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) -{ - F32 sinTheta = sin(azimuth); - F32 cosTheta = cos(azimuth); - F32 sinPhi = sin(altitude); - F32 cosPhi = cos(altitude); +namespace { + LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) + { + F32 sinTheta = sin(azimuth); + F32 cosTheta = cos(azimuth); + F32 sinPhi = sin(altitude); + F32 cosPhi = cos(altitude); - LLVector3 dir; - // +x right, +z up, +y at... - dir.mV[0] = cosTheta * cosPhi; - dir.mV[1] = sinTheta * cosPhi; - dir.mV[2] = sinPhi; + LLVector3 dir; + // +x right, +z up, +y at... + dir.mV[0] = cosTheta * cosPhi; + dir.mV[1] = sinTheta * cosPhi; + dir.mV[2] = sinPhi; - LLVector3 axis = LLVector3::x_axis % dir; - axis.normalize(); + LLVector3 axis = LLVector3::x_axis % dir; + axis.normalize(); + if (mirror_axis) + axis *= -1; - F32 angle = acos(LLVector3::x_axis * dir); + F32 angle = acos(LLVector3::x_axis * dir); - LLQuaternion quat; - quat.setAngleAxis(angle, axis); + LLQuaternion quat; + quat.setAngleAxis(angle, axis); - return quat; + return quat; + } } static LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment"); @@ -613,8 +617,9 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) // give the sun and moon slightly different tracks through the sky // instead of positioning them at opposite poles from each other... + // but keep them on opposite sides of the sky. sunquat = convert_azimuth_and_altitude_to_quat(altitude, azimuth); - moonquat = convert_azimuth_and_altitude_to_quat(altitude + (F_PI * 0.125f), azimuth + (F_PI * 0.125f)); + moonquat = convert_azimuth_and_altitude_to_quat(-(altitude + (F_PI * 0.125f)), azimuth + (F_PI * 1.125f)); // Magic constants copied form dfltsetting.xml dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); @@ -794,11 +799,10 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal(); LLQuaternion sunquat = convert_azimuth_and_altitude_to_quat(azimuth, altitude); - // original WL moon dir was diametrically opposed to the sun dir - LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, altitude + F_PI); + LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, -altitude); - newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); + newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); newsettings[SETTING_MOON_ROTATION] = moonquat.getValue(); } -- cgit v1.2.3 From d5c465b4ab263e568761f6197534f7ddcda8a5ee Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 29 Jun 2018 20:15:10 +0100 Subject: MAINT-8817 remove automatic update of inv_proj matrix so sunLightF which expects it not to match the projection mat works again Fix misspellinging in missing settings asset notification string Fix moon quat conversion to get proper directional rotation Add early out so attempting to set parcel env settings doesn't crash --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index b797c1b715..375bd7cbce 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -796,7 +796,7 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) LLQuaternion sunquat = convert_azimuth_and_altitude_to_quat(azimuth, altitude); // original WL moon dir was diametrically opposed to the sun dir - LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, altitude + F_PI); + LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, -altitude); newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); newsettings[SETTING_MOON_ROTATION] = moonquat.getValue(); -- cgit v1.2.3 From 96e8e670e104d852b1a925976f3d935448eba103 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 29 Jun 2018 12:59:53 -0700 Subject: Enable settings inventory filter checkbox. Fix day cycle editor selection on open. --- indra/llinventory/llsettingssky.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 91d2e9b23d..475b5fcf79 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -52,8 +52,6 @@ namespace { LLVector3 axis = LLVector3::x_axis % dir; axis.normalize(); - if (mirror_axis) - axis *= -1; F32 angle = acos(LLVector3::x_axis * dir); -- cgit v1.2.3 From 9717589a55c6ae0aac5b09f1146e489df2e45c5e Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 2 Jul 2018 23:15:38 +0100 Subject: MAINT-8837 fix legacy haze validation to make all params optional --- indra/llinventory/llsettingssky.cpp | 44 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index fc783f99e0..0b6ad66a0c 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -140,21 +140,21 @@ LLSettingsSky::validation_list_t legacyHazeValidationList() static LLSettingsBase::validation_list_t legacyHazeValidation; if (legacyHazeValidation.empty()) { - legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_BLUE_DENSITY, true, LLSD::TypeArray, + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_BLUE_DENSITY, false, LLSD::TypeArray, boost::bind(&LLSettingsBase::Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); - legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_BLUE_HORIZON, true, LLSD::TypeArray, + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_BLUE_HORIZON, false, LLSD::TypeArray, boost::bind(&LLSettingsBase::Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); - legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_DENSITY, true, LLSD::TypeReal, + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_DENSITY, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); - legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_HORIZON, true, LLSD::TypeReal, + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_HORIZON, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); - legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_MULTIPLIER, true, LLSD::TypeReal, + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_MULTIPLIER, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); - legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DISTANCE_MULTIPLIER, true, LLSD::TypeReal, + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DISTANCE_MULTIPLIER, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); } return legacyHazeValidation; @@ -165,19 +165,19 @@ LLSettingsSky::validation_list_t rayleighValidationList() static LLSettingsBase::validation_list_t rayleighValidation; if (rayleighValidation.empty()) { - rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); - rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); - rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); } return rayleighValidation; @@ -188,19 +188,19 @@ LLSettingsSky::validation_list_t absorptionValidationList() static LLSettingsBase::validation_list_t absorptionValidation; if (absorptionValidation.empty()) { - absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); - absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); - absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); } return absorptionValidation; @@ -211,22 +211,22 @@ LLSettingsSky::validation_list_t mieValidationList() static LLSettingsBase::validation_list_t mieValidation; if (mieValidation.empty()) { - mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); - mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); - mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); - mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR, true, LLSD::TypeReal, + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); } return mieValidation; -- cgit v1.2.3 From 8969b114357d189e1bf39024762698eeddddfc78 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 3 Jul 2018 16:37:32 +0100 Subject: MAINT-8838 render a sun disc if the texture(s) are provided by WL settings (default is no sun disc and just haze) Refactor sky texture optimization to retain building the cubemap used by shiny. --- indra/llinventory/llsettingssky.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 0b6ad66a0c..d73ae5721a 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -640,7 +640,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId(); dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); - dfltsetting[SETTING_SUN_TEXTUREID] = LLUUID::null; // GetDefaultSunTextureId(); + dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); dfltsetting[SETTING_TYPE] = "sky"; @@ -1092,7 +1092,8 @@ LLUUID LLSettingsSky::GetDefaultAssetId() LLUUID LLSettingsSky::GetDefaultSunTextureId() { - return DEFAULT_SUN_ID; + //return DEFAULT_SUN_ID; + return LLUUID::null; } LLUUID LLSettingsSky::GetDefaultMoonTextureId() -- cgit v1.2.3 From a90e61b798711306496c2ed7aa5cce6d096ea466 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 10 Jul 2018 19:08:14 +0100 Subject: Support blending current/next bloom textures in deferred star rendering. --- indra/llinventory/llsettingssky.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index d73ae5721a..2f5216eba9 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -382,7 +382,8 @@ LLSettingsSky::LLSettingsSky(const LLSD &data) : LLSettingsBase(data), mNextSunTextureId(), mNextMoonTextureId(), - mNextCloudTextureId() + mNextCloudTextureId(), + mNextBloomTextureId() { } @@ -390,7 +391,8 @@ LLSettingsSky::LLSettingsSky(): LLSettingsBase(), mNextSunTextureId(), mNextMoonTextureId(), - mNextCloudTextureId() + mNextCloudTextureId(), + mNextBloomTextureId() { } @@ -412,6 +414,7 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) mNextSunTextureId = other->getSunTextureId(); mNextMoonTextureId = other->getMoonTextureId(); mNextCloudTextureId = other->getCloudNoiseTextureId(); + mNextBloomTextureId = other->getBloomTextureId(); } else { @@ -637,7 +640,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); - dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; + dfltsetting[SETTING_BLOOM_TEXTUREID] = GetDefaultBloomTextureId(); dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId(); dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); @@ -1366,3 +1369,9 @@ LLUUID LLSettingsSky::getNextCloudNoiseTextureId() const { return mNextCloudTextureId; } + +LLUUID LLSettingsSky::getNextBloomTextureId() const +{ + return mNextBloomTextureId; +} + -- cgit v1.2.3 From 939174416453a46a4a415f37ae642e5508c05787 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 16 Jul 2018 16:49:49 -0700 Subject: Add default and wellknown asset ids. --- indra/llinventory/llsettingssky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 2f5216eba9..4451bd753b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -121,11 +121,11 @@ 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"); -// *LAPRAS* Change when Agni! +const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("ff64f04e-097f-40bc-9063-d8d48c308739"); + static const LLUUID DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver static const LLUUID DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); -static const LLUUID DEFAULT_ASSET_ID("cec9af47-90d4-9093-5245-397e5c9e7749"); const std::string LLSettingsSky::SETTING_LEGACY_HAZE("legacy_haze"); -- cgit v1.2.3 From 7da3a1eb4f14b67c698977eb1947ce06a312d507 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 6 Aug 2018 17:49:50 +0100 Subject: WIP check-in to allow merge of upstream changes. --- indra/llinventory/llsettingssky.cpp | 88 +++++++++++++++++++++++-------------- 1 file changed, 56 insertions(+), 32 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 4451bd753b..a7f9aa7842 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -554,36 +554,53 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() return validation; } +LLSD LLSettingsSky::createDensityProfileLayer( + F32 width, + F32 exponential_term, + F32 exponential_scale_factor, + F32 linear_term, + F32 constant_term, + F32 aniso_factor) +{ + LLSD dflt_layer; + dflt_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; + dflt_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + + if (aniso_factor != 0.0f) + { + dflt_layer[SETTING_MIE_ANISOTROPY_FACTOR] = aniso_factor; + } + + return dflt_layer; +} + +LLSD LLSettingsSky::createSingleLayerDensityProfile( + F32 width, + F32 exponential_term, + F32 exponential_scale_factor, + F32 linear_term, + F32 constant_term, + F32 aniso_factor) +{ + LLSD dflt; + LLSD dflt_layer = createDensityProfileLayer(width, exponential_term, exponential_scale_factor, linear_term, constant_term, aniso_factor); + dflt.append(dflt_layer); + return dflt; +} + LLSD LLSettingsSky::rayleighConfigDefault() { - LLSD dflt_rayleigh; - LLSD dflt_rayleigh_layer; - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; - dflt_rayleigh.append(dflt_rayleigh_layer); - return dflt_rayleigh; + return createSingleLayerDensityProfile(0.0f, 1.0f, -1.0f / 8000.0f, 0.0f, 0.0f); } LLSD LLSettingsSky::absorptionConfigDefault() { // absorption (ozone) has two linear ramping zones - LLSD dflt_absorption_layer_a; - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_WIDTH] = 25000.0f; // 0 -> the entire atmosphere - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 25000.0f; - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = -2.0f / 3.0f; - - LLSD dflt_absorption_layer_b; - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> remainder of the atmosphere - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 15000.0f; - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 8.0f / 3.0f; - + LLSD dflt_absorption_layer_a = createDensityProfileLayer(25000.0f, 0.0f, 0.0f, -1.0f / 25000.0f, -2.0f / 3.0f); + LLSD dflt_absorption_layer_b = createDensityProfileLayer(0.0f, 0.0f, 0.0f, -1.0f / 15000.0f, 8.0f / 3.0f); LLSD dflt_absorption; dflt_absorption.append(dflt_absorption_layer_a); dflt_absorption.append(dflt_absorption_layer_b); @@ -592,15 +609,7 @@ LLSD LLSettingsSky::absorptionConfigDefault() LLSD LLSettingsSky::mieConfigDefault() { - LLSD dflt_mie; - LLSD dflt_mie_layer; - dflt_mie_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_mie_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_mie_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f; - dflt_mie_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_mie_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; - dflt_mie_layer[SETTING_MIE_ANISOTROPY_FACTOR] = 0.8f; - dflt_mie.append(dflt_mie_layer); + LLSD dflt_mie = createSingleLayerDensityProfile(0.0f, 1.0f, -1.0f / 1200.0f, 0.0f, 0.0f, 0.8f); return dflt_mie; } @@ -1154,6 +1163,21 @@ LLSD LLSettingsSky::getAbsorptionConfigs() const return mSettings[SETTING_ABSORPTION_CONFIG]; } +void LLSettingsSky::setRayleighConfigs(const LLSD& rayleighConfig) +{ + mSettings[SETTING_RAYLEIGH_CONFIG] = rayleighConfig; +} + +void LLSettingsSky::setMieConfigs(const LLSD& mieConfig) +{ + mSettings[SETTING_MIE_CONFIG] = mieConfig; +} + +void LLSettingsSky::setAbsorptionConfigs(const LLSD& absorptionConfig) +{ + mSettings[SETTING_ABSORPTION_CONFIG] = absorptionConfig; +} + LLUUID LLSettingsSky::getBloomTextureId() const { return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); -- cgit v1.2.3 From 7a001186b3063c36a78b2537b81c75124e307ff7 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 9 Aug 2018 16:36:44 -0700 Subject: Adjust layout of sunmoon panel and size of ext day edit. Blank sun texture. Fix edit and transition in edit day cycle. Fix default and blank images in sky textures. --- indra/llinventory/llsettingssky.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 4451bd753b..072dff4ce4 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1095,10 +1095,15 @@ LLUUID LLSettingsSky::GetDefaultAssetId() LLUUID LLSettingsSky::GetDefaultSunTextureId() { - //return DEFAULT_SUN_ID; return LLUUID::null; } + +LLUUID LLSettingsSky::GetBlankSunTextureId() +{ + return DEFAULT_SUN_ID; +} + LLUUID LLSettingsSky::GetDefaultMoonTextureId() { return DEFAULT_MOON_ID; -- cgit v1.2.3 From 4859db1adabcf84b959ff0603f1bb8401232164c Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 21 Aug 2018 15:59:18 -0700 Subject: MAINT-9026: Adding scale for sun and moon. Also don't allow the user to directly set the radio buttons for inventory and custom. --- indra/llinventory/llsettingssky.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 072dff4ce4..c0402f1fe4 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -93,10 +93,12 @@ const std::string LLSettingsSky::SETTING_GLOW("glow"); const std::string LLSettingsSky::SETTING_LIGHT_NORMAL("lightnorm"); const std::string LLSettingsSky::SETTING_MAX_Y("max_y"); const std::string LLSettingsSky::SETTING_MOON_ROTATION("moon_rotation"); +const std::string LLSettingsSky::SETTING_MOON_SCALE("moon_scale"); const std::string LLSettingsSky::SETTING_MOON_TEXTUREID("moon_id"); const std::string LLSettingsSky::SETTING_STAR_BRIGHTNESS("star_brightness"); const std::string LLSettingsSky::SETTING_SUNLIGHT_COLOR("sunlight_color"); const std::string LLSettingsSky::SETTING_SUN_ROTATION("sun_rotation"); +const std::string LLSettingsSky::SETTING_SUN_SCALE("sun_scale"); const std::string LLSettingsSky::SETTING_SUN_TEXTUREID("sun_id"); const std::string LLSettingsSky::SETTING_LEGACY_EAST_ANGLE("east_angle"); @@ -524,6 +526,8 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_MAX_Y, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4000.0f))))); validation.push_back(Validator(SETTING_MOON_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); + validation.push_back(Validator(SETTING_MOON_SCALE, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.25f)(20.0f))), LLSD::Real(1.0))); validation.push_back(Validator(SETTING_MOON_TEXTUREID, false, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_STAR_BRIGHTNESS, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); @@ -532,7 +536,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); validation.push_back(Validator(SETTING_SUN_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); - validation.push_back(Validator(SETTING_SUN_TEXTUREID, false, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_SUN_SCALE, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.25f)(20.0f))), LLSD::Real(1.0))); + validation.push_back(Validator(SETTING_SUN_TEXTUREID, false, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_PLANET_RADIUS, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(32768.0f))))); @@ -1310,6 +1316,16 @@ void LLSettingsSky::setMoonRotation(const LLQuaternion &val) setValue(SETTING_MOON_ROTATION, val); } +F32 LLSettingsSky::getMoonScale() const +{ + return mSettings[SETTING_MOON_SCALE].asReal(); +} + +void LLSettingsSky::setMoonScale(F32 val) +{ + setValue(SETTING_MOON_SCALE, val); +} + LLUUID LLSettingsSky::getMoonTextureId() const { return mSettings[SETTING_MOON_TEXTUREID].asUUID(); @@ -1350,6 +1366,17 @@ void LLSettingsSky::setSunRotation(const LLQuaternion &val) setValue(SETTING_SUN_ROTATION, val); } + +F32 LLSettingsSky::getSunScale() const +{ + return mSettings[SETTING_SUN_SCALE].asReal(); +} + +void LLSettingsSky::setSunScale(F32 val) +{ + setValue(SETTING_SUN_SCALE, val); +} + LLUUID LLSettingsSky::getSunTextureId() const { return mSettings[SETTING_SUN_TEXTUREID].asUUID(); -- cgit v1.2.3 From ab1c7087e944ea9ded217770176e3444c8c39c0d Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 22 Aug 2018 00:52:47 +0100 Subject: Restore funcs to create LLSD for density layers and profiles with single density layers. --- indra/llinventory/llsettingssky.cpp | 73 +++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 32 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index bc02867ce6..3ede670d35 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -554,36 +554,53 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() return validation; } +LLSD LLSettingsSky::createDensityProfileLayer( + F32 width, + F32 exponential_term, + F32 exponential_scale_factor, + F32 linear_term, + F32 constant_term, + F32 aniso_factor) +{ + LLSD dflt_layer; + dflt_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; + dflt_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + + if (aniso_factor != 0.0f) + { + dflt_layer[SETTING_MIE_ANISOTROPY_FACTOR] = aniso_factor; + } + + return dflt_layer; +} + +LLSD LLSettingsSky::createSingleLayerDensityProfile( + F32 width, + F32 exponential_term, + F32 exponential_scale_factor, + F32 linear_term, + F32 constant_term, + F32 aniso_factor) +{ + LLSD dflt; + LLSD dflt_layer = createDensityProfileLayer(width, exponential_term, exponential_scale_factor, linear_term, constant_term, aniso_factor); + dflt.append(dflt_layer); + return dflt; +} + LLSD LLSettingsSky::rayleighConfigDefault() { - LLSD dflt_rayleigh; - LLSD dflt_rayleigh_layer; - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; - dflt_rayleigh.append(dflt_rayleigh_layer); - return dflt_rayleigh; + return createSingleLayerDensityProfile(0.0f, 1.0f, -1.0f / 8000.0f, 0.0f, 0.0f); } LLSD LLSettingsSky::absorptionConfigDefault() { // absorption (ozone) has two linear ramping zones - LLSD dflt_absorption_layer_a; - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_WIDTH] = 25000.0f; // 0 -> the entire atmosphere - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 25000.0f; - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = -2.0f / 3.0f; - - LLSD dflt_absorption_layer_b; - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> remainder of the atmosphere - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 15000.0f; - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 8.0f / 3.0f; - + LLSD dflt_absorption_layer_a = createDensityProfileLayer(25000.0f, 0.0f, 0.0f, -1.0f / 25000.0f, -2.0f / 3.0f); + LLSD dflt_absorption_layer_b = createDensityProfileLayer(0.0f, 0.0f, 0.0f, -1.0f / 15000.0f, 8.0f / 3.0f); LLSD dflt_absorption; dflt_absorption.append(dflt_absorption_layer_a); dflt_absorption.append(dflt_absorption_layer_b); @@ -592,15 +609,7 @@ LLSD LLSettingsSky::absorptionConfigDefault() LLSD LLSettingsSky::mieConfigDefault() { - LLSD dflt_mie; - LLSD dflt_mie_layer; - dflt_mie_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_mie_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_mie_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f; - dflt_mie_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_mie_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; - dflt_mie_layer[SETTING_MIE_ANISOTROPY_FACTOR] = 0.8f; - dflt_mie.append(dflt_mie_layer); + LLSD dflt_mie = createSingleLayerDensityProfile(0.0f, 1.0f, -1.0f / 1200.0f, 0.0f, 0.0f, 0.8f); return dflt_mie; } -- cgit v1.2.3 From 4c7376f939d6cbfe17a982a0e1ad93cc529a1ba7 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 22 Aug 2018 16:54:14 +0300 Subject: MAINT-8881 EEP Blue Horizon swatch does not display the color set for that keyframe. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index c0402f1fe4..184a75b9c7 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -892,7 +892,7 @@ LLColor3 LLSettingsSky::getBlueDensity() const LLColor3 LLSettingsSky::getBlueHorizon() const { - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_BLUE_DENSITY)) + if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_BLUE_HORIZON)) { return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_HORIZON]); } -- cgit v1.2.3 From 94c24b8713b72b6ce52637644ff18b234a3a400a Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 23 Aug 2018 20:14:15 +0300 Subject: MAINT-8944 Fix frame transition's images --- indra/llinventory/llsettingssky.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 184a75b9c7..dbf9117882 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -401,7 +401,10 @@ LLSettingsSky::LLSettingsSky(): void LLSettingsSky::replaceSettings(LLSD settings) { LLSettingsBase::replaceSettings(settings); - + mNextSunTextureId.setNull(); + mNextMoonTextureId.setNull(); + mNextCloudTextureId.setNull(); + mNextBloomTextureId.setNull(); } void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) -- cgit v1.2.3 From 964a472461bed91b3efa383aaea34d425b96111d Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 29 Aug 2018 21:13:09 +0100 Subject: Hook up sky density panel to fixedenv and edit_ext_daycycle UI. Fix retrieving LLSD for density configs (element not array) in density UI. Tweak layout of sky density controls. --- indra/llinventory/llsettingssky.cpp | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 0d789590fa..5f55018387 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1161,20 +1161,41 @@ F32 LLSettingsSky::getMieAnisotropy() const { return mSettings[SETTING_MIE_ANISOTROPY_FACTOR].asReal(); } - + +LLSD LLSettingsSky::getRayleighConfig() const +{ + LLSD copy = *(mSettings[SETTING_RAYLEIGH_CONFIG].beginArray()); + return copy; +} + +LLSD LLSettingsSky::getMieConfig() const +{ + LLSD copy = *(mSettings[SETTING_MIE_CONFIG].beginArray()); + return copy; +} + +LLSD LLSettingsSky::getAbsorptionConfig() const +{ + LLSD copy = *(mSettings[SETTING_ABSORPTION_CONFIG].beginArray()); + return copy; +} + LLSD LLSettingsSky::getRayleighConfigs() const { - return mSettings[SETTING_RAYLEIGH_CONFIG]; + LLSD copy = *(mSettings[SETTING_RAYLEIGH_CONFIG].beginArray()); + return copy; } LLSD LLSettingsSky::getMieConfigs() const { - return mSettings[SETTING_MIE_CONFIG]; + LLSD copy = *(mSettings[SETTING_MIE_CONFIG].beginArray()); + return copy; } LLSD LLSettingsSky::getAbsorptionConfigs() const { - return mSettings[SETTING_ABSORPTION_CONFIG]; + LLSD copy = *(mSettings[SETTING_ABSORPTION_CONFIG].beginArray()); + return copy; } void LLSettingsSky::setRayleighConfigs(const LLSD& rayleighConfig) -- cgit v1.2.3 From 3b10414c632e73d66d2840ddcd474a79fa120540 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 31 Aug 2018 11:47:18 -0700 Subject: Adding optional flags to settings objects. --- indra/llinventory/llsettingssky.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index dbf9117882..0203e5067a 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -435,6 +435,7 @@ LLSettingsSky::stringset_t LLSettingsSky::getSkipInterpolateKeys() const if (skipSet.empty()) { + skipSet = LLSettingsBase::getSkipInterpolateKeys(); skipSet.insert(SETTING_RAYLEIGH_CONFIG); skipSet.insert(SETTING_MIE_CONFIG); skipSet.insert(SETTING_ABSORPTION_CONFIG); -- cgit v1.2.3 From 0a78e9271c524c92cb8b1965e9a6081d4f700437 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 4 Sep 2018 23:39:21 +0100 Subject: Make legacy star brightness setting convert to 0-512 range of new settings. Make brightness scale in shader more linear and fix twinkling. --- indra/llinventory/llsettingssky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 0203e5067a..3b60ee2000 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -646,7 +646,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); - dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(0.0000); + dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(256.0000); dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); @@ -775,7 +775,7 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) } if (legacy.has(SETTING_STAR_BRIGHTNESS)) { - newsettings[SETTING_STAR_BRIGHTNESS] = LLSD::Real(legacy[SETTING_STAR_BRIGHTNESS].asReal()); + newsettings[SETTING_STAR_BRIGHTNESS] = LLSD::Real(legacy[SETTING_STAR_BRIGHTNESS].asReal()) * 256.0f; } if (legacy.has(SETTING_SUNLIGHT_COLOR)) { -- cgit v1.2.3 From 32631f09a57548c2bbf7e09211a2053ff2e4e47d Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 4 Sep 2018 23:41:36 +0100 Subject: 8283/4 WIP --- indra/llinventory/llsettingssky.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 5f55018387..cd6dfad71d 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,6 +32,8 @@ #include "llfasttimer.h" #include "v3colorutil.h" +#pragma optimize("", off) + //========================================================================= static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); -- cgit v1.2.3 From 4aaa23fe6d4a875998a7472e656e058a1581513a Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 4 Sep 2018 23:49:49 +0100 Subject: Update validation range for star brightness to 0 -> 512. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 3b60ee2000..8539f1fe0a 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -534,7 +534,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.25f)(20.0f))), LLSD::Real(1.0))); validation.push_back(Validator(SETTING_MOON_TEXTUREID, false, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_STAR_BRIGHTNESS, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(512.0f))))); validation.push_back(Validator(SETTING_SUNLIGHT_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), -- cgit v1.2.3 From 4bd2b8b98ba1c562dfd65975a87ef5ee3db35633 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 7 Sep 2018 17:24:29 +0100 Subject: Fix createDensityProfileLayer dropping passed in values. Enable sky density panel to update advanced atmo precomputed textures. Take wild stab at appropriate ranges for density parameters in edit panel UI. Clean up debug-only code that isn't necessary anymore. Point autobuild at latest version of libatmosphere package. --- indra/llinventory/llsettingssky.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index ba92a82174..ed8baee204 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -573,11 +573,11 @@ LLSD LLSettingsSky::createDensityProfileLayer( F32 aniso_factor) { LLSD dflt_layer; - dflt_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; - dflt_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + dflt_layer[SETTING_DENSITY_PROFILE_WIDTH] = width; // 0 -> the entire atmosphere + dflt_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = exponential_term; + dflt_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = exponential_scale_factor; + dflt_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = linear_term; + dflt_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = constant_term; if (aniso_factor != 0.0f) { @@ -670,7 +670,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; - dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; + dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00045f; dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); @@ -1160,7 +1160,7 @@ F32 LLSettingsSky::getSunArcRadians() const F32 LLSettingsSky::getMieAnisotropy() const { - return mSettings[SETTING_MIE_ANISOTROPY_FACTOR].asReal(); + return getMieConfig()[SETTING_MIE_ANISOTROPY_FACTOR].asReal(); } LLSD LLSettingsSky::getRayleighConfig() const @@ -1183,20 +1183,17 @@ LLSD LLSettingsSky::getAbsorptionConfig() const LLSD LLSettingsSky::getRayleighConfigs() const { - LLSD copy = *(mSettings[SETTING_RAYLEIGH_CONFIG].beginArray()); - return copy; + return mSettings[SETTING_RAYLEIGH_CONFIG]; } LLSD LLSettingsSky::getMieConfigs() const { - LLSD copy = *(mSettings[SETTING_MIE_CONFIG].beginArray()); - return copy; + return mSettings[SETTING_MIE_CONFIG]; } LLSD LLSettingsSky::getAbsorptionConfigs() const { - LLSD copy = *(mSettings[SETTING_ABSORPTION_CONFIG].beginArray()); - return copy; + return mSettings[SETTING_ABSORPTION_CONFIG]; } void LLSettingsSky::setRayleighConfigs(const LLSD& rayleighConfig) -- cgit v1.2.3 From 1f69a685eb7d403b8ad5b2ebc24978151da49910 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 7 Sep 2018 22:10:14 +0100 Subject: MAINT-8988 Make rebuilding sky tex not look up invariant values by converting from LLSD 15 times per pixel. Set range on density multiplier to be non-zero to clamp light attenuation to sane values. Fix UI for density multiplier to include 4 decimal places and not show 0.0003 as 0.00 --- indra/llinventory/llsettingssky.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 8539f1fe0a..bc7f4f2b5a 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -155,7 +155,7 @@ LLSettingsSky::validation_list_t legacyHazeValidationList() legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_HORIZON, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0001f)(0.9f))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DISTANCE_MULTIPLIER, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); } @@ -923,11 +923,12 @@ F32 LLSettingsSky::getHazeHorizon() const F32 LLSettingsSky::getDensityMultiplier() const { + F32 density_multiplier = 0.0001f; if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_DENSITY_MULTIPLIER)) { - return mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER].asReal(); + density_multiplier = mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER].asReal(); } - return 0.0001f; + return density_multiplier; } F32 LLSettingsSky::getDistanceMultiplier() const -- cgit v1.2.3 From 9581a197aceba7647ab9153513089570f11c4f9a Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 17 Sep 2018 19:48:58 +0100 Subject: SL-1873 Make range of star brightness in code and in UI 0-500 (not 512). --- indra/llinventory/llsettingssky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 56449c0598..399692d80b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -534,7 +534,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.25f)(20.0f))), LLSD::Real(1.0))); validation.push_back(Validator(SETTING_MOON_TEXTUREID, false, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_STAR_BRIGHTNESS, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(512.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(500.0f))))); validation.push_back(Validator(SETTING_SUNLIGHT_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), @@ -784,7 +784,7 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) } if (legacy.has(SETTING_STAR_BRIGHTNESS)) { - newsettings[SETTING_STAR_BRIGHTNESS] = LLSD::Real(legacy[SETTING_STAR_BRIGHTNESS].asReal()) * 256.0f; + newsettings[SETTING_STAR_BRIGHTNESS] = LLSD::Real(legacy[SETTING_STAR_BRIGHTNESS].asReal() * 250.0f); } if (legacy.has(SETTING_SUNLIGHT_COLOR)) { -- cgit v1.2.3 From 70c18ba14b4ea831c109030b48096d7c1fd5e510 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 24 Sep 2018 14:55:21 -0700 Subject: SL-9736: 0.0 is no motion for cloud scroll. --- indra/llinventory/llsettingssky.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 399692d80b..36e203cbf5 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -645,7 +645,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199); - dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(10.1999)(10.0109); + dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(0.0f)(0.0f); dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699); dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f); @@ -752,6 +752,7 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) { LLVector2 cloud_scroll(legacy[SETTING_CLOUD_SCROLL_RATE]); + cloud_scroll -= LLVector2(10, 10); if (legacy.has(SETTING_LEGACY_ENABLE_CLOUD_SCROLL)) { LLSD enabled = legacy[SETTING_LEGACY_ENABLE_CLOUD_SCROLL]; -- cgit v1.2.3 From ed2e333a544acc467df0f1d97b4fc5d2fd72b3b2 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 24 Sep 2018 17:00:01 -0700 Subject: MAINT-9734: Change limits on settings values. --- indra/llinventory/llsettingssky.cpp | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 36e203cbf5..4543f00454 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -33,8 +33,11 @@ #include "v3colorutil.h" //========================================================================= -static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees -static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); +namespace { + const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees + const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); + const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); +} namespace { LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) @@ -480,17 +483,17 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); validation.push_back(Validator(SETTING_HAZE_DENSITY, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(5.0f))))); validation.push_back(Validator(SETTING_HAZE_HORIZON, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(5.0f))))); validation.push_back(Validator(SETTING_AMBIENT, false, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1000.0f))))); validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); @@ -501,17 +504,17 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_CLOUD_POS_DENSITY1, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(1.68841f)(1.0f)(1.0f)("*"))))); + LLSD(LLSDArray(1.0f)(1.0f)(3.0f)("*"))))); validation.push_back(Validator(SETTING_CLOUD_POS_DENSITY2, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(1.68841f)(1.0f)(1.0f)("*"))))); + LLSD(LLSDArray(1.0f)(1.0f)(1.0f)("*"))))); validation.push_back(Validator(SETTING_CLOUD_SCALE, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.001f)(0.999f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.001f)(3.0f))))); validation.push_back(Validator(SETTING_CLOUD_SCROLL_RATE, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, - LLSD(LLSDArray(0.0f)(0.0f)), - LLSD(LLSDArray(20.0f)(20.0f))))); + LLSD(LLSDArray(-50.0f)(-50.0f)), + LLSD(LLSDArray(50.0f)(50.0f))))); validation.push_back(Validator(SETTING_CLOUD_SHADOW, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); validation.push_back(Validator(SETTING_CLOUD_TEXTUREID, false, LLSD::TypeUUID)); @@ -521,14 +524,14 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_DOME_RADIUS, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(2000.0f))))); validation.push_back(Validator(SETTING_GAMMA, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(10.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(20.0f))))); validation.push_back(Validator(SETTING_GLOW, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, - LLSD(LLSDArray(0.2f)("*")(-2.5f)("*")), - LLSD(LLSDArray(20.0f)("*")(0.0f)("*"))))); + LLSD(LLSDArray(0.2f)("*")(-10.0f)("*")), + LLSD(LLSDArray(40.0f)("*")(10.0f)("*"))))); validation.push_back(Validator(SETTING_MAX_Y, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4000.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(10000.0f))))); validation.push_back(Validator(SETTING_MOON_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); validation.push_back(Validator(SETTING_MOON_SCALE, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.25f)(20.0f))), LLSD::Real(1.0))); -- cgit v1.2.3 From 05d3d1b4815e4bd683b4362b57942563e6902262 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 2 Oct 2018 17:00:17 +0100 Subject: Add LUT textures and optional settings for moisture/ice level to sky settings. --- indra/llinventory/llsettingssky.cpp | 57 +++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 4543f00454..f298a9cbc7 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -126,6 +126,9 @@ 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 std::string LLSettingsSky::SETTING_SKY_MOISTURE_LEVEL("moisture_level"); +const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level"); + const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("ff64f04e-097f-40bc-9063-d8d48c308739"); static const LLUUID DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver @@ -559,6 +562,12 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_SUN_ARC_RADIANS, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.1f))))); + validation.push_back(Validator(SETTING_SKY_MOISTURE_LEVEL, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + + validation.push_back(Validator(SETTING_SKY_ICE_LEVEL, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_RAYLEIGH_CONFIG, true, LLSD::TypeArray, &validateRayleighLayers)); validation.push_back(Validator(SETTING_ABSORPTION_CONFIG, true, LLSD::TypeArray, &validateAbsorptionLayers)); validation.push_back(Validator(SETTING_MIE_CONFIG, true, LLSD::TypeArray, &validateMieLayers)); @@ -675,6 +684,9 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00045f; + dfltsetting[SETTING_SKY_MOISTURE_LEVEL] = 0.0f; + dfltsetting[SETTING_SKY_ICE_LEVEL] = 0.0f; + dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); dfltsetting[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); @@ -953,6 +965,41 @@ F32 LLSettingsSky::getDistanceMultiplier() const return 0.8f; } +void LLSettingsSky::setPlanetRadius(F32 radius) +{ + mSettings[SETTING_PLANET_RADIUS] = radius; +} + +void LLSettingsSky::setSkyBottomRadius(F32 radius) +{ + mSettings[SETTING_SKY_BOTTOM_RADIUS] = radius; +} + +void LLSettingsSky::setSkyTopRadius(F32 radius) +{ + mSettings[SETTING_SKY_TOP_RADIUS] = radius; +} + +void LLSettingsSky::setSunArcRadians(F32 radians) +{ + mSettings[SETTING_SUN_ARC_RADIANS] = radians; +} + +void LLSettingsSky::setMieAnisotropy(F32 aniso_factor) +{ + getMieConfig()[SETTING_MIE_ANISOTROPY_FACTOR] = aniso_factor; +} + +void LLSettingsSky::setSkyMoistureLevel(F32 moisture_level) +{ + mSettings[SETTING_SKY_MOISTURE_LEVEL] = moisture_level; +} + +void LLSettingsSky::setSkyIceLevel(F32 ice_level) +{ + mSettings[SETTING_SKY_ICE_LEVEL] = ice_level; +} + void LLSettingsSky::setBlueDensity(const LLColor3 &val) { mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_DENSITY] = val.getValue(); @@ -1148,6 +1195,16 @@ F32 LLSettingsSky::getPlanetRadius() const return mSettings[SETTING_PLANET_RADIUS].asReal(); } +F32 LLSettingsSky::getSkyMoistureLevel() const +{ + return mSettings[SETTING_SKY_MOISTURE_LEVEL].asReal(); +} + +F32 LLSettingsSky::getSkyIceLevel() const +{ + return mSettings[SETTING_SKY_ICE_LEVEL].asReal(); +} + F32 LLSettingsSky::getSkyBottomRadius() const { return mSettings[SETTING_SKY_BOTTOM_RADIUS].asReal(); -- cgit v1.2.3 From 5eed233618abd7020e130799be2abe0f986543f6 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 5 Oct 2018 21:32:42 +0100 Subject: SL-1925 More settings for rainbow/halo atmospheric effects, final default asset UUIDs, and shader mods. --- indra/llinventory/llsettingssky.cpp | 56 +++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index f298a9cbc7..21fde72941 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -37,6 +37,8 @@ namespace { const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); + const LLUUID IMG_RAINBOW("12149143-f599-91a7-77ac-b52a3c0f59cd"); + const LLUUID IMG_HALO("11b4c57c-56b3-04ed-1f82-2004363882e4"); } namespace { @@ -80,6 +82,8 @@ const std::string LLSettingsSky::SETTING_HAZE_DENSITY("haze_density"); const std::string LLSettingsSky::SETTING_HAZE_HORIZON("haze_horizon"); const std::string LLSettingsSky::SETTING_BLOOM_TEXTUREID("bloom_id"); +const std::string LLSettingsSky::SETTING_RAINBOW_TEXTUREID("rainbow_id"); +const std::string LLSettingsSky::SETTING_HALO_TEXTUREID("halo_id"); const std::string LLSettingsSky::SETTING_CLOUD_COLOR("cloud_color"); const std::string LLSettingsSky::SETTING_CLOUD_POS_DENSITY1("cloud_pos_density1"); const std::string LLSettingsSky::SETTING_CLOUD_POS_DENSITY2("cloud_pos_density2"); @@ -127,6 +131,7 @@ const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM("linear_ter const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM("constant_term"); const std::string LLSettingsSky::SETTING_SKY_MOISTURE_LEVEL("moisture_level"); +const std::string LLSettingsSky::SETTING_SKY_DROPLET_RADIUS("droplet_radius"); const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level"); const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("ff64f04e-097f-40bc-9063-d8d48c308739"); @@ -391,7 +396,9 @@ LLSettingsSky::LLSettingsSky(const LLSD &data) : mNextSunTextureId(), mNextMoonTextureId(), mNextCloudTextureId(), - mNextBloomTextureId() + mNextBloomTextureId(), + mNextRainbowTextureId(), + mNextHaloTextureId() { } @@ -400,7 +407,9 @@ LLSettingsSky::LLSettingsSky(): mNextSunTextureId(), mNextMoonTextureId(), mNextCloudTextureId(), - mNextBloomTextureId() + mNextBloomTextureId(), + mNextRainbowTextureId(), + mNextHaloTextureId() { } @@ -411,6 +420,8 @@ void LLSettingsSky::replaceSettings(LLSD settings) mNextMoonTextureId.setNull(); mNextCloudTextureId.setNull(); mNextBloomTextureId.setNull(); + mNextRainbowTextureId.setNull(); + mNextHaloTextureId.setNull(); } void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) @@ -426,6 +437,8 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) mNextMoonTextureId = other->getMoonTextureId(); mNextCloudTextureId = other->getCloudNoiseTextureId(); mNextBloomTextureId = other->getBloomTextureId(); + mNextRainbowTextureId = other->getRainbowTextureId(); + mNextHaloTextureId = other->getHaloTextureId(); } else { @@ -500,6 +513,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_RAINBOW_TEXTUREID, false, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_HALO_TEXTUREID, false, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_CLOUD_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), @@ -565,6 +581,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_SKY_MOISTURE_LEVEL, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_SKY_DROPLET_RADIUS, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(5.0f)(1000.0f))))); + validation.push_back(Validator(SETTING_SKY_ICE_LEVEL, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); @@ -675,6 +694,8 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId(); dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); + dfltsetting[SETTING_RAINBOW_TEXTUREID] = GetDefaultRainbowTextureId(); + dfltsetting[SETTING_HALO_TEXTUREID] = GetDefaultHaloTextureId(); dfltsetting[SETTING_TYPE] = "sky"; @@ -685,6 +706,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00045f; dfltsetting[SETTING_SKY_MOISTURE_LEVEL] = 0.0f; + dfltsetting[SETTING_SKY_DROPLET_RADIUS] = 800.0f; dfltsetting[SETTING_SKY_ICE_LEVEL] = 0.0f; dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); @@ -995,6 +1017,11 @@ void LLSettingsSky::setSkyMoistureLevel(F32 moisture_level) mSettings[SETTING_SKY_MOISTURE_LEVEL] = moisture_level; } +void LLSettingsSky::setSkyDropletRadius(F32 radius) +{ + mSettings[SETTING_SKY_DROPLET_RADIUS] = radius; +} + void LLSettingsSky::setSkyIceLevel(F32 ice_level) { mSettings[SETTING_SKY_ICE_LEVEL] = ice_level; @@ -1190,6 +1217,16 @@ LLUUID LLSettingsSky::GetDefaultBloomTextureId() return IMG_BLOOM1; } +LLUUID LLSettingsSky::GetDefaultRainbowTextureId() +{ + return IMG_RAINBOW; +} + +LLUUID LLSettingsSky::GetDefaultHaloTextureId() +{ + return IMG_HALO; +} + F32 LLSettingsSky::getPlanetRadius() const { return mSettings[SETTING_PLANET_RADIUS].asReal(); @@ -1200,6 +1237,11 @@ F32 LLSettingsSky::getSkyMoistureLevel() const return mSettings[SETTING_SKY_MOISTURE_LEVEL].asReal(); } +F32 LLSettingsSky::getSkyDropletRadius() const +{ + return mSettings[SETTING_SKY_DROPLET_RADIUS].asReal(); +} + F32 LLSettingsSky::getSkyIceLevel() const { return mSettings[SETTING_SKY_ICE_LEVEL].asReal(); @@ -1278,6 +1320,16 @@ LLUUID LLSettingsSky::getBloomTextureId() const return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); } +LLUUID LLSettingsSky::getRainbowTextureId() const +{ + return mSettings[SETTING_RAINBOW_TEXTUREID].asUUID(); +} + +LLUUID LLSettingsSky::getHaloTextureId() const +{ + return mSettings[SETTING_HALO_TEXTUREID].asUUID(); +} + //--------------------------------------------------------------------- LLColor3 LLSettingsSky::getAmbientColor() const { -- cgit v1.2.3 From ffc6393309d06446f9d1361f0f0282b2110768ae Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 8 Oct 2018 22:08:35 +0100 Subject: SL-9751 Add optional moon brightness setting --- indra/llinventory/llsettingssky.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 21fde72941..dd3a76be31 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -102,6 +102,8 @@ const std::string LLSettingsSky::SETTING_MAX_Y("max_y"); const std::string LLSettingsSky::SETTING_MOON_ROTATION("moon_rotation"); const std::string LLSettingsSky::SETTING_MOON_SCALE("moon_scale"); const std::string LLSettingsSky::SETTING_MOON_TEXTUREID("moon_id"); +const std::string LLSettingsSky::SETTING_MOON_BRIGHTNESS("moon_brightness"); + const std::string LLSettingsSky::SETTING_STAR_BRIGHTNESS("star_brightness"); const std::string LLSettingsSky::SETTING_SUNLIGHT_COLOR("sunlight_color"); const std::string LLSettingsSky::SETTING_SUN_ROTATION("sun_rotation"); @@ -555,6 +557,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_MOON_SCALE, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.25f)(20.0f))), LLSD::Real(1.0))); validation.push_back(Validator(SETTING_MOON_TEXTUREID, false, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_MOON_BRIGHTNESS, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_STAR_BRIGHTNESS, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(500.0f))))); validation.push_back(Validator(SETTING_SUNLIGHT_COLOR, true, LLSD::TypeArray, @@ -686,6 +691,9 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); + dfltsetting[SETTING_MOON_BRIGHTNESS] = LLSD::Real(0.5f); + dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); + dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(256.0000); dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); @@ -1496,6 +1504,16 @@ void LLSettingsSky::setMoonTextureId(LLUUID id) setValue(SETTING_MOON_TEXTUREID, id); } +F32 LLSettingsSky::getMoonBrightness() const +{ + return mSettings[SETTING_MOON_BRIGHTNESS].asReal(); +} + +void LLSettingsSky::setMoonBrightness(F32 brightness_factor) +{ + setValue(SETTING_MOON_BRIGHTNESS, brightness_factor); +} + F32 LLSettingsSky::getStarBrightness() const { return mSettings[SETTING_STAR_BRIGHTNESS].asReal(); -- cgit v1.2.3 From f8aac192378462b5824d28808ed84833e2cbfe0f Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 9 Oct 2018 18:44:43 +0100 Subject: SL-1289 add cloud_variance control for randomized perturbance of clouds to break up tiling monotony --- indra/llinventory/llsettingssky.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index dd3a76be31..5ef964af04 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -91,6 +91,7 @@ const std::string LLSettingsSky::SETTING_CLOUD_SCALE("cloud_scale"); const std::string LLSettingsSky::SETTING_CLOUD_SCROLL_RATE("cloud_scroll_rate"); const std::string LLSettingsSky::SETTING_CLOUD_SHADOW("cloud_shadow"); const std::string LLSettingsSky::SETTING_CLOUD_TEXTUREID("cloud_id"); +const std::string LLSettingsSky::SETTING_CLOUD_VARIANCE("cloud_variance"); const std::string LLSettingsSky::SETTING_DOME_OFFSET("dome_offset"); const std::string LLSettingsSky::SETTING_DOME_RADIUS("dome_radius"); @@ -539,6 +540,8 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_CLOUD_SHADOW, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); validation.push_back(Validator(SETTING_CLOUD_TEXTUREID, false, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_CLOUD_VARIANCE, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); validation.push_back(Validator(SETTING_DOME_OFFSET, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); @@ -683,7 +686,8 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199); dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(0.0f)(0.0f); dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699); - + dfltsetting[SETTING_CLOUD_VARIANCE] = LLSD::Real(0.0); + dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f); dfltsetting[SETTING_DOME_RADIUS] = LLSD::Real(15000.f); dfltsetting[SETTING_GAMMA] = LLSD::Real(1.0); @@ -1431,6 +1435,16 @@ void LLSettingsSky::setCloudShadow(F32 val) setValue(SETTING_CLOUD_SHADOW, val); } +F32 LLSettingsSky::getCloudVariance() const +{ + return mSettings[SETTING_CLOUD_VARIANCE].asReal(); +} + +void LLSettingsSky::setCloudVariance(F32 val) +{ + setValue(SETTING_CLOUD_VARIANCE, val); +} + F32 LLSettingsSky::getDomeOffset() const { //return mSettings[SETTING_DOME_OFFSET].asReal(); -- cgit v1.2.3 From c0b86245cd9f7e6805158e34423ba7d0d5ef7a04 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 9 Oct 2018 18:46:07 +0100 Subject: Remove redundant set of moon default tex id. --- indra/llinventory/llsettingssky.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 5ef964af04..61e31df663 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -696,7 +696,6 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); dfltsetting[SETTING_MOON_BRIGHTNESS] = LLSD::Real(0.5f); - dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(256.0000); dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); -- cgit v1.2.3 From 6cdcc7fe2edcb6c001f2dabf48c87e00d907a4db Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 17 Oct 2018 12:16:24 -0700 Subject: SL-9889: New reconverted default assets --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 61e31df663..0ba40e5e3d 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -137,7 +137,7 @@ const std::string LLSettingsSky::SETTING_SKY_MOISTURE_LEVEL("moisture_level"); const std::string LLSettingsSky::SETTING_SKY_DROPLET_RADIUS("droplet_radius"); const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level"); -const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("ff64f04e-097f-40bc-9063-d8d48c308739"); +const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("eb3a7080-831f-9f37-10f0-7b1f9ea4043c"); static const LLUUID DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver -- cgit v1.2.3 From 3447621a15c14a6a23a9827cfbb2e244ce91e8c0 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 18 Oct 2018 21:18:40 +0100 Subject: Port sim-side changes to back-conversion of new settings to legacy. Fix validating of density multiplier to clamp >= 0.0001f. Port fix to setter for ambient color in sky settings. --- indra/llinventory/llsettingssky.cpp | 41 ++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 61e31df663..0093d84cef 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -510,9 +510,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0001f)(2.0f))))); validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1000.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0001f)(1000.0f))))); validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); @@ -870,7 +870,7 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) // original WL moon dir was diametrically opposed to the sun dir LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, -altitude); - newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); + newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); newsettings[SETTING_MOON_ROTATION] = moonquat.getValue(); } @@ -943,6 +943,19 @@ LLVector3 LLSettingsSky::getLightDirection() const return LLVector3::z_axis; } +LLColor3 LLSettingsSky::getAmbientColor() const +{ + if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT)) + { + return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_AMBIENT]); + } + if (mSettings.has(SETTING_AMBIENT)) + { + return LLColor3(mSettings[SETTING_AMBIENT]); + } + return LLColor3(0.25f, 0.25f, 0.25f); +} + LLColor3 LLSettingsSky::getBlueDensity() const { if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_BLUE_DENSITY)) @@ -1025,17 +1038,23 @@ void LLSettingsSky::setMieAnisotropy(F32 aniso_factor) void LLSettingsSky::setSkyMoistureLevel(F32 moisture_level) { - mSettings[SETTING_SKY_MOISTURE_LEVEL] = moisture_level; + setValue(SETTING_SKY_MOISTURE_LEVEL, moisture_level); } void LLSettingsSky::setSkyDropletRadius(F32 radius) { - mSettings[SETTING_SKY_DROPLET_RADIUS] = radius; + setValue(SETTING_SKY_DROPLET_RADIUS,radius); } void LLSettingsSky::setSkyIceLevel(F32 ice_level) { - mSettings[SETTING_SKY_ICE_LEVEL] = ice_level; + setValue(SETTING_SKY_ICE_LEVEL, ice_level); +} + +void LLSettingsSky::setAmbientColor(const LLColor3 &val) +{ + mSettings[SETTING_LEGACY_HAZE][SETTING_AMBIENT] = val.getValue(); + setDirtyFlag(true); } void LLSettingsSky::setBlueDensity(const LLColor3 &val) @@ -1342,16 +1361,6 @@ LLUUID LLSettingsSky::getHaloTextureId() const } //--------------------------------------------------------------------- -LLColor3 LLSettingsSky::getAmbientColor() const -{ - return LLColor3(mSettings[SETTING_AMBIENT]); -} - -void LLSettingsSky::setAmbientColor(const LLColor3 &val) -{ - setValue(SETTING_AMBIENT, val); -} - LLColor3 LLSettingsSky::getCloudColor() const { return LLColor3(mSettings[SETTING_CLOUD_COLOR]); -- cgit v1.2.3 From 659d14504f6ab4ad283efe4ecd950a4483e1498f Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 29 Oct 2018 18:18:20 +0200 Subject: SL-1476 EEP Better shader resets and transitions --- indra/llinventory/llsettingssky.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index e2fd681039..14318a2a26 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -434,7 +434,14 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast(end); if (other) { - LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); + if (!mSettings.has(SETTING_LEGACY_HAZE) && !mSettings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT)) + { + // Special case since SETTING_AMBIENT is both in outer and legacy maps, we prioritize legacy one + // see getAmbientColor() + setAmbientColor(getAmbientColor()); + } + + LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, other->getParameterMap(), blendf); replaceSettings(blenddata); mNextSunTextureId = other->getSunTextureId(); mNextMoonTextureId = other->getMoonTextureId(); @@ -945,6 +952,7 @@ LLVector3 LLSettingsSky::getLightDirection() const LLColor3 LLSettingsSky::getAmbientColor() const { + // Todo: this causes complications, preferably to get rid of this duality if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT)) { return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_AMBIENT]); -- cgit v1.2.3 From 536799d07e4298ff8157ef51ed00040e10a5ba65 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 29 Oct 2018 23:02:20 +0100 Subject: SL-9977 SL-9973 --- indra/llinventory/llsettingssky.cpp | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index e2fd681039..8a1e74d7ea 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -156,14 +156,18 @@ LLSettingsSky::validation_list_t legacyHazeValidationList() static LLSettingsBase::validation_list_t legacyHazeValidation; if (legacyHazeValidation.empty()) { + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_AMBIENT, false, LLSD::TypeArray, + boost::bind(&LLSettingsBase::Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_BLUE_DENSITY, false, LLSD::TypeArray, boost::bind(&LLSettingsBase::Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); + LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_BLUE_HORIZON, false, LLSD::TypeArray, boost::bind(&LLSettingsBase::Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); + LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_DENSITY, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_HORIZON, false, LLSD::TypeReal, @@ -493,28 +497,6 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() // copy constructor for LLSDArray. Directly binding the LLSDArray as // a parameter without first wrapping it in a pure LLSD object will result // in deeply nested arrays like this [[[[[[[[[[v1,v2,v3]]]]]]]]]] - validation.push_back(Validator(SETTING_BLUE_DENSITY, false, LLSD::TypeArray, - boost::bind(&Validator::verifyVectorMinMax, _1, - LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); - validation.push_back(Validator(SETTING_BLUE_HORIZON, false, LLSD::TypeArray, - boost::bind(&Validator::verifyVectorMinMax, _1, - LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); - validation.push_back(Validator(SETTING_HAZE_DENSITY, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(5.0f))))); - validation.push_back(Validator(SETTING_HAZE_HORIZON, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(5.0f))))); - validation.push_back(Validator(SETTING_AMBIENT, false, LLSD::TypeArray, - boost::bind(&Validator::verifyVectorMinMax, _1, - LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); - validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0001f)(2.0f))))); - validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0001f)(1000.0f))))); - - validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_RAINBOW_TEXTUREID, false, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_HALO_TEXTUREID, false, LLSD::TypeUUID)); @@ -921,9 +903,6 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const LL_WARNS("SETTINGS") << "Zero length sun direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; if (mMoonDirection.lengthSquared() < 0.01f) LL_WARNS("SETTINGS") << "Zero length moon direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; - - llassert(mSunDirection.lengthSquared() > 0.01f); - llassert(mMoonDirection.lengthSquared() > 0.01f); } LLVector3 LLSettingsSky::getLightDirection() const -- cgit v1.2.3 From 86419eb11be50bf75c9049a80e422d7704dd7d30 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 30 Oct 2018 01:14:21 +0200 Subject: SL-1476 EEP Better shader transitions --- indra/llinventory/llsettingssky.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index cf6bc45080..088c183f70 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -438,11 +438,25 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast(end); if (other) { - if (!mSettings.has(SETTING_LEGACY_HAZE) && !mSettings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT)) + if (other->mSettings.has(SETTING_LEGACY_HAZE)) { - // Special case since SETTING_AMBIENT is both in outer and legacy maps, we prioritize legacy one - // see getAmbientColor() - setAmbientColor(getAmbientColor()); + if (!mSettings.has(SETTING_LEGACY_HAZE) || !mSettings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT)) + { + // Special case since SETTING_AMBIENT is both in outer and legacy maps, we prioritize legacy one + // see getAmbientColor(), we are about to replaceSettings(), so we are free to set it + setAmbientColor(getAmbientColor()); + } + } + else + { + if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT)) + { + // Special case due to ambient's duality + // We need to match 'other's' structure for interpolation. + // We are free to change mSettings, since we are about to reset it + mSettings[SETTING_AMBIENT] = getAmbientColor().getValue(); + mSettings[SETTING_LEGACY_HAZE].erase(SETTING_AMBIENT); + } } LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, other->getParameterMap(), blendf); -- cgit v1.2.3 From 64db1f48206ead083661a3f9df93bff9b37074a8 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 1 Nov 2018 18:17:43 +0200 Subject: SL-9793 EEP Clouds vanish and reappear abruptly if one of textures is not set --- indra/llinventory/llsettingssky.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 088c183f70..9d839e88d0 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -459,11 +459,35 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) } } + LLUUID cloud_noise_id = getCloudNoiseTextureId(); + LLUUID cloud_noise_id_next = other->getCloudNoiseTextureId(); + F64 cloud_shadow = 0; + if (!cloud_noise_id.isNull() && cloud_noise_id_next.isNull()) + { + // If there is no cloud texture in destination, reduce coverage to imitate disappearance + // See LLDrawPoolWLSky::renderSkyClouds... we don't blend present texture with null + // Note: Probably can be done by shader + cloud_shadow = lerp(mSettings[SETTING_CLOUD_SHADOW].asReal(), (F64)0.f, blendf); + cloud_noise_id_next = cloud_noise_id; + } + else if (cloud_noise_id.isNull() && !cloud_noise_id_next.isNull()) + { + // Source has no cloud texture, reduce initial coverage to imitate appearance + // use same texture as destination + cloud_shadow = lerp((F64)0.f, other->mSettings[SETTING_CLOUD_SHADOW].asReal(), blendf); + setCloudNoiseTextureId(cloud_noise_id_next); + } + else + { + cloud_shadow = lerp(mSettings[SETTING_CLOUD_SHADOW].asReal(), other->mSettings[SETTING_CLOUD_SHADOW].asReal(), blendf); + } + LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, other->getParameterMap(), blendf); + blenddata[SETTING_CLOUD_SHADOW] = LLSD::Real(cloud_shadow); replaceSettings(blenddata); mNextSunTextureId = other->getSunTextureId(); mNextMoonTextureId = other->getMoonTextureId(); - mNextCloudTextureId = other->getCloudNoiseTextureId(); + mNextCloudTextureId = cloud_noise_id_next; mNextBloomTextureId = other->getBloomTextureId(); mNextRainbowTextureId = other->getRainbowTextureId(); mNextHaloTextureId = other->getHaloTextureId(); @@ -486,6 +510,7 @@ LLSettingsSky::stringset_t LLSettingsSky::getSkipInterpolateKeys() const skipSet.insert(SETTING_RAYLEIGH_CONFIG); skipSet.insert(SETTING_MIE_CONFIG); skipSet.insert(SETTING_ABSORPTION_CONFIG); + skipSet.insert(SETTING_CLOUD_SHADOW); } return skipSet; -- cgit v1.2.3 From fb335cc243581925bb772a1f10112ec493db8552 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 1 Nov 2018 18:26:24 +0100 Subject: SL-10000 fix storing of ambient value when converting legacy settings --- indra/llinventory/llsettingssky.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index cf6bc45080..aff8bec1cd 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -169,13 +169,13 @@ LLSettingsSky::validation_list_t legacyHazeValidationList() LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_DENSITY, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(5.0f))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_HORIZON, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(5.0f))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0001f)(0.9f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0001f)(2.0f))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DISTANCE_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0001f)(1000.0f))))); } return legacyHazeValidation; } @@ -724,6 +724,10 @@ LLSD LLSettingsSky::translateLegacyHazeSettings(const LLSD& legacy) // AdvancedAtmospherics TODO // These need to be translated into density profile info in the new settings format... // LEGACY_ATMOSPHERICS + if (legacy.has(SETTING_AMBIENT)) + { + legacyhazesettings[SETTING_AMBIENT] = LLColor3(legacy[SETTING_AMBIENT]).getValue(); + } if (legacy.has(SETTING_BLUE_DENSITY)) { legacyhazesettings[SETTING_BLUE_DENSITY] = LLColor3(legacy[SETTING_BLUE_DENSITY]).getValue(); @@ -765,10 +769,6 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) newsettings[SETTING_LEGACY_HAZE] = legacyhazesettings; } - if (legacy.has(SETTING_AMBIENT)) - { - newsettings[SETTING_AMBIENT] = LLColor3(legacy[SETTING_AMBIENT]).getValue(); - } if (legacy.has(SETTING_CLOUD_COLOR)) { newsettings[SETTING_CLOUD_COLOR] = LLColor3(legacy[SETTING_CLOUD_COLOR]).getValue(); -- cgit v1.2.3 From 655e1d190044d3d4466589eeab5e6eb867fb08c0 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 19 Nov 2018 15:59:00 +0200 Subject: SL-10086 FIXED [EEP] Rainbow and Halo use wrong textures --- indra/llinventory/llsettingssky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index f21cca34a6..ace530ae54 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -37,8 +37,8 @@ namespace { const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); - const LLUUID IMG_RAINBOW("12149143-f599-91a7-77ac-b52a3c0f59cd"); - const LLUUID IMG_HALO("11b4c57c-56b3-04ed-1f82-2004363882e4"); + const LLUUID IMG_RAINBOW("11b4c57c-56b3-04ed-1f82-2004363882e4"); + const LLUUID IMG_HALO("12149143-f599-91a7-77ac-b52a3c0f59cd"); } namespace { -- cgit v1.2.3 From b6fa72d3c4d02527f6d118eadc9ba1ac48a297f5 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 3 Dec 2018 15:33:15 -0800 Subject: SL-10055 Modify handling of directional light to prefer sun when it is up but use moon dir/color when it is alone in the sky. Modify handling of shader in shaders to get some shadowing of ambient and nighttime shadowing. --- indra/llinventory/llsettingssky.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index ace530ae54..bd40760193 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -968,6 +968,23 @@ LLVector3 LLSettingsSky::getLightDirection() const return LLVector3::z_axis; } +LLColor3 LLSettingsSky::getLightDiffuse() const +{ + update(); + + // is the normal from the sun or the moon + if (getIsSunUp()) + { + return getSunDiffuse(); + } + else if (getIsMoonUp()) + { + return getMoonDiffuse(); + } + + return LLColor3::white; +} + LLColor3 LLSettingsSky::getAmbientColor() const { // Todo: this causes complications, preferably to get rid of this duality -- cgit v1.2.3 From 70ac8d9fa7049891ed1b65f68f112127dfb5f5f7 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 12 Dec 2018 14:07:23 -0800 Subject: SL-10238: Viewer spport for push notifications from the simulator contaiting partial groups of settings. Blend these settings into the current environment. --- indra/llinventory/llsettingssky.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index ace530ae54..37882b91ec 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -431,6 +431,18 @@ void LLSettingsSky::replaceSettings(LLSD settings) mNextHaloTextureId.setNull(); } +void LLSettingsSky::replaceWithSky(LLSettingsSky::ptr_t pother) +{ + replaceWith(pother); + + mNextSunTextureId = pother->mNextSunTextureId; + mNextMoonTextureId = pother->mNextMoonTextureId; + mNextCloudTextureId = pother->mNextCloudTextureId; + mNextBloomTextureId = pother->mNextBloomTextureId; + mNextRainbowTextureId = pother->mNextRainbowTextureId; + mNextHaloTextureId = pother->mNextHaloTextureId; +} + void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { llassert(getSettingsType() == end->getSettingsType()); -- cgit v1.2.3 From 07bff3129adaabb90f09b71fa65c8be0c3ecef5d Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 19 Dec 2018 14:59:19 -0800 Subject: Add new shaders for advanced atmo SH env lighting calcs. --- indra/llinventory/llsettingssky.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 231077c217..fb7f5e5c1c 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -999,7 +999,6 @@ LLColor3 LLSettingsSky::getLightDiffuse() const LLColor3 LLSettingsSky::getAmbientColor() const { - // Todo: this causes complications, preferably to get rid of this duality if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT)) { return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_AMBIENT]); -- cgit v1.2.3 From 1871f03d12e7a8e388d188f87e612117bcda75c1 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 7 Jan 2019 17:00:01 -0800 Subject: SL-10067, SL-9917: Updated UUIDs for sun and moon textures and to corrected known skies. --- indra/llinventory/llsettingssky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 231077c217..471f15e829 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -139,8 +139,8 @@ const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level"); const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("eb3a7080-831f-9f37-10f0-7b1f9ea4043c"); -static const LLUUID DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver -static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver +static const LLUUID DEFAULT_SUN_ID("0ed03550-9096-3c5a-27d8-c6496bff1064"); // dataserver +static const LLUUID DEFAULT_MOON_ID("db13b827-7e6a-7ace-bed4-4419ee00984d"); // dataserver static const LLUUID DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); const std::string LLSettingsSky::SETTING_LEGACY_HAZE("legacy_haze"); -- cgit v1.2.3 From 38c84545cc8c2c3704402d009d9bce253aa77939 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 15 Jan 2019 14:40:36 -0800 Subject: SL-9917: New default sun texture, blank moon is now no image. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 12b33142e3..e8dcba516e 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -139,7 +139,7 @@ const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level"); const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("eb3a7080-831f-9f37-10f0-7b1f9ea4043c"); -static const LLUUID DEFAULT_SUN_ID("0ed03550-9096-3c5a-27d8-c6496bff1064"); // dataserver +static const LLUUID DEFAULT_SUN_ID("8ae0acc4-9e87-7f25-e16e-2a6caa5b8fc3"); // dataserver static const LLUUID DEFAULT_MOON_ID("db13b827-7e6a-7ace-bed4-4419ee00984d"); // dataserver static const LLUUID DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); -- cgit v1.2.3 From f42ac5b94e384c789de0b2c4e865b087589a940e Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 22 Jan 2019 09:24:11 -0800 Subject: SL-10387: Move settings intjection to a setting object (and out of llEnvironment) --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index e8dcba516e..86c8393499 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -139,7 +139,7 @@ const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level"); const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("eb3a7080-831f-9f37-10f0-7b1f9ea4043c"); -static const LLUUID DEFAULT_SUN_ID("8ae0acc4-9e87-7f25-e16e-2a6caa5b8fc3"); // dataserver +static const LLUUID DEFAULT_SUN_ID("32bfbcea-24b1-fb9d-1ef9-48a28a63730f"); // dataserver static const LLUUID DEFAULT_MOON_ID("db13b827-7e6a-7ace-bed4-4419ee00984d"); // dataserver static const LLUUID DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); -- cgit v1.2.3 From c7e02b0835cbb50777c677f618c4a957e69fabee Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 30 Jan 2019 14:36:46 -0800 Subject: SL-9925: Viewer now shows an error message if import from legacy windlight fails. --- indra/llinventory/llsettingssky.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 86c8393499..f3519dc7cb 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -809,6 +809,7 @@ LLSD LLSettingsSky::translateLegacyHazeSettings(const LLSD& legacy) LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) { + bool converted_something(false); LLSD newsettings(defaults()); // Move legacy haze parameters to an inner map @@ -818,23 +819,28 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) if (legacyhazesettings.size() > 0) { newsettings[SETTING_LEGACY_HAZE] = legacyhazesettings; + converted_something |= true; } if (legacy.has(SETTING_CLOUD_COLOR)) { newsettings[SETTING_CLOUD_COLOR] = LLColor3(legacy[SETTING_CLOUD_COLOR]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_CLOUD_POS_DENSITY1)) { newsettings[SETTING_CLOUD_POS_DENSITY1] = LLColor3(legacy[SETTING_CLOUD_POS_DENSITY1]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_CLOUD_POS_DENSITY2)) { newsettings[SETTING_CLOUD_POS_DENSITY2] = LLColor3(legacy[SETTING_CLOUD_POS_DENSITY2]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_CLOUD_SCALE)) { newsettings[SETTING_CLOUD_SCALE] = LLSD::Real(legacy[SETTING_CLOUD_SCALE][0].asReal()); + converted_something |= true; } if (legacy.has(SETTING_CLOUD_SCROLL_RATE)) { @@ -851,53 +857,64 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) } newsettings[SETTING_CLOUD_SCROLL_RATE] = cloud_scroll.getValue(); + converted_something |= true; } if (legacy.has(SETTING_CLOUD_SHADOW)) { newsettings[SETTING_CLOUD_SHADOW] = LLSD::Real(legacy[SETTING_CLOUD_SHADOW][0].asReal()); + converted_something |= true; } if (legacy.has(SETTING_GAMMA)) { newsettings[SETTING_GAMMA] = legacy[SETTING_GAMMA][0].asReal(); + converted_something |= true; } if (legacy.has(SETTING_GLOW)) { newsettings[SETTING_GLOW] = LLColor3(legacy[SETTING_GLOW]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_MAX_Y)) { newsettings[SETTING_MAX_Y] = LLSD::Real(legacy[SETTING_MAX_Y][0].asReal()); + converted_something |= true; } if (legacy.has(SETTING_STAR_BRIGHTNESS)) { newsettings[SETTING_STAR_BRIGHTNESS] = LLSD::Real(legacy[SETTING_STAR_BRIGHTNESS].asReal() * 250.0f); + converted_something |= true; } if (legacy.has(SETTING_SUNLIGHT_COLOR)) { newsettings[SETTING_SUNLIGHT_COLOR] = LLColor4(legacy[SETTING_SUNLIGHT_COLOR]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_PLANET_RADIUS)) { newsettings[SETTING_PLANET_RADIUS] = LLSD::Real(legacy[SETTING_PLANET_RADIUS].asReal()); + converted_something |= true; } if (legacy.has(SETTING_SKY_BOTTOM_RADIUS)) { newsettings[SETTING_SKY_BOTTOM_RADIUS] = LLSD::Real(legacy[SETTING_SKY_BOTTOM_RADIUS].asReal()); + converted_something |= true; } if (legacy.has(SETTING_SKY_TOP_RADIUS)) { newsettings[SETTING_SKY_TOP_RADIUS] = LLSD::Real(legacy[SETTING_SKY_TOP_RADIUS].asReal()); + converted_something |= true; } if (legacy.has(SETTING_SUN_ARC_RADIANS)) { newsettings[SETTING_SUN_ARC_RADIANS] = LLSD::Real(legacy[SETTING_SUN_ARC_RADIANS].asReal()); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_EAST_ANGLE) && legacy.has(SETTING_LEGACY_SUN_ANGLE)) @@ -912,8 +929,12 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); newsettings[SETTING_MOON_ROTATION] = moonquat.getValue(); + converted_something |= true; } + if (!converted_something) + return LLSD(); + return newsettings; } -- cgit v1.2.3 From 50b383e5aa333d453e906ae2beb28fe1da549bef Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 1 Feb 2019 09:45:07 -0800 Subject: Fix issue with OSX shader compiler not implementing #if correctly (nice job, Timmy). --- indra/llinventory/llsettingssky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index f3519dc7cb..44ed16e0f9 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -955,13 +955,13 @@ void LLSettingsSky::updateSettings() bool LLSettingsSky::getIsSunUp() const { LLVector3 sunDir = getSunDirection(); - return sunDir.mV[2] > NIGHTTIME_ELEVATION_SIN; + return sunDir.mV[2] > 0;//NIGHTTIME_ELEVATION_SIN; } bool LLSettingsSky::getIsMoonUp() const { LLVector3 moonDir = getMoonDirection(); - return moonDir.mV[2] > NIGHTTIME_ELEVATION_SIN; + return moonDir.mV[2] > 0;//NIGHTTIME_ELEVATION_SIN; } void LLSettingsSky::calculateHeavenlyBodyPositions() const -- cgit v1.2.3 From db97bb51489dc610fd748b73c321a08e7388d668 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 1 Feb 2019 09:49:55 -0800 Subject: Roll back attempted fix for 9996 on ALM which has unacceptable knock-on effects. --- indra/llinventory/llsettingssky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 44ed16e0f9..f3519dc7cb 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -955,13 +955,13 @@ void LLSettingsSky::updateSettings() bool LLSettingsSky::getIsSunUp() const { LLVector3 sunDir = getSunDirection(); - return sunDir.mV[2] > 0;//NIGHTTIME_ELEVATION_SIN; + return sunDir.mV[2] > NIGHTTIME_ELEVATION_SIN; } bool LLSettingsSky::getIsMoonUp() const { LLVector3 moonDir = getMoonDirection(); - return moonDir.mV[2] > 0;//NIGHTTIME_ELEVATION_SIN; + return moonDir.mV[2] > NIGHTTIME_ELEVATION_SIN; } void LLSettingsSky::calculateHeavenlyBodyPositions() const -- cgit v1.2.3 From 5a8610ccb7e1f5a0e4d54170ac922e6820ce3acb Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 1 Feb 2019 13:41:31 -0800 Subject: SL-9996, SL-1130, SL-5546 Fix bug with setting texture matrix for rigged mesh. Fix z-fighting between sea and sky in ALM by cheating sky, stars, and moon using gl_FragDepth. Fix handling of atmospheric haze glow w.r.t independent sun/moon positioning (we can no longer depend on them being mutex to each other). --- indra/llinventory/llsettingssky.cpp | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index f3519dc7cb..db54140e2c 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,9 +32,13 @@ #include "llfasttimer.h" #include "v3colorutil.h" +#if LL_WINDOWS +#pragma optimize("", off) +#endif + //========================================================================= namespace { - const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees + const F32 NIGHTTIME_ELEVATION = 8.0f; // degrees const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); const LLUUID IMG_RAINBOW("11b4c57c-56b3-04ed-1f82-2004363882e4"); @@ -952,16 +956,38 @@ void LLSettingsSky::updateSettings() calculateLightSettings(); } +F32 LLSettingsSky::getSunMoonGlowFactor() const +{ + LLVector3 sunDir = getSunDirection(); + LLVector3 moonDir = getMoonDirection(); + + // sun glow at full iff moon is not up + if (sunDir.mV[VZ] > -NIGHTTIME_ELEVATION_SIN) + { + if (moonDir.mV[2] <= 0.0f) + { + return 1.0f; + } + } + + if (moonDir.mV[2] > 0.0f) + { + return moonDir.mV[VZ] / 3.0f; // ramp moon glow at moonset + } + + return 0.0f; +} + bool LLSettingsSky::getIsSunUp() const { LLVector3 sunDir = getSunDirection(); - return sunDir.mV[2] > NIGHTTIME_ELEVATION_SIN; + return (sunDir.mV[2] >= 0.0f) || ((sunDir.mV[2] > -NIGHTTIME_ELEVATION_SIN) && !getIsMoonUp()); } bool LLSettingsSky::getIsMoonUp() const { LLVector3 moonDir = getMoonDirection(); - return moonDir.mV[2] > NIGHTTIME_ELEVATION_SIN; + return moonDir.mV[2] > 0.0f; } void LLSettingsSky::calculateHeavenlyBodyPositions() const -- cgit v1.2.3 From 8b4a86db298335de52db114d63a153808dfde36a Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 1 Feb 2019 13:43:49 -0800 Subject: Remove MSVC pragma to make debugging feasible in RelWithDebInfo. --- indra/llinventory/llsettingssky.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index db54140e2c..612c97168c 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,10 +32,6 @@ #include "llfasttimer.h" #include "v3colorutil.h" -#if LL_WINDOWS -#pragma optimize("", off) -#endif - //========================================================================= namespace { const F32 NIGHTTIME_ELEVATION = 8.0f; // degrees -- cgit v1.2.3 From 8890c3238ab4ae8bbf1bc123284f9c6d4db4f9d6 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 6 Feb 2019 16:42:23 -0800 Subject: SL-10478 Fix side-effects of having both sun and moon as potential directional light contributors. We pass an int to the shader indicating which to prefer instead of making per-pixel decisions and pass the moonlight color/di independently. Obsolete llsettingssky fade color which was unused elsewhere and cached for no reason. --- indra/llinventory/llsettingssky.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 612c97168c..2a503664ad 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1238,12 +1238,6 @@ LLVector3 LLSettingsSky::getMoonDirection() const return mMoonDirection; } -LLColor4U LLSettingsSky::getFadeColor() const -{ - update(); - return mFadeColor; -} - LLColor4 LLSettingsSky::getMoonAmbient() const { update(); @@ -1305,12 +1299,9 @@ void LLSettingsSky::calculateLightSettings() const mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); - mMoonDiffuse = gammaCorrect(componentMult(LLColor3::white, light_transmittance)); - mMoonAmbient = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.5f); + mMoonDiffuse = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.5f); + mMoonAmbient = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.25f); mTotalAmbient = mSunAmbient; - - mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; - mFadeColor.setAlpha(0); } LLUUID LLSettingsSky::GetDefaultAssetId() -- cgit v1.2.3 From 4952736a063b674f5a91904686920b11b0e04b69 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 7 Feb 2019 11:06:03 -0800 Subject: SL-10486 Use brighter moon texture for both default and blank moon texture ids in picker. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 2a503664ad..72a3c7b01c 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -140,7 +140,7 @@ const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level"); const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("eb3a7080-831f-9f37-10f0-7b1f9ea4043c"); static const LLUUID DEFAULT_SUN_ID("32bfbcea-24b1-fb9d-1ef9-48a28a63730f"); // dataserver -static const LLUUID DEFAULT_MOON_ID("db13b827-7e6a-7ace-bed4-4419ee00984d"); // dataserver +static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver static const LLUUID DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); const std::string LLSettingsSky::SETTING_LEGACY_HAZE("legacy_haze"); -- cgit v1.2.3 From 3e0c9087cd6b26a64831f99bf9be05daa1dec510 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 8 Feb 2019 14:29:55 -0800 Subject: SL-10414 --- indra/llinventory/llsettingssky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 72a3c7b01c..af7425cca0 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -954,7 +954,7 @@ void LLSettingsSky::updateSettings() F32 LLSettingsSky::getSunMoonGlowFactor() const { - LLVector3 sunDir = getSunDirection(); + LLVector3 sunDir = getSunDirection(); LLVector3 moonDir = getMoonDirection(); // sun glow at full iff moon is not up @@ -968,7 +968,7 @@ F32 LLSettingsSky::getSunMoonGlowFactor() const if (moonDir.mV[2] > 0.0f) { - return moonDir.mV[VZ] / 3.0f; // ramp moon glow at moonset + return 0.25f; } return 0.0f; -- cgit v1.2.3 From 2401712d1073e85b4b9183d20c6e9274bc874f64 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 20 Feb 2019 15:20:30 -0800 Subject: SL-9660: Next pass cleanup. Removed and downgraded a number of logs. Removed refs to LAPAS. Better sync with legacy regions. --- indra/llinventory/llsettingssky.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index af7425cca0..744c5853e4 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -997,9 +997,6 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const mSunDirection.normalize(); mMoonDirection.normalize(); - //LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL; - //LL_WARNS("LAPRAS") << "Moon info: Rotation=" << moonq << " Vector=" << mMoonDirection << LL_ENDL; - if (mSunDirection.lengthSquared() < 0.01f) LL_WARNS("SETTINGS") << "Zero length sun direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; if (mMoonDirection.lengthSquared() < 0.01f) -- cgit v1.2.3 From a10ec81e82d79bd79d5b058fda1b370073bfb480 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 15 Mar 2019 08:13:04 -0700 Subject: SL-10743, SL-10744 Don't step on SUNLIGHT_COLOR uniform w/ syncLightState competing set. Put drawpool alpha render loop lighting setup changes as they were (this will give back some performance and possibly require reopening 10566). --- indra/llinventory/llsettingssky.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 744c5853e4..f1bea326c1 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1281,19 +1281,18 @@ void LLSettingsSky::calculateLightSettings() const // and vary_sunlight will work properly with moon light F32 lighty = lightnorm[1]; - - lighty = llmax(0.f, lighty); - if(lighty > 0.f) + if(fabs(lighty) > 0.001f) { lighty = 1.f / lighty; } + lighty = llmax(0.001f, lighty); componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); //increase ambient when there are more clouds LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; //brightness of surface both sunlight and ambient - mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); + mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); mMoonDiffuse = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.5f); -- cgit v1.2.3 From 446afe2d1a081a0e10a34749bbe1e4475075dae0 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 26 Mar 2019 08:21:53 -0700 Subject: Make whether the sun or moon is primary part of llrender light state so we can set uniforms for shaders along with other light params. Fix atten calcs to not use abs val. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index f1bea326c1..0e597aabb0 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1281,7 +1281,7 @@ void LLSettingsSky::calculateLightSettings() const // and vary_sunlight will work properly with moon light F32 lighty = lightnorm[1]; - if(fabs(lighty) > 0.001f) + if(lighty > 0.001f) { lighty = 1.f / lighty; } -- cgit v1.2.3 From 9dee4149ae6f33e2f82b8986b041df311f0cbe88 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 26 Mar 2019 13:37:07 -0700 Subject: Remove remaining 0.5/1.5 fudge factors on lighting radius/falloff params. Make moonlight darker and slightly bluish for scotopic feel when moon is primary. --- indra/llinventory/llsettingssky.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 0e597aabb0..a7b87c4d96 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1295,8 +1295,9 @@ void LLSettingsSky::calculateLightSettings() const mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); - mMoonDiffuse = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.5f); - mMoonAmbient = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.25f); + LLColor3 moonlight(0.75, 0.75, 0.92); + mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * 0.25f); + mMoonAmbient = gammaCorrect(componentMult(moonlight, light_transmittance) * 0.125f); mTotalAmbient = mSunAmbient; } -- cgit v1.2.3 From 823172cab99c55b1c26b523d7dd63a99ece9f6cb Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 28 Mar 2019 14:18:59 -0700 Subject: SL-10831 Make moon brightness env setting affect moon diffuse/ambient color combo so it affects in-world lighting. Adjust how the moon brightness affects the moon disc texture rendering (washes out less). --- indra/llinventory/llsettingssky.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index a7b87c4d96..0010e62658 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1295,9 +1295,15 @@ void LLSettingsSky::calculateLightSettings() const mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); - LLColor3 moonlight(0.75, 0.75, 0.92); - mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * 0.25f); - mMoonAmbient = gammaCorrect(componentMult(moonlight, light_transmittance) * 0.125f); + F32 moon_brightness = getMoonBrightness(); + + LLColor3 moonlight_a(0.66, 0.66, 0.66); + LLColor3 moonlight_b(0.66, 0.66, 1.0); + + LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); + + mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness * 0.25f); + mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); mTotalAmbient = mSunAmbient; } -- cgit v1.2.3 From 4490399cc5fe944fff2e81d9ba134ab0447cd9a1 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 29 Mar 2019 07:58:45 -0700 Subject: Fix windows line endings. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 0010e62658..9211a48a8e 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1300,7 +1300,7 @@ void LLSettingsSky::calculateLightSettings() const LLColor3 moonlight_a(0.66, 0.66, 0.66); LLColor3 moonlight_b(0.66, 0.66, 1.0); - LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); + LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness * 0.25f); mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); -- cgit v1.2.3 From 759525040ac11a2edee541c944ad0c6e9cc04d0f Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 8 Apr 2019 13:07:44 -0700 Subject: SL-10912 Fix conversion of star brightness, density mult, and distance mult to legacy ranges. Make settings look in both legacyhaze and top-level settings for haze params. --- indra/llinventory/llsettingssky.cpp | 67 +++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 37 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 9211a48a8e..a0d81e6d99 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -737,7 +737,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); dfltsetting[SETTING_MOON_BRIGHTNESS] = LLSD::Real(0.5f); - dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(256.0000); + dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(250.0000); dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); @@ -1037,72 +1037,65 @@ LLColor3 LLSettingsSky::getLightDiffuse() const return LLColor3::white; } -LLColor3 LLSettingsSky::getAmbientColor() const +LLColor3 LLSettingsSky::getColor(const std::string& key, const LLColor3& default_value) const { - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT)) + if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(key)) { - return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_AMBIENT]); + return LLColor3(mSettings[SETTING_LEGACY_HAZE][key]); } - if (mSettings.has(SETTING_AMBIENT)) + if (mSettings.has(key)) { - return LLColor3(mSettings[SETTING_AMBIENT]); + return LLColor3(mSettings[key]); } - return LLColor3(0.25f, 0.25f, 0.25f); + return default_value; } -LLColor3 LLSettingsSky::getBlueDensity() const +F32 LLSettingsSky::getFloat(const std::string& key, F32 default_value) const { - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_BLUE_DENSITY)) + if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(key)) + { + return mSettings[SETTING_LEGACY_HAZE][key].asReal(); + } + if (mSettings.has(key)) { - return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_DENSITY]); + return mSettings[key].asReal(); } - return LLColor3(0.2447f, 0.4487f, 0.7599f); + return default_value; +} + +LLColor3 LLSettingsSky::getAmbientColor() const +{ + return getColor(SETTING_AMBIENT, LLColor3(0.25f, 0.25f, 0.25f)); +} + +LLColor3 LLSettingsSky::getBlueDensity() const +{ + return getColor(SETTING_BLUE_DENSITY, LLColor3(0.2447f, 0.4487f, 0.7599f)); } LLColor3 LLSettingsSky::getBlueHorizon() const { - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_BLUE_HORIZON)) - { - return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_HORIZON]); - } - return LLColor3(0.4954f, 0.4954f, 0.6399f); + return getColor(SETTING_BLUE_HORIZON, LLColor3(0.4954f, 0.4954f, 0.6399f)); } F32 LLSettingsSky::getHazeDensity() const { - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_HAZE_DENSITY)) - { - return mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_DENSITY].asReal(); - } - return 0.7f; + return getFloat(SETTING_HAZE_DENSITY, 0.7f); } F32 LLSettingsSky::getHazeHorizon() const { - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_HAZE_HORIZON)) - { - return mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_HORIZON].asReal(); - } - return 0.19f; + return getFloat(SETTING_HAZE_HORIZON, 0.19f); } F32 LLSettingsSky::getDensityMultiplier() const { - F32 density_multiplier = 0.0001f; - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_DENSITY_MULTIPLIER)) - { - density_multiplier = mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER].asReal(); - } - return density_multiplier; + return getFloat(SETTING_DENSITY_MULTIPLIER, 0.0001f); } F32 LLSettingsSky::getDistanceMultiplier() const { - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_DISTANCE_MULTIPLIER)) - { - return mSettings[SETTING_LEGACY_HAZE][SETTING_DISTANCE_MULTIPLIER].asReal(); - } - return 0.8f; + return getFloat(SETTING_DISTANCE_MULTIPLIER, 0.8f); } void LLSettingsSky::setPlanetRadius(F32 radius) -- cgit v1.2.3 From 4d76ba2d23c22e9a507a0eb7687b3750091b356f Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 22 Apr 2019 10:21:10 -0700 Subject: Fix mismatch between release and EEP in sunlight and ambient color from settings. --- indra/llinventory/llsettingssky.cpp | 55 +++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 24 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index a0d81e6d99..41e8882181 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1180,29 +1180,34 @@ void LLSettingsSky::setHazeHorizon(F32 val) setDirtyFlag(true); } +// Get total from rayleigh and mie density values for normalization +LLColor3 LLSettingsSky::getTotalDensity() const +{ + LLColor3 blue_density = getBlueDensity(); + F32 haze_density = getHazeDensity(); + LLColor3 total_density = blue_density + smear(haze_density); + return total_density; +} + // Sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const { -// LEGACY_ATMOSPHERICS - LLColor3 blue_density = getBlueDensity(); - F32 haze_density = getHazeDensity(); F32 density_multiplier = getDensityMultiplier(); - LLColor3 density = (blue_density * 1.0 + smear(haze_density * 0.25f)); - LLColor3 light_atten = density * density_multiplier * distance; + LLColor3 blue_density = getBlueDensity(); + F32 haze_density = getHazeDensity(); + // Approximate line integral over requested distance + LLColor3 light_atten = (blue_density * 1.0 + smear(haze_density * 0.25f)) * density_multiplier * distance; return light_atten; } LLColor3 LLSettingsSky::getLightTransmittance() const { -// LEGACY_ATMOSPHERICS - LLColor3 blue_density = getBlueDensity(); - F32 haze_density = getHazeDensity(); - F32 density_multiplier = getDensityMultiplier(); - LLColor3 temp1 = blue_density + smear(haze_density); - // Transparency (-> temp1) - temp1 = componentExp((temp1 * -1.f) * density_multiplier); - return temp1; + LLColor3 total_density = getTotalDensity(); + F32 density_multiplier = getDensityMultiplier(); + // Transparency (-> density) from Beer's law + LLColor3 transmittance = componentExp(total_density * -density_multiplier); + return transmittance; } LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const @@ -1262,18 +1267,19 @@ void LLSettingsSky::calculateLightSettings() const { // Initialize temp variables LLColor3 sunlight = getSunlightColor(); - LLColor3 ambient = getAmbientColor(); + LLColor3 ambient = getAmbientColor(); + F32 cloud_shadow = getCloudShadow(); LLVector3 lightnorm = getLightDirection(); // Sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes - F32 max_y = getMaxY(); - LLColor3 light_atten = getLightAttenuation(max_y); - LLColor3 light_transmittance = getLightTransmittance(); + F32 max_y = getMaxY(); + LLColor3 light_atten = getLightAttenuation(max_y); + LLColor3 light_transmittance = getLightTransmittance(); // and vary_sunlight will work properly with moon light - F32 lighty = lightnorm[1]; + F32 lighty = lightnorm[2]; if(lighty > 0.001f) { lighty = 1.f / lighty; @@ -1282,22 +1288,23 @@ void LLSettingsSky::calculateLightSettings() const componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); //increase ambient when there are more clouds - LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; + LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow; //brightness of surface both sunlight and ambient - mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); - mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); + mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); + mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance)); F32 moon_brightness = getMoonBrightness(); LLColor3 moonlight_a(0.66, 0.66, 0.66); LLColor3 moonlight_b(0.66, 0.66, 1.0); - LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); - + LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); + componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); + mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness * 0.25f); mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); - mTotalAmbient = mSunAmbient; + mTotalAmbient = mSunAmbient + mMoonAmbient; } LLUUID LLSettingsSky::GetDefaultAssetId() -- cgit v1.2.3 From 4ed05fc84fce0fbee76c583e91feed5aff2dbbfc Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 25 Apr 2019 10:59:00 -0700 Subject: Fix dark ALM and strangeness at Mid lighting (class 3 but with a darkness about it). Make a distinct class3/lighting/lightV which boosts to WL levels (* 2.0) and make lighting without WL atmo enabled use class 2 or below. Make forward shaders (alpha and materialF with alpha-blend mode on) more consistent with deferred lighting. --- indra/llinventory/llsettingssky.cpp | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 41e8882181..c41944bdbb 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -33,9 +33,8 @@ #include "v3colorutil.h" //========================================================================= -namespace { - const F32 NIGHTTIME_ELEVATION = 8.0f; // degrees - const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); +namespace +{ const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); const LLUUID IMG_RAINBOW("11b4c57c-56b3-04ed-1f82-2004363882e4"); const LLUUID IMG_HALO("12149143-f599-91a7-77ac-b52a3c0f59cd"); @@ -958,15 +957,15 @@ F32 LLSettingsSky::getSunMoonGlowFactor() const LLVector3 moonDir = getMoonDirection(); // sun glow at full iff moon is not up - if (sunDir.mV[VZ] > -NIGHTTIME_ELEVATION_SIN) + if (getIsSunUp()) { - if (moonDir.mV[2] <= 0.0f) + if (!getIsMoonUp()) { return 1.0f; } } - if (moonDir.mV[2] > 0.0f) + if (getIsMoonUp()) { return 0.25f; } @@ -977,13 +976,13 @@ F32 LLSettingsSky::getSunMoonGlowFactor() const bool LLSettingsSky::getIsSunUp() const { LLVector3 sunDir = getSunDirection(); - return (sunDir.mV[2] >= 0.0f) || ((sunDir.mV[2] > -NIGHTTIME_ELEVATION_SIN) && !getIsMoonUp()); + return sunDir.mV[2] >= 0.0f || !getIsMoonUp(); } bool LLSettingsSky::getIsMoonUp() const { LLVector3 moonDir = getMoonDirection(); - return moonDir.mV[2] > 0.0f; + return moonDir.mV[2] >= 0.0f; } void LLSettingsSky::calculateHeavenlyBodyPositions() const @@ -997,10 +996,19 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const mSunDirection.normalize(); mMoonDirection.normalize(); - if (mSunDirection.lengthSquared() < 0.01f) - LL_WARNS("SETTINGS") << "Zero length sun direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; - if (mMoonDirection.lengthSquared() < 0.01f) - LL_WARNS("SETTINGS") << "Zero length moon direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; + // find out about degen math earlier rather than later + llassert(mSunDirection.length() >= 0.9f); + llassert(mMoonDirection.length() >= 0.9f); + + if (mSunDirection.lengthSquared() < 0.9f) + { + LL_WARNS("SETTINGS") << "Invalid sun direction." << LL_ENDL; + } + + if (mMoonDirection.lengthSquared() < 0.9f) + { + LL_WARNS("SETTINGS") << "Invalid moon direction." << LL_ENDL; + } } LLVector3 LLSettingsSky::getLightDirection() const @@ -1280,9 +1288,9 @@ void LLSettingsSky::calculateLightSettings() const // and vary_sunlight will work properly with moon light F32 lighty = lightnorm[2]; - if(lighty > 0.001f) + if(fabs(lighty) > 0.001f) { - lighty = 1.f / lighty; + lighty = 1.f / fabs(lighty); } lighty = llmax(0.001f, lighty); componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); -- cgit v1.2.3 From 4d6cb310ec516fe50912293042ee95d5a10cbe73 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 25 Apr 2019 11:43:16 -0700 Subject: Remove unused vars making Clang warnerror. --- indra/llinventory/llsettingssky.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index c41944bdbb..549d0c4b3b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -953,9 +953,6 @@ void LLSettingsSky::updateSettings() F32 LLSettingsSky::getSunMoonGlowFactor() const { - LLVector3 sunDir = getSunDirection(); - LLVector3 moonDir = getMoonDirection(); - // sun glow at full iff moon is not up if (getIsSunUp()) { -- cgit v1.2.3 From 5f4b93466cf714df13af2056d13973071bc3d541 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 25 Apr 2019 11:44:48 -0700 Subject: Remove bughunting asserts. --- indra/llinventory/llsettingssky.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 549d0c4b3b..5870fb27e3 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -994,9 +994,6 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const mMoonDirection.normalize(); // find out about degen math earlier rather than later - llassert(mSunDirection.length() >= 0.9f); - llassert(mMoonDirection.length() >= 0.9f); - if (mSunDirection.lengthSquared() < 0.9f) { LL_WARNS("SETTINGS") << "Invalid sun direction." << LL_ENDL; -- cgit v1.2.3 From 48ed3f9318cf3750f1c4f72d1e7195f06d06e53c Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 25 Apr 2019 11:46:56 -0700 Subject: Put warnings on sun/moon direction as they were. --- indra/llinventory/llsettingssky.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 5870fb27e3..07a03f0315 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -993,16 +993,10 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const mSunDirection.normalize(); mMoonDirection.normalize(); - // find out about degen math earlier rather than later - if (mSunDirection.lengthSquared() < 0.9f) - { - LL_WARNS("SETTINGS") << "Invalid sun direction." << LL_ENDL; - } - - if (mMoonDirection.lengthSquared() < 0.9f) - { - LL_WARNS("SETTINGS") << "Invalid moon direction." << LL_ENDL; - } + if (mSunDirection.lengthSquared() < 0.01f) + LL_WARNS("SETTINGS") << "Zero length sun direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; + if (mMoonDirection.lengthSquared() < 0.01f) + LL_WARNS("SETTINGS") << "Zero length moon direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; } LLVector3 LLSettingsSky::getLightDirection() const -- cgit v1.2.3 From 5766325290974ee2cfa30fd655060ef396d1e87a Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 25 Apr 2019 13:02:24 -0700 Subject: SL-10904, SL-10998, SL-11018 Fix handling of 1/light_y when y was tiny but getting even tinier. Add similar adjustment to shader version of same calc. --- indra/llinventory/llsettingssky.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 07a03f0315..1490708ca5 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1275,12 +1275,14 @@ void LLSettingsSky::calculateLightSettings() const LLColor3 light_transmittance = getLightTransmittance(); // and vary_sunlight will work properly with moon light - F32 lighty = lightnorm[2]; - if(fabs(lighty) > 0.001f) + const F32 LIMIT = FLT_EPSILON * 8.0f; + + F32 lighty = fabs(lightnorm[2]); + if(lighty >= LIMIT) { - lighty = 1.f / fabs(lighty); + lighty = 1.f / lighty; } - lighty = llmax(0.001f, lighty); + lighty = llmax(LIMIT, lighty); componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); //increase ambient when there are more clouds -- cgit v1.2.3 From 29f8e04ddba3b36776b295949d03ac44d6cb3b11 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 29 Apr 2019 13:07:57 -0700 Subject: SL-11065 Modify is sun up logic to exclude condition of moon. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 1490708ca5..aa26cd8054 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -973,7 +973,7 @@ F32 LLSettingsSky::getSunMoonGlowFactor() const bool LLSettingsSky::getIsSunUp() const { LLVector3 sunDir = getSunDirection(); - return sunDir.mV[2] >= 0.0f || !getIsMoonUp(); + return sunDir.mV[2] >= 0.0f; } bool LLSettingsSky::getIsMoonUp() const -- cgit v1.2.3 From 906b0be675e5467665f65180924e6117700b4cbb Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 3 May 2019 08:47:13 -0700 Subject: SL-11087, SL-11086, SL-11092 Fix sun/moon glow factor bustage. Make darkness an option. Fix moon fade shader logic getting confused when sun was below horizon. --- indra/llinventory/llsettingssky.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index aa26cd8054..a090a7be32 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1292,15 +1292,15 @@ void LLSettingsSky::calculateLightSettings() const mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance)); - F32 moon_brightness = getMoonBrightness(); + F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; - LLColor3 moonlight_a(0.66, 0.66, 0.66); - LLColor3 moonlight_b(0.66, 0.66, 1.0); + LLColor3 moonlight_a(0.45, 0.45, 0.66); + LLColor3 moonlight_b(0.33, 0.33, 1.0); LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); - mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness * 0.25f); + mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness); mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); mTotalAmbient = mSunAmbient + mMoonAmbient; } -- cgit v1.2.3 From 1522a9902481b69b3d04bee5edd79102a796630b Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 3 May 2019 10:12:56 -0700 Subject: SL-11070 Gave clouds the Bob Ross treatment. --- indra/llinventory/llsettingssky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index a090a7be32..def492c203 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1189,7 +1189,7 @@ LLColor3 LLSettingsSky::getTotalDensity() const // this is used later for sunlight modulation at various altitudes LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const { - F32 density_multiplier = getDensityMultiplier(); + F32 density_multiplier = getDensityMultiplier() * 0.45f; LLColor3 blue_density = getBlueDensity(); F32 haze_density = getHazeDensity(); // Approximate line integral over requested distance @@ -1200,7 +1200,7 @@ LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const LLColor3 LLSettingsSky::getLightTransmittance() const { LLColor3 total_density = getTotalDensity(); - F32 density_multiplier = getDensityMultiplier(); + F32 density_multiplier = getDensityMultiplier() * 0.45f; // Transparency (-> density) from Beer's law LLColor3 transmittance = componentExp(total_density * -density_multiplier); return transmittance; -- cgit v1.2.3 From 989de25f189276d586d5c7077e505bc697fe4112 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 7 May 2019 16:32:34 -0700 Subject: SL-11086 Re-fix sun/moon glow factor and make it depend on moon brightness. Make cloud shaders use sunlight color exclusively for consistency when moon is up or down. --- indra/llinventory/llsettingssky.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index def492c203..cfca2d0d78 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -953,21 +953,8 @@ void LLSettingsSky::updateSettings() F32 LLSettingsSky::getSunMoonGlowFactor() const { - // sun glow at full iff moon is not up - if (getIsSunUp()) - { - if (!getIsMoonUp()) - { - return 1.0f; - } - } - - if (getIsMoonUp()) - { - return 0.25f; - } - - return 0.0f; + return getIsSunUp() ? 1.0f : + getIsMoonUp() ? getMoonBrightness() * 0.25 : 0.0f; } bool LLSettingsSky::getIsSunUp() const @@ -1302,7 +1289,7 @@ void LLSettingsSky::calculateLightSettings() const mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness); mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); - mTotalAmbient = mSunAmbient + mMoonAmbient; + mTotalAmbient = mSunAmbient; } LLUUID LLSettingsSky::GetDefaultAssetId() -- cgit v1.2.3 From b143aa96fcd6d16558464c98bcfd9984f7d29750 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 13 May 2019 15:33:48 -0700 Subject: SL-10856 Modify calc of sunlight to avoid clipping in gamma correct on values outside 0-1 range. Modify shaders to put back ambient clamp tuned to be close to ambient contrib in low/mid lighting. --- indra/llinventory/llsettingssky.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index cfca2d0d78..211af6a7ae 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,6 +32,10 @@ #include "llfasttimer.h" #include "v3colorutil.h" +#if LL_WINDOWS +#pragma optimize("", off) +#endif + //========================================================================= namespace { @@ -1276,8 +1280,10 @@ void LLSettingsSky::calculateLightSettings() const LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow; //brightness of surface both sunlight and ambient - mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); - mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance)); + // reduce range to 0 - 1 before gamma correct to prevent clipping + // then restore to full 0 - 3 range before storage + mSunDiffuse = gammaCorrect(componentMult(sunlight * 0.33333f, light_transmittance)) * 3.0f; + mSunAmbient = gammaCorrect(componentMult(tmpAmbient * 0.33333f, light_transmittance)) * 3.0f; F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; -- cgit v1.2.3 From 041d92b6bd4212bafd51567a52b4e2147da3132a Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 14 May 2019 07:56:41 -0700 Subject: Force file update. --- indra/llinventory/llsettingssky.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index cfca2d0d78..8483778e63 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1682,4 +1682,3 @@ LLUUID LLSettingsSky::getNextBloomTextureId() const { return mNextBloomTextureId; } - -- cgit v1.2.3 From b3c0218a31b9d7dd699cf3944bbcfc35e9adbd49 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 16 May 2019 14:14:02 -0700 Subject: Revert lighting changes for 10856 causing knock-on. --- indra/llinventory/llsettingssky.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 45d034cb1f..e02ecc8a33 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1684,3 +1684,4 @@ LLUUID LLSettingsSky::getNextBloomTextureId() const { return mNextBloomTextureId; } + -- cgit v1.2.3 From e9dbee00262a437e4b3f971b37ea636e92032133 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 21 May 2019 16:00:45 -0700 Subject: SL-11238 Fix ambient light inputs to the renderer. Fix 3rd sky shader w/ mistaken density mod conversion. Make ambient clamp apply to all modes. Tune ALM ambient clamp to match non-ALM. --- indra/llinventory/llsettingssky.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index e02ecc8a33..fecca12905 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1246,6 +1246,17 @@ LLColor4 LLSettingsSky::getTotalAmbient() const return mTotalAmbient; } +LLColor3 LLSettingsSky::getMoonlightColor() const +{ + F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; + + LLColor3 moonlight_a(0.45, 0.45, 0.66); + LLColor3 moonlight_b(0.33, 0.33, 1.0); + + LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); + return moonlight; +} + void LLSettingsSky::calculateLightSettings() const { // Initialize temp variables @@ -1278,19 +1289,24 @@ void LLSettingsSky::calculateLightSettings() const //brightness of surface both sunlight and ambient // reduce range to 0 - 1 before gamma correct to prevent clipping // then restore to full 0 - 3 range before storage - mSunDiffuse = gammaCorrect(componentMult(sunlight * 0.33333f, light_transmittance)) * 3.0f; - mSunAmbient = gammaCorrect(componentMult(tmpAmbient * 0.33333f, light_transmittance)) * 3.0f; + //mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); + //mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance)); + + mSunDiffuse = componentMult(sunlight, light_transmittance); + mSunAmbient = componentMult(tmpAmbient, light_transmittance); F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; - LLColor3 moonlight_a(0.45, 0.45, 0.66); - LLColor3 moonlight_b(0.33, 0.33, 1.0); + LLColor3 moonlight = getMoonlightColor(); + LLColor3 moonlight_b(0.33, 0.33, 1.0); // scotopic ambient value - LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); - mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness); - mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); + //mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness); + //mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); + mMoonDiffuse = componentMult(moonlight, light_transmittance) * moon_brightness; + mMoonAmbient = componentMult(moonlight_b, light_transmittance) * 0.0125f; + mTotalAmbient = mSunAmbient; } -- cgit v1.2.3 From 2f2cf6d855e1e5977ef0ed3583238636e890220a Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 29 May 2019 15:57:24 -0700 Subject: SL-10969 Modify ambient handling and forward projector lighting again to stamp out alpha fires. --- indra/llinventory/llsettingssky.cpp | 38 +++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index fecca12905..23b2b003a5 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1249,14 +1249,22 @@ LLColor4 LLSettingsSky::getTotalAmbient() const LLColor3 LLSettingsSky::getMoonlightColor() const { F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; - - LLColor3 moonlight_a(0.45, 0.45, 0.66); - LLColor3 moonlight_b(0.33, 0.33, 1.0); - + LLColor3 moonlight_a(0.9, 0.9, 1.32); + LLColor3 moonlight_b(0.66, 0.66, 2.0); LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); return moonlight; } +void LLSettingsSky::clampColor(LLColor3& color) const +{ + F32 max_color = llmax(color.mV[0], color.mV[1], color.mV[2]); + if (max_color > 1.f) + { + color *= 1.f/max_color; + } + color.clamp(); +} + void LLSettingsSky::calculateLightSettings() const { // Initialize temp variables @@ -1282,30 +1290,28 @@ void LLSettingsSky::calculateLightSettings() const } lighty = llmax(LIMIT, lighty); componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); + componentMultBy(sunlight, light_transmittance); + clampColor(sunlight); //increase ambient when there are more clouds LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow; + componentMultBy(tmpAmbient, light_transmittance); + clampColor(tmpAmbient); //brightness of surface both sunlight and ambient - // reduce range to 0 - 1 before gamma correct to prevent clipping - // then restore to full 0 - 3 range before storage - //mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); - //mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance)); - - mSunDiffuse = componentMult(sunlight, light_transmittance); - mSunAmbient = componentMult(tmpAmbient, light_transmittance); + mSunDiffuse = gammaCorrect(sunlight); + mSunAmbient = gammaCorrect(tmpAmbient); F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; LLColor3 moonlight = getMoonlightColor(); - LLColor3 moonlight_b(0.33, 0.33, 1.0); // scotopic ambient value + LLColor3 moonlight_b(0.66, 0.66, 1.2); // scotopic ambient value componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); + clampColor(moonlight); - //mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness); - //mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); - mMoonDiffuse = componentMult(moonlight, light_transmittance) * moon_brightness; - mMoonAmbient = componentMult(moonlight_b, light_transmittance) * 0.0125f; + mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness); + mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); mTotalAmbient = mSunAmbient; } -- cgit v1.2.3 From 59275152120efd0637bbef67443b9c0d5014a321 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 31 May 2019 09:24:30 -0700 Subject: SL-11117: Set default sky asset ID to A-12PM --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 23b2b003a5..b98522c176 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -136,7 +136,7 @@ const std::string LLSettingsSky::SETTING_SKY_MOISTURE_LEVEL("moisture_level"); const std::string LLSettingsSky::SETTING_SKY_DROPLET_RADIUS("droplet_radius"); const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level"); -const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("eb3a7080-831f-9f37-10f0-7b1f9ea4043c"); +const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("3ae23978-ac82-bcf3-a9cb-ba6e52dcb9ad"); static const LLUUID DEFAULT_SUN_ID("32bfbcea-24b1-fb9d-1ef9-48a28a63730f"); // dataserver static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver -- cgit v1.2.3 From 16d3279995bcb4a4766b721d0897b3d2199971d5 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 3 Jun 2019 11:30:41 -0700 Subject: SL-10966 Fix light atten and transmittance calcs breaking ambient color contrib to fog. Needs to be tested on DRTSIM-415 or better to get legacy viewer settings that match EEP. --- indra/llinventory/llsettingssky.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 23b2b003a5..50a897bb77 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1176,7 +1176,7 @@ LLColor3 LLSettingsSky::getTotalDensity() const // this is used later for sunlight modulation at various altitudes LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const { - F32 density_multiplier = getDensityMultiplier() * 0.45f; + F32 density_multiplier = getDensityMultiplier(); LLColor3 blue_density = getBlueDensity(); F32 haze_density = getHazeDensity(); // Approximate line integral over requested distance @@ -1187,7 +1187,7 @@ LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const LLColor3 LLSettingsSky::getLightTransmittance() const { LLColor3 total_density = getTotalDensity(); - F32 density_multiplier = getDensityMultiplier() * 0.45f; + F32 density_multiplier = getDensityMultiplier(); // Transparency (-> density) from Beer's law LLColor3 transmittance = componentExp(total_density * -density_multiplier); return transmittance; @@ -1294,7 +1294,7 @@ void LLSettingsSky::calculateLightSettings() const clampColor(sunlight); //increase ambient when there are more clouds - LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow; + LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5; componentMultBy(tmpAmbient, light_transmittance); clampColor(tmpAmbient); -- cgit v1.2.3 From d23bf2c16e2d36b18c920bbd42f49c47f3c58bd9 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 10 Jul 2019 13:02:09 -0700 Subject: SL-11541 WIP Make LLSettingsSky::gammaCorrect work like the soft scale clip and gamma correct from release. Add transmittance effects to the low-end sky tex gen. --- indra/llinventory/llsettingssky.cpp | 77 ++++++++++++++++++++++++++++--------- 1 file changed, 58 insertions(+), 19 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 5047f312f0..75b4415086 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1184,24 +1184,34 @@ LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const return light_atten; } -LLColor3 LLSettingsSky::getLightTransmittance() const +LLColor3 LLSettingsSky::getLightTransmittance(F32 distance) const { LLColor3 total_density = getTotalDensity(); F32 density_multiplier = getDensityMultiplier(); // Transparency (-> density) from Beer's law - LLColor3 transmittance = componentExp(total_density * -density_multiplier); + LLColor3 transmittance = componentExp(total_density * -(density_multiplier * distance)); return transmittance; } +// performs soft scale clip and gamma correction ala the shader implementation +// scales colors down to 0 - 1 range preserving relative ratios LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const { F32 gamma = getGamma(); + LLColor3 v(in); - v.clamp(); - v= smear(1.0f) - v; - v = componentPow(v, gamma); - v = smear(1.0f) - v; - return v; + // scale down to 0 to 1 range preserving relative ratio (aka homegenize) + F32 max_color = llmax(llmax(in.mV[0], in.mV[1]), in.mV[2]); + if (max_color > 1.0f) + { + v *= 1.0f / max_color; + } + + LLColor3 color = in * 2.0f; + color = smear(1.f) - componentSaturate(color); // clamping after mul seems wrong, but prevents negative colors... + componentPow(color, gamma); + color = smear(1.f) - color; + return color; } LLVector3 LLSettingsSky::getSunDirection() const @@ -1240,6 +1250,12 @@ LLColor3 LLSettingsSky::getSunDiffuse() const return mSunDiffuse; } +LLColor4 LLSettingsSky::getHazeColor() const +{ + update(); + return mHazeColor; +} + LLColor4 LLSettingsSky::getTotalAmbient() const { update(); @@ -1255,14 +1271,19 @@ LLColor3 LLSettingsSky::getMoonlightColor() const return moonlight; } -void LLSettingsSky::clampColor(LLColor3& color) const +void LLSettingsSky::clampColor(LLColor3& color, F32 gamma, F32 scale) const { F32 max_color = llmax(color.mV[0], color.mV[1], color.mV[2]); - if (max_color > 1.f) + if (max_color > scale) { - color *= 1.f/max_color; + color *= scale/max_color; } - color.clamp(); + LLColor3 linear(color); + linear *= 1.0 / scale; + linear = smear(1.0f) - linear; + linear = componentPow(linear, gamma); + linear *= scale; + color = linear; } void LLSettingsSky::calculateLightSettings() const @@ -1278,7 +1299,7 @@ void LLSettingsSky::calculateLightSettings() const // this is used later for sunlight modulation at various altitudes F32 max_y = getMaxY(); LLColor3 light_atten = getLightAttenuation(max_y); - LLColor3 light_transmittance = getLightTransmittance(); + LLColor3 light_transmittance = getLightTransmittance(max_y); // and vary_sunlight will work properly with moon light const F32 LIMIT = FLT_EPSILON * 8.0f; @@ -1291,16 +1312,34 @@ void LLSettingsSky::calculateLightSettings() const lighty = llmax(LIMIT, lighty); componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); componentMultBy(sunlight, light_transmittance); - clampColor(sunlight); + + F32 max_color = llmax(sunlight.mV[0], sunlight.mV[1], sunlight.mV[2]); + if (max_color > 1.0f) + { + sunlight *= 1.0f/max_color; + } //increase ambient when there are more clouds LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5; componentMultBy(tmpAmbient, light_transmittance); - clampColor(tmpAmbient); + + //tmpAmbient = LLColor3::clamp(tmpAmbient, getGamma(), 1.0f); + max_color = llmax(tmpAmbient.mV[0], tmpAmbient.mV[1], tmpAmbient.mV[2]); + if (max_color > 1.0f) + { + tmpAmbient *= 1.0f/max_color; + } //brightness of surface both sunlight and ambient - mSunDiffuse = gammaCorrect(sunlight); - mSunAmbient = gammaCorrect(tmpAmbient); + mSunDiffuse = sunlight; + mSunAmbient = tmpAmbient; + F32 haze_horizon = getHazeHorizon(); + + sunlight *= 1.0 - cloud_shadow; + sunlight += tmpAmbient; + + mHazeColor = getBlueHorizon() * getBlueDensity() * sunlight; + mHazeColor += LLColor4(haze_horizon, haze_horizon, haze_horizon, haze_horizon) * getHazeDensity() * sunlight; F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; @@ -1308,10 +1347,10 @@ void LLSettingsSky::calculateLightSettings() const LLColor3 moonlight_b(0.66, 0.66, 1.2); // scotopic ambient value componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); - clampColor(moonlight); + clampColor(moonlight, getGamma(), 1.0f); - mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness); - mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); + mMoonDiffuse = componentMult(moonlight, light_transmittance) * moon_brightness; + mMoonAmbient = componentMult(moonlight_b, light_transmittance) * 0.0125f; mTotalAmbient = mSunAmbient; } -- cgit v1.2.3 From 53b71f0dc3d8a947225c2ca2ecf22b30fb7667d2 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 24 Jul 2019 13:45:03 -0700 Subject: SL-11600 Make default direction when neither sun nor moon are up straight down instead of noon. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 75b4415086..434270d178 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1000,7 +1000,7 @@ LLVector3 LLSettingsSky::getLightDirection() const return mMoonDirection; } - return LLVector3::z_axis; + return -LLVector3::z_axis; } LLColor3 LLSettingsSky::getLightDiffuse() const -- cgit v1.2.3 From b1cab5d24687b07c124e0dcd61485fa9e368c882 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 13 Aug 2019 09:20:37 -0700 Subject: SL-11212 Remove color clamping in determining sun diffuse and moonlight diffuse color from atmo settings. --- indra/llinventory/llsettingssky.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 434270d178..35bd9a2254 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1313,23 +1313,10 @@ void LLSettingsSky::calculateLightSettings() const componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); componentMultBy(sunlight, light_transmittance); - F32 max_color = llmax(sunlight.mV[0], sunlight.mV[1], sunlight.mV[2]); - if (max_color > 1.0f) - { - sunlight *= 1.0f/max_color; - } - //increase ambient when there are more clouds LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5; componentMultBy(tmpAmbient, light_transmittance); - //tmpAmbient = LLColor3::clamp(tmpAmbient, getGamma(), 1.0f); - max_color = llmax(tmpAmbient.mV[0], tmpAmbient.mV[1], tmpAmbient.mV[2]); - if (max_color > 1.0f) - { - tmpAmbient *= 1.0f/max_color; - } - //brightness of surface both sunlight and ambient mSunDiffuse = sunlight; mSunAmbient = tmpAmbient; @@ -1347,7 +1334,6 @@ void LLSettingsSky::calculateLightSettings() const LLColor3 moonlight_b(0.66, 0.66, 1.2); // scotopic ambient value componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); - clampColor(moonlight, getGamma(), 1.0f); mMoonDiffuse = componentMult(moonlight, light_transmittance) * moon_brightness; mMoonAmbient = componentMult(moonlight_b, light_transmittance) * 0.0125f; -- cgit v1.2.3 From 8960a56f531745bc2d434bdddb6c65731621f596 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 22 Aug 2019 11:19:04 -0700 Subject: SL-11776 Fix false alarming sky updates and doing expensive CPU work for same sky pixels. --- indra/llinventory/llsettingssky.cpp | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 35bd9a2254..9bbeb00efe 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1051,6 +1051,19 @@ LLColor3 LLSettingsSky::getAmbientColor() const return getColor(SETTING_AMBIENT, LLColor3(0.25f, 0.25f, 0.25f)); } +LLColor3 LLSettingsSky::getAmbientColorClamped() const +{ + LLColor3 ambient = getAmbientColor(); + + F32 max_color = llmax(ambient.mV[0], ambient.mV[1], ambient.mV[2]); + if (max_color > 1.0f) + { + ambient *= 1.0f/max_color; + } + + return ambient; +} + LLColor3 LLSettingsSky::getBlueDensity() const { return getColor(SETTING_BLUE_DENSITY, LLColor3(0.2447f, 0.4487f, 0.7599f)); @@ -1313,10 +1326,23 @@ void LLSettingsSky::calculateLightSettings() const componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); componentMultBy(sunlight, light_transmittance); + //F32 max_color = llmax(sunlight.mV[0], sunlight.mV[1], sunlight.mV[2]); + //if (max_color > 1.0f) + //{ + // sunlight *= 1.0f/max_color; + //} + //increase ambient when there are more clouds LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5; componentMultBy(tmpAmbient, light_transmittance); + //tmpAmbient = LLColor3::clamp(tmpAmbient, getGamma(), 1.0f); + //max_color = llmax(tmpAmbient.mV[0], tmpAmbient.mV[1], tmpAmbient.mV[2]); + //if (max_color > 1.0f) + //{ + // tmpAmbient *= 1.0f/max_color; + //} + //brightness of surface both sunlight and ambient mSunDiffuse = sunlight; mSunAmbient = tmpAmbient; @@ -1334,6 +1360,7 @@ void LLSettingsSky::calculateLightSettings() const LLColor3 moonlight_b(0.66, 0.66, 1.2); // scotopic ambient value componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); + //clampColor(moonlight, getGamma(), 1.0f); mMoonDiffuse = componentMult(moonlight, light_transmittance) * moon_brightness; mMoonAmbient = componentMult(moonlight_b, light_transmittance) * 0.0125f; @@ -1676,6 +1703,20 @@ LLColor3 LLSettingsSky::getSunlightColor() const return LLColor3(mSettings[SETTING_SUNLIGHT_COLOR]); } +LLColor3 LLSettingsSky::getSunlightColorClamped() const +{ + LLColor3 sunlight = getSunlightColor(); + //clampColor(sunlight, getGamma(), 3.0f); + + F32 max_color = llmax(sunlight.mV[0], sunlight.mV[1], sunlight.mV[2]); + if (max_color > 1.0f) + { + sunlight *= 1.0f/max_color; + } + + return sunlight; +} + void LLSettingsSky::setSunlightColor(const LLColor3 &val) { setValue(SETTING_SUNLIGHT_COLOR, val); -- cgit v1.2.3 From ad26896a1086536cf47d3cb0041b0410aebf2119 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 27 Aug 2019 12:49:18 -0700 Subject: SL-11055 Remedy cloud_shadow and hack halving being done twice to ambient in some cases (i.e. artificial dimunition of necessary bullshit factor). --- indra/llinventory/llsettingssky.cpp | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 9bbeb00efe..c4ce3af157 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1326,26 +1326,13 @@ void LLSettingsSky::calculateLightSettings() const componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); componentMultBy(sunlight, light_transmittance); - //F32 max_color = llmax(sunlight.mV[0], sunlight.mV[1], sunlight.mV[2]); - //if (max_color > 1.0f) - //{ - // sunlight *= 1.0f/max_color; - //} - //increase ambient when there are more clouds LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5; - componentMultBy(tmpAmbient, light_transmittance); - - //tmpAmbient = LLColor3::clamp(tmpAmbient, getGamma(), 1.0f); - //max_color = llmax(tmpAmbient.mV[0], tmpAmbient.mV[1], tmpAmbient.mV[2]); - //if (max_color > 1.0f) - //{ - // tmpAmbient *= 1.0f/max_color; - //} //brightness of surface both sunlight and ambient mSunDiffuse = sunlight; mSunAmbient = tmpAmbient; + F32 haze_horizon = getHazeHorizon(); sunlight *= 1.0 - cloud_shadow; @@ -1360,12 +1347,11 @@ void LLSettingsSky::calculateLightSettings() const LLColor3 moonlight_b(0.66, 0.66, 1.2); // scotopic ambient value componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); - //clampColor(moonlight, getGamma(), 1.0f); mMoonDiffuse = componentMult(moonlight, light_transmittance) * moon_brightness; - mMoonAmbient = componentMult(moonlight_b, light_transmittance) * 0.0125f; + mMoonAmbient = moonlight_b * 0.0125f; - mTotalAmbient = mSunAmbient; + mTotalAmbient = ambient; } LLUUID LLSettingsSky::GetDefaultAssetId() -- cgit v1.2.3 From b3e11083cc31abfa7cebf2c3acc6aeebfc1f4205 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Thu, 19 Dec 2019 18:04:32 -0700 Subject: SL-11606 fix to match EEP light falloff vs release --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index c4ce3af157..8d0b37d01f 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1000,7 +1000,7 @@ LLVector3 LLSettingsSky::getLightDirection() const return mMoonDirection; } - return -LLVector3::z_axis; + return LLVector3::z_axis_neg; } LLColor3 LLSettingsSky::getLightDiffuse() const -- cgit v1.2.3 From d16a79fc4c5d5af016db6c97efc3a7b2d08f62ce Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 24 Feb 2020 21:22:21 +0200 Subject: SL-12741 Moon was using fixed color --- indra/llinventory/llsettingssky.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 8d0b37d01f..306c732920 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1277,11 +1277,7 @@ LLColor4 LLSettingsSky::getTotalAmbient() const LLColor3 LLSettingsSky::getMoonlightColor() const { - F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; - LLColor3 moonlight_a(0.9, 0.9, 1.32); - LLColor3 moonlight_b(0.66, 0.66, 2.0); - LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); - return moonlight; + return getSunlightColor(); //moon and sun share light color } void LLSettingsSky::clampColor(LLColor3& color, F32 gamma, F32 scale) const -- cgit v1.2.3