summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llinventory/llsettingsbase.h2
-rw-r--r--indra/newview/llenvironment.cpp117
-rw-r--r--indra/newview/llenvironment.h32
3 files changed, 103 insertions, 48 deletions
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h
index f5146b1c27..073e4616a5 100644
--- a/indra/llinventory/llsettingsbase.h
+++ b/indra/llinventory/llsettingsbase.h
@@ -241,7 +241,7 @@ class LLSettingsBlender : public boost::enable_shared_from_this<LLSettingsBlende
{
public:
typedef boost::shared_ptr<LLSettingsBlender> ptr_t;
- typedef boost::signals2::signal<void(const ptr_t &)> finish_signal_t;
+ typedef boost::signals2::signal<void(const ptr_t )> finish_signal_t;
typedef boost::signals2::connection connection_t;
static const F64Seconds DEFAULT_THRESHOLD;
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index db8fd570c0..cb1d85bed2 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -360,26 +360,33 @@ void LLEnvironment::updateEnvironment(F64Seconds transition)
if (mCurrentEnvironment != pinstance)
{
- LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky();
- LLSettingsWater::ptr_t pwater = mCurrentEnvironment->getWater();
+ DayInstance::ptr_t trans = boost::make_shared<DayTransition>(
+ mCurrentEnvironment->getSky(), mCurrentEnvironment->getWater(), pinstance, transition);
- LLSettingsSky::ptr_t ptargetsky = psky->buildClone();
- LLSettingsWater::ptr_t ptargetwater = pwater->buildClone();
-
- LLSettingsBlender::ptr_t skyblend = boost::make_shared<LLSettingsBlender>(ptargetsky, psky, pinstance->getSky(), transition);
- skyblend->setOnFinished(boost::bind(&LLEnvironment::onTransitionDone, this, _1, true));
- LLSettingsBlender::ptr_t waterblend = boost::make_shared<LLSettingsBlender>(ptargetwater, pwater, pinstance->getWater(), transition);
- waterblend->setOnFinished(boost::bind(&LLEnvironment::onTransitionDone, this, _1, false));
+ trans->animate();
- pinstance->setBlenders(skyblend, waterblend);
-
- mCurrentEnvironment = pinstance;
-
- mCurrentEnvironment->animate();
+ mCurrentEnvironment = trans;
+//
+// LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky();
+// LLSettingsWater::ptr_t pwater = mCurrentEnvironment->getWater();
+//
+// LLSettingsSky::ptr_t ptargetsky = psky->buildClone();
+// LLSettingsWater::ptr_t ptargetwater = pwater->buildClone();
+//
+// LLSettingsBlender::ptr_t skyblend = boost::make_shared<LLSettingsBlender>(ptargetsky, psky, pinstance->getSky(), transition);
+// skyblend->setOnFinished(boost::bind(&LLEnvironment::onTransitionDone, this, _1, true));
+// LLSettingsBlender::ptr_t waterblend = boost::make_shared<LLSettingsBlender>(ptargetwater, pwater, pinstance->getWater(), transition);
+// waterblend->setOnFinished(boost::bind(&LLEnvironment::onTransitionDone, this, _1, false));
+//
+// pinstance->setBlenders(skyblend, waterblend);
+//
+// mCurrentEnvironment = pinstance;
+//
+// mCurrentEnvironment->animate();
}
}
-void LLEnvironment::onTransitionDone(const LLSettingsBlender::ptr_t &blender, bool isSky)
+void LLEnvironment::onTransitionDone(const LLSettingsBlender::ptr_t blender, bool isSky)
{
/*TODO: Test for both sky and water*/
mCurrentEnvironment->animate();
@@ -394,29 +401,16 @@ void LLEnvironment::update(const LLViewerCamera * cam)
F32Seconds delta(timer.getElapsedTimeAndResetF32());
- for (InstanceArray_t::iterator it = mEnvironments.begin(); it != mEnvironments.end(); ++it)
- {
- if (*it)
- (*it)->update(delta);
- }
+// for (InstanceArray_t::reverse_iterator it = mEnvironments.rbegin(); it != mEnvironments.rend(); ++it)
+// {
+// if (*it)
+// (*it)->update(delta);
+// }
+ mCurrentEnvironment->update(delta);
// update clouds, sun, and general
updateCloudScroll();
-// if (mBlenderSky)
-// mBlenderSky->update(delta);
-// if (mBlenderWater)
-// mBlenderWater->update(delta);
-//
-//
-// if (mCurrentDay)
-// mCurrentDay->update();
-//
-// if (mCurrentEnvironment->getSky())
-// mCurrentEnvironment->getSky()->update();
-// if (mCurrentEnvironment->getWater())
-// mCurrentEnvironment->getWater()->update();
-
F32 camYaw = cam->getYaw();
stop_glerror();
@@ -1348,10 +1342,10 @@ void LLEnvironment::DayInstance::update(F64Seconds delta)
if (mBlenderWater)
mBlenderWater->update(delta);
- if (mSky)
- mSky->update();
- if (mWater)
- mWater->update();
+// if (mSky)
+// mSky->update();
+// if (mWater)
+// mWater->update();
}
void LLEnvironment::DayInstance::setDay(const LLSettingsDay::ptr_t &pday, S64Seconds daylength, S64Seconds dayoffset)
@@ -1490,7 +1484,7 @@ void LLEnvironment::DayInstance::animate()
}
}
-void LLEnvironment::DayInstance::onTrackTransitionDone(S32 trackno, const LLSettingsBlender::ptr_t &blender)
+void LLEnvironment::DayInstance::onTrackTransitionDone(S32 trackno, const LLSettingsBlender::ptr_t blender)
{
LL_WARNS("LAPRAS") << "onTrackTransitionDone for " << trackno << LL_ENDL;
F64Seconds now(LLDate::now().secondsSinceEpoch());
@@ -1510,3 +1504,48 @@ void LLEnvironment::DayInstance::onTrackTransitionDone(S32 trackno, const LLSett
blender->reset((*bounds.first).second, (*bounds.second).second, timespan);
}
+
+//-------------------------------------------------------------------------
+LLEnvironment::DayTransition::DayTransition(const LLSettingsSky::ptr_t &skystart,
+ const LLSettingsWater::ptr_t &waterstart, LLEnvironment::DayInstance::ptr_t &end, S64Seconds time) :
+ DayInstance(),
+ mStartSky(skystart),
+ mStartWater(waterstart),
+ mNextInstance(end),
+ mTransitionTime(time)
+{
+
+}
+
+void LLEnvironment::DayTransition::update(F64Seconds delta)
+{
+ mNextInstance->update(delta);
+ DayInstance::update(delta);
+}
+
+void LLEnvironment::DayTransition::animate()
+{
+ mNextInstance->animate();
+
+ mWater = mStartWater->buildClone();
+ mBlenderWater = boost::make_shared<LLSettingsBlender>(mWater, mStartWater, mNextInstance->getWater(), mTransitionTime);
+ mBlenderWater->setOnFinished(boost::bind(&LLEnvironment::DayTransition::onTransitonDone, this, LLSettingsDay::TRACK_WATER, _1));
+
+ mSky = mStartSky->buildClone();
+ mBlenderSky = boost::make_shared<LLSettingsBlender>(mSky, mStartSky, mNextInstance->getSky(), mTransitionTime);
+ mBlenderSky->setOnFinished(boost::bind(&LLEnvironment::DayTransition::onTransitonDone, this, LLSettingsDay::TRACK_MAX, _1));
+}
+
+
+void LLEnvironment::DayTransition::onTransitonDone(S32 trackno, const LLSettingsBlender::ptr_t blender)
+{
+ if (trackno == LLSettingsDay::TRACK_WATER)
+ mBlenderWater.reset();
+ else
+ mBlenderSky.reset();
+
+ if (!mBlenderSky && !mBlenderWater)
+ {
+ LLEnvironment::instance().mCurrentEnvironment = mNextInstance;
+ }
+}
diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h
index 4230f76862..2b045e483c 100644
--- a/indra/newview/llenvironment.h
+++ b/indra/newview/llenvironment.h
@@ -220,8 +220,9 @@ private:
typedef boost::shared_ptr<DayInstance> ptr_t;
DayInstance();
+ virtual ~DayInstance() { };
- void update(F64Seconds);
+ virtual void update(F64Seconds);
void setDay(const LLSettingsDay::ptr_t &pday, S64Seconds daylength, S64Seconds dayoffset);
void setSky(const LLSettingsSky::ptr_t &psky);
@@ -238,11 +239,11 @@ private:
S64Seconds getDayLength() const { return mDayLength; }
S64Seconds getDayOffset() const { return mDayOffset; }
- void animate();
+ virtual void animate();
void setBlenders(const LLSettingsBlender::ptr_t &skyblend, const LLSettingsBlender::ptr_t &waterblend);
- private:
+ protected:
LLSettingsDay::ptr_t mDayCycle;
LLSettingsSky::ptr_t mSky;
LLSettingsWater::ptr_t mWater;
@@ -256,14 +257,31 @@ private:
LLSettingsBlender::ptr_t mBlenderSky;
LLSettingsBlender::ptr_t mBlenderWater;
-
F64 secondsToKeyframe(S64Seconds seconds);
- void onTrackTransitionDone(S32 trackno, const LLSettingsBlender::ptr_t &blender);
+ void onTrackTransitionDone(S32 trackno, const LLSettingsBlender::ptr_t blender);
};
typedef std::array<DayInstance::ptr_t, ENV_END> InstanceArray_t;
+ class DayTransition : public DayInstance
+ {
+ public:
+ DayTransition(const LLSettingsSky::ptr_t &skystart, const LLSettingsWater::ptr_t &waterstart, DayInstance::ptr_t &end, S64Seconds time);
+ virtual ~DayTransition() { };
+
+ virtual void update(F64Seconds);
+ virtual void animate();
+
+ protected:
+ LLSettingsSky::ptr_t mStartSky;
+ LLSettingsWater::ptr_t mStartWater;
+ DayInstance::ptr_t mNextInstance;
+ S64Seconds mTransitionTime;
+
+ void onTransitonDone(S32 trackno, const LLSettingsBlender::ptr_t blender);
+ };
+
static const F32 SUN_DELTA_YAW;
static const F32 NIGHTTIME_ELEVATION_COS;
@@ -283,8 +301,6 @@ private:
LLSettingsBlender::ptr_t mBlenderSky;
LLSettingsBlender::ptr_t mBlenderWater;
- LLSettingsDay::ptr_t mCurrentDay;
-
typedef std::vector<LLSettingsSky::ptr_t> SkyList_t;
typedef std::vector<LLSettingsWater::ptr_t> WaterList_t;
typedef std::vector<LLSettingsDay::ptr_t> DayList_t;
@@ -338,7 +354,7 @@ private:
void recordEnvironment(S32 parcel_id, EnvironmentInfo::ptr_t environment);
- void onTransitionDone(const LLSettingsBlender::ptr_t &, bool isSky);
+ void onTransitionDone(const LLSettingsBlender::ptr_t, bool isSky);
//=========================================================================
void legacyLoadAllPresets();
LLSD legacyLoadPreset(const std::string& path);