summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2018-05-24 17:09:01 -0700
committerRider Linden <rider@lindenlab.com>2018-05-24 17:09:01 -0700
commitacaf57100eade61262d73cf5b318c4545e921bd5 (patch)
tree636955754701af7b1421aaf98b3feb59c15fba3f /indra/newview
parent581869f2ca01aaa3349baef8785f1b26198d576e (diff)
switch track based on altitudes sent from region.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llenvironment.cpp30
-rw-r--r--indra/newview/llenvironment.h21
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp11
-rw-r--r--indra/newview/llfloatereditextdaycycle.h2
4 files changed, 43 insertions, 21 deletions
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;