diff options
| author | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-03-03 00:53:39 +0000 | 
|---|---|---|
| committer | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-03-03 00:53:39 +0000 | 
| commit | 98862a53a77cd1ce9a2cae596a743669cc32a2af (patch) | |
| tree | 09838f73b2b7ecaabb88a9839b343ac0f6b68aa7 | |
| parent | acdead96cd194040f586c5a6e976beca7bb999c4 (diff) | |
Fix 16F enum for compat w/ SL gl headers on Mac.
Make density profile/layer parsing handle when
LLSD heard you liked arrays so it put an array
in your array.
| -rw-r--r-- | indra/llinventory/llsettingssky.cpp | 51 | ||||
| -rw-r--r-- | indra/llrender/llatmosphere.cpp | 6 | ||||
| -rw-r--r-- | indra/newview/llenvadapters.h | 54 | ||||
| -rw-r--r-- | indra/newview/llenvironment.cpp | 10 | ||||
| -rw-r--r-- | indra/newview/llsettingsvo.cpp | 18 | ||||
| -rw-r--r-- | indra/newview/llsettingsvo.h | 8 | ||||
| -rw-r--r-- | indra/newview/llvosky.cpp | 14 | 
7 files changed, 129 insertions, 32 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index b8a45a8d89..91357a6e49 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,6 +32,8 @@  #include "llfasttimer.h"  #include "v3colorutil.h" +#pragma optimize("", off) +  //=========================================================================  namespace  { @@ -190,9 +192,20 @@ bool validateRayleighLayers(LLSD &value)          for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf)          {              LLSD& layerConfig = (*itf); -            if (!validateRayleighLayers(layerConfig)) +            if (layerConfig.type() == LLSD::Type::TypeMap) +            { +                if (!validateRayleighLayers(layerConfig)) +                { +                    allGood = false; +                } +            } +            else if (layerConfig.type() == LLSD::Type::TypeArray)              { -                allGood = false; +                return validateRayleighLayers(layerConfig); +            } +            else +            { +                return LLSettingsBase::settingValidation(value, rayleighValidations);              }          }          return allGood; @@ -221,9 +234,20 @@ bool validateAbsorptionLayers(LLSD &value)          for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf)          {              LLSD& layerConfig = (*itf); -            if (!validateAbsorptionLayers(layerConfig)) +            if (layerConfig.type() == LLSD::Type::TypeMap) +            { +                if (!validateAbsorptionLayers(layerConfig)) +                { +                    allGood = false; +                } +            } +            else if (layerConfig.type() == LLSD::Type::TypeArray)              { -                allGood = false; +                return validateAbsorptionLayers(layerConfig); +            } +            else +            { +                return LLSettingsBase::settingValidation(value, absorptionValidations);              }          }          return allGood; @@ -252,9 +276,20 @@ bool validateMieLayers(LLSD &value)          for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf)          {              LLSD& layerConfig = (*itf); -            if (!validateMieLayers(layerConfig)) +            if (layerConfig.type() == LLSD::Type::TypeMap) +            { +                if (!validateMieLayers(layerConfig)) +                { +                    allGood = false; +                } +            } +            else if (layerConfig.type() == LLSD::Type::TypeArray)              { -                allGood = false; +                return validateMieLayers(layerConfig); +            } +            else +            { +                return LLSettingsBase::settingValidation(value, mieValidations);              }          }          return allGood; @@ -779,6 +814,7 @@ void LLSettingsSky::calculateLightSettings()          LLColor3    blue_horizon = getBlueHorizon();          F32         haze_density = getHazeDensity();          F32         haze_horizon = getHazeHorizon(); +          F32         density_multiplier = getDensityMultiplier();          F32         max_y = getMaxY();          F32         cloud_shadow = getCloudShadow(); @@ -786,8 +822,7 @@ void LLSettingsSky::calculateLightSettings()          // Sunlight attenuation effect (hue and brightness) due to atmosphere          // this is used later for sunlight modulation at various altitudes -        LLColor3 light_atten = -            (blue_density * 1.0 + smear(haze_density * 0.25f)) * (density_multiplier * max_y); +        LLColor3 light_atten = (blue_density * 1.0 + smear(haze_density * 0.25f)) * (density_multiplier * max_y);          // Calculate relative weights          LLColor3 temp2(0.f, 0.f, 0.f); diff --git a/indra/llrender/llatmosphere.cpp b/indra/llrender/llatmosphere.cpp index 8840f49454..a8557e82da 100644 --- a/indra/llrender/llatmosphere.cpp +++ b/indra/llrender/llatmosphere.cpp @@ -170,21 +170,21 @@ LLAtmosphere::LLAtmosphere()      m_transmittance->generateGLTexture();      m_transmittance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP);      m_transmittance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); -    m_transmittance->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); +    m_transmittance->setExplicitFormat(GL_RGB16F_ARB, GL_RGB, GL_FLOAT);      m_transmittance->setTexName(m_textures.transmittance_texture);      m_transmittance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE);      m_scattering->generateGLTexture();      m_scattering->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP);      m_scattering->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); -    m_scattering->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); +    m_scattering->setExplicitFormat(GL_RGB16F_ARB, GL_RGB, GL_FLOAT);      m_scattering->setTexName(m_textures.transmittance_texture);      m_scattering->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D);      m_mie_scattering->generateGLTexture();      m_mie_scattering->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP);      m_mie_scattering->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); -    m_mie_scattering->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); +    m_mie_scattering->setExplicitFormat(GL_RGB16F_ARB, GL_RGB, GL_FLOAT);      m_mie_scattering->setTexName(m_textures.transmittance_texture);      m_mie_scattering->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D);  }; diff --git a/indra/newview/llenvadapters.h b/indra/newview/llenvadapters.h index 1547e38b1d..c53423c5ae 100644 --- a/indra/newview/llenvadapters.h +++ b/indra/newview/llenvadapters.h @@ -354,6 +354,60 @@ private:      std::string mName;  }; +class LLDensityProfileSettingsAdapter +{ +public: +    LLDensityProfileSettingsAdapter(const std::string& config, int layerIndex = 0) +    : mConfig(config) +    , mLayerIndex(layerIndex) +    , mLayerWidth(1.0f, LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH) +    , mExpTerm(1.0f, LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM) +    , mExpScale(1.0f, LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR) +    , mLinTerm(1.0f, LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM) +    , mConstantTerm(1.0f, LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM) +    {} + +protected: +    std::string     mConfig; +    int             mLayerIndex; +    WLFloatControl  mLayerWidth; // 0.0 -> to top of atmosphere, however big that may be. +    WLFloatControl  mExpTerm; +    WLFloatControl  mExpScale; +    WLFloatControl  mLinTerm; +    WLFloatControl  mConstantTerm; +}; + +class LLRayleighDensityProfileSettingsAdapter : public LLDensityProfileSettingsAdapter +{ +public: +    LLRayleighDensityProfileSettingsAdapter(int layerIndex = 0) +    : LLDensityProfileSettingsAdapter(LLSettingsSky::SETTING_RAYLEIGH_CONFIG, layerIndex) +    { +    } +}; + +class LLMieDensityProfileSettingsAdapter : public LLDensityProfileSettingsAdapter +{ +public: +    LLMieDensityProfileSettingsAdapter(int layerIndex = 0) +    : LLDensityProfileSettingsAdapter(LLSettingsSky::SETTING_MIE_CONFIG, layerIndex) +    , mAnisotropy(0.8f, LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR) +    { +    } + +protected: +    WLFloatControl  mAnisotropy; +}; + +class LLAbsorptionDensityProfileSettingsAdapter : public LLDensityProfileSettingsAdapter +{ +public: +    LLAbsorptionDensityProfileSettingsAdapter(int layerIndex = 0) +    : LLDensityProfileSettingsAdapter(LLSettingsSky::SETTING_ABSORPTION_CONFIG, layerIndex) +    { +    } +}; +  //-------------------------------------------------------------------------  class LLSkySettingsAdapter  { diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index c67fcf880e..1936a67a18 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -1157,7 +1157,15 @@ void LLEnvironment::legacyLoadAllPresets()                  std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), true));                  LLSettingsDay::ptr_t day = LLSettingsVODay::buildFromLegacyPreset(name, data); -                LLEnvironment::instance().addDayCycle(day); +                if (day->validate()) +                { +                    LL_INFOS() << "Adding Day Cycle " << name << "." << LL_ENDL; +                    LLEnvironment::instance().addDayCycle(day); +                } +                else +                { +                    LL_WARNS() << "Day Cycle " << name << " was not valid. Ignoring." << LL_ENDL; +                }  #ifdef EXPORT_PRESETS                  std::string exportfile = LLURI::escape(name) + "(new).xml"; diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index f57de011f8..4c10017a57 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -331,13 +331,15 @@ LLSettingsBase::ptr_t LLSettingsVOBase::importFile(const std::string &filename)  //========================================================================= -LLSettingsVOSky::LLSettingsVOSky(const LLSD &data): -    LLSettingsSky(data) +LLSettingsVOSky::LLSettingsVOSky(const LLSD &data, bool isAdvanced) +: LLSettingsSky(data) +, m_isAdvanced(isAdvanced)  {  } -LLSettingsVOSky::LLSettingsVOSky(): -    LLSettingsSky() +LLSettingsVOSky::LLSettingsVOSky() +: LLSettingsSky() +, m_isAdvanced(false)  {  } @@ -354,7 +356,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildSky(LLSD settings)          LLSettingsSky::ptr_t();      } -    return std::make_shared<LLSettingsVOSky>(settings); +    return std::make_shared<LLSettingsVOSky>(settings, true);  } @@ -376,7 +378,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &n      LLSettingsSky::ptr_t skyp = std::make_shared<LLSettingsVOSky>(newsettings);  #ifdef VERIFY_LEGACY_CONVERSION -    LLSD oldsettings = LLSettingsVOSky::convertToLegacy(skyp); +    LLSD oldsettings = LLSettingsVOSky::convertToLegacy(skyp, isAdvanced());      if (!llsd_equals(legacy, oldsettings))      { @@ -423,7 +425,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildClone()      return skyp;  } -LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky) +LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky, bool isAdvanced)  {      LLSD legacy(LLSD::emptyMap());      LLSD settings = psky->getSettings(); @@ -940,7 +942,7 @@ LLSD LLSettingsVODay::convertToLegacy(const LLSettingsVODay::ptr_t &pday)      for (std::map<std::string, LLSettingsSky::ptr_t>::iterator its = skys.begin(); its != skys.end(); ++its)      { -        LLSD llsdsky = LLSettingsVOSky::convertToLegacy((*its).second); +        LLSD llsdsky = LLSettingsVOSky::convertToLegacy((*its).second, false);          llsdsky[SETTING_NAME] = (*its).first;          llsdskylist[(*its).first] = llsdsky; diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h index 7f8dc40c36..48b5cad168 100644 --- a/indra/newview/llsettingsvo.h +++ b/indra/newview/llsettingsvo.h @@ -79,7 +79,7 @@ private:  class LLSettingsVOSky : public LLSettingsSky  {  public: -    LLSettingsVOSky(const LLSD &data); +    LLSettingsVOSky(const LLSD &data, bool advanced = false);      static ptr_t    buildSky(LLSD settings); @@ -87,7 +87,10 @@ public:      static ptr_t    buildDefaultSky();      virtual ptr_t   buildClone() override; -    static LLSD     convertToLegacy(const ptr_t &); +    static LLSD     convertToLegacy(const ptr_t &, bool isAdvanced); + +    bool isAdvanced() const { return  m_isAdvanced; } +  protected:      LLSettingsVOSky(); @@ -97,6 +100,7 @@ protected:      virtual parammapping_t getParameterMap() const override; +    bool m_isAdvanced = false;  };  //========================================================================= diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index f27bfcb959..61500aebfe 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -665,8 +665,7 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo  	// Sunlight attenuation effect (hue and brightness) due to atmosphere  	// this is used later for sunlight modulation at various altitudes -	LLColor3 light_atten = -		(blue_density * 1.0 + smear(haze_density * 0.25f)) * (density_multiplier * max_y); +	LLColor3 light_atten = (blue_density * 1.0 + smear(haze_density * 0.25f)) * (density_multiplier * max_y);  	// Calculate relative weights  	LLColor3 temp2(0.f, 0.f, 0.f); @@ -704,9 +703,7 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo  	// Haze color above cloud -	vary_HazeColor = (blue_horizon * blue_weight * (sunlight + ambient) -				+ componentMult(haze_horizon * haze_weight, sunlight * temp2.mV[0] + ambient) -			 );	 +	vary_HazeColor = (blue_horizon * blue_weight * (sunlight + ambient) + componentMult(haze_horizon * haze_weight, sunlight * temp2.mV[0] + ambient));	  	// Increase ambient when there are more clouds  	LLColor3 tmpAmbient = ambient + (LLColor3::white - ambient) * cloud_shadow * 0.5f; @@ -715,9 +712,7 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo  	sunlight *= (1.f - cloud_shadow);  	// Haze color below cloud -	LLColor3 additiveColorBelowCloud = (blue_horizon * blue_weight * (sunlight + tmpAmbient) -				+ componentMult(haze_horizon * haze_weight, sunlight * temp2.mV[0] + tmpAmbient) -			 );	 +	LLColor3 additiveColorBelowCloud = (blue_horizon * blue_weight * (sunlight + tmpAmbient) + componentMult(haze_horizon * haze_weight, sunlight * temp2.mV[0] + tmpAmbient));	  	// Final atmosphere additive  	componentMultBy(vary_HazeColor, LLColor3::white - temp1); @@ -731,8 +726,7 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo  	temp1 = componentSqrt(temp1);	//less atmos opacity (more transparency) below clouds  	// At horizon, blend high altitude sky color towards the darker color below the clouds -	vary_HazeColor += -		componentMult(additiveColorBelowCloud - vary_HazeColor, LLColor3::white - componentSqrt(temp1)); +	vary_HazeColor += componentMult(additiveColorBelowCloud - vary_HazeColor, LLColor3::white - componentSqrt(temp1));  	if (Pn[1] < 0.f)  	{  | 
