diff options
author | Rider Linden <rider@lindenlab.com> | 2018-05-24 17:09:01 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-05-24 17:09:01 -0700 |
commit | acaf57100eade61262d73cf5b318c4545e921bd5 (patch) | |
tree | 636955754701af7b1421aaf98b3feb59c15fba3f | |
parent | 581869f2ca01aaa3349baef8785f1b26198d576e (diff) |
switch track based on altitudes sent from region.
-rw-r--r-- | indra/llinventory/llsettingsbase.cpp | 2 | ||||
-rw-r--r-- | indra/llinventory/llsettingsbase.h | 6 | ||||
-rw-r--r-- | indra/newview/llenvironment.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llenvironment.h | 21 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.h | 2 |
6 files changed, 45 insertions, 27 deletions
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 411eaff8e3..d8e337e231 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -548,7 +548,7 @@ F64 LLSettingsBlender::setPosition(F64 blendf) blendf = llclamp(blendf, 0.0, 1.0); mTarget->replaceSettings(mInitial->getSettings()); - if (mIsTrivial || (blendf == 0.0)) + if (!mFinal || (mInitial == mFinal) || (blendf == 0.0)) { // this is a trivial blend. Results will be identical to the initial. return blendf; } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 71358d6a49..1ef7df79ad 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -271,15 +271,13 @@ public: mOnFinished(), mTarget(target), mInitial(initsetting), - mFinal(endsetting), - mIsTrivial(false) + mFinal(endsetting) { if (mInitial) mTarget->replaceSettings(mInitial->getSettings()); if (!mFinal) mFinal = mInitial; - mIsTrivial = (mFinal == mInitial); } virtual ~LLSettingsBlender() {} @@ -295,7 +293,6 @@ public: if (!mFinal) mFinal = mInitial; - mIsTrivial = (mFinal == mInitial); mTarget->replaceSettings(mInitial->getSettings()); } @@ -333,7 +330,6 @@ protected: LLSettingsBase::ptr_t mTarget; LLSettingsBase::ptr_t mInitial; LLSettingsBase::ptr_t mFinal; - bool mIsTrivial; }; class LLSettingsBlenderTimeDelta : public LLSettingsBlender diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 11347917c3..e0cfbbf79e 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -961,6 +961,10 @@ void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentI LL_WARNS("LAPRAS") << "Had requested parcel environment #" << parcel_id << " but got region." << LL_ENDL; clearEnvironment(ENV_PARCEL); } + + mTrackAltitudes = envinfo->mAltitudes; + + LL_WARNS("LAPRAS") << "Altitudes set to {" << mTrackAltitudes[0] << ", "<< mTrackAltitudes[1] << ", " << mTrackAltitudes[2] << ", " << mTrackAltitudes[3] << LL_ENDL; } else { @@ -1250,7 +1254,7 @@ LLEnvironment::EnvironmentInfo::EnvironmentInfo(): mDayOffset(0), mDayHash(0), mDaycycleData(), - mAltitudes(), + mAltitudes({ { 0.0, 0.0, 0.0, 0.0 } }), mIsDefault(false), mIsRegion(false) { @@ -1275,7 +1279,16 @@ LLEnvironment::EnvironmentInfo::ptr_t LLEnvironment::EnvironmentInfo::extract(LL if (environment.has("is_default")) pinfo->mIsDefault = environment["is_default"].asBoolean(); if (environment.has("track_altitudes")) - pinfo->mAltitudes = environment["track_altitudes"]; + { + LL_WARNS("LAPRAS") << "track_altitudes=" << environment["track_altitudes"] << LL_ENDL; + + /*LAPRAS: TODO: Fix the simulator message. Shouldn't be 5, just 4*/ + int idx = 1; + for (F32 &altitude : pinfo->mAltitudes) + { + altitude = environment["track_altitudes"][idx++].asReal(); + } + } return pinfo; } @@ -1506,8 +1519,17 @@ void LLEnvironment::onAgentPositionHasChanged(const LLVector3 &localpos) S32 LLEnvironment::calculateSkyTrackForAltitude(F64 altitude) { - //*LAPRAS* temp base on region's response. - return llmin((static_cast<S32>(altitude) / 100) + 1, (LLSettingsDay::TRACK_MAX - 1)); +// //*LAPRAS* temp base on region's response. +// return llmin((static_cast<S32>(altitude) / 100) + 1, (LLSettingsDay::TRACK_MAX - 1)); + + auto it = std::find_if_not(mTrackAltitudes.begin(), mTrackAltitudes.end(), [altitude](F32 test) { return altitude > test; }); + + if (it == mTrackAltitudes.begin()) + return 1; + else if (it == mTrackAltitudes.end()) + return 4; + + return std::min(std::distance(mTrackAltitudes.begin(), it), 4LL); } diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index cdfac34d90..398c97ebe9 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -61,18 +61,18 @@ public: typedef std::shared_ptr<EnvironmentInfo> ptr_t; - S32 mParcelId; - LLUUID mRegionId; - S64Seconds mDayLength; - S64Seconds mDayOffset; - size_t mDayHash; - LLSD mDaycycleData; - LLSD mAltitudes; - bool mIsDefault; - bool mIsRegion; + S32 mParcelId; + LLUUID mRegionId; + S64Seconds mDayLength; + S64Seconds mDayOffset; + size_t mDayHash; + LLSD mDaycycleData; + std::array<F32, 4> mAltitudes; + bool mIsDefault; + bool mIsRegion; - static ptr_t extract(LLSD); + static ptr_t extract(LLSD); }; @@ -338,6 +338,7 @@ private: change_signal_t mDayCycleListChange; S32 mCurrentTrack; + std::array<F32, 4> mTrackAltitudes; DayInstance::ptr_t getEnvironmentInstance(EnvSelection_t env, bool create = false); diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 277f2fab52..f4de71426e 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -852,6 +852,7 @@ void LLFloaterEditExtDayCycle::syncronizeTabs() panel->setSettings(psettingWater); panel->setEnabled(canedit); panel->setAllChildrenEnabled(canedit); + panel->refresh(); } } @@ -883,6 +884,7 @@ void LLFloaterEditExtDayCycle::syncronizeTabs() panel->setSettings(psettingSky); panel->setEnabled(canedit); panel->setAllChildrenEnabled(canedit); + panel->refresh(); } } @@ -1041,13 +1043,10 @@ void LLFloaterEditExtDayCycle::onIdlePlay(void* user_data) F32 new_frame = fmod(self->mPlayStartFrame + prcnt_played, 1.f); self->mTimeSlider->setCurSliderValue(new_frame); // will do the rounding - self->selectFrame(self->mTimeSlider->getCurSliderValue()); + self->mSkyBlender->setPosition(new_frame); + self->mWaterBlender->setPosition(new_frame); + self->syncronizeTabs(); - if (self->mPlayTimer.getElapsedTimeF32() > DAY_CYCLE_PLAY_TIME_SECONDS) - { - // Nothing to do anymore. - self->stopPlay(); - } } diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index c68e189cae..f2462ee1cc 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -132,7 +132,7 @@ private: // play functions void startPlay(); void stopPlay(); - static void onIdlePlay(void* user_data); + static void onIdlePlay(void *); LLSettingsDay::ptr_t mEditDay; // edited copy S64Seconds mDayLength; |