summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-07-10 23:26:35 +0100
committerGraham Linden <graham@lindenlab.com>2018-07-10 23:26:35 +0100
commitffdd6c3d7dad87e9873067a923d4e7ce9e6d4d2c (patch)
treeb28dd084c3e016e91c2860a90d52507cd29c0dcc /indra/llrender
parenta90e61b798711306496c2ed7aa5cce6d096ea466 (diff)
Make advanced atmo sky shader compile again.
Make atmospheric model avoid redundant work when settings don't change. Point autobuild.xml at libatmosphere with op== to compare density profiles.
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llatmosphere.cpp47
-rw-r--r--indra/llrender/llatmosphere.h4
2 files changed, 48 insertions, 3 deletions
diff --git a/indra/llrender/llatmosphere.cpp b/indra/llrender/llatmosphere.cpp
index 644e102a15..4edfd9efe9 100644
--- a/indra/llrender/llatmosphere.cpp
+++ b/indra/llrender/llatmosphere.cpp
@@ -132,6 +132,46 @@ AtmosphericModelSettings::AtmosphericModelSettings(
{
}
+bool AtmosphericModelSettings::operator==(const AtmosphericModelSettings& rhs) const
+{
+ if (m_skyBottomRadius != rhs.m_skyBottomRadius)
+ {
+ return false;
+ }
+
+ if (m_skyTopRadius != rhs.m_skyTopRadius)
+ {
+ return false;
+ }
+
+ if (m_sunArcRadians != rhs.m_sunArcRadians)
+ {
+ return false;
+ }
+
+ if (m_mieAnisotropy != rhs.m_mieAnisotropy)
+ {
+ return false;
+ }
+
+ if (m_rayleighProfile != rhs.m_rayleighProfile)
+ {
+ return false;
+ }
+
+ if (m_mieProfile != rhs.m_mieProfile)
+ {
+ return false;
+ }
+
+ if (m_absorptionProfile != rhs.m_absorptionProfile)
+ {
+ return false;
+ }
+
+ return true;
+}
+
void LLAtmosphere::initClass()
{
if (!gAtmosphere)
@@ -192,9 +232,10 @@ LLAtmosphere::~LLAtmosphere()
bool LLAtmosphere::configureAtmosphericModel(AtmosphericModelSettings& settings)
{
-// Advanced Atmospherics TODO
-// Make this store a hash of the precomputed data
-// and avoid redundant calcs for identical settings
+ if ((m_model != nullptr) && (settings == m_settings))
+ {
+ return true;
+ }
if (m_model)
{
diff --git a/indra/llrender/llatmosphere.h b/indra/llrender/llatmosphere.h
index 0d62a069ac..a010803595 100644
--- a/indra/llrender/llatmosphere.h
+++ b/indra/llrender/llatmosphere.h
@@ -52,6 +52,8 @@ public:
F32 sunArcRadians,
F32 mieAniso);
+ bool operator==(const AtmosphericModelSettings& rhs) const;
+
F32 m_skyBottomRadius;
F32 m_skyTopRadius;
DensityProfile m_rayleighProfile;
@@ -107,6 +109,8 @@ protected:
std::vector<double> m_mie_extinction;
std::vector<double> m_absorption_extinction;
std::vector<double> m_ground_albedo;
+
+ AtmosphericModelSettings m_settings;
};
extern LLAtmosphere* gAtmosphere;