Initial QP day cycle slider to see if method is viable

meow-7.2.2
Kadah_Coba 2019-04-04 02:13:55 -07:00
parent 1545a62060
commit f917c39b4f
4 changed files with 67 additions and 2 deletions

View File

@ -113,6 +113,7 @@ const LLSettingsDay::Seconds LLSettingsDay::MAXIMUM_DAYLENGTH(604800); // 7 days
const LLSettingsDay::Seconds LLSettingsDay::MINIMUM_DAYOFFSET(0);
const LLSettingsDay::Seconds LLSettingsDay::DEFAULT_DAYOFFSET(57600); // +16 hours == -8 hours (SLT time offset)
const LLSettingsDay::Seconds LLSettingsDay::MAXIMUM_DAYOFFSET(86400); // 24 hours
const LLSettingsDay::Seconds LLSettingsDay::INVALID_DAYOFFSET(-1); // KC
const S32 LLSettingsDay::TRACK_WATER(0); // water track is 0
const S32 LLSettingsDay::TRACK_GROUND_LEVEL(1);

View File

@ -58,6 +58,7 @@ public:
static const Seconds MINIMUM_DAYOFFSET;
static const Seconds DEFAULT_DAYOFFSET;
static const Seconds MAXIMUM_DAYOFFSET;
static const Seconds INVALID_DAYOFFSET; // KC
static const S32 TRACK_WATER;
static const S32 TRACK_GROUND_LEVEL;

View File

@ -313,6 +313,12 @@ public:
DayInstance::ptr_t getSelectedEnvironmentInstance();
DayInstance::ptr_t getSharedEnvironmentInstance();
//<KC: Environment hacks>
public:
LLSettingsDay::Seconds getDayOffset() const { return (mCurrentEnvironment) ? mCurrentEnvironment->getDayOffset() : LLSettingsDay::INVALID_DAYOFFSET; }
void setDayOffset(LLSettingsBase::Seconds offset) { if (mCurrentEnvironment) mCurrentEnvironment->setDayOffset(offset); }
//</KC: Environment hacks>
protected:
virtual void initSingleton() override;
virtual void cleanupSingleton() override;

View File

@ -59,6 +59,7 @@
#include "rlvhandler.h"
#include <boost/foreach.hpp>
const LLVector3 VectorZero(1.0f, 0.0f, 0.0f);
// static F32 sun_pos_to_time24(F32 sun_pos)
// {
@ -571,7 +572,8 @@ BOOL FloaterQuickPrefs::postBuild()
mWLPresetsCombo = getChild<LLComboBox>("WLPresetsCombo");
mDayCyclePresetsCombo = getChild<LLComboBox>("DCPresetsCombo");
mWLSunPos = getChild<LLMultiSliderCtrl>("WLSunPos");
mWLSunPos->addSlider(12.f);
mWLSunPos->addSlider(0);
mWLSunPos->setMaxValue(LLSettingsDay::MAXIMUM_DAYOFFSET);
initCallbacks();
loadPresets();
@ -858,7 +860,6 @@ void FloaterQuickPrefs::onClickDayCycleNext()
selectDayCyclePreset(mDayCyclePresetsCombo->getSelectedValue());
}
void FloaterQuickPrefs::draw()
{
// [EEPMERGE]
@ -876,6 +877,28 @@ void FloaterQuickPrefs::draw()
//mWLSunPos->setCurSliderValue(val);
// [/EEPMERGE]
// Quick hack to see if this is viable - KC
LLSettingsDay::Seconds day_offset = LLEnvironment::instance().getDayOffset();
if (day_offset > LLSettingsDay::INVALID_DAYOFFSET)
{
mWLSunPos->setCurSliderValue(day_offset);
}
// The fallowing kind of works for sun position, conflicts with above
// - Slider tick does not work properly
// LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
// LLQuaternion sunq = psky->getSunRotation();
// LLVector3 draw_point = VectorZero * sunq;
// LL_INFOS() << "draw_point VX: " << draw_point.mV[VX] << LL_ENDL;
// LL_INFOS() << "draw_point VY: " << draw_point.mV[VY] << LL_ENDL;
// draw_point.mV[VX] = draw_point.mV[VX] * 24.f;
// // draw_point.mV[VY] = draw_point.mV[VY] * 24.f;
// mWLSunPos->setCurSliderValue(draw_point.mV[VX]);
LLTransientDockableFloater::draw();
}
@ -900,6 +923,40 @@ void FloaterQuickPrefs::onSunMoved()
// LLWLParamManager::instance().mCurParams.setSunAngle(val);
//}
// [/EEPMERGE]
// Quick hack to see if this is viable - KC
if (LLEnvironment::instance().getDayOffset() > LLSettingsDay::INVALID_DAYOFFSET)
{
LLSettingsDay::Seconds day_offset(mWLSunPos->getCurSliderValue());
LLEnvironment::instance().setDayOffset(day_offset);
}
// The fallowing kind of works for sun position, conflicts with above
// - Sometimes it seems that only the light source moves and not the visual sun
// LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
// LLQuaternion sunq = psky->getSunRotation();
// F32 altitude = mWLSunPos->getCurSliderValue() / 24.0f;
// // F32 azimuth = mWLSunPos->getCurSliderValue() / 24.0f;
// LLVector3 draw_point = VectorZero * sunq;
// if (draw_point.mV[VZ] >= 0.f)
// {
// if (is_approx_zero(altitude)) // don't change the hemisphere
// {
// altitude = F_APPROXIMATELY_ZERO;
// }
// altitude *= -1;
// }
// sunq.setAngleAxis(altitude, 0, 1, 0);
// // LLQuaternion az_quat;
// // az_quat.setAngleAxis(azimuth, 0, 0, 1);
// // sunq *= az_quat;
// psky->setSunRotation(sunq);
}
void FloaterQuickPrefs::onClickResetToRegionDefault()