From 35873f5963791af08a9951624dc96481a71fa1d7 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 13 Nov 2017 16:43:47 -0800 Subject: Clean up on sun and moon --- indra/newview/llviewermessage.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index e7917c043f..cd3443eee2 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4738,10 +4738,9 @@ void process_time_synch(LLMessageSystem *mesgsys, void **user_data) LL_DEBUGS("Windlight Sync") << "Sun phase: " << phase << " rad = " << fmodf(phase / F_TWO_PI + 0.25, 1.f) * 24.f << " h" << LL_ENDL; gSky.setSunPhase(phase); - gSky.setSunTargetDirection(sun_direction, sun_ang_velocity); - if ( !(gSavedSettings.getBOOL("SkyOverrideSimSunPosition") || gSky.getOverrideSun()) ) + if ( !gSavedSettings.getBOOL("SkyOverrideSimSunPosition") ) { - gSky.setSunDirection(sun_direction, sun_ang_velocity); + gSky.setSunDirection(sun_direction, -sun_direction); } } -- cgit v1.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/llsettingsbase.h | 2 +- indra/llinventory/llsettingssky.cpp | 177 +++++---- indra/llinventory/llsettingssky.h | 113 ++---- indra/llmath/llquaternion.cpp | 2 - indra/llmath/m3math.cpp | 2 - indra/llrender/llrender.h | 5 + indra/llrender/llshadermgr.cpp | 6 +- indra/newview/app_settings/settings.xml | 2 +- .../shaders/class2/deferred/softenLightF.glsl | 8 +- indra/newview/lldrawpoolwater.cpp | 19 +- indra/newview/lldrawpoolwlsky.cpp | 21 +- indra/newview/llenvironment.cpp | 80 ++-- indra/newview/llenvironment.h | 27 +- indra/newview/llface.cpp | 6 +- indra/newview/lllegacyatmospherics.cpp | 6 +- indra/newview/lllegacyatmospherics.h | 2 +- indra/newview/llsettingsvo.cpp | 69 ++-- indra/newview/llsettingsvo.h | 1 + indra/newview/llsky.cpp | 157 +------- indra/newview/llsky.h | 19 +- indra/newview/llstartup.cpp | 3 +- indra/newview/lltoolgun.cpp | 2 +- indra/newview/llviewermessage.cpp | 11 +- indra/newview/llviewershadermgr.cpp | 2 + indra/newview/llvosky.cpp | 417 ++++++++++++--------- indra/newview/llvosky.h | 109 ++---- indra/newview/llvowlsky.cpp | 5 - indra/newview/llvowlsky.h | 3 - indra/newview/pipeline.cpp | 61 ++- indra/newview/pipeline.h | 6 +- 30 files changed, 637 insertions(+), 706 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 5b44dc4666..264c6c6c49 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -251,7 +251,7 @@ protected: void markDirty() { mDirty = true; } private: - bool mDirty; + bool mDirty = true; LLSD combineSDMaps(const LLSD &first, const LLSD &other) const; 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); } - diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 4c8a5e4016..3084cadd57 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -281,16 +281,6 @@ public: setValue(SETTING_GLOW, val); } - LLVector3 getLightNormal() const - { - return LLVector3(mSettings[SETTING_LIGHT_NORMAL]); - } - - void setLightNormal(const LLVector3 &val) - { - setValue(SETTING_LIGHT_NORMAL, val); - } - F32 getMaxY() const { return mSettings[SETTING_MAX_Y].asReal(); @@ -361,68 +351,7 @@ public: setValue(SETTING_SUN_TEXTUREID, id); } - // Internal/calculated settings - LLVector3 getLightDirection() const - { - update(); - return mLightDirection; - }; - - LLVector3 getClampedLightDirection() const - { - update(); - return mClampedLightDirection; - }; - - LLVector3 getSunDirection() const - { - update(); - return mSunDirection; - } - - LLVector3 getMoonDirection() const - { - update(); - return mMoonDirection; - } - - LLColor4U getFadeColor() const - { - update(); - return mFadeColor; - } - - LLColor4 getMoonAmbient() const - { - update(); - return mMoonAmbient; - } - - LLColor3 getMoonDiffuse() const - { - update(); - return mMoonDiffuse; - } - - LLColor4 getSunAmbient() const - { - update(); - return mSunAmbient; - } - - LLColor3 getSunDiffuse() const - { - update(); - return mSunDiffuse; - } - - LLColor4 getTotalAmbient() const - { - update(); - return mTotalAmbient; - } - -//===================================================================== + //===================================================================== // transient properties used in animations. LLUUID getNextSunTextureId() const { @@ -446,7 +375,7 @@ public: virtual validation_list_t getValidationList() const override; static validation_list_t validationList(); - static LLSD translateLegacySettings(const LLSD& legacy, const std::string* name = nullptr); + static LLSD translateLegacySettings(const LLSD& legacy); static LLSD translateLegacyHazeSettings(const LLSD& legacy); LLColor3 getLightAttenuation(F32 distance) const; @@ -468,9 +397,20 @@ public: void setHazeDensity(F32 val); void setHazeHorizon(F32 val); +// Internal/calculated settings bool getIsSunUp() const; bool getIsMoonUp() const; + LLVector3 getLightDirection() const; + LLVector3 getSunDirection() const; + LLVector3 getMoonDirection() const; + LLColor4U getFadeColor() const; + LLColor4 getMoonAmbient() const; + LLColor3 getMoonDiffuse() const; + LLColor4 getSunAmbient() const; + LLColor3 getSunDiffuse() const; + LLColor4 getTotalAmbient() const; + protected: static const std::string SETTING_LEGACY_EAST_ANGLE; static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; @@ -484,28 +424,29 @@ protected: virtual void updateSettings() override; private: + mutable bool mPositionsDirty = true; + mutable bool mLightingDirty = true; + static LLSD rayleighConfigDefault(); static LLSD absorptionConfigDefault(); static LLSD mieConfigDefault(); - void calculateHeavnlyBodyPositions(); - void calculateLightSettings(); + void calculateHeavnlyBodyPositions() const; + void calculateLightSettings() const; - LLVector3 mSunDirection; - LLVector3 mMoonDirection; - LLVector3 mLightDirection; - LLVector3 mClampedLightDirection; + mutable LLVector3 mSunDirection; + mutable LLVector3 mMoonDirection; + mutable LLVector3 mLightDirection; static const F32 DOME_RADIUS; static const F32 DOME_OFFSET; - LLColor4U mFadeColor; - LLColor4 mMoonAmbient; - LLColor3 mMoonDiffuse; - LLColor4 mSunAmbient; - LLColor3 mSunDiffuse; - - LLColor4 mTotalAmbient; + mutable LLColor4U mFadeColor; + mutable LLColor4 mMoonAmbient; + mutable LLColor3 mMoonDiffuse; + mutable LLColor4 mSunAmbient; + mutable LLColor3 mSunDiffuse; + mutable LLColor4 mTotalAmbient; LLUUID mNextSunTextureId; LLUUID mNextMoonTextureId; diff --git a/indra/llmath/llquaternion.cpp b/indra/llmath/llquaternion.cpp index a7ff707bb8..a8d9eba2a0 100644 --- a/indra/llmath/llquaternion.cpp +++ b/indra/llmath/llquaternion.cpp @@ -38,8 +38,6 @@ #include "m3math.h" #include "llquantize.h" -#pragma optimize("", off) - // WARNING: Don't use this for global const definitions! using this // at the top of a *.cpp file might not give you what you think. const LLQuaternion LLQuaternion::DEFAULT; diff --git a/indra/llmath/m3math.cpp b/indra/llmath/m3math.cpp index 7e59e10bab..65eb3348de 100644 --- a/indra/llmath/m3math.cpp +++ b/indra/llmath/m3math.cpp @@ -34,8 +34,6 @@ #include "m3math.h" #include "llquaternion.h" -#pragma optimize("", off) - // LLMatrix3 // ji diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 113909c1c6..ceebc7000b 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -503,6 +503,11 @@ const F32 OGL_TO_CFR_ROTATION[16] = { 0.f, 0.f, -1.f, 0.f, // -Z becomes X 0.f, 1.f, 0.f, 0.f, // Y becomes Z 0.f, 0.f, 0.f, 1.f }; +const F32 XYZ_TO_OGL_ROTATION[16] = { 1.f, 0.f, 0.f, 0.f, // X stays X + 0.f, 0.f, -1.f, 0.f, // Z becomes -Y + 0.f, 1.f, 0.f, 0.f, // Y becomes Z + 0.f, 0.f, 0.f, 1.f }; + glh::matrix4f copy_matrix(F32* src); glh::matrix4f get_current_modelview(); glh::matrix4f get_current_projection(); diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 4d0e0f2249..aa54a5f040 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -35,6 +35,8 @@ #include "OpenGL/OpenGL.h" #endif +#pragma optimize("", off) + #ifdef LL_RELEASE_FOR_DOWNLOAD #define UNIFORM_ERRS LL_WARNS_ONCE("Shader") #else @@ -552,8 +554,8 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns, const std::string& if (log.length() > 0) { - LL_INFOS() << "Shader loading from " << fname << ":\n" << LL_ENDL; - LL_INFOS() << log << LL_ENDL; + LL_INFOS("ShaderErrors") << "Shader loading from " << fname << ":\n" << LL_ENDL; + LL_INFOS("ShaderErrors") << log << LL_ENDL; } } diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index c9e0f7c2f4..0793784878 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8645,7 +8645,7 @@ Type Boolean Value - 0 + 1 RenderLocalLights diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index c20092bfe0..371b32406c 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -82,6 +82,8 @@ vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); vec3 scaleFragSoftClip(vec3 l); vec3 atmosFragAffectDirectionalLight(float intensity, vec3 sunlit); void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten); +vec3 fullbrightFragAtmosTransport(vec3 l, vec3 additive, vec3 atten); +vec3 fullbrightScaleSoftClipFrag(vec3 l, vec3 atten); vec4 getPosition_d(vec2 pos_screen, float depth) { @@ -147,7 +149,7 @@ void main() calcFragAtmospherics(pos.xyz, ambocc, sunlit, amblit, additive, atten); - col = atmosAmbient(vec3(0)); + col = atmosFragAmbient(vec3(0), amblit); float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); ambient *= 0.5; ambient *= ambient; @@ -167,7 +169,7 @@ void main() // float sa = dot(refnormpersp, sun_dir.xyz); - vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*(texture2D(lightFunc, vec2(sa, spec.a)).r); + vec3 dumbshiny = sunlit*scol_ambocc.r*(texture2D(lightFunc, vec2(sa, spec.a)).r); // add the two types of shiny together vec3 spec_contrib = dumbshiny * spec.rgb; @@ -192,7 +194,7 @@ void main() if (norm.w < 0.5) { col = mix(atmosFragLighting(col, additive, atten), fullbrightFragAtmosTransport(col, atten, additive), diffuse.a); - col = mix(scaleFragSoftClip(col), fullbrightFragScaleSoftClip(col), diffuse.a); + col = mix(scaleFragSoftClip(col), fullbrightScaleSoftClipFrag(col, atten), diffuse.a); } #ifdef WATER_FOG diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index bcc0023089..9cd59c61ec 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -488,26 +488,29 @@ void LLDrawPoolWater::shade() LLVector3 light_dir; LLColor3 light_color; - LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); + LLEnvironment& environment = LLEnvironment::instance(); + LLSettingsWater::ptr_t pwater = environment.getCurrentWater(); + LLSettingsSky::ptr_t psky = environment.getCurrentSky(); - light_dir = voskyp->getLightDirection(); + light_dir = environment.getLightDirection(); light_dir.normalize(); - bool sun_up = LLEnvironment::instance().getIsSunUp(); - bool moon_up = LLEnvironment::instance().getIsSunUp(); + bool sun_up = environment.getIsSunUp(); + bool moon_up = environment.getIsMoonUp(); if (sun_up) { - light_color = light_color + voskyp->getSunAmbientColor(); - light_diffuse += voskyp->getSunDiffuseColor(); + light_color = light_color + psky->getSunAmbient(); + light_diffuse += psky->getSunDiffuse(); } light_exp = light_dir * LLVector3(light_dir.mV[0], light_dir.mV[1], 0.f); if (moon_up) { - light_color += voskyp->getMoonDiffuseColor(); - light_diffuse += voskyp->getMoonDiffuseColor() * 0.5f; + LLColor3 moon_diffuse_color = psky->getMoonDiffuse(); + light_color += moon_diffuse_color; + light_diffuse += moon_diffuse_color * 0.5f; if (!sun_up) { diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 277f1f3d6c..def81e46fc 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -179,22 +179,12 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca sky_shader->bindTexture(LLShaderMgr::SINGLE_MIE_SCATTER_TEX, gAtmosphere->getMieScattering()); sky_shader->bindTexture(LLShaderMgr::ILLUMINANCE_TEX, gAtmosphere->getIlluminance()); - static float sunSize = (float)cos(0.0005); + LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); + LLVector4 light_dir = LLEnvironment::instance().getClampedLightNorm(); + F32 sunSize = (float)cosf(psky->getSunArcRadians()); sky_shader->uniform1f(LLShaderMgr::SUN_SIZE, sunSize); - - static LLVector3 solDir(-0.935f, 0.23f, 0.27f); - - static bool fooA = false; - static bool fooB = false; - - //neither of these appear to track with the env settings, would the real sun please stand up. - if (fooA) solDir = gPipeline.mTransformedSunDir; - if (fooB) solDir = gSky.mVOSkyp->getSun().getDirection(); - - solDir.normalize(); - - sky_shader->uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, solDir.mV); + sky_shader->uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, light_dir.mV); // clouds are rendered along with sky in adv atmo if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && sCloudNoiseTexture.notNull()) @@ -295,7 +285,7 @@ void LLDrawPoolWLSky::renderSkyClouds(const LLVector3& camPosLocal, F32 camHeigh cloud_shader->bind(); /// Render the skydome - renderDome(camPosLocal, camHeightLocal, cloud_shader); +//renderDome(camPosLocal, camHeightLocal, cloud_shader); cloud_shader->unbind(); } @@ -339,6 +329,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() if (gPipeline.canUseVertexShaders()) { gHighlightProgram.bind(); + gHighlightProgram.uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV); } LLFacePool::LLOverrideFaceColor color_override(this, color); diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index a6f0f2cb62..0177f88b6d 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -56,6 +56,8 @@ #include "llatmosphere.h" +#pragma optimize("", off) + //define EXPORT_PRESETS 1 //========================================================================= namespace @@ -630,6 +632,52 @@ void LLEnvironment::updateEnvironment(F64Seconds transition, bool forced) } } +LLVector3 LLEnvironment::getLightDirection() const +{ + LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky(); + if (!psky) + { + return LLVector3(0, 0, 1); + } + return psky->getLightDirection(); +} + +LLVector4 LLEnvironment::toCFR(const LLVector3 vec) const +{ + LLVector4 vec_cfr(vec.mV[1], vec.mV[0], vec.mV[2], 0.0f); + return vec_cfr; +} + +LLVector4 LLEnvironment::toLightNorm(const LLVector3 vec) const +{ + LLVector4 vec_ogl(vec.mV[1], vec.mV[2], vec.mV[0], 0.0f); + return vec_ogl; +} + +LLVector4 LLEnvironment::getLightDirectionCFR() const +{ + LLVector3 light_direction = getLightDirection(); + LLVector4 light_direction_cfr = toCFR(light_direction); + return light_direction_cfr; +} + +LLVector4 LLEnvironment::getClampedLightNorm() const +{ + LLVector3 light_direction = getLightDirection(); + if (light_direction.mV[2] < -0.1f) + { + light_direction.mV[2] = -0.1f; + } + return toLightNorm(light_direction); +} + +LLVector4 LLEnvironment::getRotatedLightNorm() const +{ + LLVector3 light_direction = getLightDirection(); + light_direction *= LLQuaternion(-mLastCamYaw, LLVector3(0.f, 1.f, 0.f)); + return toLightNorm(light_direction); +} + //------------------------------------------------------------------------- void LLEnvironment::update(const LLViewerCamera * cam) { @@ -644,18 +692,14 @@ void LLEnvironment::update(const LLViewerCamera * cam) // update clouds, sun, and general updateCloudScroll(); - F32 camYaw = cam->getYaw(); + // cache this for use in rotating the rotated light vec for shader param updates later... + mLastCamYaw = cam->getYaw() + SUN_DELTA_YAW; stop_glerror(); // *TODO: potential optimization - this block may only need to be // executed some of the time. For example for water shaders only. { - LLVector3 lightNorm3( getLightDirection() ); - - lightNorm3 *= LLQuaternion(-(camYaw + SUN_DELTA_YAW), LLVector3(0.f, 1.f, 0.f)); - mRotatedLight = LLVector4(lightNorm3, 0.f); - LLViewerShaderMgr::shader_iter shaders_iter, end_shaders; end_shaders = LLViewerShaderMgr::instance()->endShaders(); for (shaders_iter = LLViewerShaderMgr::instance()->beginShaders(); shaders_iter != end_shaders; ++shaders_iter) @@ -767,26 +811,10 @@ void LLEnvironment::updateGLVariablesForSettings(LLGLSLShader *shader, const LLS void LLEnvironment::updateShaderUniforms(LLGLSLShader *shader) { if (gPipeline.canUseWindLightShaders()) - { - updateGLVariablesForSettings(shader, mCurrentEnvironment->getSky()); + { updateGLVariablesForSettings(shader, mCurrentEnvironment->getWater()); - } - - if (shader->mShaderGroup == LLGLSLShader::SG_DEFAULT) - { - stop_glerror(); - shader->uniform4fv(LLShaderMgr::LIGHTNORM, 1, mRotatedLight.mV); - shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV); - stop_glerror(); - } - else if (shader->mShaderGroup == LLGLSLShader::SG_SKY) - { - stop_glerror(); - shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, getClampedLightDirection().mV); - stop_glerror(); - } - - shader->uniform1f(LLShaderMgr::SCENE_LIGHT_STRENGTH, getSceneLightStrength()); + updateGLVariablesForSettings(shader, mCurrentEnvironment->getSky()); + } } LLEnvironment::list_name_id_t LLEnvironment::getSkyList() const @@ -1552,6 +1580,7 @@ void LLEnvironment::DayInstance::setSky(const LLSettingsSky::ptr_t &psky) mInitialized = false; mSky = psky; + mSky->update(); mBlenderSky.reset(); if (gAtmosphere) @@ -1570,6 +1599,7 @@ void LLEnvironment::DayInstance::setWater(const LLSettingsWater::ptr_t &pwater) mInitialized = false; mWater = pwater; + mWater->update(); mBlenderWater.reset(); } diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 615318a4e6..27bb6e7fc2 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -188,15 +188,23 @@ public: bool getIsSunUp() const; bool getIsMoonUp() const; - inline F32 getSceneLightStrength() const { return mSceneLightStrength; } - inline void setSceneLightStrength(F32 light_strength) { mSceneLightStrength = light_strength; } + // Returns either sun or moon direction (depending on which is up and stronger) + // Light direction in +x right, +z up, +y at internal coord sys + LLVector3 getLightDirection() const; - inline LLVector4 getLightDirection() const { return ((mCurrentEnvironment->getSky()) ? LLVector4(mCurrentEnvironment->getSky()->getLightDirection(), 0.0f) : LLVector4(0, 0, 1, 0)); } - inline LLVector4 getClampedLightDirection() const { return LLVector4(mCurrentEnvironment->getSky()->getClampedLightDirection(), 0.0f); } - inline LLVector4 getRotatedLight() const { return mRotatedLight; } + // Returns light direction converted to CFR coord system + LLVector4 getLightDirectionCFR() const; + + // Returns light direction converted to OGL coord system + // and clamped above -0.1f in Y to avoid render artifacts in sky shaders + LLVector4 getClampedLightNorm() const; + + // Returns light direction converted to OGL coord system + // and rotated by last cam yaw needed by water rendering shaders + LLVector4 getRotatedLightNorm() const; static LLSettingsWater::ptr_t createWaterFromLegacyPreset(const std::string filename); - static LLSettingsSky::ptr_t createSkyFromLegacyPreset(const std::string filename); + static LLSettingsSky::ptr_t createSkyFromLegacyPreset(const std::string filename); //------------------------------------------- connection_t setSkyListChange(const change_signal_t::slot_type& cb); @@ -220,6 +228,9 @@ protected: virtual void initSingleton(); private: + LLVector4 toCFR(const LLVector3 vec) const; + LLVector4 toLightNorm(const LLVector3 vec) const; + class DayInstance { public: @@ -295,6 +306,7 @@ private: }; static const F32 SUN_DELTA_YAW; + F32 mLastCamYaw = 0.0f; typedef std::map AssetSettingMap_t; @@ -325,9 +337,6 @@ private: namedSettingMap_t mDayCycleByName; AssetSettingMap_t mDayCycleById; - F32 mSceneLightStrength; - LLVector4 mRotatedLight; - UserPrefs mUserPrefs; change_signal_t mSkyListChange; diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 5af4cd89c4..a880cfa2a2 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -42,7 +42,6 @@ #include "llrender.h" #include "lllightconstants.h" #include "llsky.h" -#include "llenvironment.h" #include "llviewercamera.h" #include "llviewertexturelist.h" #include "llvopartgroup.h" @@ -1626,14 +1625,11 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { tep->getScale( &s_scale, &t_scale ); } - - LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); - // Use the nudged south when coming from above sun angle, such // that emboss mapping always shows up on the upward faces of cubes when // it's noon (since a lot of builders build with the sun forced to noon). LLVector3 sun_ray = gSky.mVOSkyp->mBumpSunDir; - LLVector3 moon_ray = psky->getMoonDirection(); + LLVector3 moon_ray = gSky.mVOSkyp->getMoon().getDirection(); LLVector3& primary_light_ray = (sun_ray.mV[VZ] > 0) ? sun_ray : moon_ray; bump_s_primary_light_ray.load3((offset_multiple * s_scale * primary_light_ray).mV); diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp index ff09e62f76..59cfab61fd 100644 --- a/indra/newview/lllegacyatmospherics.cpp +++ b/indra/newview/lllegacyatmospherics.cpp @@ -267,7 +267,7 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars) F32 density_multiplier = psky->getDensityMultiplier(); F32 max_y = psky->getMaxY(); - LLVector3 lightnorm = psky->getLightNormal(); + LLVector3 lightnorm = LLVector3(LLEnvironment::instance().getClampedLightNorm()); // project the direction ray onto the sky dome. F32 phi = acos(Pn[1]); @@ -444,8 +444,10 @@ LLColor3 LLAtmospherics::calcSkyColorWLFrag(LLVector3 & Pn, AtmosphericsVars& va return res; } -void LLAtmospherics::updateFog(const F32 distance, LLVector3& tosun) +void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in) { + LLVector3 tosun = tosun_in; + if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOG)) { if (!LLGLSLShader::sNoFixedFunction) diff --git a/indra/newview/lllegacyatmospherics.h b/indra/newview/lllegacyatmospherics.h index 83250ee50b..ded7e1f554 100644 --- a/indra/newview/lllegacyatmospherics.h +++ b/indra/newview/lllegacyatmospherics.h @@ -207,7 +207,7 @@ public: ~LLAtmospherics(); void init(); - void updateFog(const F32 distance, LLVector3& tosun); + void updateFog(const F32 distance, const LLVector3& tosun); const LLHaze& getHaze() const { return mHaze; } LLHaze& getHaze() { return mHaze; } diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index bd69659e7a..85cdd1e984 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -365,7 +365,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildSky(LLSD settings) LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &name, const LLSD &legacy) { - LLSD newsettings = LLSettingsSky::translateLegacySettings(legacy, &name); + LLSD newsettings = LLSettingsSky::translateLegacySettings(legacy); newsettings[SETTING_NAME] = name; @@ -476,7 +476,7 @@ LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky, bool isA sunquat.getEulerAngles(&roll, &pitch, &yaw); legacy[SETTING_LEGACY_EAST_ANGLE] = yaw; - legacy[SETTING_LEGACY_SUN_ANGLE] = pitch; + legacy[SETTING_LEGACY_SUN_ANGLE] = -pitch; return legacy; } @@ -485,32 +485,51 @@ LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky, bool isA void LLSettingsVOSky::updateSettings() { LLSettingsSky::updateSettings(); - LLVector3 sun_direction = getSunDirection(); LLVector3 moon_direction = getMoonDirection(); - // axis swap converts from +x right, +z up, +y at - // to CFR (+x at, +z up, +y right) - // set direction (in CRF) and don't allow overriding - //LLVector3 crf_sunDirection(sun_direction.mV[1], sun_direction.mV[0], sun_direction.mV[2]); - //LLVector3 crf_moonDirection(moon_direction.mV[1], moon_direction.mV[0], moon_direction.mV[2]); - - gSky.setSunDirection(sun_direction, moon_direction); + F32 dp = getLightDirection() * LLVector3(0.0f, 0.0f, 1.0f); + if (dp < 0) + { + dp = 0; + } + dp = llmax(dp, 0.1f); + + // Since WL scales everything by 2, there should always be at least a 2:1 brightness ratio + // between sunlight and point lights in windlight to normalize point lights. + F32 sun_dynamic_range = llmax(gSavedSettings.getF32("RenderSunDynamicRange"), 0.0001f); + mSceneLightStrength = 2.0f * (1.0f + sun_dynamic_range * dp); + + // Axis swaps convert from +x right, +z up, +y at + // to CFR +x at, +z up, +y right coord sys + LLVector3 sun_direction_cfr(sun_direction.mV[0], -sun_direction.mV[1], sun_direction.mV[2]); + LLVector3 moon_direction_cfr(moon_direction.mV[0], -moon_direction.mV[1], moon_direction.mV[2]); + gSky.setSunAndMoonDirectionsCFR(sun_direction_cfr, moon_direction_cfr); } void LLSettingsVOSky::applySpecial(void *ptarget) { LLGLSLShader *shader = (LLGLSLShader *)ptarget; - shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, getClampedLightDirection().mV); + LLVector4 light_direction = LLEnvironment::instance().getClampedLightNorm(); - shader->uniform4f(LLShaderMgr::GAMMA, getGamma(), 0.0, 0.0, 1.0); + if (shader->mShaderGroup == LLGLSLShader::SG_DEFAULT) + { + shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, light_direction.mV); + shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV); + } + else if (shader->mShaderGroup == LLGLSLShader::SG_SKY) + { + LLVector4 light_direction = LLEnvironment::instance().getClampedLightNorm(); + shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, light_direction.mV); - { LLVector4 vect_c_p_d1(mSettings[SETTING_CLOUD_POS_DENSITY1]); vect_c_p_d1 += LLVector4(LLEnvironment::instance().getCloudScrollDelta()); shader->uniform4fv(LLShaderMgr::CLOUD_POS_DENSITY1, 1, vect_c_p_d1.mV); - } + } + + shader->uniform1f(LLShaderMgr::SCENE_LIGHT_STRENGTH, mSceneLightStrength); + shader->uniform4f(LLShaderMgr::GAMMA, getGamma(), 0.0, 0.0, 1.0); } LLSettingsSky::parammapping_t LLSettingsVOSky::getParameterMap() const @@ -519,12 +538,12 @@ LLSettingsSky::parammapping_t LLSettingsVOSky::getParameterMap() const if (param_map.empty()) { +// LEGACY_ATMOSPHERICS + param_map[SETTING_AMBIENT] = LLShaderMgr::AMBIENT; param_map[SETTING_BLUE_DENSITY] = LLShaderMgr::BLUE_DENSITY; param_map[SETTING_BLUE_HORIZON] = LLShaderMgr::BLUE_HORIZON; param_map[SETTING_HAZE_DENSITY] = LLShaderMgr::HAZE_DENSITY; param_map[SETTING_HAZE_HORIZON] = LLShaderMgr::HAZE_HORIZON; - - param_map[SETTING_AMBIENT] = LLShaderMgr::AMBIENT; param_map[SETTING_DENSITY_MULTIPLIER] = LLShaderMgr::DENSITY_MULTIPLIER; param_map[SETTING_DISTANCE_MULTIPLIER] = LLShaderMgr::DISTANCE_MULTIPLIER; @@ -663,12 +682,16 @@ void LLSettingsVOWater::applySpecial(void *ptarget) { LLGLSLShader *shader = (LLGLSLShader *)ptarget; - shader->uniform4fv(LLShaderMgr::WATER_WATERPLANE, 1, getWaterPlane().mV); - shader->uniform1f(LLShaderMgr::WATER_FOGKS, getWaterFogKS()); + if (shader->mShaderGroup == LLGLSLShader::SG_WATER) + { + shader->uniform4fv(LLShaderMgr::WATER_WATERPLANE, 1, getWaterPlane().mV); + shader->uniform1f(LLShaderMgr::WATER_FOGKS, getWaterFogKS()); - shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, LLEnvironment::instance().getRotatedLight().mV); - shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV); - shader->uniform1f(LLViewerShaderMgr::DISTANCE_MULTIPLIER, 0); + LLVector4 rotated_light_direction = LLEnvironment::instance().getRotatedLightNorm(); + shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, rotated_light_direction.mV); + shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV); + shader->uniform1f(LLViewerShaderMgr::DISTANCE_MULTIPLIER, 0); + } } void LLSettingsVOWater::updateSettings() @@ -702,7 +725,7 @@ void LLSettingsVOWater::updateSettings() mWaterPlane = LLVector4(enorm.v[0], enorm.v[1], enorm.v[2], -ep.dot(enorm)); - LLVector4 light_direction = LLEnvironment::instance().getLightDirection(); + LLVector4 light_direction = LLEnvironment::instance().getClampedLightNorm(); mWaterFogKS = 1.f / llmax(light_direction.mV[2], WATER_FOG_LIGHT_CLAMP); } @@ -820,7 +843,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID ®io for (LLSD::map_iterator itm = skydefs.beginMap(); itm != skydefs.endMap(); ++itm) { std::string newname = "sky:" + (*itm).first; - LLSD newsettings = LLSettingsSky::translateLegacySettings((*itm).second, &newname); + LLSD newsettings = LLSettingsSky::translateLegacySettings((*itm).second); newsettings[SETTING_NAME] = newname; frames[newname] = newsettings; diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h index 3339aaf037..2f91117858 100644 --- a/indra/newview/llsettingsvo.h +++ b/indra/newview/llsettingsvo.h @@ -107,6 +107,7 @@ protected: virtual parammapping_t getParameterMap() const override; bool m_isAdvanced = false; + F32 mSceneLightStrength = 3.0f; }; //========================================================================= diff --git a/indra/newview/llsky.cpp b/indra/newview/llsky.cpp index f7ccf7c7ff..41fe206ada 100644 --- a/indra/newview/llsky.cpp +++ b/indra/newview/llsky.cpp @@ -129,170 +129,31 @@ void LLSky::resetVertexBuffers() } } -void LLSky::setSunDirection(const LLVector3 &sun_direction, const LLVector3 &moon_direction) +void LLSky::setSunAndMoonDirectionsCFR(const LLVector3 &sun_direction, const LLVector3 &moon_direction) { - if(mVOSkyp.notNull()) { - mVOSkyp->setSunDirection(sun_direction, moon_direction); + if(mVOSkyp.notNull()) { + mVOSkyp->setSunAndMoonDirectionsCFR(sun_direction, moon_direction); } } -/*LLVector3 LLSky::getSunDirection() const -{ - if (mVOSkyp) - { - return mVOSkyp->getToSun(); - } - else - { - return LLVector3::z_axis; - } -} - - -LLVector3 LLSky::getMoonDirection() const -{ - if (mVOSkyp) - { - return mVOSkyp->getToMoon(); - } - else - { - return LLVector3::z_axis; - } -}*/ - - -LLColor4 LLSky::getSunDiffuseColor() const -{ - if (mVOSkyp) - { - return LLColor4(mVOSkyp->getSunDiffuseColor()); - } - else - { - return LLColor4(1.f, 1.f, 1.f, 1.f); - } -} - -LLColor4 LLSky::getSunAmbientColor() const -{ - if (mVOSkyp) - { - return LLColor4(mVOSkyp->getSunAmbientColor()); - } - else - { - return LLColor4(0.f, 0.f, 0.f, 1.f); - } -} - - -LLColor4 LLSky::getMoonDiffuseColor() const -{ - if (mVOSkyp) - { - return LLColor4(mVOSkyp->getMoonDiffuseColor()); - } - else - { - return LLColor4(1.f, 1.f, 1.f, 1.f); - } -} - -LLColor4 LLSky::getMoonAmbientColor() const -{ - if (mVOSkyp) - { - return LLColor4(mVOSkyp->getMoonAmbientColor()); - } - else - { - return LLColor4(0.f, 0.f, 0.f, 0.f); - } -} - - -LLColor4 LLSky::getTotalAmbientColor() const -{ - if (mVOSkyp) - { - return mVOSkyp->getTotalAmbientColor(); - } - else - { - return LLColor4(1.f, 1.f, 1.f, 1.f); - } -} - - -/*BOOL LLSky::sunUp() const -{ - if (mVOSkyp) - { - return mVOSkyp->isSunUp(); - } - else - { - return TRUE; - } -}*/ - - -LLColor4U LLSky::getFadeColor() const -{ - if (mVOSkyp) - { - return mVOSkyp->getFadeColor(); - } - else - { - return LLColor4(1.f, 1.f, 1.f, 1.f); - } -} - - ////////////////////////////////////////////////////////////////////// // Public Methods ////////////////////////////////////////////////////////////////////// -void LLSky::init(const LLVector3 &sun_direction) +void LLSky::init() { - LLGLState::checkStates(); - LLGLState::checkTextureChannels(); - mVOWLSkyp = static_cast(gObjectList.createObjectViewer(LLViewerObject::LL_VO_WL_SKY, NULL)); - mVOWLSkyp->initSunDirection(sun_direction, LLVector3::zero); + mVOWLSkyp->init(); gPipeline.createObject(mVOWLSkyp.get()); - LLGLState::checkStates(); - LLGLState::checkTextureChannels(); - mVOSkyp = (LLVOSky *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_SKY, NULL); - - LLGLState::checkStates(); - LLGLState::checkTextureChannels(); - - mVOSkyp->initSunDirection(sun_direction, LLVector3()); - - LLGLState::checkStates(); - LLGLState::checkTextureChannels(); - - gPipeline.createObject((LLViewerObject *)mVOSkyp); - - LLGLState::checkStates(); - LLGLState::checkTextureChannels(); + mVOSkyp->init(); + gPipeline.createObject(mVOSkyp.get()); mVOGroundp = (LLVOGround*)gObjectList.createObjectViewer(LLViewerObject::LL_VO_GROUND, NULL); - LLVOGround *groundp = mVOGroundp; - gPipeline.createObject((LLViewerObject *)groundp); - - LLGLState::checkStates(); - LLGLState::checkTextureChannels(); - - gSky.setFogRatio(gSavedSettings.getF32("RenderFogRatio")); + gPipeline.createObject(mVOGroundp.get()); - LLGLState::checkStates(); - LLGLState::checkTextureChannels(); + gSky.setFogRatio(gSavedSettings.getF32("RenderFogRatio")); mUpdatedThisFrame = TRUE; } diff --git a/indra/newview/llsky.h b/indra/newview/llsky.h index 626076fea4..8e86853481 100644 --- a/indra/newview/llsky.h +++ b/indra/newview/llsky.h @@ -48,11 +48,11 @@ public: LLSky(); ~LLSky(); - void init(const LLVector3 &sun_direction); - + void init(); void cleanup(); - void setSunDirection(const LLVector3 &sun_direction, const LLVector3 &moon_direction); + // These directions should be in CFR coord sys (+x at, +z up, +y right) + void setSunAndMoonDirectionsCFR(const LLVector3 &sun_direction, const LLVector3 &moon_direction); LLColor4 getSkyFogColor() const; @@ -70,19 +70,6 @@ public: F32 getFogRatio() const; LLColor4U getFadeColor() const; - //LLVector3 getSunDirection() const; - //LLVector3 getMoonDirection() const; - - LLColor4 getSunDiffuseColor() const; - LLColor4 getMoonDiffuseColor() const; - LLColor4 getSunAmbientColor() const; - LLColor4 getMoonAmbientColor() const; - LLColor4 getTotalAmbientColor() const; - //BOOL sunUp() const; - - // Legacy - void setSunPhase(const F32) { } - void destroyGL(); void restoreGL(); void resetVertexBuffers(); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index deebd91198..e7a149ac0c 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -332,7 +332,6 @@ bool idle_startup() static std::string auth_desc; static std::string auth_message; - static LLVector3 initial_sun_direction(1.f, 0.f, 0.f); static LLVector3 agent_start_position_region(10.f, 10.f, 10.f); // default for when no space server // last location by default @@ -1467,7 +1466,7 @@ bool idle_startup() LLGLState::checkTextureChannels(); LLEnvironment::instance().loadPreferences(); - gSky.init(initial_sun_direction); + gSky.init(); LLGLState::checkStates(); LLGLState::checkTextureChannels(); diff --git a/indra/newview/lltoolgun.cpp b/indra/newview/lltoolgun.cpp index 6903e69d46..fb96804bfa 100644 --- a/indra/newview/lltoolgun.cpp +++ b/indra/newview/lltoolgun.cpp @@ -108,7 +108,7 @@ BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask) if (gSavedSettings.getBOOL("MouseSun")) { LLVector3 sunpos = LLViewerCamera::getInstance()->getAtAxis(); - gSky.setSunDirection(sunpos, -sunpos); + gSky.setSunAndMoonDirectionsCFR(sunpos, -sunpos); gSavedSettings.setVector3("SkySunDefaultPosition", LLViewerCamera::getInstance()->getAtAxis()); } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index e4c71c1648..e88afdc465 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3395,6 +3395,7 @@ void process_kill_object(LLMessageSystem *mesgsys, void **user_data) void process_time_synch(LLMessageSystem *mesgsys, void **user_data) { LLVector3 sun_direction; + LLVector3 moon_direction; LLVector3 sun_ang_velocity; F32 phase; U64 space_time_usec; @@ -3416,11 +3417,11 @@ void process_time_synch(LLMessageSystem *mesgsys, void **user_data) LL_DEBUGS("Windlight Sync") << "Sun phase: " << phase << " rad = " << fmodf(phase / F_TWO_PI + 0.25, 1.f) * 24.f << " h" << LL_ENDL; - gSky.setSunPhase(phase); - if ( !gSavedSettings.getBOOL("SkyOverrideSimSunPosition") ) - { - gSky.setSunDirection(sun_direction, -sun_direction); - } + + /* LAPRAS + We decode these parts of the message but ignore them + as the real values are provided elsewhere. */ + (void)sun_direction, (void)moon_direction, (void)phase; } void process_sound_trigger(LLMessageSystem *msg, void **) diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 5aa29f920e..40cf4c82e6 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -46,6 +46,8 @@ #include "llenvironment.h" #include "llatmosphere.h" +#pragma optimize("", off) + #ifdef LL_RELEASE_FOR_DOWNLOAD #define UNIFORM_ERRS LL_WARNS_ONCE("Shader") #else diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index dc4f4a92d4..a2ea3181ca 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -53,6 +53,8 @@ #include "llsettingssky.h" #include "llenvironment.h" +#pragma optimize("", off) + #undef min #undef max @@ -71,6 +73,9 @@ static const LLVector2 TEX01 = LLVector2(0.f, 1.f); static const LLVector2 TEX10 = LLVector2(1.f, 0.f); static const LLVector2 TEX11 = LLVector2(1.f, 1.f); +static const F32 LIGHT_DIRECTION_THRESHOLD = (F32) cosf(DEG_TO_RAD * 1.f); +static const F32 COLOR_CHANGE_THRESHOLD = 0.01f; + // Exported globals LLUUID gSunTextureID = IMG_SUN; LLUUID gMoonTextureID = IMG_MOON; @@ -185,11 +190,165 @@ void LLSkyTex::bindTexture(BOOL curr) } /*************************************** - Sky + LLHeavenBody ***************************************/ F32 LLHeavenBody::sInterpVal = 0; +LLHeavenBody::LLHeavenBody(const F32 rad) +: mDirectionCached(LLVector3(0,0,0)), + mDirection(LLVector3(0,0,0)), + mIntensity(0.f), + mDiskRadius(rad), + mDraw(FALSE), + mHorizonVisibility(1.f), + mVisibility(1.f), + mVisible(FALSE) +{ + mColor.setToBlack(); + mColorCached.setToBlack(); +} + +const LLVector3& LLHeavenBody::getDirection() const +{ + return mDirection; +} + +void LLHeavenBody::setDirection(const LLVector3 &direction) +{ + mDirection = direction; +} + +void LLHeavenBody::setAngularVelocity(const LLVector3 &ang_vel) +{ + mAngularVelocity = ang_vel; +} + +const LLVector3& LLHeavenBody::getAngularVelocity() const +{ + return mAngularVelocity; +} + +const LLVector3& LLHeavenBody::getDirectionCached() const +{ + return mDirectionCached; +} + +void LLHeavenBody::renewDirection() +{ + mDirectionCached = mDirection; +} + +const LLColor3& LLHeavenBody::getColorCached() const +{ + return mColorCached; +} + +void LLHeavenBody::setColorCached(const LLColor3& c) +{ + mColorCached = c; +} + +const LLColor3& LLHeavenBody::getColor() const +{ + return mColor; +} + +void LLHeavenBody::setColor(const LLColor3& c) +{ + mColor = c; +} + +void LLHeavenBody::renewColor() +{ + mColorCached = mColor; +} + +F32 LLHeavenBody::interpVal() +{ + return sInterpVal; +} + +void LLHeavenBody::setInterpVal(const F32 v) +{ + sInterpVal = v; +} + +LLColor3 LLHeavenBody::getInterpColor() const +{ + return sInterpVal * mColor + (1 - sInterpVal) * mColorCached; +} + +const F32& LLHeavenBody::getVisibility() const +{ + return mVisibility; +} + +void LLHeavenBody::setVisibility(const F32 c) +{ + mVisibility = c; +} + +bool LLHeavenBody::isVisible() const +{ + return mVisible; +} + +void LLHeavenBody::setVisible(const bool v) +{ + mVisible = v; +} + +const F32& LLHeavenBody::getIntensity() const +{ + return mIntensity; +} + +void LLHeavenBody::setIntensity(const F32 c) +{ + mIntensity = c; +} + +void LLHeavenBody::setDiskRadius(const F32 radius) +{ + mDiskRadius = radius; +} + +F32 LLHeavenBody::getDiskRadius() const +{ + return mDiskRadius; +} + +void LLHeavenBody::setDraw(const bool draw) +{ + mDraw = draw; +} + +bool LLHeavenBody::getDraw() const +{ + return mDraw; +} + +const LLVector3& LLHeavenBody::corner(const S32 n) const +{ + return mQuadCorner[n]; +} + +LLVector3& LLHeavenBody::corner(const S32 n) +{ + return mQuadCorner[n]; +} + +const LLVector3* LLHeavenBody::corners() const +{ + return mQuadCorner; +} + +/*************************************** + Sky +***************************************/ + + S32 LLVOSky::sResolution = LLSkyTex::getResolution(); S32 LLVOSky::sTileResX = sResolution/NUM_TILES_X; S32 LLVOSky::sTileResY = sResolution/NUM_TILES_Y; @@ -227,16 +386,6 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) mAtmHeight = ATM_HEIGHT; mEarthCenter = LLVector3(mCameraPosAgent.mV[0], mCameraPosAgent.mV[1], -EARTH_RADIUS); - // *LAPRAS - mSunDefaultPosition = LLEnvironment::instance().getCurrentSky()->getSunDirection(); - - if (gSavedSettings.getBOOL("SkyOverrideSimSunPosition")) - { - - initSunDirection(LLVector3(mSunDefaultPosition.mV[2], mSunDefaultPosition.mV[0], mSunDefaultPosition.mV[1]), LLVector3(0, 0, 0)); - } - - mSun.setIntensity(SUN_INTENSITY); mMoon.setIntensity(0.1f * SUN_INTENSITY); @@ -265,6 +414,11 @@ LLVOSky::~LLVOSky() void LLVOSky::init() { + llassert(!mInitialized); + + // Update sky at least once to get correct initial sun/moon directions and lighting calcs performed + LLEnvironment::instance().getCurrentSky()->update(); + updateDirections(); // Initialize the cached normalized direction vectors @@ -353,10 +507,11 @@ void LLVOSky::restoreGL() if(cube_map) { cube_map->init(images); - mForceUpdate = TRUE; } } + mForceUpdate = TRUE; + if (mDrawable) { gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE); @@ -426,24 +581,13 @@ void LLVOSky::updateDirections(void) mSun.renewColor(); mMoon.renewDirection(); mMoon.renewColor(); - - float dp = psky->getSunDirection() * LLVector3::y_axis; - if (dp < 0) - { - dp = 0; - } - - // Since WL scales everything by 2, there should always be at least a 2:1 brightness ratio - // between sunlight and point lights in windlight to normalize point lights. - F32 sun_dynamic_range = llmax(gSavedSettings.getF32("RenderSunDynamicRange"), 0.0001f); - LLEnvironment::instance().setSceneLightStrength(2.0f * (1.0f + sun_dynamic_range * dp)); } void LLVOSky::idleUpdate(LLAgent &agent, const F64 &time) { } -BOOL LLVOSky::updateSky() +bool LLVOSky::updateSky() { LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); @@ -473,6 +617,8 @@ BOOL LLVOSky::updateSky() mUpdateTimer.reset(); const S32 frame = next_frame; + mForceUpdate = mForceUpdate || (total_no_tiles == frame); + ++next_frame; next_frame = next_frame % cycle_frame_no; @@ -482,26 +628,27 @@ BOOL LLVOSky::updateSky() LLHeavenBody::setInterpVal( mInterpVal ); updateDirections(); - if (mForceUpdate || total_no_tiles == frame) + LLVector3 direction = mSun.getDirection(); + direction.normalize(); + const F32 dot_lighting = direction * mLastLightingDirection; + + LLColor3 delta_color; + delta_color.setVec(mLastTotalAmbient.mV[0] - total_ambient.mV[0], + mLastTotalAmbient.mV[1] - total_ambient.mV[1], + mLastTotalAmbient.mV[2] - total_ambient.mV[2]); + + bool light_direction_changed = (dot_lighting >= LIGHT_DIRECTION_THRESHOLD); + bool color_changed = (delta_color.length() >= COLOR_CHANGE_THRESHOLD); + + mForceUpdate = mForceUpdate || light_direction_changed; + mForceUpdate = mForceUpdate || color_changed; + mForceUpdate = mForceUpdate || !mInitialized; + + if (mForceUpdate) { - LLSkyTex::stepCurrent(); - - const static F32 LIGHT_DIRECTION_THRESHOLD = (F32) cos(DEG_TO_RAD * 1.f); - const static F32 COLOR_CHANGE_THRESHOLD = 0.01f; - - LLVector3 direction = mSun.getDirection(); - direction.normalize(); - const F32 dot_lighting = direction * mLastLightingDirection; - - LLColor3 delta_color; - delta_color.setVec(mLastTotalAmbient.mV[0] - total_ambient.mV[0], - mLastTotalAmbient.mV[1] - total_ambient.mV[1], - mLastTotalAmbient.mV[2] - total_ambient.mV[2]); - - bool light_direction_changed = (dot_lighting >= LIGHT_DIRECTION_THRESHOLD); - bool color_changed = (delta_color.length() >= COLOR_CHANGE_THRESHOLD); - bool do_update = !mInitialized || mForceUpdate || light_direction_changed || color_changed; - if ( do_update && !direction.isExactlyZero()) + LLSkyTex::stepCurrent(); + + if (!direction.isExactlyZero()) { mLastLightingDirection = direction; mLastTotalAmbient = total_ambient; @@ -509,52 +656,49 @@ BOOL LLVOSky::updateSky() if (mCubeMap) { - if (mForceUpdate) - { - updateFog(LLViewerCamera::getInstance()->getFar()); + updateFog(LLViewerCamera::getInstance()->getFar()); - for (int side = 0; side < 6; side++) + for (int side = 0; side < 6; side++) + { + for (int tile = 0; tile < NUM_TILES; tile++) { - for (int tile = 0; tile < NUM_TILES; tile++) - { - createSkyTexture(side, tile); - } + createSkyTexture(side, tile); } + } - for (int side = 0; side < 6; side++) - { - LLImageRaw* raw1 = mSkyTex[side].getImageRaw(TRUE); - LLImageRaw* raw2 = mSkyTex[side].getImageRaw(FALSE); - raw2->copy(raw1); - mSkyTex[side].createGLImage(mSkyTex[side].getWhich(FALSE)); - - raw1 = mShinyTex[side].getImageRaw(TRUE); - raw2 = mShinyTex[side].getImageRaw(FALSE); - raw2->copy(raw1); - mShinyTex[side].createGLImage(mShinyTex[side].getWhich(FALSE)); - } - next_frame = 0; - - // update the sky texture - for (S32 i = 0; i < 6; ++i) - { - mSkyTex[i].create(1.0f); - mShinyTex[i].create(1.0f); - } - - // update the environment map - if (mCubeMap) - { - std::vector > images; - images.reserve(6); - for (S32 side = 0; side < 6; side++) - { - images.push_back(mShinyTex[side].getImageRaw(TRUE)); - } - mCubeMap->init(images); - gGL.getTexUnit(0)->disable(); - } + for (int side = 0; side < 6; side++) + { + LLImageRaw* raw1 = mSkyTex[side].getImageRaw(TRUE); + LLImageRaw* raw2 = mSkyTex[side].getImageRaw(FALSE); + raw2->copy(raw1); + mSkyTex[side].createGLImage(mSkyTex[side].getWhich(FALSE)); + + raw1 = mShinyTex[side].getImageRaw(TRUE); + raw2 = mShinyTex[side].getImageRaw(FALSE); + raw2->copy(raw1); + mShinyTex[side].createGLImage(mShinyTex[side].getWhich(FALSE)); } + next_frame = 0; + + // update the sky texture + for (S32 i = 0; i < 6; ++i) + { + mSkyTex[i].create(1.0f); + mShinyTex[i].create(1.0f); + } + + // update the environment map + if (mCubeMap) + { + std::vector > images; + images.reserve(6); + for (S32 side = 0; side < 6; side++) + { + images.push_back(mShinyTex[side].getImageRaw(TRUE)); + } + mCubeMap->init(images); + gGL.getTexUnit(0)->disable(); + } } } @@ -706,7 +850,7 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable) const F32 camera_height = mCameraPosAgent.mV[2]; const F32 height_above_water = camera_height - water_height; - BOOL sun_flag = FALSE; + bool sun_flag = FALSE; if (mSun.isVisible()) { @@ -722,7 +866,7 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable) if (height_above_water > 0) { - BOOL render_ref = gPipeline.getPool(LLDrawPool::POOL_WATER)->getVertexShaderLevel() == 0; + bool render_ref = gPipeline.getPool(LLDrawPool::POOL_WATER)->getVertexShaderLevel() == 0; if (sun_flag) { @@ -750,7 +894,7 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable) return TRUE; } -BOOL LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 f, LLHeavenBody& hb, const LLVector3 &up, const LLVector3 &right) +bool LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 f, LLHeavenBody& hb, const LLVector3 &up, const LLVector3 &right) { mHeavenlyBodyUpdated = TRUE ; @@ -1180,96 +1324,35 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, void LLVOSky::updateFog(const F32 distance) { - LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); - m_legacyAtmospherics.updateFog(distance, psky->getSunDirection()); + LLEnvironment& environment = LLEnvironment::instance(); + LLVector3 light_dir = LLVector3(environment.getClampedLightNorm()); + m_legacyAtmospherics.updateFog(distance, light_dir); } -void LLVOSky::initSunDirection(const LLVector3 &sun_dir, const LLVector3 &sun_ang_velocity) +void LLVOSky::setSunAndMoonDirectionsCFR(const LLVector3 &sun_dir_cfr, const LLVector3 &moon_dir_cfr) { - LLVector3 sun_direction = (sun_dir.length() == 0) ? LLVector3::x_axis : sun_dir; - sun_direction.normalize(); - mSun.setDirection(sun_direction); - mSun.renewDirection(); - mSun.setAngularVelocity(sun_ang_velocity); - mMoon.setDirection(-mSun.getDirection()); - mMoon.renewDirection(); - mLastLightingDirection = mSun.getDirection(); - - updateDirections(); + mSun.setDirection(sun_dir_cfr); + mMoon.setDirection(moon_dir_cfr); - if ( !mInitialized ) - { - init(); - LLSkyTex::stepCurrent(); - } -} - -void LLVOSky::setSunDirection(const LLVector3 &sun_dir, const LLVector3 &moon_dir) -{ - LLVector3 sun_direction = (sun_dir.length() == 0) ? LLVector3::x_axis : sun_dir; - LLVector3 moon_direction = (moon_dir.length() == 0) ? LLVector3::x_axis : moon_dir; - - sun_direction.normalize(); - moon_direction.normalize(); + mLastLightingDirection = mSun.getDirection(); // Push the sun "South" as it approaches directly overhead so that we can always see bump mapping // on the upward facing faces of cubes. - LLVector3 newDir = sun_direction; - - // Same as dot product with the up direction + clamp. - F32 sunDot = llmax(0.f, newDir.mV[2]); - sunDot *= sunDot; - - // Create normalized vector that has the sunDir pushed south about an hour and change. - LLVector3 adjustedDir = (newDir + LLVector3(0.f, -0.70711f, 0.70711f)) * 0.5f; + { + // Same as dot product with the up direction + clamp. + F32 sunDot = llmax(0.f, sun_dir_cfr.mV[2]); + sunDot *= sunDot; - // Blend between normal sun dir and adjusted sun dir based on how close we are - // to having the sun overhead. - mBumpSunDir = adjustedDir * sunDot + newDir * (1.0f - sunDot); - mBumpSunDir.normalize(); + // Create normalized vector that has the sunDir pushed south about an hour and change. + LLVector3 adjustedDir = (sun_dir_cfr + LLVector3(0.f, -0.70711f, 0.70711f)) * 0.5f; - F32 dp = mLastLightingDirection * sun_direction; - mSun.setDirection(sun_direction); + // Blend between normal sun dir and adjusted sun dir based on how close we are + // to having the sun overhead. + mBumpSunDir = adjustedDir * sunDot + sun_dir_cfr * (1.0f - sunDot); + mBumpSunDir.normalize(); + } - mMoon.setDirection(moon_direction); updateDirections(); - if (dp < 0.995f) { //the sun jumped a great deal, update immediately - mForceUpdate = TRUE; - } -} - -LLVector3 LLVOSky::getLightDirection() const -{ - return LLEnvironment::instance().getCurrentSky()->getLightDirection(); -} - -LLColor4U LLVOSky::getFadeColor() const -{ - return LLEnvironment::instance().getCurrentSky()->getFadeColor(); -} - -LLColor3 LLVOSky::getSunDiffuseColor() const -{ - return LLEnvironment::instance().getCurrentSky()->getSunDiffuse(); -} - -LLColor3 LLVOSky::getMoonDiffuseColor() const -{ - return LLEnvironment::instance().getCurrentSky()->getMoonDiffuse(); -} - -LLColor4 LLVOSky::getSunAmbientColor() const -{ - return LLEnvironment::instance().getCurrentSky()->getSunAmbient(); -} - -LLColor4 LLVOSky::getMoonAmbientColor() const -{ - return LLEnvironment::instance().getCurrentSky()->getMoonAmbient(); -} - -LLColor4 LLVOSky::getTotalAmbientColor() const -{ - return LLEnvironment::instance().getCurrentSky()->getTotalAmbient(); + LLSkyTex::stepCurrent(); } diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h index 96fe12e21c..4de3d12068 100644 --- a/indra/newview/llvosky.h +++ b/indra/newview/llvosky.h @@ -141,69 +141,56 @@ protected: LLVector3 mAngularVelocity; // velocity of the local heavenly body F32 mDiskRadius; - BOOL mDraw; // FALSE - do not draw. + bool mDraw; // FALSE - do not draw. F32 mHorizonVisibility; // number [0, 1] due to how horizon F32 mVisibility; // same but due to other objects being in throng. - BOOL mVisible; + bool mVisible; static F32 sInterpVal; LLVector3 mQuadCorner[4]; LLVector3 mO; public: - LLHeavenBody(const F32 rad) : - mDirectionCached(LLVector3(0,0,0)), - mDirection(LLVector3(0,0,0)), - mIntensity(0.f), - mDiskRadius(rad), mDraw(FALSE), - mHorizonVisibility(1.f), mVisibility(1.f), - mVisible(FALSE) - { - mColor.setToBlack(); - mColorCached.setToBlack(); - } + LLHeavenBody(const F32 rad); ~LLHeavenBody() {} - const LLVector3& getDirection() const { return mDirection; } - void setDirection(const LLVector3 &direction) { mDirection = direction; } - void setAngularVelocity(const LLVector3 &ang_vel) { mAngularVelocity = ang_vel; } - const LLVector3& getAngularVelocity() const { return mAngularVelocity; } + const LLVector3& getDirection() const; + void setDirection(const LLVector3 &direction); + void setAngularVelocity(const LLVector3 &ang_vel); + const LLVector3& getAngularVelocity() const; - const LLVector3& getDirectionCached() const { return mDirectionCached; } - void renewDirection() { mDirectionCached = mDirection; } + const LLVector3& getDirectionCached() const; + void renewDirection(); - const LLColor3& getColorCached() const { return mColorCached; } - void setColorCached(const LLColor3& c) { mColorCached = c; } - const LLColor3& getColor() const { return mColor; } - void setColor(const LLColor3& c) { mColor = c; } + const LLColor3& getColorCached() const; + void setColorCached(const LLColor3& c); + const LLColor3& getColor() const; + void setColor(const LLColor3& c); - void renewColor() { mColorCached = mColor; } + void renewColor(); - static F32 interpVal() { return sInterpVal; } - static void setInterpVal(const F32 v) { sInterpVal = v; } + static F32 interpVal(); + static void setInterpVal(const F32 v); - LLColor3 getInterpColor() const - { - return sInterpVal * mColor + (1 - sInterpVal) * mColorCached; - } + LLColor3 getInterpColor() const; - const F32& getVisibility() const { return mVisibility; } - void setVisibility(const F32 c = 1) { mVisibility = c; } + const F32& getVisibility() const; + void setVisibility(const F32 c = 1); - BOOL isVisible() const { return mVisible; } - void setVisible(const BOOL v) { mVisible = v; } + bool isVisible() const; + void setVisible(const bool v); - const F32& getIntensity() const { return mIntensity; } - void setIntensity(const F32 c) { mIntensity = c; } + const F32& getIntensity() const; + void setIntensity(const F32 c); - void setDiskRadius(const F32 radius) { mDiskRadius = radius; } - F32 getDiskRadius() const { return mDiskRadius; } + void setDiskRadius(const F32 radius); + F32 getDiskRadius() const; - void setDraw(const BOOL draw) { mDraw = draw; } - BOOL getDraw() const { return mDraw; } + void setDraw(const bool draw); + bool getDraw() const; - const LLVector3& corner(const S32 n) const { return mQuadCorner[n]; } - LLVector3& corner(const S32 n) { return mQuadCorner[n]; } - const LLVector3* corners() const { return mQuadCorner; } + const LLVector3& corner(const S32 n) const; + LLVector3& corner(const S32 n); + const LLVector3* corners() const; }; class LLCubeMap; @@ -237,7 +224,7 @@ public: void restoreGL(); /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time); - BOOL updateSky(); + bool updateSky(); // Graphical stuff for objects - maybe broken out into render class // later? @@ -245,29 +232,15 @@ public: /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); - const LLHeavenBody& getSun() const { return mSun; } + const LLHeavenBody& getSun() const { return mSun; } const LLHeavenBody& getMoon() const { return mMoon; } - //const LLVector3& getToSunLast() const { return mSun.getDirectionCached(); } - //const LLVector3& getToSun() const { return mSun.getDirection(); } - //const LLVector3& getToMoon() const { return mMoon.getDirection(); } - //const LLVector3& getToMoonLast() const { return mMoon.getDirectionCached(); } - //BOOL isSunUp() const { return mSun.getDirectionCached().mV[2] > -0.05f; } - - LLVector3 getLightDirection() const; - LLColor3 getSunDiffuseColor() const; - LLColor3 getMoonDiffuseColor() const; - LLColor4 getSunAmbientColor() const; - LLColor4 getMoonAmbientColor() const; - LLColor4 getTotalAmbientColor() const; - - BOOL isSameFace(S32 idx, const LLFace* face) const { return mFace[idx] == face; } - - void initSunDirection(const LLVector3 &sun_dir, const LLVector3 &sun_ang_velocity); + bool isSameFace(S32 idx, const LLFace* face) const { return mFace[idx] == face; } - void setSunDirection(const LLVector3 &sun_dir, const LLVector3 &moon_dir); + // directions provided should already be in CFR coord sys (+x at, +z up, +y right) + void setSunAndMoonDirectionsCFR(const LLVector3 &sun_dir, const LLVector3 &moon_dir); - BOOL updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 side, LLHeavenBody& hb, const LLVector3 &up, const LLVector3 &right); + bool updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 side, LLHeavenBody& hb, const LLVector3 &up, const LLVector3 &right); void updateReflectionGeometry(LLDrawable *drawable, F32 H, const LLHeavenBody& HB); F32 getWorldScale() const { return mWorldScale; } @@ -291,7 +264,7 @@ public: LLCubeMap *getCubeMap() const { return mCubeMap; } S32 getDrawRefl() const { return mDrawRefl; } void setDrawRefl(const S32 r) { mDrawRefl = r; } - BOOL isReflFace(const LLFace* face) const { return face == mFace[FACE_REFLECTION]; } + bool isReflFace(const LLFace* face) const { return face == mFace[FACE_REFLECTION]; } LLFace* getReflFace() const { return mFace[FACE_REFLECTION]; } LLViewerTexture* getSunTex() const { return mSunTexturep; } @@ -333,12 +306,12 @@ protected: LLColor3 mBrightestPointNew; F32 mBrightnessScaleGuess; LLColor3 mBrightestPointGuess; - BOOL mWeatherChange; + bool mWeatherChange; F32 mCloudDensity; F32 mWind; - BOOL mInitialized; - BOOL mForceUpdate; //flag to force instantaneous update of cubemap + bool mInitialized; + bool mForceUpdate; //flag to force instantaneous update of cubemap LLVector3 mLastLightingDirection; LLColor3 mLastTotalAmbient; F32 mAmbientScale; @@ -351,7 +324,7 @@ protected: LLFrameTimer mUpdateTimer; - BOOL mHeavenlyBodyUpdated ; + bool mHeavenlyBodyUpdated ; LLAtmospherics m_legacyAtmospherics; }; diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp index 3ab149fef0..bdef2ed9fb 100644 --- a/indra/newview/llvowlsky.cpp +++ b/indra/newview/llvowlsky.cpp @@ -87,11 +87,6 @@ LLVOWLSky::LLVOWLSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regi initStars(); } -void LLVOWLSky::initSunDirection(LLVector3 const & sun_direction, - LLVector3 const & sun_angular_velocity) -{ -} - void LLVOWLSky::idleUpdate(LLAgent &agent, const F64 &time) { diff --git a/indra/newview/llvowlsky.h b/indra/newview/llvowlsky.h index 8bc6afba1b..3c801d5d57 100644 --- a/indra/newview/llvowlsky.h +++ b/indra/newview/llvowlsky.h @@ -50,9 +50,6 @@ private: public: LLVOWLSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); - void initSunDirection(LLVector3 const & sun_direction, - LLVector3 const & sun_angular_velocity); - /*virtual*/ void idleUpdate(LLAgent &agent, const F64 &time); /*virtual*/ BOOL isActive(void) const; /*virtual*/ LLDrawable * createDrawable(LLPipeline *pipeline); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 625f811789..f3e4291092 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -116,6 +116,8 @@ #include "llenvironment.h" +#pragma optimize("", off) + #ifdef _DEBUG // Debug indices is disabled for now for debug performance - djs 4/24/02 //#define DEBUG_INDICES @@ -2145,7 +2147,7 @@ void check_references(LLSpatialGroup* group, LLFace* face) void LLPipeline::checkReferences(LLFace* face) { -#if 0 +#if CHECK_PIPELINE_REFERENCES if (sCull) { for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) @@ -2177,7 +2179,7 @@ void LLPipeline::checkReferences(LLFace* face) void LLPipeline::checkReferences(LLDrawable* drawable) { -#if 0 +#if CHECK_PIPELINE_REFERENCES if (sCull) { for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) @@ -2228,7 +2230,7 @@ void check_references(LLSpatialGroup* group, LLDrawInfo* draw_info) void LLPipeline::checkReferences(LLDrawInfo* draw_info) { -#if 0 +#if CHECK_PIPELINE_REFERENCES if (sCull) { for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) @@ -2254,7 +2256,7 @@ void LLPipeline::checkReferences(LLDrawInfo* draw_info) void LLPipeline::checkReferences(LLSpatialGroup* group) { -#if 0 +#if CHECK_PIPELINE_REFERENCES if (sCull) { for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) @@ -6018,8 +6020,9 @@ void LLPipeline::setupAvatarLights(bool for_edit) } else if (gAvatarBacklight) // Always true (unless overridden in a devs .ini) { - LLVector3 opposite_pos = -1.f * mSunDir; - LLVector3 orthog_light_pos = mSunDir % LLVector3::z_axis; + LLVector3 sun_dir = LLVector3(mSunDir); + LLVector3 opposite_pos = -sun_dir; + LLVector3 orthog_light_pos = sun_dir % LLVector3::z_axis; LLVector4 backlight_pos = LLVector4(lerp(opposite_pos, orthog_light_pos, 0.3f), 0.0f); backlight_pos.normalize(); @@ -6243,27 +6246,29 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) { assertInitialized(); + LLEnvironment& environment = LLEnvironment::instance(); + LLSettingsSky::ptr_t psky = environment.getCurrentSky(); + // Ambient if (!LLGLSLShader::sNoFixedFunction) { gGL.syncMatrices(); - LLColor4 ambient = gSky.getTotalAmbientColor(); + LLColor4 ambient = psky->getTotalAmbient(); gGL.setAmbientLightColor(ambient); } // Light 0 = Sun or Moon (All objects) { - LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); + LLVector4 light_dir = environment.getLightDirectionCFR(); + mSunDir.setVec(light_dir); - if (LLEnvironment::instance().getIsSunUp()) - { - mSunDir.setVec(psky->getSunDirection()); - mSunDiffuse.setVec(gSky.getSunDiffuseColor()); + if (environment.getIsSunUp()) + { + mSunDiffuse.setVec(psky->getSunDiffuse()); } else { - mSunDir.setVec(psky->getMoonDirection()); - mSunDiffuse.setVec(gSky.getMoonDiffuseColor()); + mSunDiffuse.setVec(psky->getMoonDiffuse()); } F32 max_color = llmax(mSunDiffuse.mV[0], mSunDiffuse.mV[1], mSunDiffuse.mV[2]); @@ -6273,20 +6278,12 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) } mSunDiffuse.clamp(); - LLVector4 light_pos(mSunDir, 0.0f); LLColor4 light_diffuse = mSunDiffuse; - if (LLPipeline::sRenderDeferred) - { - /*light_diffuse.mV[0] = powf(light_diffuse.mV[0], 2.2f); - light_diffuse.mV[1] = powf(light_diffuse.mV[1], 2.2f); - light_diffuse.mV[2] = powf(light_diffuse.mV[2], 2.2f);*/ - } - mHWLightColors[0] = light_diffuse; LLLightState* light = gGL.getLight(0); - light->setPosition(light_pos); + light->setPosition(mSunDir); light->setDiffuse(light_diffuse); light->setAmbient(LLColor4::black); light->setSpecular(LLColor4::black); @@ -6505,7 +6502,7 @@ void LLPipeline::enableLights(U32 mask) mLightMask = mask; stop_glerror(); - LLColor4 ambient = gSky.getTotalAmbientColor(); + LLColor4 ambient = LLEnvironment::instance().getCurrentSky()->getTotalAmbient(); gGL.setAmbientLightColor(ambient); } } @@ -8470,8 +8467,7 @@ void LLPipeline::renderDeferredLighting() { setupHWLights(NULL); //to set mSunDir; - LLVector4 dir(mSunDir, 0.f); - glh::vec4f tc(dir.mV); + glh::vec4f tc(mSunDir.mV); mat.mult_matrix_vec(tc); mTransformedSunDir.set(tc.v); } @@ -9084,8 +9080,7 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target) { setupHWLights(NULL); //to set mSunDir; - LLVector4 dir(mSunDir, 0.f); - glh::vec4f tc(dir.mV); + glh::vec4f tc(mSunDir.mV); mat.mult_matrix_vec(tc); mTransformedSunDir.set(tc.v); } @@ -10654,15 +10649,17 @@ void LLPipeline::generateSunShadow(LLCamera& camera) //LLVector3 n = RenderShadowNearDist; //F32 nearDist[] = { n.mV[0], n.mV[1], n.mV[2], n.mV[2] }; + LLVector3 sun_dir(mSunDir); + //put together a universal "near clip" plane for shadow frusta LLPlane shadow_near_clip; - { + { LLVector3 p = gAgent.getPositionAgent(); - p += mSunDir * RenderFarClip*2.f; - shadow_near_clip.setVec(p, mSunDir); + p += sun_dir * RenderFarClip*2.f; + shadow_near_clip.setVec(p, sun_dir); } - LLVector3 lightDir = -mSunDir; + LLVector3 lightDir = -sun_dir; lightDir.normVec(); glh::vec3f light_dir(lightDir.mV); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 75fed7dd39..d3fe5b4fdd 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -655,9 +655,9 @@ public: U32 mTrueNoiseMap; U32 mLightFunc; - LLColor4 mSunDiffuse; - LLVector3 mSunDir; - LLVector3 mTransformedSunDir; + LLColor4 mSunDiffuse; + LLVector4 mSunDir; + LLVector4 mTransformedSunDir; bool mInitialized; bool mVertexShadersEnabled; -- cgit v1.3 From 8067bd824ecbf0f2c63a27937f3e36c4cbc99418 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 21 Nov 2018 12:51:41 -0800 Subject: SL-10117: Include environment changes in experience agreement. --- indra/newview/llviewermessage.cpp | 1 + indra/newview/skins/default/xui/en/strings.xml | 1 + 2 files changed, 2 insertions(+) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 8f8b9afaf5..eaa67e6755 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5769,6 +5769,7 @@ void process_script_question(LLMessageSystem *msg, void **user_data) if (script_perm.question == "JoinAnExperience") { // Some experience only permissions do not have an explicit permission bit. Add them here. script_question += " " + LLTrans::getString("ForceSitAvatar") + "\n"; + script_question += " " + LLTrans::getString("ChangeEnvSettings") + "\n"; } script_question += " " + LLTrans::getString(script_perm.question) + "\n"; diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 39c2cb79ad..33c2224b9d 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -531,6 +531,7 @@ http://secondlife.com/support for help fixing this problem. Manage your estates silently Change your default animations Force your avatar to sit + Change your environment settings Not Connected (You) -- cgit v1.3 From c302e4ee967c5ceb2aff95e207a5f3fb8ac0ebb2 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 8 Jan 2019 15:04:10 -0800 Subject: SL-10268, SL-10323: Use _script_perm to display sit and change env questions. Exp log messages for environment changes." --- indra/newview/llscriptruntimeperms.h | 8 +++++--- indra/newview/llviewermessage.cpp | 11 ++++------- indra/newview/skins/default/xui/en/strings.xml | 4 ++++ 3 files changed, 13 insertions(+), 10 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llscriptruntimeperms.h b/indra/newview/llscriptruntimeperms.h index 51f57afdc9..f692c0ad01 100644 --- a/indra/newview/llscriptruntimeperms.h +++ b/indra/newview/llscriptruntimeperms.h @@ -37,7 +37,7 @@ typedef struct _script_perm { question(q), permbit(b), caution(c) {} } script_perm_t; -const U32 NUM_SCRIPT_PERMISSIONS = 16; +const U32 NUM_SCRIPT_PERMISSIONS = 18; const S32 SCRIPT_PERMISSION_DEBIT = 0; const S32 SCRIPT_PERMISSION_TRIGGER_ANIMATION = 3; const S32 SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS = 14; @@ -58,7 +58,9 @@ static const boost::array SCRIPT_PERMISSI _script_perm("JoinAnExperience", (0x1 << 13), false), _script_perm("SilentlyManageEstateAccess", (0x1 << 14), false), _script_perm("OverrideYourAnimations", (0x1 << 15), false), - _script_perm("ScriptReturnObjects", (0x1 << 16), false) -}}; + _script_perm("ScriptReturnObjects", (0x1 << 16), false), + _script_perm("ForceSitAvatar", (0x1 << 17), false), + _script_perm("ChangeEnvSettings", (0x1 << 18), false) + } }; #endif // LL_LLSCRIPTRUNTIME_PERMS_H diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index eaa67e6755..0597347ca8 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5763,19 +5763,16 @@ void process_script_question(LLMessageSystem *msg, void **user_data) // check whether permission question should cause special caution dialog caution |= (script_perm.caution); - if (("ScriptTakeMoney" == script_perm.question) && has_not_only_debit) + if ((("ScriptTakeMoney" == script_perm.question) && has_not_only_debit) || + (script_perm.question == "JoinAnExperience")) continue; - if (script_perm.question == "JoinAnExperience") - { // Some experience only permissions do not have an explicit permission bit. Add them here. - script_question += " " + LLTrans::getString("ForceSitAvatar") + "\n"; - script_question += " " + LLTrans::getString("ChangeEnvSettings") + "\n"; - } - script_question += " " + LLTrans::getString(script_perm.question) + "\n"; } } + script_question += "\n"; + args["QUESTIONS"] = script_question; if (known_questions != questions) diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 10e98719a4..1879ce6f32 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -4219,6 +4219,8 @@ Try enclosing path to the editor with double quotes. control your camera teleport you automatically accept experience permissions + force your avatar to sit + change your environment settings perform an unknown operation: [Permission] Take Controls Trigger Animations @@ -4227,6 +4229,8 @@ Try enclosing path to the editor with double quotes. Control Camera Teleport Permission + Sit + Environment -- cgit v1.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/llsettingsbase.cpp | 2 +- indra/llinventory/llsettingsdaycycle.cpp | 2 - indra/llinventory/llsettingssky.cpp | 3 - indra/llmessage/llassetstorage.cpp | 4 - indra/newview/lldaycyclemanager.cpp | 233 ---------------------------- indra/newview/lldaycyclemanager.h | 83 ---------- indra/newview/llenvironment.cpp | 76 +++++---- indra/newview/llenvironment.h | 51 +++--- indra/newview/llfloatereditextdaycycle.cpp | 2 +- indra/newview/llfloaterfixedenvironment.cpp | 8 +- indra/newview/llinventorybridge.cpp | 3 +- indra/newview/llpaneleditwater.cpp | 3 - indra/newview/llsettingsvo.cpp | 7 - indra/newview/llstartup.cpp | 15 -- indra/newview/llviewermenu.cpp | 1 - indra/newview/llviewermessage.cpp | 21 ++- indra/newview/llviewerparcelmgr.cpp | 4 +- 17 files changed, 99 insertions(+), 419 deletions(-) delete mode 100644 indra/newview/lldaycyclemanager.cpp delete mode 100644 indra/newview/lldaycyclemanager.h (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 5adb787048..7d7547ecb1 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -381,7 +381,7 @@ bool LLSettingsBase::validate() } if (result["warnings"].size() > 0) { - LL_WARNS("SETTINGS") << "Validation warnings: " << result["warnings"] << LL_ENDL; + LL_DEBUGS("SETTINGS") << "Validation warnings: " << result["warnings"] << LL_ENDL; } return result["success"].asBoolean(); diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 188e205176..feb734f64e 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -863,8 +863,6 @@ LLSettingsDay::CycleTrack_t::value_type LLSettingsDay::getSettingsNearKeyframe(c F32 dist = get_wrapping_distance(startframe, (*it).first); - //LL_DEBUGS("LAPRAS") << "[" << startframe << " ... " << keyframe << " -> " << (*it).first << "@" << dist << LL_ENDL; - if (dist <= (fudge * 2.0f)) return (*it); 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) diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 2b12a062c3..18b2b124e1 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -533,10 +533,6 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLVFile file(mVFS, uuid, type); U32 size = exists ? file.getSize() : 0; -// LAPRAS TESTING -// if (type == LLAssetType::AT_SETTINGS) -// size = 0; - if (size > 0) { // we've already got the file diff --git a/indra/newview/lldaycyclemanager.cpp b/indra/newview/lldaycyclemanager.cpp deleted file mode 100644 index 23d442f3b6..0000000000 --- a/indra/newview/lldaycyclemanager.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/** - * @file lldaycyclemanager.cpp - * @brief Implementation for the LLDayCycleManager class. - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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 "llviewerprecompiledheaders.h" - -#include "lldaycyclemanager.h" - -#include "lldiriterator.h" - -#include "llenvironment.h" -#include "llsettingsdaycycle.h" - -void LLDayCycleManager::getPresetNames(preset_name_list_t& names) const -{ - names.clear(); - - for (dc_map_t::const_iterator it = mDayCycleMap.begin(); it != mDayCycleMap.end(); ++it) - { - names.push_back(it->first); - } -} - -void LLDayCycleManager::getPresetNames(preset_name_list_t& user, preset_name_list_t& sys) const -{ - user.clear(); - sys.clear(); - - for (dc_map_t::const_iterator it = mDayCycleMap.begin(); it != mDayCycleMap.end(); ++it) - { - const std::string& name = it->first; - - if (isSystemPreset(name)) - { - sys.push_back(name); - } - else - { - user.push_back(name); - } - } -} - -void LLDayCycleManager::getUserPresetNames(preset_name_list_t& user) const -{ - preset_name_list_t sys; // unused - getPresetNames(user, sys); -} - -bool LLDayCycleManager::getPreset(const std::string name, LLWLDayCycle& day_cycle) const -{ - dc_map_t::const_iterator it = mDayCycleMap.find(name); - if (it == mDayCycleMap.end()) - { - return false; - } - - day_cycle = it->second; - return true; -} - -bool LLDayCycleManager::getPreset(const std::string name, LLSD& day_cycle) const -{ - LLWLDayCycle dc; - if (!getPreset(name, dc)) - { - return false; - } - - day_cycle = dc.asLLSD(); - return true; -} - -bool LLDayCycleManager::presetExists(const std::string name) const -{ - LLWLDayCycle dummy; - return getPreset(name, dummy); -} - -bool LLDayCycleManager::isSystemPreset(const std::string& name) const -{ - return gDirUtilp->fileExists(getSysDir() + LLURI::escape(name) + ".xml"); -} - -bool LLDayCycleManager::savePreset(const std::string& name, const LLSD& data) -{ - // Save given preset. - LLWLDayCycle day; - day.loadDayCycle(data, LLEnvKey::SCOPE_LOCAL); - day.save(getUserDir() + LLURI::escape(name) + ".xml"); - - // Add it to our map. - addPreset(name, data); - mModifySignal(); - return true; -} - -bool LLDayCycleManager::deletePreset(const std::string& name) -{ - // Remove it from the map. - dc_map_t::iterator it = mDayCycleMap.find(name); - if (it == mDayCycleMap.end()) - { - LL_WARNS("Windlight") << "No day cycle named " << name << LL_ENDL; - return false; - } - mDayCycleMap.erase(it); - - // Remove from the filesystem. - std::string filename = LLURI::escape(name) + ".xml"; - if (gDirUtilp->fileExists(getUserDir() + filename)) - { - gDirUtilp->deleteFilesInDir(getUserDir(), filename); - } - - // Signal interested parties. - mModifySignal(); - return true; -} - -bool LLDayCycleManager::isSkyPresetReferenced(const std::string& preset_name) const -{ - // We're traversing local day cycles, they can only reference local skies. - LLWLParamKey key(preset_name, LLEnvKey::SCOPE_LOCAL); - - for (dc_map_t::const_iterator it = mDayCycleMap.begin(); it != mDayCycleMap.end(); ++it) - { - if (it->second.hasReferencesTo(key)) - { - return true; - } - } - - return false; -} - -boost::signals2::connection LLDayCycleManager::setModifyCallback(const modify_signal_t::slot_type& cb) -{ - return mModifySignal.connect(cb); -} - -// virtual -void LLDayCycleManager::initSingleton() -{ - LL_DEBUGS("Windlight") << "Loading all day cycles" << LL_ENDL; - loadAllPresets(); -} - -void LLDayCycleManager::loadAllPresets() -{ - mDayCycleMap.clear(); - - // First, load system (coming out of the box) day cycles. - loadPresets(getSysDir()); - - // Then load user presets. Note that user day cycles will modify any system ones already loaded. - loadPresets(getUserDir()); -} - -void LLDayCycleManager::loadPresets(const std::string& dir) -{ - LLDirIterator dir_iter(dir, "*.xml"); - - while (1) - { - std::string file; - if (!dir_iter.next(file)) break; // no more files - loadPreset(gDirUtilp->add(dir, file)); - } -} - -bool LLDayCycleManager::loadPreset(const std::string& path) -{ - LLSD data = LLWLDayCycle::loadDayCycleFromPath(path); - if (data.isUndefined()) - { - LL_WARNS() << "Error loading day cycle from " << path << LL_ENDL; - return false; - } - - std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true)); - addPreset(name, data); - - return true; -} - -bool LLDayCycleManager::addPreset(const std::string& name, const LLSD& data) -{ - if (name.empty()) - { - //llassert(name.empty()); - return false; - } - - LLWLDayCycle day; - day.loadDayCycle(data, LLEnvKey::SCOPE_LOCAL); - mDayCycleMap[name] = day; - return true; -} - -// static -std::string LLDayCycleManager::getSysDir() -{ - return gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/days", ""); -} - -// static -std::string LLDayCycleManager::getUserDir() -{ - return gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS , "windlight/days", ""); -} diff --git a/indra/newview/lldaycyclemanager.h b/indra/newview/lldaycyclemanager.h deleted file mode 100644 index 810212c92a..0000000000 --- a/indra/newview/lldaycyclemanager.h +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @file lldaycyclemanager.h - * @brief Implementation for the LLDayCycleManager class. - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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$ - */ - -#ifndef LL_LLDAYCYCLEMANAGER_H -#define LL_LLDAYCYCLEMANAGER_H - -#include -#include - -#include "llwlparammanager.h" - -/** - * WindLight day cycles manager class - * - * Provides interface for accessing, loading and saving day cycles. - */ -class LLDayCycleManager : public LLSingleton -{ - LLSINGLETON_EMPTY_CTOR(LLDayCycleManager); - LOG_CLASS(LLDayCycleManager); - -public: - typedef std::list preset_name_list_t; - -// typedef std::map dc_map_t; - typedef boost::signals2::signal modify_signal_t; - - void getPresetNames(preset_name_list_t& names) const; - void getPresetNames(preset_name_list_t& user, preset_name_list_t& sys) const; - void getUserPresetNames(preset_name_list_t& user) const; - -// bool getPreset(const std::string name, LLWLDayCycle& day_cycle) const; - bool getPreset(const std::string name, LLSD& day_cycle) const; - bool presetExists(const std::string name) const; - bool isSystemPreset(const std::string& name) const; - bool savePreset(const std::string& name, const LLSD& data); - bool deletePreset(const std::string& name); - - /// @return true if there is a day cycle that refers to the sky preset. - bool isSkyPresetReferenced(const std::string& preset_name) const; - - /// Emitted when a preset gets added or deleted. - boost::signals2::connection setModifyCallback(const modify_signal_t::slot_type& cb); - -private: - /*virtual*/ void initSingleton(); - - void loadAllPresets(); - void loadPresets(const std::string& dir); - bool loadPreset(const std::string& path); - bool addPreset(const std::string& name, const LLSD& data); - - static std::string getSysDir(); - static std::string getUserDir(); - - dc_map_t mDayCycleMap; - modify_signal_t mModifySignal; -}; - -#endif // LL_LLDAYCYCLEMANAGER_H diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 4bf7a630a5..f021c4a8c3 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -470,7 +470,6 @@ namespace { if ((*it)->mBlendIn) { - //_WARNS("LAPRAS") << "Done blending '" << key_name << "' after " << (*it)->mTransition.value() - (*it)->mTimeRemaining.value() << " value now=" << target << LL_ENDL; mOverrideValues[key_name] = target; mOverrideExps[key_name] = (*it)->mExperience; this->mSettings[key_name] = target; @@ -1621,39 +1620,38 @@ void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentI else if (envinfo->mDayCycle->isTrackEmpty(LLSettingsDay::TRACK_WATER) || envinfo->mDayCycle->isTrackEmpty(LLSettingsDay::TRACK_GROUND_LEVEL)) { - LL_WARNS("LAPRAS") << "Invalid day cycle for region" << LL_ENDL; + LL_WARNS("ENVIRONMENT") << "Invalid day cycle for region" << LL_ENDL; clearEnvironment(ENV_PARCEL); setEnvironment(ENV_REGION, LLSettingsDay::GetDefaultAssetId(), LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET, envinfo->mEnvVersion); updateEnvironment(); } else { - LL_INFOS("LAPRAS") << "Setting Region environment" << LL_ENDL; setEnvironment(ENV_REGION, envinfo->mDayCycle, envinfo->mDayLength, envinfo->mDayOffset, envinfo->mEnvVersion); mTrackAltitudes = envinfo->mAltitudes; } - LL_WARNS("LAPRAS") << "Altitudes set to {" << mTrackAltitudes[0] << ", "<< mTrackAltitudes[1] << ", " << mTrackAltitudes[2] << ", " << mTrackAltitudes[3] << LL_ENDL; + LL_DEBUGS("ENVIRONMENT") << "Altitudes set to {" << mTrackAltitudes[0] << ", "<< mTrackAltitudes[1] << ", " << mTrackAltitudes[2] << ", " << mTrackAltitudes[3] << LL_ENDL; } else { LLParcel *parcel = LLViewerParcelMgr::instance().getAgentParcel(); - LL_WARNS("LAPRAS") << "Have parcel environment #" << envinfo->mParcelId << LL_ENDL; + LL_DEBUGS("ENVIRONMENT") << "Have parcel environment #" << envinfo->mParcelId << LL_ENDL; if (parcel && (parcel->getLocalID() != parcel_id)) { - LL_WARNS("ENVIRONMENT") << "Requested parcel #" << parcel_id << " agent is on " << parcel->getLocalID() << LL_ENDL; + LL_DEBUGS("ENVIRONMENT") << "Requested parcel #" << parcel_id << " agent is on " << parcel->getLocalID() << LL_ENDL; return; } if (!envinfo->mDayCycle) { - LL_WARNS("LAPRAS") << "Clearing environment on parcel #" << parcel_id << LL_ENDL; + LL_DEBUGS("ENVIRONMENT") << "Clearing environment on parcel #" << parcel_id << LL_ENDL; clearEnvironment(ENV_PARCEL); } else if (envinfo->mDayCycle->isTrackEmpty(LLSettingsDay::TRACK_WATER) || envinfo->mDayCycle->isTrackEmpty(LLSettingsDay::TRACK_GROUND_LEVEL)) { - LL_WARNS("LAPRAS") << "Invalid day cycle for parcel #" << parcel_id << LL_ENDL; + LL_WARNS("ENVIRONMENT") << "Invalid day cycle for parcel #" << parcel_id << LL_ENDL; clearEnvironment(ENV_PARCEL); } else @@ -1665,6 +1663,27 @@ void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentI updateEnvironment(transition); } +void LLEnvironment::adjustRegionOffset(F32 adjust) +{ + if (isExtendedEnvironmentEnabled()) + { + LL_WARNS("ENVIRONMENT") << "Attempt to adjust region offset on EEP region. Legacy regions only." << LL_ENDL; + } + + if (mEnvironments[ENV_REGION]) + { + F32 day_length = mEnvironments[ENV_REGION]->getDayLength(); + F32 day_offset = mEnvironments[ENV_REGION]->getDayOffset(); + + F32 day_adjustment = adjust * day_length; + + day_offset += day_adjustment; + if (day_offset < 0.0f) + day_offset = day_length + day_offset; + mEnvironments[ENV_REGION]->setDayOffset(LLSettingsBase::Seconds(day_offset)); + } +} + //========================================================================= void LLEnvironment::requestRegion(environment_apply_fn cb) { @@ -1820,7 +1839,7 @@ void LLEnvironment::coroRequestEnvironment(S32 parcel_id, LLEnvironment::environ if (url.empty()) return; - LL_WARNS("LAPRAS") << "Requesting for parcel_id=" << parcel_id << LL_ENDL; + LL_DEBUGS("ENVIRONMENT") << "Requesting for parcel_id=" << parcel_id << LL_ENDL; if (parcel_id != INVALID_PARCEL_ID) { @@ -1830,24 +1849,14 @@ void LLEnvironment::coroRequestEnvironment(S32 parcel_id, LLEnvironment::environ url += query.str(); } - LL_WARNS("LAPRAS") << "url=" << url << LL_ENDL; - LLSD result = httpAdapter->getAndSuspend(httpRequest, url); // results that come back may contain the new settings -// LLSD notify; - LLSD httpResults = result["http_result"]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (!status) { - LL_WARNS("WindlightCaps") << "Couldn't retrieve environment settings for " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL; - -// std::stringstream msg; -// msg << status.toString() << " (Code " << status.toTerseString() << ")"; -// notify = LLSD::emptyMap(); -// notify["FAIL_REASON"] = msg.str(); - + LL_WARNS("ENVIRONMENT") << "Couldn't retrieve environment settings for " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL; } else { @@ -1859,11 +1868,6 @@ void LLEnvironment::coroRequestEnvironment(S32 parcel_id, LLEnvironment::environ } } -// if (!notify.isUndefined()) -// { -// LLNotificationsUtil::add("WLRegionApplyFail", notify); -// //LLEnvManagerNew::instance().onRegionSettingsApplyResponse(false); -// } } void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, S32 track_no, UpdateInfo::ptr_t updates, environment_apply_fn apply) @@ -1906,7 +1910,7 @@ void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, S32 track_no, UpdateInf body[KEY_ENVIRONMENT][KEY_DAYNAME] = updates->mDayName; } - LL_WARNS("LAPRAS") << "Body = " << body << LL_ENDL; + //_WARNS("ENVIRONMENT") << "Body = " << body << LL_ENDL; if ((parcel_id != INVALID_PARCEL_ID) || (track_no != NO_TRACK)) { @@ -1934,10 +1938,10 @@ void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, S32 track_no, UpdateInf LLSD httpResults = result["http_result"]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); - LL_WARNS("LAPRAS") << "success=" << result["success"] << LL_ENDL; + if ((!status) || !result["success"].asBoolean()) { - LL_WARNS("WindlightCaps") << "Couldn't update Windlight settings for " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL; + LL_WARNS("ENVIRONMENT") << "Couldn't update Windlight settings for " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL; notify = LLSD::emptyMap(); notify["FAIL_REASON"] = result["message"].asString(); @@ -1996,10 +2000,10 @@ void LLEnvironment::coroResetEnvironment(S32 parcel_id, S32 track_no, environmen LLSD httpResults = result["http_result"]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); - LL_WARNS("LAPRAS") << "success=" << result["success"] << LL_ENDL; + if ((!status) || !result["success"].asBoolean()) { - LL_WARNS("WindlightCaps") << "Couldn't reset Windlight settings in " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL; + LL_WARNS("ENVIRONMENT") << "Couldn't reset Windlight settings in " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL; notify = LLSD::emptyMap(); notify["FAIL_REASON"] = result["message"].asString(); @@ -2416,8 +2420,6 @@ void LLEnvironment::setExperienceEnvironment(LLUUID experience_id, LLSD data, F3 void LLEnvironment::listenExperiencePump(const LLSD &message) { - LL_WARNS("LAPRAS") << "Have experience event: " << message << LL_ENDL; - LLUUID experience_id = message["experience"]; LLSD data = message[experience_id.asString()]; std::string permission(data["permission"].asString()); @@ -2564,6 +2566,16 @@ void LLEnvironment::DayInstance::setBlenders(const LLSettingsBlender::ptr_t &sky mBlenderWater = waterblend; } +LLSettingsBase::TrackPosition LLEnvironment::DayInstance::getProgress() const +{ + LLSettingsBase::Seconds now(LLDate::now().secondsSinceEpoch()); + now += mDayOffset; + + if ((mDayLength <= 0) || !mDayCycle) + return -1.0f; // no actual day cycle. + + return convert_time_to_position(now, mDayLength); +} LLSettingsBase::TrackPosition LLEnvironment::DayInstance::secondsToKeyframe(LLSettingsDay::Seconds seconds) { diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 6a930959bb..64350c42e8 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -197,6 +197,10 @@ public: // Construct a new day cycle based on the environment. Replacing either the water or the sky tracks. LLSettingsDay::ptr_t createDayCycleFromEnvironment(EnvSelection_t env, LLSettingsBase::ptr_t settings); + F32 getProgress() const { return (mCurrentEnvironment) ? mCurrentEnvironment->getProgress() : -1.0f; } + F32 getRegionProgress() const { return (mEnvironments[ENV_REGION]) ? mEnvironments[ENV_REGION]->getProgress() : -1.0f; } + void adjustRegionOffset(F32 adjust); // only used on legacy regions, to better sync the viewer with other agents + //------------------------------------------- connection_t setEnvironmentChanged(env_changed_fn cb) { return mSignalEnvChanged.connect(cb); } @@ -233,37 +237,42 @@ public: }; typedef std::shared_ptr ptr_t; - DayInstance(EnvSelection_t env); - virtual ~DayInstance() { }; + DayInstance(EnvSelection_t env); + virtual ~DayInstance() { }; + + virtual ptr_t clone() const; + + virtual bool applyTimeDelta(const LLSettingsBase::Seconds& delta); + + virtual void setDay(const LLSettingsDay::ptr_t &pday, LLSettingsDay::Seconds daylength, LLSettingsDay::Seconds dayoffset); + virtual void setSky(const LLSettingsSky::ptr_t &psky); + virtual void setWater(const LLSettingsWater::ptr_t &pwater); - virtual ptr_t clone() const; + void initialize(); + bool isInitialized(); - virtual bool applyTimeDelta(const LLSettingsBase::Seconds& delta); + void clear(); - virtual void setDay(const LLSettingsDay::ptr_t &pday, LLSettingsDay::Seconds daylength, LLSettingsDay::Seconds dayoffset); - virtual void setSky(const LLSettingsSky::ptr_t &psky); - virtual void setWater(const LLSettingsWater::ptr_t &pwater); + void setSkyTrack(S32 trackno); - void initialize(); - bool isInitialized(); + LLSettingsDay::ptr_t getDayCycle() const { return mDayCycle; } + LLSettingsSky::ptr_t getSky() const { return mSky; } + LLSettingsWater::ptr_t getWater() const { return mWater; } + LLSettingsDay::Seconds getDayLength() const { return mDayLength; } + LLSettingsDay::Seconds getDayOffset() const { return mDayOffset; } + S32 getSkyTrack() const { return mSkyTrack; } - void clear(); + void setDayOffset(LLSettingsBase::Seconds offset) { mDayOffset = offset; animate(); } - void setSkyTrack(S32 trackno); + virtual void animate(); - LLSettingsDay::ptr_t getDayCycle() const { return mDayCycle; } - LLSettingsSky::ptr_t getSky() const { return mSky; } - LLSettingsWater::ptr_t getWater() const { return mWater; } - LLSettingsDay::Seconds getDayLength() const { return mDayLength; } - LLSettingsDay::Seconds getDayOffset() const { return mDayOffset; } - S32 getSkyTrack() const { return mSkyTrack; } + void setBlenders(const LLSettingsBlender::ptr_t &skyblend, const LLSettingsBlender::ptr_t &waterblend); - virtual void animate(); + EnvSelection_t getEnvironmentSelection() const { return mEnv; } + void setEnvironmentSelection(EnvSelection_t env) { mEnv = env; } - void setBlenders(const LLSettingsBlender::ptr_t &skyblend, const LLSettingsBlender::ptr_t &waterblend); + LLSettingsBase::TrackPosition getProgress() const; - EnvSelection_t getEnvironmentSelection() const { return mEnv; } - void setEnvironmentSelection(EnvSelection_t env) { mEnv = env; } protected: LLSettingsDay::ptr_t mDayCycle; LLSettingsSky::ptr_t mSky; diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 482caaaa85..3b148fa89e 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -1797,7 +1797,7 @@ void LLFloaterEditExtDayCycle::loadSettingFromFile(const std::vectorgetAssetUUID(); - LL_WARNS("LAPRAS") << "Locally applying asset ID " << asset_id << LL_ENDL; LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, asset_id); LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); } @@ -6958,7 +6957,7 @@ void LLSettingsBridge::performAction(LLInventoryModel* model, std::string action } S32 parcel_id = parcel->getLocalID(); - LL_WARNS("LAPRAS") << "Applying asset ID " << asset_id << " to parcel " << parcel_id << LL_ENDL; + LL_DEBUGS("ENVIRONMENT") << "Applying asset ID " << asset_id << " to parcel " << parcel_id << LL_ENDL; LLEnvironment::instance().updateParcel(parcel_id, asset_id, name, LLEnvironment::NO_TRACK, -1, -1); LLEnvironment::instance().setSharedEnvironment(); } diff --git a/indra/newview/llpaneleditwater.cpp b/indra/newview/llpaneleditwater.cpp index f639ad0d98..1f9c79c9eb 100644 --- a/indra/newview/llpaneleditwater.cpp +++ b/indra/newview/llpaneleditwater.cpp @@ -189,7 +189,6 @@ void LLPanelSettingsWaterMainTab::onLargeWaveChanged() { LLVector2 vect(getChild(FIELD_WATER_WAVE1_XY)->getValue()); vect *= -1.0; // Flip so that north and east are - - LL_WARNS("LAPRAS") << "Changing Large Wave from " << mWaterSettings->getWave1Dir() << " -> " << vect << LL_ENDL; mWaterSettings->setWave1Dir(vect); setIsDirty(); } @@ -198,7 +197,6 @@ void LLPanelSettingsWaterMainTab::onSmallWaveChanged() { LLVector2 vect(getChild(FIELD_WATER_WAVE2_XY)->getValue()); vect *= -1.0; // Flip so that north and east are - - LL_WARNS("LAPRAS") << "Changing Small Wave from " << mWaterSettings->getWave2Dir() << " -> " << vect << LL_ENDL; mWaterSettings->setWave2Dir(vect); setIsDirty(); } @@ -207,7 +205,6 @@ void LLPanelSettingsWaterMainTab::onSmallWaveChanged() void LLPanelSettingsWaterMainTab::onNormalScaleChanged() { LLVector3 vect(getChild(FIELD_WATER_NORMAL_SCALE_X)->getValue().asReal(), getChild(FIELD_WATER_NORMAL_SCALE_Y)->getValue().asReal(), getChild(FIELD_WATER_NORMAL_SCALE_Z)->getValue().asReal()); - LL_WARNS("LAPRAS") << "Changing normal scale from " << mWaterSettings->getNormalScale() << " -> " << vect << LL_ENDL; mWaterSettings->setNormalScale(vect); setIsDirty(); } diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 3ef5e46e38..10a0527fe2 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -324,7 +324,6 @@ void LLSettingsVOBase::onAssetDownloadComplete(LLVFS *vfs, const LLUUID &asset_i } else { - //_WARNS("LAPRAS") << "Setting asset ID to " << asset_id << LL_ENDL; settings->setAssetId(asset_id); } } @@ -870,7 +869,6 @@ LLSD LLSettingsVOWater::convertToLegacy(const LLSettingsWater::ptr_t &pwater) legacy[SETTING_LEGACY_WAVE1_DIR] = settings[SETTING_WAVE1_DIR]; legacy[SETTING_LEGACY_WAVE2_DIR] = settings[SETTING_WAVE2_DIR]; - //_WARNS("LAPRAS") << "Legacy water: " << legacy << LL_ENDL; return legacy; } //------------------------------------------------------------------------- @@ -1120,8 +1118,6 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID ®io ( SETTING_FRAMES, frames ) ( SETTING_TYPE, "daycycle" ); - //_WARNS("LAPRAS") << "newsettings=" << newsettings << LL_ENDL; - LLSettingsSky::validation_list_t validations = LLSettingsDay::validationList(); LLSD results = LLSettingsDay::settingValidation(newsettings, validations); if (!results["success"].asBoolean()) @@ -1299,7 +1295,6 @@ LLSD LLSettingsVODay::convertToLegacy(const LLSettingsVODay::ptr_t &pday) F32 frame = ((tracksky.size() == 1) && (it == tracksky.begin())) ? -1.0f : (*it).first; llsdcycle.append( LLSDArray(LLSD::Real(frame))(name.str()) ); } - //_WARNS("LAPRAS") << "Cycle created with " << llsdcycle.size() << "entries: " << llsdcycle << LL_ENDL; LLSD llsdskylist(LLSD::emptyMap()); @@ -1311,8 +1306,6 @@ LLSD LLSettingsVODay::convertToLegacy(const LLSettingsVODay::ptr_t &pday) llsdskylist[(*its).first] = llsdsky; } - //_WARNS("LAPRAS") << "Sky map with " << llsdskylist.size() << " entries created: " << llsdskylist << LL_ENDL; - return LLSDArray(LLSD::emptyMap())(llsdcycle)(llsdskylist)(llsdwater); } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 9c0e842c30..1d24df5886 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -941,21 +941,6 @@ bool idle_startup() LLFile::mkdir(gDirUtilp->getChatLogsDir()); LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir()); - - //good a place as any to create user windlight directories - std::string user_windlight_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight", "")); - LLFile::mkdir(user_windlight_path_name.c_str()); - - std::string user_windlight_skies_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", "")); - LLFile::mkdir(user_windlight_skies_path_name.c_str()); - - std::string user_windlight_water_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", "")); - LLFile::mkdir(user_windlight_water_path_name.c_str()); - - std::string user_windlight_days_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/days", "")); - LLFile::mkdir(user_windlight_days_path_name.c_str()); - - if (show_connect_box) { LLSLURL slurl; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 1bbda04ae6..c9b13f92d3 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8616,7 +8616,6 @@ class LLWorldEnvPreset : public view_listener_t { std::string item = userdata.asString(); -// *LAPRAS* These go away! Keep for the moment. if (item == "new_water") { LLFloaterReg::showInstance("env_fixed_environmentent_water", "new"); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 0597347ca8..e610387b37 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3780,11 +3780,24 @@ void process_time_synch(LLMessageSystem *mesgsys, void **user_data) LLWorld::getInstance()->setSpaceTimeUSec(space_time_usec); - LL_DEBUGS("WindlightSync") << "Sun phase: " << phase << " rad = " << fmodf(phase / F_TWO_PI + 0.25, 1.f) * 24.f << " h" << LL_ENDL; + LL_DEBUGS("ENVIRONMENT") << "Sun phase: " << phase << " rad = " << fmodf(phase / F_TWO_PI + 0.25, 1.f) * 24.f << " h" << LL_ENDL; - - /* LAPRAS - We decode these parts of the message but ignore them + F32 region_phase = LLEnvironment::instance().getRegionProgress(); + if (region_phase >= 0.0) + { + F32 adjusted_phase = fmodf(phase / F_TWO_PI + 0.25, 1.f); + F32 delta_phase = adjusted_phase - region_phase; + + LL_DEBUGS("ENVIRONMENT") << "adjusted phase = " << adjusted_phase << " local phase = " << region_phase << " delta = " << delta_phase << LL_ENDL; + + if (!LLEnvironment::instance().isExtendedEnvironmentEnabled() && (fabs(delta_phase) > 0.125)) + { + LL_INFOS("ENVIRONMENT") << "Adjusting environment to match region. adjustment=" << delta_phase << LL_ENDL; + LLEnvironment::instance().adjustRegionOffset(delta_phase); + } + } + + /* We decode these parts of the message but ignore them as the real values are provided elsewhere. */ (void)sun_direction, (void)moon_direction, (void)phase; } diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index cca02544ee..e2a7c563a7 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -1670,7 +1670,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use } } parcel->setParcelEnvironmentVersion(parcel_environment_version); - LL_WARNS("LAPRAS") << "Parcel environment version is " << parcel->getParcelEnvironmentVersion() << LL_ENDL; + LL_DEBUGS("ENVIRONMENT") << "Parcel environment version is " << parcel->getParcelEnvironmentVersion() << LL_ENDL; // Notify anything that wants to know when the agent changes parcels gAgent.changeParcels(); instance->mTeleportInProgress = FALSE; @@ -1682,7 +1682,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use parcel_mgr.mAgentParcel->unpackMessage(msg); if ((LLEnvironment::instance().isExtendedEnvironmentEnabled() && environment_changed)) { - LL_WARNS("LAPRAS") << "Parcel environment version is " << parcel->getParcelEnvironmentVersion() << LL_ENDL; + LL_DEBUGS("ENVIRONMENT") << "Parcel environment version is " << parcel->getParcelEnvironmentVersion() << LL_ENDL; LLEnvironment::instance().requestParcel(local_id); } } -- cgit v1.3 From 605c9c19661702755171669e2af846abe77d2a51 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 8 May 2019 11:42:31 -0700 Subject: Fix merge fail. --- indra/llui/llmenugl.h | 7 ++++++- indra/newview/llinventorybridge.cpp | 5 ++++- indra/newview/llinventorypanel.cpp | 3 --- indra/newview/llmeshrepository.cpp | 13 ------------- indra/newview/llviewerfloaterreg.cpp | 2 +- indra/newview/llviewermenufile.cpp | 2 +- indra/newview/llviewermessage.cpp | 28 ++++++---------------------- indra/newview/llviewertexture.cpp | 4 ++-- indra/newview/llviewertexture.h | 2 +- indra/newview/llvovolume.cpp | 4 ++-- 10 files changed, 23 insertions(+), 47 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index aa87329020..1f11f26192 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -175,7 +175,12 @@ protected: // This function appends the character string representation of // the current accelerator key and mask to the provided string. void appendAcceleratorString( std::string& st ) const; - + + virtual std::string _getSearchText() const + { + return mLabel.getString(); + } + protected: KEY mAcceleratorKey; MASK mAcceleratorMask; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 50c4fdc870..ee9dfbc376 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -81,6 +81,10 @@ #include "llwearableitemslist.h" #include "lllandmarkactions.h" #include "llpanellandmarks.h" +#include "llviewerparcelmgr.h" +#include "llparcel.h" + +#include "llenvironment.h" #include @@ -4058,7 +4062,6 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items } } getClipboardEntries(false, items, disabled_items, flags); - } else { diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 4eb42950b7..dd541defa1 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1726,9 +1726,6 @@ bool LLInventoryPanel::isSelectionRemovable() /************************************************************************/ /* Recent Inventory Panel related class */ /************************************************************************/ -class LLInventoryRecentItemsPanel; -static LLDefaultChildRegistry::Register t_recent_inventory_panel("recent_inventory_panel"); - static const LLRecentInventoryBridgeBuilder RECENT_ITEMS_BUILDER; class LLInventoryRecentItemsPanel : public LLInventoryPanel { diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 4e9ebec0f2..127d04c34d 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2190,7 +2190,6 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) std::map mesh_index; std::string model_name; - std::string model_metric; S32 instance_num = 0; @@ -2220,11 +2219,6 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) model_name = data.mBaseModel->getName(); } - if (model_metric.empty()) - { - model_metric = data.mBaseModel->getMetric(); - } - std::stringstream ostr; LLModel::Decomposition& decomp = @@ -2379,11 +2373,6 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) model_name = data.mBaseModel->getName(); } - if (model_metric.empty()) - { - model_metric = data.mBaseModel->getMetric(); - } - std::stringstream ostr; LLModel::Decomposition& decomp = @@ -2514,8 +2503,6 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) if (model_name.empty()) model_name = "mesh model"; result["name"] = model_name; - if (model_metric.empty()) model_metric = "MUT_Unspecified"; - res["metric"] = model_metric; result["asset_resources"] = res; dump_llsd_to_file(result,make_dump_name("whole_model_",dump_num)); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index ad016d0817..ffc21e8f14 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -90,7 +90,7 @@ #include "llfloatermemleak.h" #include "llfloatermodelpreview.h" #include "llfloatermyscripts.h" -"llfloatermyenvironment.h" +#include "llfloatermyenvironment.h" #include "llfloaternamedesc.h" #include "llfloaternotificationsconsole.h" #include "llfloaternotificationstabbed.h" diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 693d2ab60a..07873f482f 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -812,7 +812,7 @@ void upload_done_callback( LLStringUtil::trim(asset_name); std::string display_name = LLStringUtil::null; - LLAssetStorage::LLStoreAssetCallback callback = NULL; + LLAssetStorage::LLStoreAssetCallback callback; void *userdata = NULL; upload_new_resource( next_file, diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 982f1980f1..c22be25f1f 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3760,6 +3760,7 @@ void process_kill_object(LLMessageSystem *mesgsys, void **user_data) void process_time_synch(LLMessageSystem *mesgsys, void **user_data) { LLVector3 sun_direction; + LLVector3 moon_direction; LLVector3 sun_ang_velocity; F32 phase; U64 space_time_usec; @@ -3781,12 +3782,10 @@ void process_time_synch(LLMessageSystem *mesgsys, void **user_data) LL_DEBUGS("WindlightSync") << "Sun phase: " << phase << " rad = " << fmodf(phase / F_TWO_PI + 0.25, 1.f) * 24.f << " h" << LL_ENDL; - gSky.setSunPhase(phase); - gSky.setSunTargetDirection(sun_direction, sun_ang_velocity); - if ( !(gSavedSettings.getBOOL("SkyOverrideSimSunPosition") || gSky.getOverrideSun()) ) - { - gSky.setSunDirection(sun_direction, sun_ang_velocity); - } + /* LAPRAS + We decode these parts of the message but ignore them + as the real values are provided elsewhere. */ + (void)sun_direction, (void)moon_direction, (void)phase; } void process_sound_trigger(LLMessageSystem *msg, void **) @@ -5531,17 +5530,6 @@ void notify_cautioned_script_question(const LLSD& notification, const LLSD& resp void script_question_mute(const LLUUID& item_id, const std::string& object_name); -bool unknown_script_question_cb(const LLSD& notification, const LLSD& response) -{ - // Only care if they muted the object here. - if ( response["Mute"] ) // mute - { - LLUUID task_id = notification["payload"]["task_id"].asUUID(); - script_question_mute(task_id,notification["payload"]["object_name"].asString()); - } - return false; -} - void experiencePermissionBlock(LLUUID experience, LLSD result) { LLSD permission; @@ -5647,8 +5635,7 @@ void script_question_mute(const LLUUID& task_id, const std::string& object_name) bool matches(const LLNotificationPtr notification) const { if (notification->getName() == "ScriptQuestionCaution" - || notification->getName() == "ScriptQuestion" - /*|| notification->getName() == "UnknownScriptQuestion"*/) + || notification->getName() == "ScriptQuestion") { return (notification->getPayload()["task_id"].asUUID() == blocked_id); } @@ -5665,7 +5652,6 @@ void script_question_mute(const LLUUID& task_id, const std::string& object_name) static LLNotificationFunctorRegistration script_question_cb_reg_1("ScriptQuestion", script_question_cb); static LLNotificationFunctorRegistration script_question_cb_reg_2("ScriptQuestionCaution", script_question_cb); static LLNotificationFunctorRegistration script_question_cb_reg_3("ScriptQuestionExperience", script_question_cb); -//static LLNotificationFunctorRegistration unknown_script_question_cb_reg("UnknownScriptQuestion", unknown_script_question_cb); void process_script_experience_details(const LLSD& experience_details, LLSD args, LLSD payload) { @@ -5775,8 +5761,6 @@ void process_script_question(LLMessageSystem *msg, void **user_data) } } - script_question += "\n"; - args["QUESTIONS"] = script_question; if (known_questions != questions) diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 68a9994bee..5bd60c6b94 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -98,8 +98,8 @@ const S32 MAX_CACHED_RAW_IMAGE_AREA = 64 * 64; const S32 MAX_CACHED_RAW_SCULPT_IMAGE_AREA = LLViewerTexture::sMaxSculptRez * LLViewerTexture::sMaxSculptRez; const S32 MAX_CACHED_RAW_TERRAIN_IMAGE_AREA = 128 * 128; const S32 DEFAULT_ICON_DIMENTIONS = 32; -S32 LLViewerTexture::sMinLargeImageSize = 65536; //256 * 256. -S32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA; +U32 LLViewerTexture::sMinLargeImageSize = 65536; //256 * 256. +U32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA; bool LLViewerTexture::sFreezeImageUpdates = false; F32 LLViewerTexture::sCurrentTime = 0.0f; F32 LLViewerTexture::sTexelPixelRatio = 1.0f; diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 78bebb542a..69568cc825 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -125,7 +125,7 @@ public: virtual BOOL isMissingAsset() const ; virtual void dump(); // debug info to LL_INFOS() - virtual BOOL isViewerMediaTexture() const { return false; } + virtual bool isViewerMediaTexture() const { return false; } /*virtual*/ bool bindDefaultImage(const S32 stage = 0) ; /*virtual*/ bool bindDebugImage(const S32 stage = 0) ; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 08798d81b7..664615d4eb 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4981,7 +4981,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, if ( type == LLRenderPass::PASS_ALPHA && facep->getTextureEntry()->getMaterialParams().notNull() && !facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_TANGENT) - && LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1) + && LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1) { LL_WARNS_ONCE("RenderMaterials") << "Oh no! No binormals for this alpha blended face!" << LL_ENDL; } @@ -5882,7 +5882,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) spec_mask = spec_mask | LLVertexBuffer::MAP_EMISSIVE; } - BOOL batch_textures = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1; + BOOL batch_textures = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 1; if (batch_textures) { -- cgit v1.3 From 7a7f68fb3c09c187f5b6fd333d0292a3fbfbc9df Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 27 Sep 2019 16:58:54 +0300 Subject: SL-12024 [EEP] UI should indicate that the Environment tab is an estate-wide setting. --- indra/newview/llfloaterregioninfo.cpp | 33 ++++++++++++++++- indra/newview/llfloaterregioninfo.h | 3 ++ indra/newview/llviewermessage.cpp | 3 +- .../newview/skins/default/xui/en/notifications.xml | 2 +- .../default/xui/en/panel_region_environment.xml | 42 +++++++++++++++++++++- 5 files changed, 78 insertions(+), 5 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 83215a7fec..816ef68093 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -200,6 +200,8 @@ public: virtual S32 getParcelId() override { return INVALID_PARCEL_ID; } + static void updateEstateName(const std::string& name); + protected: static const U32 DIRTY_FLAG_OVERRIDE; @@ -572,6 +574,16 @@ LLPanelRegionGeneralInfo* LLFloaterRegionInfo::getPanelGeneral() return panel; } +// static +LLPanelRegionEnvironment* LLFloaterRegionInfo::getPanelEnvironment() +{ + LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance("region_info"); + if (!floater) return NULL; + LLTabContainer* tab = floater->getChild("region_panels"); + LLPanelRegionEnvironment* panel = (LLPanelRegionEnvironment*)tab->getChild("panel_env_info"); + return panel; +} + // static LLPanelRegionTerrainInfo* LLFloaterRegionInfo::getPanelRegionTerrain() { @@ -597,6 +609,13 @@ LLPanelRegionExperiences* LLFloaterRegionInfo::getPanelExperiences() return (LLPanelRegionExperiences*)tab->getChild("Experiences"); } +void LLFloaterRegionInfo::updateEstateName(const std::string& estate_name) +{ + LLPanelEstateCovenant::updateEstateName(estate_name); + LLPanelEstateInfo::updateEstateName(estate_name); + LLPanelRegionEnvironment::updateEstateName(estate_name); +} + void LLFloaterRegionInfo::disableTabCtrls() { LLTabContainer* tab = getChild("region_panels"); @@ -3813,6 +3832,15 @@ bool LLPanelRegionEnvironment::confirmUpdateEstateEnvironment(const LLSD& notifi return false; } +void LLPanelRegionEnvironment::updateEstateName(const std::string& name) +{ + LLPanelRegionEnvironment* panelp = LLFloaterRegionInfo::getPanelEnvironment(); + if (panelp) + { + panelp->getChildRef("estate_name").setText(name); + } +} + void LLPanelRegionEnvironment::onChkAllowOverride(bool value) { setDirtyFlag(DIRTY_FLAG_OVERRIDE); @@ -3824,7 +3852,10 @@ void LLPanelRegionEnvironment::onChkAllowOverride(bool value) if (LLPanelEstateInfo::isLindenEstate()) notification = "ChangeLindenEstate"; - LLNotification::Params params(notification); + LLSD args; + args["ESTATENAME"] = LLEstateInfoModel::instance().getName(); + LLNotification::Params params(notification); + params.substitutions(args); params.functor.function([this](const LLSD& notification, const LLSD& response) { confirmUpdateEstateEnvironment(notification, response); }); if (!value || LLPanelEstateInfo::isLindenEstate()) diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 0dda13cdc5..61aa0778ef 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -96,6 +96,7 @@ public: static LLPanelRegionTerrainInfo* getPanelRegionTerrain(); static LLPanelRegionExperiences* getPanelExperiences(); static LLPanelRegionGeneralInfo* getPanelGeneral(); + static LLPanelRegionEnvironment* getPanelEnvironment(); // from LLPanel virtual void refresh(); @@ -106,6 +107,8 @@ public: void enableTopButtons(); void disableTopButtons(); + static void updateEstateName(const std::string& estate_name); + private: LLFloaterRegionInfo(const LLSD& seed); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index a0935628d7..296289de09 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6714,9 +6714,8 @@ void process_covenant_reply(LLMessageSystem* msg, void**) msg->getString("Data", "EstateName", estate_name); msg->getUUID("Data", "EstateOwnerID", estate_owner_id); - LLPanelEstateCovenant::updateEstateName(estate_name); LLPanelLandCovenant::updateEstateName(estate_name); - LLPanelEstateInfo::updateEstateName(estate_name); + LLFloaterRegionInfo::updateEstateName(estate_name); LLFloaterBuyLand::updateEstateName(estate_name); std::string owner_name = diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 228c50bb6d..35c51dbc52 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -4896,7 +4896,7 @@ Unchecking this option may remove restrictions that parcel owners have added to icon="alertmodal.tga" name="EstateParcelEnvironmentOverride" type="alertmodal"> -Unchecking this option will remove any custom environments that parcel owners have added to their parcels. Please discuss with your parcel owners as needed. +(Estate-wide change: [ESTATENAME]) Unchecking this option will remove any custom environments that parcel owners have added to their parcels. Please discuss with your parcel owners as needed. Do you wish to proceed? confirm The parcel must be at least 128 square meters to support an environment. (empty) (region environment) + + Changes to settings on this tab will affect all regions in the estate. + + + Estate: + + + (unknown) + Date: Mon, 7 Oct 2019 12:41:00 +0300 Subject: SL-12024 Remove 'Estate warning' message and show just region name instead --- indra/newview/llfloaterland.cpp | 1 + indra/newview/llfloaterregioninfo.cpp | 23 ++----- indra/newview/llfloaterregioninfo.h | 2 - indra/newview/llpanelenvironment.cpp | 4 +- indra/newview/llpanelenvironment.h | 1 + indra/newview/llviewermessage.cpp | 3 +- .../default/xui/en/panel_region_environment.xml | 70 ++++++++++------------ 7 files changed, 42 insertions(+), 62 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 02c81adf2c..7b0c91da80 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -3329,6 +3329,7 @@ BOOL LLPanelLandEnvironment::postBuild() getChild(BTN_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEREGION)); getChild(CHK_ALLOWOVERRIDE)->setVisible(FALSE); + getChild(PNL_REGION_MSG)->setVisible(FALSE); getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(TRUE); return TRUE; diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 816ef68093..8bcc5bbe7a 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -200,8 +200,6 @@ public: virtual S32 getParcelId() override { return INVALID_PARCEL_ID; } - static void updateEstateName(const std::string& name); - protected: static const U32 DIRTY_FLAG_OVERRIDE; @@ -609,13 +607,6 @@ LLPanelRegionExperiences* LLFloaterRegionInfo::getPanelExperiences() return (LLPanelRegionExperiences*)tab->getChild("Experiences"); } -void LLFloaterRegionInfo::updateEstateName(const std::string& estate_name) -{ - LLPanelEstateCovenant::updateEstateName(estate_name); - LLPanelEstateInfo::updateEstateName(estate_name); - LLPanelRegionEnvironment::updateEstateName(estate_name); -} - void LLFloaterRegionInfo::disableTabCtrls() { LLTabContainer* tab = getChild("region_panels"); @@ -3773,6 +3764,11 @@ bool LLPanelRegionEnvironment::refreshFromRegion(LLViewerRegion* region) setNoSelection(true); setControlsEnabled(false); mCurEnvVersion = INVALID_PARCEL_ENVIRONMENT_VERSION; + getChild("region_text")->setValue(LLSD("")); + } + else + { + getChild("region_text")->setValue(LLSD(region->getName())); } setNoSelection(false); @@ -3832,15 +3828,6 @@ bool LLPanelRegionEnvironment::confirmUpdateEstateEnvironment(const LLSD& notifi return false; } -void LLPanelRegionEnvironment::updateEstateName(const std::string& name) -{ - LLPanelRegionEnvironment* panelp = LLFloaterRegionInfo::getPanelEnvironment(); - if (panelp) - { - panelp->getChildRef("estate_name").setText(name); - } -} - void LLPanelRegionEnvironment::onChkAllowOverride(bool value) { setDirtyFlag(DIRTY_FLAG_OVERRIDE); diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 61aa0778ef..75d0c3ea5c 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -107,8 +107,6 @@ public: void enableTopButtons(); void disableTopButtons(); - static void updateEstateName(const std::string& estate_name); - private: LLFloaterRegionInfo(const LLSD& seed); diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index c4fa4244b1..2ad7a23278 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -84,6 +84,7 @@ const std::string LLPanelEnvironmentInfo::PNL_ENVIRONMENT_ALTITUDES("pnl_environ const std::string LLPanelEnvironmentInfo::PNL_BUTTONS("pnl_environment_buttons"); const std::string LLPanelEnvironmentInfo::PNL_DISABLED("pnl_environment_disabled"); const std::string LLPanelEnvironmentInfo::TXT_DISABLED("txt_environment_disabled"); +const std::string LLPanelEnvironmentInfo::PNL_REGION_MSG("pnl_environment_region_msg"); const std::string LLPanelEnvironmentInfo::SDT_DROP_TARGET("sdt_drop_target"); const std::string LLPanelEnvironmentInfo::STR_LABEL_USEDEFAULT("str_label_use_default"); @@ -483,7 +484,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(PNL_BUTTONS)->setVisible(false); getChild(PNL_DISABLED)->setVisible(true); getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(false); - + getChild(PNL_REGION_MSG)->setVisible(false); updateEditFloater(mCurrentEnvironment, false); return false; @@ -491,6 +492,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(PNL_SETTINGS)->setVisible(true); getChild(PNL_BUTTONS)->setVisible(true); getChild(PNL_DISABLED)->setVisible(false); + getChild(PNL_REGION_MSG)->setVisible(isRegion()); getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(LLEnvironment::instance().isExtendedEnvironmentEnabled()); getChild(BTN_RST_ALTITUDES)->setVisible(isRegion()); diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h index 50ec1165be..38e3f09e34 100644 --- a/indra/newview/llpanelenvironment.h +++ b/indra/newview/llpanelenvironment.h @@ -80,6 +80,7 @@ protected: static const std::string PNL_ENVIRONMENT_ALTITUDES; static const std::string PNL_BUTTONS; static const std::string PNL_DISABLED; + static const std::string PNL_REGION_MSG; static const std::string TXT_DISABLED; static const std::string SDT_DROP_TARGET; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 296289de09..a0935628d7 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6714,8 +6714,9 @@ void process_covenant_reply(LLMessageSystem* msg, void**) msg->getString("Data", "EstateName", estate_name); msg->getUUID("Data", "EstateOwnerID", estate_owner_id); + LLPanelEstateCovenant::updateEstateName(estate_name); LLPanelLandCovenant::updateEstateName(estate_name); - LLFloaterRegionInfo::updateEstateName(estate_name); + LLPanelEstateInfo::updateEstateName(estate_name); LLFloaterBuyLand::updateEstateName(estate_name); std::string owner_name = diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml index bc0d59bcc7..edf1e1efd4 100644 --- a/indra/newview/skins/default/xui/en/panel_region_environment.xml +++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml @@ -19,53 +19,42 @@ The parcel must be at least 128 square meters to support an environment. (empty) (region environment) - - Changes to settings on this tab will affect all regions in the estate. - - - Estate: - - - (unknown) - + + + + Region: + + + unknown + + Date: Fri, 15 Nov 2019 15:13:11 +0000 Subject: SL-10499 - benefits. Removed no-longer-needed lleconomy files and classes. Group-related costs and limits via benefits. --- indra/llinventory/CMakeLists.txt | 2 - indra/llinventory/lleconomy.cpp | 287 --------------------- indra/llinventory/lleconomy.h | 157 ----------- indra/newview/llagent.cpp | 3 +- indra/newview/llagentbenefits.cpp | 16 +- indra/newview/llagentbenefits.h | 2 + indra/newview/llfloaterbvhpreview.cpp | 1 - indra/newview/llfloatergroups.cpp | 5 +- indra/newview/llfloatermodelpreview.cpp | 1 - indra/newview/llfloaternamedesc.cpp | 7 +- indra/newview/llgroupmgr.cpp | 1 - indra/newview/llmeshrepository.cpp | 1 - indra/newview/lloutfitgallery.cpp | 1 - indra/newview/llpanelcontents.cpp | 1 - indra/newview/llpanelgroupgeneral.cpp | 5 +- indra/newview/llpanelmaininventory.cpp | 6 - indra/newview/llpanelobject.cpp | 1 - indra/newview/llpanelpeople.cpp | 12 +- indra/newview/llpanelsnapshotinventory.cpp | 9 +- indra/newview/llpanelsnapshotoptions.cpp | 1 - indra/newview/llpanelvolume.cpp | 1 - indra/newview/llselectmgr.cpp | 1 - indra/newview/llsnapshotlivepreview.cpp | 4 +- indra/newview/llstartup.cpp | 8 - indra/newview/llstartup.h | 1 - indra/newview/llviewerassetupload.cpp | 1 - indra/newview/llviewermenu.cpp | 1 - indra/newview/llviewermenufile.cpp | 7 +- indra/newview/llviewermessage.cpp | 15 +- .../newview/skins/default/xui/en/notifications.xml | 4 +- 30 files changed, 47 insertions(+), 515 deletions(-) delete mode 100644 indra/llinventory/lleconomy.cpp delete mode 100644 indra/llinventory/lleconomy.h (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt index 68dd00d880..32a83a88d9 100644 --- a/indra/llinventory/CMakeLists.txt +++ b/indra/llinventory/CMakeLists.txt @@ -19,7 +19,6 @@ include_directories( set(llinventory_SOURCE_FILES llcategory.cpp - lleconomy.cpp llfoldertype.cpp llinventory.cpp llinventorydefines.cpp @@ -37,7 +36,6 @@ set(llinventory_HEADER_FILES CMakeLists.txt llcategory.h - lleconomy.h llfoldertype.h llinventory.h llinventorydefines.h diff --git a/indra/llinventory/lleconomy.cpp b/indra/llinventory/lleconomy.cpp deleted file mode 100644 index 2a023d8c24..0000000000 --- a/indra/llinventory/lleconomy.cpp +++ /dev/null @@ -1,287 +0,0 @@ -/** - * @file lleconomy.cpp - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, 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 "linden_common.h" - -#include "lleconomy.h" -#include "llerror.h" -#include "message.h" -#include "v3math.h" - - -LLBaseEconomy::LLBaseEconomy() -: mObjectCount( -1 ), - mObjectCapacity( -1 ), - mPriceObjectClaim( -1 ), - mPricePublicObjectDecay( -1 ), - mPricePublicObjectDelete( -1 ), - mPriceEnergyUnit( -1 ), - mPriceUpload( -1 ), - mPriceRentLight( -1 ), - mTeleportMinPrice( -1 ), - mTeleportPriceExponent( -1 ), - mPriceGroupCreate( -1 ) -{ } - -LLBaseEconomy::~LLBaseEconomy() -{ } - -void LLBaseEconomy::addObserver(LLEconomyObserver* observer) -{ - mObservers.push_back(observer); -} - -void LLBaseEconomy::removeObserver(LLEconomyObserver* observer) -{ - std::list::iterator it = - std::find(mObservers.begin(), mObservers.end(), observer); - if (it != mObservers.end()) - { - mObservers.erase(it); - } -} - -void LLBaseEconomy::notifyObservers() -{ - for (std::list::iterator it = mObservers.begin(); - it != mObservers.end(); - ++it) - { - (*it)->onEconomyDataChange(); - } -} - -// static -void LLBaseEconomy::processEconomyData(LLMessageSystem *msg, LLBaseEconomy* econ_data) -{ - S32 i; - F32 f; - - msg->getS32Fast(_PREHASH_Info, _PREHASH_ObjectCapacity, i); - econ_data->setObjectCapacity(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_ObjectCount, i); - econ_data->setObjectCount(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceEnergyUnit, i); - econ_data->setPriceEnergyUnit(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceObjectClaim, i); - econ_data->setPriceObjectClaim(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PricePublicObjectDecay, i); - econ_data->setPricePublicObjectDecay(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PricePublicObjectDelete, i); - econ_data->setPricePublicObjectDelete(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceUpload, i); - econ_data->setPriceUpload(i); -#if LL_LINUX - // We can optionally fake the received upload price for testing. - // Note that the server is within its rights to not obey our fake - // price. :) - const char* fakeprice_str = getenv("LL_FAKE_UPLOAD_PRICE"); - if (fakeprice_str) - { - S32 fakeprice = (S32)atoi(fakeprice_str); - LL_WARNS() << "LL_FAKE_UPLOAD_PRICE: Faking upload price as L$" << fakeprice << LL_ENDL; - econ_data->setPriceUpload(fakeprice); - } -#endif - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceRentLight, i); - econ_data->setPriceRentLight(i); - msg->getS32Fast(_PREHASH_Info, _PREHASH_TeleportMinPrice, i); - econ_data->setTeleportMinPrice(i); - msg->getF32Fast(_PREHASH_Info, _PREHASH_TeleportPriceExponent, f); - econ_data->setTeleportPriceExponent(f); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceGroupCreate, i); - econ_data->setPriceGroupCreate(i); - - econ_data->notifyObservers(); -} - -S32 LLBaseEconomy::calculateTeleportCost(F32 distance) const -{ - S32 min_cost = getTeleportMinPrice(); - F32 exponent = getTeleportPriceExponent(); - F32 divisor = 100.f * pow(3.f, exponent); - S32 cost = (U32)(distance * pow(log10(distance), exponent) / divisor); - if (cost < 0) - { - cost = 0; - } - else if (cost < min_cost) - { - cost = min_cost; - } - - return cost; -} - -S32 LLBaseEconomy::calculateLightRent(const LLVector3& object_size) const -{ - F32 intensity_mod = llmax(object_size.magVec(), 1.f); - return (S32)(intensity_mod * getPriceRentLight()); -} - -void LLBaseEconomy::print() -{ - LL_INFOS() << "Global Economy Settings: " << LL_ENDL; - LL_INFOS() << "Object Capacity: " << mObjectCapacity << LL_ENDL; - LL_INFOS() << "Object Count: " << mObjectCount << LL_ENDL; - LL_INFOS() << "Claim Price Per Object: " << mPriceObjectClaim << LL_ENDL; - LL_INFOS() << "Claim Price Per Public Object: " << mPricePublicObjectDecay << LL_ENDL; - LL_INFOS() << "Delete Price Per Public Object: " << mPricePublicObjectDelete << LL_ENDL; - LL_INFOS() << "Release Price Per Public Object: " << getPricePublicObjectRelease() << LL_ENDL; - LL_INFOS() << "Price Per Energy Unit: " << mPriceEnergyUnit << LL_ENDL; - LL_INFOS() << "Price Per Upload: " << mPriceUpload << LL_ENDL; - LL_INFOS() << "Light Base Price: " << mPriceRentLight << LL_ENDL; - LL_INFOS() << "Teleport Min Price: " << mTeleportMinPrice << LL_ENDL; - LL_INFOS() << "Teleport Price Exponent: " << mTeleportPriceExponent << LL_ENDL; - LL_INFOS() << "Price for group creation: " << mPriceGroupCreate << LL_ENDL; -} - -LLRegionEconomy::LLRegionEconomy() -: mPriceObjectRent( -1.f ), - mPriceObjectScaleFactor( -1.f ), - mEnergyEfficiency( -1.f ), - mBasePriceParcelClaimDefault(-1), - mBasePriceParcelClaimActual(-1), - mPriceParcelClaimFactor(-1.f), - mBasePriceParcelRent(-1), - mAreaOwned(-1.f), - mAreaTotal(-1.f) -{ } - -LLRegionEconomy::~LLRegionEconomy() -{ } - -BOOL LLRegionEconomy::hasData() const -{ - return (mBasePriceParcelRent != -1); -} - -// static -void LLRegionEconomy::processEconomyData(LLMessageSystem *msg, void** user_data) -{ - S32 i; - F32 f; - - LLRegionEconomy *this_ptr = (LLRegionEconomy*)user_data; - - LLBaseEconomy::processEconomyData(msg, this_ptr); - - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceParcelClaim, i); - this_ptr->setBasePriceParcelClaimDefault(i); - msg->getF32(_PREHASH_Info, _PREHASH_PriceParcelClaimFactor, f); - this_ptr->setPriceParcelClaimFactor(f); - msg->getF32Fast(_PREHASH_Info, _PREHASH_EnergyEfficiency, f); - this_ptr->setEnergyEfficiency(f); - msg->getF32Fast(_PREHASH_Info, _PREHASH_PriceObjectRent, f); - this_ptr->setPriceObjectRent(f); - msg->getF32Fast(_PREHASH_Info, _PREHASH_PriceObjectScaleFactor, f); - this_ptr->setPriceObjectScaleFactor(f); - msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceParcelRent, i); - this_ptr->setBasePriceParcelRent(i); -} - -// static -void LLRegionEconomy::processEconomyDataRequest(LLMessageSystem *msg, void **user_data) -{ - LLRegionEconomy *this_ptr = (LLRegionEconomy*)user_data; - if (!this_ptr->hasData()) - { - LL_WARNS() << "Dropping EconomyDataRequest, because EconomyData message " - << "has not been processed" << LL_ENDL; - } - - msg->newMessageFast(_PREHASH_EconomyData); - msg->nextBlockFast(_PREHASH_Info); - msg->addS32Fast(_PREHASH_ObjectCapacity, this_ptr->getObjectCapacity()); - msg->addS32Fast(_PREHASH_ObjectCount, this_ptr->getObjectCount()); - msg->addS32Fast(_PREHASH_PriceEnergyUnit, this_ptr->getPriceEnergyUnit()); - msg->addS32Fast(_PREHASH_PriceObjectClaim, this_ptr->getPriceObjectClaim()); - msg->addS32Fast(_PREHASH_PricePublicObjectDecay, this_ptr->getPricePublicObjectDecay()); - msg->addS32Fast(_PREHASH_PricePublicObjectDelete, this_ptr->getPricePublicObjectDelete()); - msg->addS32Fast(_PREHASH_PriceParcelClaim, this_ptr->mBasePriceParcelClaimActual); - msg->addF32Fast(_PREHASH_PriceParcelClaimFactor, this_ptr->mPriceParcelClaimFactor); - msg->addS32Fast(_PREHASH_PriceUpload, this_ptr->getPriceUpload()); - msg->addS32Fast(_PREHASH_PriceRentLight, this_ptr->getPriceRentLight()); - msg->addS32Fast(_PREHASH_TeleportMinPrice, this_ptr->getTeleportMinPrice()); - msg->addF32Fast(_PREHASH_TeleportPriceExponent, this_ptr->getTeleportPriceExponent()); - - msg->addF32Fast(_PREHASH_EnergyEfficiency, this_ptr->getEnergyEfficiency()); - msg->addF32Fast(_PREHASH_PriceObjectRent, this_ptr->getPriceObjectRent()); - msg->addF32Fast(_PREHASH_PriceObjectScaleFactor, this_ptr->getPriceObjectScaleFactor()); - msg->addS32Fast(_PREHASH_PriceParcelRent, this_ptr->getPriceParcelRent()); - msg->addS32Fast(_PREHASH_PriceGroupCreate, this_ptr->getPriceGroupCreate()); - - msg->sendReliable(msg->getSender()); -} - - -S32 LLRegionEconomy::getPriceParcelClaim() const -{ - //return (S32)((F32)mBasePriceParcelClaim * (mAreaTotal / (mAreaTotal - mAreaOwned))); - return (S32)((F32)mBasePriceParcelClaimActual * mPriceParcelClaimFactor); -} - -S32 LLRegionEconomy::getPriceParcelRent() const -{ - return mBasePriceParcelRent; -} - - -void LLRegionEconomy::print() -{ - this->LLBaseEconomy::print(); - - LL_INFOS() << "Region Economy Settings: " << LL_ENDL; - LL_INFOS() << "Land (square meters): " << mAreaTotal << LL_ENDL; - LL_INFOS() << "Owned Land (square meters): " << mAreaOwned << LL_ENDL; - LL_INFOS() << "Daily Object Rent: " << mPriceObjectRent << LL_ENDL; - LL_INFOS() << "Daily Land Rent (per meter): " << getPriceParcelRent() << LL_ENDL; - LL_INFOS() << "Energey Efficiency: " << mEnergyEfficiency << LL_ENDL; -} - - -void LLRegionEconomy::setBasePriceParcelClaimDefault(S32 val) -{ - mBasePriceParcelClaimDefault = val; - if(mBasePriceParcelClaimActual == -1) - { - mBasePriceParcelClaimActual = val; - } -} - -void LLRegionEconomy::setBasePriceParcelClaimActual(S32 val) -{ - mBasePriceParcelClaimActual = val; -} - -void LLRegionEconomy::setPriceParcelClaimFactor(F32 val) -{ - mPriceParcelClaimFactor = val; -} - -void LLRegionEconomy::setBasePriceParcelRent(S32 val) -{ - mBasePriceParcelRent = val; -} diff --git a/indra/llinventory/lleconomy.h b/indra/llinventory/lleconomy.h deleted file mode 100644 index cdfde171c1..0000000000 --- a/indra/llinventory/lleconomy.h +++ /dev/null @@ -1,157 +0,0 @@ -/** - * @file lleconomy.h - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, 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$ - */ - -#ifndef LL_LLECONOMY_H -#define LL_LLECONOMY_H - -#include "llsingleton.h" -#include - -class LLMessageSystem; -class LLVector3; - -/** - * Register an observer to be notified of economy data updates coming from server. - */ -class LLEconomyObserver -{ -public: - virtual ~LLEconomyObserver() {} - virtual void onEconomyDataChange() = 0; -}; - -class LLBaseEconomy -{ -public: - LLBaseEconomy(); - virtual ~LLBaseEconomy(); - - virtual void print(); - - void addObserver(LLEconomyObserver* observer); - void removeObserver(LLEconomyObserver* observer); - void notifyObservers(); - - static void processEconomyData(LLMessageSystem *msg, LLBaseEconomy* econ_data); - - S32 calculateTeleportCost(F32 distance) const; - S32 calculateLightRent(const LLVector3& object_size) const; - - S32 getObjectCount() const { return mObjectCount; } - S32 getObjectCapacity() const { return mObjectCapacity; } - S32 getPriceObjectClaim() const { return mPriceObjectClaim; } - S32 getPricePublicObjectDecay() const { return mPricePublicObjectDecay; } - S32 getPricePublicObjectDelete() const { return mPricePublicObjectDelete; } - S32 getPricePublicObjectRelease() const { return mPriceObjectClaim - mPricePublicObjectDelete; } - S32 getPriceEnergyUnit() const { return mPriceEnergyUnit; } - S32 getPriceUpload() const { return mPriceUpload; } - S32 getPriceRentLight() const { return mPriceRentLight; } - S32 getTeleportMinPrice() const { return mTeleportMinPrice; } - F32 getTeleportPriceExponent() const { return mTeleportPriceExponent; } - S32 getPriceGroupCreate() const { return mPriceGroupCreate; } - - - void setObjectCount(S32 val) { mObjectCount = val; } - void setObjectCapacity(S32 val) { mObjectCapacity = val; } - void setPriceObjectClaim(S32 val) { mPriceObjectClaim = val; } - void setPricePublicObjectDecay(S32 val) { mPricePublicObjectDecay = val; } - void setPricePublicObjectDelete(S32 val) { mPricePublicObjectDelete = val; } - void setPriceEnergyUnit(S32 val) { mPriceEnergyUnit = val; } - void setPriceUpload(S32 val) { mPriceUpload = val; } - void setPriceRentLight(S32 val) { mPriceRentLight = val; } - void setTeleportMinPrice(S32 val) { mTeleportMinPrice = val; } - void setTeleportPriceExponent(F32 val) { mTeleportPriceExponent = val; } - void setPriceGroupCreate(S32 val) { mPriceGroupCreate = val; } - -private: - S32 mObjectCount; - S32 mObjectCapacity; - S32 mPriceObjectClaim; // per primitive - S32 mPricePublicObjectDecay; // per primitive - S32 mPricePublicObjectDelete; // per primitive - S32 mPriceEnergyUnit; - S32 mPriceUpload; - S32 mPriceRentLight; - S32 mTeleportMinPrice; - F32 mTeleportPriceExponent; - S32 mPriceGroupCreate; - - std::list mObservers; -}; - -class LLGlobalEconomy: public LLSingleton, public LLBaseEconomy -{ - LLSINGLETON_EMPTY_CTOR(LLGlobalEconomy); -}; - -class LLRegionEconomy : public LLBaseEconomy -{ -public: - LLRegionEconomy(); - ~LLRegionEconomy(); - - static void processEconomyData(LLMessageSystem *msg, void **user_data); - static void processEconomyDataRequest(LLMessageSystem *msg, void **user_data); - - void print(); - - BOOL hasData() const; - F32 getPriceObjectRent() const { return mPriceObjectRent; } - F32 getPriceObjectScaleFactor() const {return mPriceObjectScaleFactor;} - F32 getEnergyEfficiency() const { return mEnergyEfficiency; } - S32 getPriceParcelClaim() const; - S32 getPriceParcelRent() const; - F32 getAreaOwned() const { return mAreaOwned; } - F32 getAreaTotal() const { return mAreaTotal; } - S32 getBasePriceParcelClaimActual() const { return mBasePriceParcelClaimActual; } - - void setPriceObjectRent(F32 val) { mPriceObjectRent = val; } - void setPriceObjectScaleFactor(F32 val) { mPriceObjectScaleFactor = val; } - void setEnergyEfficiency(F32 val) { mEnergyEfficiency = val; } - - void setBasePriceParcelClaimDefault(S32 val); - void setBasePriceParcelClaimActual(S32 val); - void setPriceParcelClaimFactor(F32 val); - void setBasePriceParcelRent(S32 val); - - void setAreaOwned(F32 val) { mAreaOwned = val; } - void setAreaTotal(F32 val) { mAreaTotal = val; } - -private: - F32 mPriceObjectRent; - F32 mPriceObjectScaleFactor; - F32 mEnergyEfficiency; - - S32 mBasePriceParcelClaimDefault; - S32 mBasePriceParcelClaimActual; - F32 mPriceParcelClaimFactor; - S32 mBasePriceParcelRent; - - F32 mAreaOwned; - F32 mAreaTotal; - -}; - -#endif diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 31b8b90518..1b622de847 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -32,6 +32,7 @@ #include "pipeline.h" #include "llagentaccess.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llagentlistener.h" #include "llagentwearables.h" @@ -2984,7 +2985,7 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO BOOL LLAgent::canJoinGroups() const { - return (S32)mGroups.size() < gMaxAgentGroups; + return (S32)mGroups.size() < LLAgentBenefits::instance().getGroupMembershipLimit(); } LLQuaternion LLAgent::getHeadRotation() diff --git a/indra/newview/llagentbenefits.cpp b/indra/newview/llagentbenefits.cpp index 09be8f46c1..5ca4ecb456 100644 --- a/indra/newview/llagentbenefits.cpp +++ b/indra/newview/llagentbenefits.cpp @@ -73,6 +73,10 @@ bool LLAgentBenefits::init(const LLSD& benefits_sd) { return false; } + if (!get_required_S32(benefits_sd, "create_group_cost", m_create_group_cost)) + { + return false; + } if (!get_required_S32(benefits_sd, "group_membership_limit", m_group_membership_limit)) { return false; @@ -86,42 +90,42 @@ bool LLAgentBenefits::init(const LLSD& benefits_sd) return false; } + // FIXME PREMIUM - either use this field or get rid of it m_initalized = true; return true; } S32 LLAgentBenefits::getAnimatedObjectLimit() const { - //llassert(m_initalized); return m_animated_object_limit; } S32 LLAgentBenefits::getAnimationUploadCost() const { - //llassert(m_initalized); return m_animation_upload_cost; } S32 LLAgentBenefits::getAttachmentLimit() const { - //llassert(m_initalized); return m_attachment_limit; } +S32 LLAgentBenefits::getCreateGroupCost() const +{ + return m_create_group_cost; +} + S32 LLAgentBenefits::getGroupMembershipLimit() const { - //llassert(m_initalized); return m_group_membership_limit; } S32 LLAgentBenefits::getSoundUploadCost() const { - //llassert(m_initalized); return m_sound_upload_cost; } S32 LLAgentBenefits::getTextureUploadCost() const { - //llassert(m_initalized); return m_texture_upload_cost; } diff --git a/indra/newview/llagentbenefits.h b/indra/newview/llagentbenefits.h index 995833149c..b21048e38b 100644 --- a/indra/newview/llagentbenefits.h +++ b/indra/newview/llagentbenefits.h @@ -41,6 +41,7 @@ public: S32 getAnimatedObjectLimit() const; S32 getAnimationUploadCost() const; S32 getAttachmentLimit() const; + S32 getCreateGroupCost() const; S32 getGroupMembershipLimit() const; S32 getSoundUploadCost() const; S32 getTextureUploadCost() const; @@ -49,6 +50,7 @@ private: S32 m_animated_object_limit; S32 m_animation_upload_cost; S32 m_attachment_limit; + S32 m_create_group_cost; S32 m_group_membership_limit; S32 m_sound_upload_cost; S32 m_texture_upload_cost; diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index 91a6e63665..6d7d3c8556 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -31,7 +31,6 @@ #include "llbvhloader.h" #include "lldatapacker.h" #include "lldir.h" -#include "lleconomy.h" #include "llnotificationsutil.h" #include "llvfile.h" #include "llapr.h" diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index dbe7fee108..a32b01679a 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -38,6 +38,7 @@ #include "roles_constants.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llbutton.h" #include "llgroupactions.h" #include "llscrolllistctrl.h" @@ -172,7 +173,7 @@ void LLPanelGroups::reset() group_list->operateOnAll(LLCtrlListInterface::OP_DELETE); } getChild("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size())); - getChild("groupcount")->setTextArg("[MAX]", llformat("%d",gMaxAgentGroups)); + getChild("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefits::instance().getGroupMembershipLimit())); init_group_list(getChild("group list"), gAgent.getGroupID()); enableButtons(); @@ -183,7 +184,7 @@ BOOL LLPanelGroups::postBuild() childSetCommitCallback("group list", onGroupList, this); getChild("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size())); - getChild("groupcount")->setTextArg("[MAX]", llformat("%d",gMaxAgentGroups)); + getChild("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefits::instance().getGroupMembershipLimit())); LLScrollListCtrl *list = getChild("group list"); if (list) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index b6efc1590e..dfed11f1b0 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -44,7 +44,6 @@ #include "lldrawable.h" #include "llrender.h" #include "llface.h" -#include "lleconomy.h" #include "llfocusmgr.h" #include "llfloaterperms.h" #include "lliconctrl.h" diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index 33dfae8be8..fa1ed57d1f 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -46,12 +46,12 @@ #include "llnotificationsutil.h" #include "lluictrlfactory.h" #include "llstring.h" -#include "lleconomy.h" #include "llpermissions.h" // linden includes #include "llassetstorage.h" #include "llinventorytype.h" +#include "llagentbenefits.h" const S32 PREVIEW_LINE_HEIGHT = 19; const S32 PREVIEW_BORDER_WIDTH = 2; @@ -123,7 +123,8 @@ BOOL LLFloaterNameDesc::postBuild() // Cancel button getChild("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnCancel, this)); - getChild("ok_btn")->setLabelArg("[AMOUNT]", llformat("%d", LLGlobalEconomy::getInstance()->getPriceUpload() )); + // FIXME PREMIUM - depends - what are we uploading here? + getChild("ok_btn")->setLabelArg("[AMOUNT]", llformat("%d", LLAgentBenefits::instance().getTextureUploadCost())); setDefaultBtn("ok_btn"); @@ -163,7 +164,7 @@ void LLFloaterNameDesc::onBtnOK( ) // FIXME PREMIUM - upload cost. Need to know which asset type this is, use agent benefits. LLAssetStorage::LLStoreAssetCallback callback = NULL; - S32 expected_upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). + S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). if (can_afford_transaction(expected_upload_cost)) { diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 088d052533..e384019a43 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -44,7 +44,6 @@ #include "roles_constants.h" #include "lltransactiontypes.h" #include "llstatusbar.h" -#include "lleconomy.h" #include "llviewerwindow.h" #include "llpanelgroup.h" #include "llgroupactions.h" diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 31e3d408d7..be05ba9207 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -41,7 +41,6 @@ #include "lldeadmantimer.h" #include "llfloatermodelpreview.h" #include "llfloaterperms.h" -#include "lleconomy.h" #include "llimagej2c.h" #include "llhost.h" #include "llmath.h" diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 8f5626bd7a..35b83880d9 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -37,7 +37,6 @@ #include "llaccordionctrltab.h" #include "llappearancemgr.h" #include "llagentbenefits.h" -#include "lleconomy.h" #include "llerror.h" #include "llfilepicker.h" #include "llfloaterperms.h" diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index 451f41cd3b..3bae0cebfb 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -30,7 +30,6 @@ #include "llpanelcontents.h" // linden library includes -#include "lleconomy.h" #include "llerror.h" #include "llfloaterreg.h" #include "llfontgl.h" diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index b53cd222e7..2d0a09b469 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -30,6 +30,7 @@ #include "llavatarnamecache.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llsdparam.h" #include "lluictrlfactory.h" #include "roles_constants.h" @@ -339,7 +340,9 @@ bool LLPanelGroupGeneral::apply(std::string& mesg) return false; } - LLNotificationsUtil::add("CreateGroupCost", LLSD(), LLSD(), boost::bind(&LLPanelGroupGeneral::createGroupCallback, this, _1, _2)); + LLSD args; + args["COST"] = LLAgentBenefits::instance().getCreateGroupCost(); + LLNotificationsUtil::add("CreateGroupCost", args, LLSD(), boost::bind(&LLPanelGroupGeneral::createGroupCallback, this, _1, _2)); return false; } diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 7404798589..b81dce4e31 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -34,7 +34,6 @@ #include "llcheckboxctrl.h" #include "llcombobox.h" #include "lldndbutton.h" -#include "lleconomy.h" #include "llfilepicker.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" @@ -1510,11 +1509,6 @@ bool LLPanelMainInventory::handleDragAndDropToTrash(BOOL drop, EDragAndDropType void LLPanelMainInventory::setUploadCostIfNeeded() { - // *NOTE dzaporozhan - // Upload cost is set in process_economy_data() (llviewermessage.cpp). But since we - // have two instances of Inventory panel at the moment(and two instances of context menu), - // call to gMenuHolder->childSetLabelArg() sets upload cost only for one of the instances. - LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get(); if(mNeedUploadCost && menu) { diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 3665910c63..6bff95ab36 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -30,7 +30,6 @@ #include "llpanelobject.h" // linden library includes -#include "lleconomy.h" #include "llerror.h" #include "llfontgl.h" #include "llpermissionsflags.h" diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index d138433ed8..0a41018293 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -47,6 +47,7 @@ #include "llaccordionctrl.h" #include "llaccordionctrltab.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llavataractions.h" #include "llavatarlist.h" #include "llavatarlistitem.h" @@ -85,11 +86,10 @@ static const std::string RECENT_TAB_NAME = "recent_panel"; static const std::string BLOCKED_TAB_NAME = "blocked_panel"; // blocked avatars static const std::string COLLAPSED_BY_USER = "collapsed_by_user"; +// FIXME PREMIUM - these should come from package info, once viewer is receiving it all. const S32 BASE_MAX_AGENT_GROUPS = 42; const S32 PREMIUM_MAX_AGENT_GROUPS = 60; -extern S32 gMaxAgentGroups; - /** Comparator for comparing avatar items by last interaction date */ class LLAvatarItemRecentComparator : public LLAvatarItemComparator { @@ -629,7 +629,7 @@ BOOL LLPanelPeople::postBuild() getChild("groups_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); getChild("recent_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); - if(gMaxAgentGroups < max_premium) + if(LLAgentBenefits::instance().getGroupMembershipLimit() < max_premium) { getChild("groupcount")->setText(getString("GroupCountWithInfo")); getChild("groupcount")->setURLClickedCallback(boost::bind(&LLPanelPeople::onGroupLimitInfo, this)); @@ -877,9 +877,10 @@ void LLPanelPeople::updateButtons() groups_panel->getChildView("minus_btn")->setEnabled(item_selected && selected_id.notNull()); // a real group selected U32 groups_count = gAgent.mGroups.size(); - U32 groups_ramaining = gMaxAgentGroups > groups_count ? gMaxAgentGroups - groups_count : 0; + S32 max_groups = LLAgentBenefits::instance().getGroupMembershipLimit(); + U32 groups_remaining = max_groups > groups_count ? max_groups - groups_count : 0; groups_panel->getChild("groupcount")->setTextArg("[COUNT]", llformat("%d", groups_count)); - groups_panel->getChild("groupcount")->setTextArg("[REMAINING]", llformat("%d", groups_ramaining)); + groups_panel->getChild("groupcount")->setTextArg("[REMAINING]", llformat("%d", groups_remaining)); } else { @@ -1092,6 +1093,7 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string) } } +// FIXME PREMIUM this should be coming from LLAgentBenefits info about the various packages. void LLPanelPeople::onGroupLimitInfo() { LLSD args; diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp index 21ac7604ff..202f42c53a 100644 --- a/indra/newview/llpanelsnapshotinventory.cpp +++ b/indra/newview/llpanelsnapshotinventory.cpp @@ -27,7 +27,6 @@ #include "llviewerprecompiledheaders.h" #include "llcombobox.h" -#include "lleconomy.h" #include "llsidetraypanelcontainer.h" #include "llspinctrl.h" @@ -38,6 +37,8 @@ #include "llstatusbar.h" // can_afford_transaction() #include "llnotificationsutil.h" +#include "llagentbenefits.h" + /** * The panel provides UI for saving snapshot as an inventory texture. */ @@ -135,7 +136,7 @@ BOOL LLPanelSnapshotInventory::postBuild() // virtual void LLPanelSnapshotInventory::onOpen(const LLSD& key) { - getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLGlobalEconomy::getInstance()->getPriceUpload())); + getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLAgentBenefits::instance().getTextureUploadCost())); LLPanelSnapshot::onOpen(key); } @@ -155,7 +156,7 @@ void LLPanelSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl) void LLPanelSnapshotInventoryBase::onSend() { - S32 expected_upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); + S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); if (can_afford_transaction(expected_upload_cost)) { if (mSnapshotFloater) @@ -191,7 +192,7 @@ BOOL LLPanelOutfitSnapshotInventory::postBuild() // virtual void LLPanelOutfitSnapshotInventory::onOpen(const LLSD& key) { - getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLGlobalEconomy::getInstance()->getPriceUpload())); + getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLAgentBenefits::instance().getTextureUploadCost())); LLPanelSnapshot::onOpen(key); } diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index 63206e2780..7932db8727 100644 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -26,7 +26,6 @@ #include "llviewerprecompiledheaders.h" -#include "lleconomy.h" #include "llpanel.h" #include "llsidetraypanelcontainer.h" diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 735eaa423d..de2fa74803 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -31,7 +31,6 @@ // linden library includes #include "llclickaction.h" -#include "lleconomy.h" #include "llerror.h" #include "llfontgl.h" #include "llflexibleobject.h" diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 90f8f84ea4..00ff91634d 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -35,7 +35,6 @@ #include "llcachename.h" #include "llavatarnamecache.h" #include "lldbstrings.h" -#include "lleconomy.h" #include "llgl.h" #include "llmediaentry.h" #include "llrender.h" diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index f5fea9dece..430abba543 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -28,10 +28,10 @@ #include "llviewerprecompiledheaders.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llagentui.h" #include "llcombobox.h" -#include "lleconomy.h" #include "llfloaterperms.h" #include "llfloaterreg.h" #include "llfloaterflickr.h" @@ -1039,7 +1039,7 @@ void LLSnapshotLivePreview::saveTexture(BOOL outfit_snapshot, std::string name) LLAgentUI::buildLocationString(pos_string, LLAgentUI::LOCATION_FORMAT_FULL); std::string who_took_it; LLAgentUI::buildFullname(who_took_it); - S32 expected_upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); + S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); std::string res_name = outfit_snapshot ? name : "Snapshot : " + pos_string; std::string res_desc = outfit_snapshot ? "" : "Taken by " + who_took_it + " at " + pos_string; LLFolderType::EType folder_type = outfit_snapshot ? LLFolderType::FT_NONE : LLFolderType::FT_SNAPSHOT_CATEGORY; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 979fe63432..2f9bc786ca 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -209,7 +209,6 @@ // exported globals // bool gAgentMovementCompleted = false; -S32 gMaxAgentGroups; const std::string SCREEN_HOME_FILENAME = "screen_home%s.png"; const std::string SCREEN_LAST_FILENAME = "screen_last%s.png"; @@ -246,7 +245,6 @@ static LLVector3 gAgentStartLookAt(1.0f, 0.f, 0.f); static std::string gAgentStartLocation = "safe"; static bool mLoginStatePastUI = false; -const S32 DEFAULT_MAX_AGENT_GROUPS = 42; const F32 STATE_AGENT_WAIT_TIMEOUT = 240; //seconds boost::scoped_ptr LLStartUp::sStateWatcher(new LLEventStream("StartupState")); @@ -1574,8 +1572,6 @@ bool idle_startup() send_complete_agent_movement(regionp->getHost()); gAssetStorage->setUpstream(regionp->getHost()); gCacheName->setUpstream(regionp->getHost()); - msg->newMessageFast(_PREHASH_EconomyDataRequest); - gAgent.sendReliableMessage(); } display_startup(); @@ -3606,10 +3602,6 @@ bool process_login_success_response() LLViewerMedia::getInstance()->openIDSetup(openid_url, openid_token); } - gMaxAgentGroups = LLAgentBenefits::instance().getGroupMembershipLimit(); - LL_INFOS("LLStartup") << "gMaxAgentGroups set from agent benefits: " - << gMaxAgentGroups << LL_ENDL; - bool success = false; // JC: gesture loading done below, when we have an asset system // in place. Don't delete/clear gUserCredentials until then. diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h index db37207022..e9d0498fcb 100644 --- a/indra/newview/llstartup.h +++ b/indra/newview/llstartup.h @@ -80,7 +80,6 @@ typedef enum { // exported symbols extern bool gAgentMovementCompleted; -extern S32 gMaxAgentGroups; extern LLPointer gStartTexture; class LLStartUp diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index a919362321..2a79eee80e 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -36,7 +36,6 @@ #include "lluploaddialog.h" #include "llpreviewscript.h" #include "llnotificationsutil.h" -#include "lleconomy.h" #include "llagent.h" #include "llfloaterreg.h" #include "llfloatersnapshot.h" diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 0fda4d3df8..ef3c1f4c14 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -128,7 +128,6 @@ #include "lluilistener.h" #include "llappearancemgr.h" #include "lltrans.h" -#include "lleconomy.h" #include "lltoolgrab.h" #include "llwindow.h" #include "llpathfindingmanager.h" diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index a9a91b158b..b1606958e1 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -30,6 +30,7 @@ // project includes #include "llagent.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llfilepicker.h" #include "llfloaterreg.h" @@ -67,7 +68,6 @@ #include "llviewerassetupload.h" // linden libraries -#include "lleconomy.h" #include "llnotificationsutil.h" #include "llsdserialize.h" #include "llsdutil.h" @@ -85,8 +85,6 @@ class LLFileEnableUpload : public view_listener_t bool handleEvent(const LLSD& userdata) { return true; -// bool new_value = gStatusBar && LLGlobalEconomy::getInstance() && (gStatusBar->getBalance() >= LLGlobalEconomy::getInstance()->getPriceUpload()); -// return new_value; } }; @@ -417,7 +415,8 @@ const void upload_bulk(const std::vector& filenames, LLFilePicker:: // // Also fix single upload to charge first, then refund - S32 expected_upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); + // FIXME PREMIUM - upload_cost should be per-file, depends on asset type + S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); for (std::vector::const_iterator in_iter = filenames.begin(); in_iter != filenames.end(); ++in_iter) { std::string filename = (*in_iter); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index b0ad81614a..2cde93f471 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -32,7 +32,6 @@ #include "llaudioengine.h" #include "llavataractions.h" #include "llavatarnamecache.h" // IDEVO HACK -#include "lleconomy.h" #include "lleventtimer.h" #include "llfloaterreg.h" #include "llfolderview.h" @@ -51,6 +50,7 @@ #include "mean_collision_data.h" #include "llagent.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llcallingcard.h" #include "llbuycurrencyhtml.h" @@ -903,7 +903,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response) if(option == 0 && !group_id.isNull()) { // check for promotion or demotion. - S32 max_groups = gMaxAgentGroups; + S32 max_groups = LLAgentBenefits::instance().getGroupMembershipLimit(); if(gAgent.isInGroup(group_id)) ++max_groups; if(gAgent.mGroups.size() < max_groups) @@ -5435,16 +5435,7 @@ void process_frozen_message(LLMessageSystem *msgsystem, void **user_data) // do some extra stuff once we get our economy data void process_economy_data(LLMessageSystem *msg, void** /*user_data*/) { - LLGlobalEconomy::processEconomyData(msg, LLGlobalEconomy::getInstance()); - - S32 upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); - - LL_INFOS_ONCE("Messaging") << "EconomyData message arrived; upload cost is L$" << upload_cost << LL_ENDL; - - gMenuHolder->getChild("Upload Image")->setLabelArg("[COST]", llformat("%d", upload_cost)); - gMenuHolder->getChild("Upload Sound")->setLabelArg("[COST]", llformat("%d", upload_cost)); - gMenuHolder->getChild("Upload Animation")->setLabelArg("[COST]", llformat("%d", upload_cost)); - gMenuHolder->getChild("Bulk Upload")->setLabelArg("[COST]", llformat("%d", upload_cost)); + LL_DEBUGS("Benefits") << "Received economy data, not currently used" << LL_ENDL; } void notify_cautioned_script_question(const LLSD& notification, const LLSD& response, S32 orig_questions, BOOL granted) diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index f72767cceb..e0fc6bb9a5 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -920,7 +920,7 @@ You do not have enough L$ to join this group. icon="alertmodal.tga" name="CreateGroupCost" type="alertmodal"> -Creating this group will cost L$100. +Creating this group will cost L$[COST]. Groups need more than one member, or they are deleted forever. Please invite members within 48 hours. group @@ -929,7 +929,7 @@ Please invite members within 48 hours. canceltext="Cancel" name="okcancelbuttons" notext="Cancel" - yestext="Create group for L$100"/> + yestext="Create group for L$[COST]"/> Date: Wed, 20 Nov 2019 14:03:57 +0000 Subject: SL-10499 - handle package info from benefits service --- indra/newview/llagent.cpp | 2 +- indra/newview/llagentbenefits.cpp | 69 +++++++++++++++++++++- indra/newview/llagentbenefits.h | 28 +++++++-- indra/newview/llfloaterbvhpreview.cpp | 2 +- indra/newview/llfloatergroups.cpp | 4 +- indra/newview/llfloaternamedesc.cpp | 2 +- indra/newview/lloutfitgallery.cpp | 2 +- indra/newview/llpanelgroupgeneral.cpp | 2 +- indra/newview/llpanelmaininventory.cpp | 12 ++-- indra/newview/llpanelpeople.cpp | 39 ++---------- indra/newview/llpanelsnapshotinventory.cpp | 6 +- indra/newview/llpanelsnapshotoptions.cpp | 2 +- indra/newview/llsnapshotlivepreview.cpp | 2 +- indra/newview/llstartup.cpp | 59 +++++++++++++++++- indra/newview/llviewermenu.cpp | 12 ++-- indra/newview/llviewermenufile.cpp | 4 +- indra/newview/llviewermessage.cpp | 2 +- indra/newview/llvoavatar.cpp | 4 +- .../newview/skins/default/xui/en/notifications.xml | 12 +++- 19 files changed, 194 insertions(+), 71 deletions(-) (limited to 'indra/newview/llviewermessage.cpp') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 1b622de847..1545be3457 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -2985,7 +2985,7 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO BOOL LLAgent::canJoinGroups() const { - return (S32)mGroups.size() < LLAgentBenefits::instance().getGroupMembershipLimit(); + return (S32)mGroups.size() < LLAgentBenefitsMgr::current().getGroupMembershipLimit(); } LLQuaternion LLAgent::getHeadRotation() diff --git a/indra/newview/llagentbenefits.cpp b/indra/newview/llagentbenefits.cpp index eef644ccc0..a7f16b03d2 100644 --- a/indra/newview/llagentbenefits.cpp +++ b/indra/newview/llagentbenefits.cpp @@ -130,7 +130,7 @@ S32 LLAgentBenefits::getTextureUploadCost() const return m_texture_upload_cost; } -bool LLAgentBenefits::findUploadCost(LLAssetType::EType& asset_type, S32& cost) +bool LLAgentBenefits::findUploadCost(LLAssetType::EType& asset_type, S32& cost) const { bool succ = false; if (asset_type == LLAssetType::AT_TEXTURE) @@ -150,3 +150,70 @@ bool LLAgentBenefits::findUploadCost(LLAssetType::EType& asset_type, S32& cost) } return succ; } + +LLAgentBenefitsMgr::LLAgentBenefitsMgr() +{ +} + +LLAgentBenefitsMgr::~LLAgentBenefitsMgr() +{ +} + +// static +const LLAgentBenefits& LLAgentBenefitsMgr::current() +{ + return instance().mCurrent; +} + +// static +const LLAgentBenefits& LLAgentBenefitsMgr::get(const std::string& package) +{ + if (instance().mPackageMap.find(package) != instance().mPackageMap.end()) + { + return instance().mPackageMap[package]; + } + else + { + return instance().mDefault; + } +} + +// static +bool LLAgentBenefitsMgr::init(const std::string& package, const LLSD& benefits_sd) +{ + LLAgentBenefits benefits; + if (!benefits.init(benefits_sd)) + { + LL_WARNS("Benefits") << "Unable to initialize package " << package << " from sd " << benefits_sd << LL_ENDL; + return false; + } + else + { + instance().mPackageMap[package] = benefits; + } + return true; + +} + +// static +bool LLAgentBenefitsMgr::initCurrent(const std::string& package, const LLSD& benefits_sd) +{ + LLAgentBenefits benefits; + if (!benefits.init(benefits_sd)) + { + LL_WARNS("Benefits") << "Unable to initialize package " << package << " from sd " << benefits_sd << LL_ENDL; + return false; + } + else + { + instance().mCurrent = benefits; + } + return true; + +} + +// static +bool LLAgentBenefitsMgr::has(const std::string& package) +{ + return instance().mPackageMap.find(package) != instance().mPackageMap.end(); +} diff --git a/indra/newview/llagentbenefits.h b/indra/newview/llagentbenefits.h index 7ed6e169ce..9338bc1c26 100644 --- a/indra/newview/llagentbenefits.h +++ b/indra/newview/llagentbenefits.h @@ -30,13 +30,13 @@ #include "llsd.h" #include "llassettype.h" -class LLAgentBenefits: public LLSingleton +class LLAgentBenefits { - LLSINGLETON(LLAgentBenefits); +public: + LLAgentBenefits(); ~LLAgentBenefits(); LOG_CLASS(LLAgentBenefits); -public: bool init(const LLSD& benefits_sd); S32 getAnimatedObjectLimit() const; @@ -47,7 +47,7 @@ public: S32 getSoundUploadCost() const; S32 getTextureUploadCost() const; - bool findUploadCost(LLAssetType::EType& asset_type, S32& cost); + bool findUploadCost(LLAssetType::EType& asset_type, S32& cost) const; private: S32 m_animated_object_limit; @@ -61,4 +61,24 @@ private: bool m_initalized; }; +class LLAgentBenefitsMgr: public LLSingleton +{ + LLSINGLETON(LLAgentBenefitsMgr); + ~LLAgentBenefitsMgr(); + LOG_CLASS(LLAgentBenefitsMgr); + +public: + static const LLAgentBenefits& current(); + static const LLAgentBenefits& get(const std::string& package); + static bool init(const std::string& package, const LLSD& benefits_sd); + static bool initCurrent(const std::string& package, const LLSD& benefits_sd); + static bool has(const std::string& package); + +private: + LLAgentBenefits mCurrent; + LLAgentBenefits mDefault; + std::map mPackageMap; +}; + + #endif diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index 6d7d3c8556..1f54b5f838 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -1004,7 +1004,7 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata) { std::string name = floaterp->getChild("name_form")->getValue().asString(); std::string desc = floaterp->getChild("description_form")->getValue().asString(); - S32 expected_upload_cost = LLAgentBenefits::instance().getAnimationUploadCost(); + S32 expected_upload_cost = LLAgentBenefitsMgr::current().getAnimationUploadCost(); LLResourceUploadInfo::ptr_t assetUploadInfo(new LLResourceUploadInfo( floaterp->mTransactionID, LLAssetType::AT_ANIMATION, diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index a32b01679a..f341e2ebcb 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -173,7 +173,7 @@ void LLPanelGroups::reset() group_list->operateOnAll(LLCtrlListInterface::OP_DELETE); } getChild("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size())); - getChild("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefits::instance().getGroupMembershipLimit())); + getChild("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefitsMgr::current().getGroupMembershipLimit())); init_group_list(getChild("group list"), gAgent.getGroupID()); enableButtons(); @@ -184,7 +184,7 @@ BOOL LLPanelGroups::postBuild() childSetCommitCallback("group list", onGroupList, this); getChild("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size())); - getChild("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefits::instance().getGroupMembershipLimit())); + getChild("groupcount")->setTextArg("[MAX]", llformat("%d",LLAgentBenefitsMgr::current().getGroupMembershipLimit())); LLScrollListCtrl *list = getChild("group list"); if (list) diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index 937dd60f0f..89e93102dd 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -138,7 +138,7 @@ S32 LLFloaterNameDesc::getExpectedUploadCost() const S32 upload_cost = -1; if (LLResourceUploadInfo::findAssetTypeOfExtension(exten, asset_type)) { - if (!LLAgentBenefits::instance().findUploadCost(asset_type, upload_cost)) + if (!LLAgentBenefitsMgr::current().findUploadCost(asset_type, upload_cost)) { LL_WARNS() << "Unable to find upload cost for asset type " << asset_type << LL_ENDL; } diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 35b83880d9..6c3d385811 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -1205,7 +1205,7 @@ void LLOutfitGallery::uploadOutfitImage(const std::vector& filename return; } - S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); + S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); void *nruserdata = NULL; nruserdata = (void *)&outfit_id; diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 2d0a09b469..18f38b0d12 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -341,7 +341,7 @@ bool LLPanelGroupGeneral::apply(std::string& mesg) } LLSD args; - args["COST"] = LLAgentBenefits::instance().getCreateGroupCost(); + args["COST"] = LLAgentBenefitsMgr::current().getCreateGroupCost(); LLNotificationsUtil::add("CreateGroupCost", args, LLSD(), boost::bind(&LLPanelGroupGeneral::createGroupCallback, this, _1, _2)); return false; diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index a57ee83285..be31a2ed5d 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -227,9 +227,9 @@ BOOL LLPanelMainInventory::postBuild() initListCommandsHandlers(); - const std::string texture_upload_cost_str = std::to_string(LLAgentBenefits::instance().getTextureUploadCost()); - const std::string sound_upload_cost_str = std::to_string(LLAgentBenefits::instance().getSoundUploadCost()); - const std::string animation_upload_cost_str = std::to_string(LLAgentBenefits::instance().getAnimationUploadCost()); + const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost()); + const std::string sound_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getSoundUploadCost()); + const std::string animation_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getAnimationUploadCost()); LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get(); if (menu) @@ -1507,9 +1507,9 @@ void LLPanelMainInventory::setUploadCostIfNeeded() LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get(); if(mNeedUploadCost && menu) { - const std::string texture_upload_cost_str = std::to_string(LLAgentBenefits::instance().getTextureUploadCost()); - const std::string sound_upload_cost_str = std::to_string(LLAgentBenefits::instance().getSoundUploadCost()); - const std::string animation_upload_cost_str = std::to_string(LLAgentBenefits::instance().getAnimationUploadCost()); + const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost()); + const std::string sound_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getSoundUploadCost()); + const std::string animation_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getAnimationUploadCost()); menu->getChild("Upload Image")->setLabelArg("[COST]", texture_upload_cost_str); menu->getChild("Upload Sound")->setLabelArg("[COST]", sound_upload_cost_str); diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 0a41018293..2e991e425d 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -86,10 +86,6 @@ static const std::string RECENT_TAB_NAME = "recent_panel"; static const std::string BLOCKED_TAB_NAME = "blocked_panel"; // blocked avatars static const std::string COLLAPSED_BY_USER = "collapsed_by_user"; -// FIXME PREMIUM - these should come from package info, once viewer is receiving it all. -const S32 BASE_MAX_AGENT_GROUPS = 42; -const S32 PREMIUM_MAX_AGENT_GROUPS = 60; - /** Comparator for comparing avatar items by last interaction date */ class LLAvatarItemRecentComparator : public LLAvatarItemComparator { @@ -612,24 +608,14 @@ void LLPanelPeople::removePicker() BOOL LLPanelPeople::postBuild() { - // FIXME PREMIUM - need to get premium vs. basic info via BaaS - S32 max_premium = PREMIUM_MAX_AGENT_GROUPS; - if (gAgent.getRegion()) - { - LLSD features; - gAgent.getRegion()->getSimulatorFeatures(features); - if (features.has("MaxAgentGroupsPremium")) - { - max_premium = features["MaxAgentGroupsPremium"].asInteger(); - } - } + S32 max_premium = LLAgentBenefitsMgr::get("Premium").getGroupMembershipLimit(); getChild("nearby_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); getChild("friends_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); getChild("groups_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); getChild("recent_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); - if(LLAgentBenefits::instance().getGroupMembershipLimit() < max_premium) + if(LLAgentBenefitsMgr::current().getGroupMembershipLimit() < max_premium) { getChild("groupcount")->setText(getString("GroupCountWithInfo")); getChild("groupcount")->setURLClickedCallback(boost::bind(&LLPanelPeople::onGroupLimitInfo, this)); @@ -877,7 +863,7 @@ void LLPanelPeople::updateButtons() groups_panel->getChildView("minus_btn")->setEnabled(item_selected && selected_id.notNull()); // a real group selected U32 groups_count = gAgent.mGroups.size(); - S32 max_groups = LLAgentBenefits::instance().getGroupMembershipLimit(); + S32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit(); U32 groups_remaining = max_groups > groups_count ? max_groups - groups_count : 0; groups_panel->getChild("groupcount")->setTextArg("[COUNT]", llformat("%d", groups_count)); groups_panel->getChild("groupcount")->setTextArg("[REMAINING]", llformat("%d", groups_remaining)); @@ -1093,26 +1079,13 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string) } } -// FIXME PREMIUM this should be coming from LLAgentBenefits info about the various packages. void LLPanelPeople::onGroupLimitInfo() { LLSD args; - S32 max_basic = BASE_MAX_AGENT_GROUPS; - S32 max_premium = PREMIUM_MAX_AGENT_GROUPS; - if (gAgent.getRegion()) - { - LLSD features; - gAgent.getRegion()->getSimulatorFeatures(features); - if (features.has("MaxAgentGroupsBasic")) - { - max_basic = features["MaxAgentGroupsBasic"].asInteger(); - } - if (features.has("MaxAgentGroupsPremium")) - { - max_premium = features["MaxAgentGroupsPremium"].asInteger(); - } - } + S32 max_basic = LLAgentBenefitsMgr::get("Base").getGroupMembershipLimit(); + S32 max_premium = LLAgentBenefitsMgr::get("Premium").getGroupMembershipLimit(); + args["MAX_BASIC"] = max_basic; args["MAX_PREMIUM"] = max_premium; diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp index 202f42c53a..594cbed7ad 100644 --- a/indra/newview/llpanelsnapshotinventory.cpp +++ b/indra/newview/llpanelsnapshotinventory.cpp @@ -136,7 +136,7 @@ BOOL LLPanelSnapshotInventory::postBuild() // virtual void LLPanelSnapshotInventory::onOpen(const LLSD& key) { - getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLAgentBenefits::instance().getTextureUploadCost())); + getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLAgentBenefitsMgr::current().getTextureUploadCost())); LLPanelSnapshot::onOpen(key); } @@ -156,7 +156,7 @@ void LLPanelSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl) void LLPanelSnapshotInventoryBase::onSend() { - S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); + S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); if (can_afford_transaction(expected_upload_cost)) { if (mSnapshotFloater) @@ -192,7 +192,7 @@ BOOL LLPanelOutfitSnapshotInventory::postBuild() // virtual void LLPanelOutfitSnapshotInventory::onOpen(const LLSD& key) { - getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLAgentBenefits::instance().getTextureUploadCost())); + getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLAgentBenefitsMgr::current().getTextureUploadCost())); LLPanelSnapshot::onOpen(key); } diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index 7932db8727..6ded46d690 100644 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -94,7 +94,7 @@ void LLPanelSnapshotOptions::onOpen(const LLSD& key) void LLPanelSnapshotOptions::updateUploadCost() { - S32 upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); + S32 upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); getChild("save_to_inventory_btn")->setLabelArg("[AMOUNT]", llformat("%d", upload_cost)); } diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index 430abba543..3c8b405a67 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -1039,7 +1039,7 @@ void LLSnapshotLivePreview::saveTexture(BOOL outfit_snapshot, std::string name) LLAgentUI::buildLocationString(pos_string, LLAgentUI::LOCATION_FORMAT_FULL); std::string who_took_it; LLAgentUI::buildFullname(who_took_it); - S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); + S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); std::string res_name = outfit_snapshot ? name : "Snapshot : " + pos_string; std::string res_desc = outfit_snapshot ? "" : "Taken by " + who_took_it + " at " + pos_string; LLFolderType::EType folder_type = outfit_snapshot ? LLFolderType::FT_NONE : LLFolderType::FT_SNAPSHOT_CATEGORY; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index c144ea2f8e..3f65d69719 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -3250,14 +3250,67 @@ void apply_udp_blacklist(const std::string& csv) } +void on_benefits_failed_callback(const LLSD& notification, const LLSD& response) +{ + LL_WARNS("Benefits") << "Failed to load benefits information" << LL_ENDL; +} + +bool init_benefits(LLSD& response) +{ + LL_DEBUGS("Benefits") << "login success response:" << response << LL_ENDL; + + bool succ = true; + + std::string package_name = response["account_type"].asString(); + const LLSD& benefits_sd = response["account_level_benefits"]; + if (!LLAgentBenefitsMgr::init(package_name, benefits_sd) || + !LLAgentBenefitsMgr::initCurrent(package_name, benefits_sd)) + { + succ = false; + } + else + { + LL_DEBUGS("Benefits") << "Initialized current benefits, level " << package_name << " from " << benefits_sd << LL_ENDL; + } + const LLSD& packages_sd = response["premium_packages"]; + for(LLSD::map_const_iterator package_iter = packages_sd.beginMap(); + package_iter != packages_sd.endMap(); + ++package_iter) + { + std::string package_name = package_iter->first; + const LLSD& benefits_sd = package_iter->second["benefits"]; + if (LLAgentBenefitsMgr::init(package_name, benefits_sd)) + { + LL_DEBUGS("Benefits") << "Initialized benefits for package " << package_name << " from " << benefits_sd << LL_ENDL; + } + else + { + LL_WARNS("Benefits") << "Failed init for package " << package_name << " from " << benefits_sd << LL_ENDL; + succ = false; + } + } + + if (!LLAgentBenefitsMgr::has("Base")) + { + LL_WARNS("Benefits") << "Benefits info did not include required package Base" << LL_ENDL; + succ = false; + } + if (!LLAgentBenefitsMgr::has("Premium")) + { + LL_WARNS("Benefits") << "Benefits info did not include required package Premium" << LL_ENDL; + succ = false; + } + return succ; +} + bool process_login_success_response() { LLSD response = LLLoginInstance::getInstance()->getResponse(); - LL_DEBUGS("Benefits") << "login success response:" << response << LL_ENDL; - if (!LLAgentBenefits::instance().init(response["account_level_benefits"])) + bool benefits_ok = init_benefits(response); + if (!benefits_ok) { - LL_ERRS() << "Benefits error" << LL_ENDL; + LLNotificationsUtil::add("FailedToGetBenefits", LLSD(), LLSD(), boost::bind(on_benefits_failed_callback, _1, _2)); } std::string text(response["udp_blacklist"]); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index e88acc2ac4..49a4eb6a4d 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -510,9 +510,9 @@ void init_menus() LLGridManager::getInstance()->isInProductionGrid()); // *TODO:Also fix cost in llfolderview.cpp for Inventory menus - const std::string texture_upload_cost_str = std::to_string(LLAgentBenefits::instance().getTextureUploadCost()); - const std::string sound_upload_cost_str = std::to_string(LLAgentBenefits::instance().getSoundUploadCost()); - const std::string animation_upload_cost_str = std::to_string(LLAgentBenefits::instance().getAnimationUploadCost()); + const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost()); + const std::string sound_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getSoundUploadCost()); + const std::string animation_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getAnimationUploadCost()); gMenuHolder->childSetLabelArg("Upload Image", "[COST]", texture_upload_cost_str); gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", sound_upload_cost_str); gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", animation_upload_cost_str); @@ -8722,15 +8722,15 @@ void LLUploadCostCalculator::calculateCost(const std::string& asset_type_str) if (asset_type_str == "texture") { - upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); + upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); } else if (asset_type_str == "animation") { - upload_cost = LLAgentBenefits::instance().getAnimationUploadCost(); + upload_cost = LLAgentBenefitsMgr::current().getAnimationUploadCost(); } else if (asset_type_str == "sound") { - upload_cost = LLAgentBenefits::instance().getSoundUploadCost(); + upload_cost = LLAgentBenefitsMgr::current().getSoundUploadCost(); } if (upload_cost < 0) { diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 90fbbcc8d2..4ce39e715c 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -429,7 +429,7 @@ void do_bulk_upload(std::vector filenames, const LLSD& notification U32 codec; S32 expected_upload_cost; if (LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(ext, asset_type, codec) && - LLAgentBenefits::instance().findUploadCost(asset_type, expected_upload_cost)) + LLAgentBenefitsMgr::current().findUploadCost(asset_type, expected_upload_cost)) { LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo( filename, @@ -460,7 +460,7 @@ bool get_bulk_upload_expected_cost(const std::vector& filenames, S3 S32 cost; if (LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(ext, asset_type, codec) && - LLAgentBenefits::instance().findUploadCost(asset_type, cost)) + LLAgentBenefitsMgr::current().findUploadCost(asset_type, cost)) { total_cost += cost; } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 2cde93f471..6e64ccc501 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -903,7 +903,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response) if(option == 0 && !group_id.isNull()) { // check for promotion or demotion. - S32 max_groups = LLAgentBenefits::instance().getGroupMembershipLimit(); + S32 max_groups = LLAgentBenefitsMgr::current().getGroupMembershipLimit(); if(gAgent.isInGroup(group_id)) ++max_groups; if(gAgent.mGroups.size() < max_groups) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f8ff71911e..e7ceec40ef 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7061,7 +7061,7 @@ U32 LLVOAvatar::getNumAttachments() const //----------------------------------------------------------------------------- S32 LLVOAvatar::getMaxAttachments() const { - return LLAgentBenefits::instance().getAttachmentLimit(); + return LLAgentBenefitsMgr::current().getAttachmentLimit(); } //----------------------------------------------------------------------------- @@ -7095,7 +7095,7 @@ U32 LLVOAvatar::getNumAnimatedObjectAttachments() const //----------------------------------------------------------------------------- S32 LLVOAvatar::getMaxAnimatedObjectAttachments() const { - return LLAgentBenefits::instance().getAnimatedObjectLimit(); + return LLAgentBenefitsMgr::current().getAnimatedObjectLimit(); } //----------------------------------------------------------------------------- diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index f93113ebd0..c8db5d24dd 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -8410,7 +8410,17 @@ Your voice has been muted by moderator. name="okbutton" yestext="OK"/> - + + + Unfortunately, we were unable to get benefits information for this session. This should not happen in a normal production environment. Please contact support. This session will not work normally and we recommend that you restart. + + +