diff options
Diffstat (limited to 'indra')
91 files changed, 4094 insertions, 418 deletions
diff --git a/indra/cmake/Atmosphere.cmake b/indra/cmake/Atmosphere.cmake new file mode 100644 index 0000000000..0975e3df02 --- /dev/null +++ b/indra/cmake/Atmosphere.cmake @@ -0,0 +1,5 @@ +# -*- cmake -*- +include(Prebuilt) +use_prebuilt_binary(libatmosphere) +set(LIBATMOSPHERE_LIBRARIES libatmosphere) +set(LIBATMOSPHERE_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/atmosphere) diff --git a/indra/cmake/LLRender.cmake b/indra/cmake/LLRender.cmake index 868922451f..0940d1de63 100644 --- a/indra/cmake/LLRender.cmake +++ b/indra/cmake/LLRender.cmake @@ -3,6 +3,7 @@ include(Variables) include(FreeType) include(GLH) +include(Atmosphere) set(LLRENDER_INCLUDE_DIRS ${LIBS_OPEN_DIR}/llrender diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp index 2cf86bb4fe..3dbab22de1 100644 --- a/indra/llappearance/lltexlayer.cpp +++ b/indra/llappearance/lltexlayer.cpp @@ -1578,7 +1578,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC alpha_data = new U8[width * height]; mAlphaCache[cache_index] = alpha_data; glReadPixels(x, y, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, alpha_data); - } + } getTexLayerSet()->getAvatarAppearance()->dirtyMesh(); diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 901c8dbe8e..abe1a1a04a 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -343,7 +343,7 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida { std::stringstream errtext; - errtext << "Settings LLSD fails validation and could not be corrected for '" << test.getName() << "'!"; + errtext << "Settings LLSD fails validation and could not be corrected for '" << test.getName() << "'!\n"; errors.append( errtext.str() ); isValid = false; } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index c7ed9e9e21..c34d365a0b 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -149,16 +149,16 @@ public: // Note this method is marked const but may modify the settings object. // (note the internal const cast). This is so that it may be called without // special consideration from getters. - inline void update() const + inline void update() const { if (!mDirty) return; (const_cast<LLSettingsBase *>(this))->updateSettings(); } - virtual void blend(const ptr_t &end, F64 blendf) = 0; + virtual void blend(const ptr_t &end, F64 blendf) = 0; - virtual bool validate(); + virtual bool validate(); class Validator { @@ -231,16 +231,16 @@ protected: virtual parammapping_t getParameterMap() const { return parammapping_t(); } - LLSD mSettings; - bool mIsValid; + LLSD mSettings; + bool mIsValid; LLAssetID mAssetID; - LLSD cloneSettings() const; + LLSD cloneSettings() const; private: - bool mDirty; + bool mDirty; - LLSD combineSDMaps(const LLSD &first, const LLSD &other) const; + LLSD combineSDMaps(const LLSD &first, const LLSD &other) const; }; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 18add703cb..b437ac57bd 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -268,12 +268,30 @@ LLSD LLSettingsDay::defaults() LLSD dfltsetting; dfltsetting[SETTING_NAME] = "_default_"; - dfltsetting[SETTING_TRACKS] = LLSDArray( - LLSDArray(LLSDMap(SETTING_KEYKFRAME, LLSD::Real(0.0f))(SETTING_KEYNAME, "_default_")) - (LLSDMap(SETTING_KEYKFRAME, LLSD::Real(0.0f))(SETTING_KEYNAME, "_default_"))); - dfltsetting[SETTING_FRAMES] = LLSD::emptyMap(); + + LLSD waterTrack; + waterTrack[SETTING_KEYKFRAME] = 0.0f; + waterTrack[SETTING_KEYNAME] = "_default_"; + + LLSD skyTrack; + skyTrack[SETTING_KEYKFRAME] = 0.0f; + skyTrack[SETTING_KEYNAME] = "_default_"; + + LLSD tracks; + tracks.append(LLSDArray(waterTrack)); + tracks.append(LLSDArray(skyTrack)); + + dfltsetting[SETTING_TRACKS] = tracks; + + LLSD frames(LLSD::emptyMap()); + + frames["water:_defaults_"] = LLSettingsWater::defaults(); + frames["sky:_defaults_"] = LLSettingsSky::defaults(); + + dfltsetting[SETTING_FRAMES] = frames; dfltsetting[SETTING_TYPE] = "daycycle"; + return dfltsetting; } @@ -299,6 +317,8 @@ namespace S32 index = 0; while (index < (*track).size()) { + LLSD& elem = (*track)[index]; + ++framecount; if (index >= LLSettingsDay::FRAME_MAX) { @@ -306,40 +326,46 @@ namespace continue; } - if (!(*track)[index].has(LLSettingsDay::SETTING_KEYKFRAME) || - !(*track)[index][LLSettingsDay::SETTING_KEYKFRAME].isReal()) + if (!elem.has(LLSettingsDay::SETTING_KEYKFRAME)) + { + (*track).erase(index); + continue; + } + + if (!elem[LLSettingsDay::SETTING_KEYKFRAME].isReal()) { (*track).erase(index); continue; } - if (!(*track)[index].has(LLSettingsDay::SETTING_KEYNAME) && - !(*track)[index].has(LLSettingsDay::SETTING_KEYID)) + if (!elem.has(LLSettingsDay::SETTING_KEYNAME) && + !elem.has(LLSettingsDay::SETTING_KEYID)) { (*track).erase(index); continue; } - F32 frame = (*track)[index][LLSettingsDay::SETTING_KEYKFRAME].asReal(); + F32 frame = elem[LLSettingsDay::SETTING_KEYKFRAME].asReal(); if ((frame < 0.0) || (frame > 1.0)) { frame = llclamp(frame, 0.0f, 1.0f); - (*track)[index][LLSettingsDay::SETTING_KEYKFRAME] = frame; + elem[LLSettingsDay::SETTING_KEYKFRAME] = frame; } ++index; } } - framecount -= value[0].size(); + int waterTracks = value[0].size(); + int skyTracks = framecount - waterTracks; - if (value[0].size() < 1) + if (waterTracks < 1) { LL_WARNS("SETTINGS") << "Missing water track" << LL_ENDL; return false; } - if (framecount < 1) + if (skyTracks < 1) { LL_WARNS("SETTINGS") << "Missing sky tracks" << LL_ENDL; return false; diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 572b5703b3..c2d92fdd38 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -54,9 +54,14 @@ const F32 LLSettingsSky::NIGHTTIME_ELEVATION_COS((F32)sin(NIGHTTIME_ELEVATION*DE //========================================================================= const std::string LLSettingsSky::SETTING_AMBIENT("ambient"); -const std::string LLSettingsSky::SETTING_BLOOM_TEXTUREID("bloom_id"); const std::string LLSettingsSky::SETTING_BLUE_DENSITY("blue_density"); const std::string LLSettingsSky::SETTING_BLUE_HORIZON("blue_horizon"); +const std::string LLSettingsSky::SETTING_DENSITY_MULTIPLIER("density_multiplier"); +const std::string LLSettingsSky::SETTING_DISTANCE_MULTIPLIER("distance_multiplier"); +const std::string LLSettingsSky::SETTING_HAZE_DENSITY("haze_density"); +const std::string LLSettingsSky::SETTING_HAZE_HORIZON("haze_horizon"); + +const std::string LLSettingsSky::SETTING_BLOOM_TEXTUREID("bloom_id"); const std::string LLSettingsSky::SETTING_CLOUD_COLOR("cloud_color"); const std::string LLSettingsSky::SETTING_CLOUD_POS_DENSITY1("cloud_pos_density1"); const std::string LLSettingsSky::SETTING_CLOUD_POS_DENSITY2("cloud_pos_density2"); @@ -64,14 +69,12 @@ const std::string LLSettingsSky::SETTING_CLOUD_SCALE("cloud_scale"); const std::string LLSettingsSky::SETTING_CLOUD_SCROLL_RATE("cloud_scroll_rate"); const std::string LLSettingsSky::SETTING_CLOUD_SHADOW("cloud_shadow"); const std::string LLSettingsSky::SETTING_CLOUD_TEXTUREID("cloud_id"); -const std::string LLSettingsSky::SETTING_DENSITY_MULTIPLIER("density_multiplier"); -const std::string LLSettingsSky::SETTING_DISTANCE_MULTIPLIER("distance_multiplier"); + const std::string LLSettingsSky::SETTING_DOME_OFFSET("dome_offset"); const std::string LLSettingsSky::SETTING_DOME_RADIUS("dome_radius"); const std::string LLSettingsSky::SETTING_GAMMA("gamma"); const std::string LLSettingsSky::SETTING_GLOW("glow"); -const std::string LLSettingsSky::SETTING_HAZE_DENSITY("haze_density"); -const std::string LLSettingsSky::SETTING_HAZE_HORIZON("haze_horizon"); + const std::string LLSettingsSky::SETTING_LIGHT_NORMAL("lightnorm"); const std::string LLSettingsSky::SETTING_MAX_Y("max_y"); const std::string LLSettingsSky::SETTING_MOON_ROTATION("moon_rotation"); @@ -79,12 +82,28 @@ const std::string LLSettingsSky::SETTING_MOON_TEXTUREID("moon_id"); const std::string LLSettingsSky::SETTING_STAR_BRIGHTNESS("star_brightness"); const std::string LLSettingsSky::SETTING_SUNLIGHT_COLOR("sunlight_color"); const std::string LLSettingsSky::SETTING_SUN_ROTATION("sun_rotation"); -const std::string LLSettingsSky::SETTING_SUN_TEXUTUREID("sun_id"); +const std::string LLSettingsSky::SETTING_SUN_TEXTUREID("sun_id"); const std::string LLSettingsSky::SETTING_LEGACY_EAST_ANGLE("east_angle"); const std::string LLSettingsSky::SETTING_LEGACY_ENABLE_CLOUD_SCROLL("enable_cloud_scroll"); const std::string LLSettingsSky::SETTING_LEGACY_SUN_ANGLE("sun_angle"); +// these are new settings for the advanced atmospherics model +const std::string LLSettingsSky::SETTING_PLANET_RADIUS("planet_radius"); +const std::string LLSettingsSky::SETTING_SKY_BOTTOM_RADIUS("sky_bottom_radius"); +const std::string LLSettingsSky::SETTING_SKY_TOP_RADIUS("sky_top_radius"); +const std::string LLSettingsSky::SETTING_RAYLEIGH_CONFIG("rayleigh"); +const std::string LLSettingsSky::SETTING_MIE_CONFIG("mie"); +const std::string LLSettingsSky::SETTING_ABSORPTION_CONFIG("absorption"); +const std::string LLSettingsSky::KEY_DENSITY_PROFILE("density"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH("width"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM("exp_term"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR("exp_scale"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM("linear_term"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM("constant_term"); +const std::string LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR("anisotropy"); +const std::string LLSettingsSky::SETTING_SUN_ARC_RADIANS("sun_arc_radians"); + //========================================================================= LLSettingsSky::LLSettingsSky(const LLSD &data) : LLSettingsBase(data) @@ -144,6 +163,78 @@ LLSettingsSky::stringset_t LLSettingsSky::getSlerpKeys() const return slepSet; } +LLSettingsSky::validation_list_t LLSettingsSky::rayleighValidationList() +{ + static validation_list_t rayleighValidation; + if (rayleighValidation.empty()) + { + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); + + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); + + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + } + return rayleighValidation; +} + +LLSettingsSky::validation_list_t LLSettingsSky::absorptionValidationList() +{ + static validation_list_t absorptionValidation; + if (absorptionValidation.empty()) + { + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); + + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); + + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + } + return absorptionValidation; +} + +LLSettingsSky::validation_list_t LLSettingsSky::mieValidationList() +{ + static validation_list_t mieValidation; + if (mieValidation.empty()) + { + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); + + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); + + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + + mieValidation.push_back(Validator(SETTING_MIE_ANISOTROPY_FACTOR, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + } + return mieValidation; +} + LLSettingsSky::validation_list_t LLSettingsSky::getValidationList() const { return LLSettingsSky::validationList(); @@ -158,12 +249,12 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() // copy constructor for LLSDArray. Directly binding the LLSDArray as // a parameter without first wrapping it in a pure LLSD object will result // in deeply nested arrays like this [[[[[[[[[[v1,v2,v3]]]]]]]]]] - + +#if SUPPORT_LEGACY_ATMOSPHERICS validation.push_back(Validator(SETTING_AMBIENT, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); - validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_BLUE_DENSITY, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), @@ -172,6 +263,18 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); + validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); + validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); + validation.push_back(Validator(SETTING_HAZE_DENSITY, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); + validation.push_back(Validator(SETTING_HAZE_HORIZON, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + +#endif + + validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_CLOUD_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), @@ -193,10 +296,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_CLOUD_SHADOW, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); validation.push_back(Validator(SETTING_CLOUD_TEXTUREID, false, LLSD::TypeUUID)); - validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); - validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); + validation.push_back(Validator(SETTING_DOME_OFFSET, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); validation.push_back(Validator(SETTING_DOME_RADIUS, false, LLSD::TypeReal, @@ -207,10 +307,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.2f)("*")(-2.5f)("*")), LLSD(LLSDArray(20.0f)("*")(0.0f)("*"))))); - validation.push_back(Validator(SETTING_HAZE_DENSITY, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); - validation.push_back(Validator(SETTING_HAZE_HORIZON, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_LIGHT_NORMAL, false, LLSD::TypeArray, boost::bind(&Validator::verifyVectorNormalized, _1, 3))); validation.push_back(Validator(SETTING_MAX_Y, true, LLSD::TypeReal, @@ -224,12 +321,69 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); validation.push_back(Validator(SETTING_SUN_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); - validation.push_back(Validator(SETTING_SUN_TEXUTUREID, false, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_SUN_TEXTUREID, false, LLSD::TypeUUID)); + + validation.push_back(Validator(SETTING_PLANET_RADIUS, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(32768.0f))))); + + validation.push_back(Validator(SETTING_SKY_BOTTOM_RADIUS, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(32768.0f))))); + + validation.push_back(Validator(SETTING_SKY_TOP_RADIUS, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(32768.0f))))); + + validation.push_back(Validator(SETTING_SUN_ARC_RADIANS, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.1f))))); } return validation; } +LLSD LLSettingsSky::rayleighConfigDefault() +{ + LLSD dflt_rayleigh; + dflt_rayleigh[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; + dflt_rayleigh[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_rayleigh[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + return dflt_rayleigh; +} + +LLSD LLSettingsSky::absorptionConfigDefault() +{ +// absorption (ozone) has two linear ramping zones + LLSD dflt_absorption_layer_a; + dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_WIDTH] = 25000.0f; // 0 -> the entire atmosphere + dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; + dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; + dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 25000.0f; + dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = -2.0f / 3.0f; + + LLSD dflt_absorption_layer_b; + dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> remainder of the atmosphere + dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; + dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; + dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 15000.0f; + dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 8.0f / 3.0f; + + LLSD dflt_absorption; + dflt_absorption.append(dflt_absorption_layer_a); + dflt_absorption.append(dflt_absorption_layer_b); + return dflt_absorption; +} + +LLSD LLSettingsSky::mieConfigDefault() +{ + LLSD dflt_mie; + dflt_mie[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_mie[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_mie[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f; + dflt_mie[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_mie[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + dflt_mie[SETTING_MIE_ANISOTROPY_FACTOR] = 0.9f; + return dflt_mie; +} LLSD LLSettingsSky::defaults() { @@ -241,23 +395,28 @@ LLSD LLSettingsSky::defaults() LLQuaternion moonquat = ~sunquat; // Magic constants copied form dfltsetting.xml +#if SUPPORT_LEGACY_ATMOSPHERICS dfltsetting[SETTING_AMBIENT] = LLColor4::white.getValue(); dfltsetting[SETTING_BLUE_DENSITY] = LLColor4(0.2447, 0.4487, 0.7599, 0.0).getValue(); dfltsetting[SETTING_BLUE_HORIZON] = LLColor4(0.4954, 0.4954, 0.6399, 0.0).getValue(); + dfltsetting[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(0.0001); + dfltsetting[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(0.8000); + dfltsetting[SETTING_HAZE_DENSITY] = LLSD::Real(0.6999); + dfltsetting[SETTING_HAZE_HORIZON] = LLSD::Real(0.1899); +#endif + dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199); dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(10.1999)(10.0109); dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699); - dfltsetting[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(0.0001); - dfltsetting[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(0.8000); + dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f); dfltsetting[SETTING_DOME_RADIUS] = LLSD::Real(15000.f); dfltsetting[SETTING_GAMMA] = LLSD::Real(1.0); dfltsetting[SETTING_GLOW] = LLColor4(5.000, 0.0010, -0.4799, 1.0).getValue(); - dfltsetting[SETTING_HAZE_DENSITY] = LLSD::Real(0.6999); - dfltsetting[SETTING_HAZE_HORIZON] = LLSD::Real(0.1899); + dfltsetting[SETTING_LIGHT_NORMAL] = LLVector3(0.0000, 0.9126, -0.4086).getValue(); dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); @@ -268,17 +427,164 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; dfltsetting[SETTING_CLOUD_TEXTUREID] = LLUUID::null; dfltsetting[SETTING_MOON_TEXTUREID] = IMG_MOON; // gMoonTextureID; // These two are returned by the login... wow! - dfltsetting[SETTING_SUN_TEXUTUREID] = IMG_SUN; // gSunTextureID; + dfltsetting[SETTING_SUN_TEXTUREID] = IMG_SUN; // gSunTextureID; dfltsetting[SETTING_TYPE] = "sky"; + // defaults are for earth... + dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; + dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; + dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); + dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); + dfltsetting[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); + return dfltsetting; } +#pragma optimize("", off) + +LLSD LLSettingsSky::settingValidation(LLSD &settingsIn, validation_list_t &validations) +{ + // Make a copy we can safely modify + LLSD settings = settingsIn; + + validation_list_t& rayleighValidations = rayleighValidationList(); + validation_list_t& absorptionValidations = absorptionValidationList(); + validation_list_t& mieValidations = mieValidationList(); + + bool isValid = true; + + LLSD& rayleighConfigs = settings[SETTING_RAYLEIGH_CONFIG]; + LLSD& mieConfigs = settings[SETTING_MIE_CONFIG]; + LLSD& absorptionConfigs = settings[SETTING_ABSORPTION_CONFIG]; + +// this is an attempt to handle a single defined layer (w/o array elem) +// but also handle an array of density profiles if they are specified thus. + if (rayleighConfigs.isArray()) + { + for (LLSD::array_iterator it = rayleighConfigs.beginArray(); it != rayleighConfigs.endArray(); ++it) + { + LLSD rayleighResults = LLSettingsBase::settingValidation(*it, rayleighValidations); + if (!rayleighResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + } + else + { + LLSD rayleighResults = LLSettingsBase::settingValidation(rayleighConfigs, rayleighValidations); + if (!rayleighResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + + if (mieConfigs.isArray()) + { + for (LLSD::array_iterator it = mieConfigs.beginArray(); it != mieConfigs.endArray(); ++it) + { + LLSD mieResults = LLSettingsBase::settingValidation(*it, mieValidations); + if (!mieResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + } + else + { + LLSD mieResults = LLSettingsBase::settingValidation(mieConfigs, mieValidations); + if (!mieResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + + if (absorptionConfigs.isArray()) + { + for (LLSD::array_iterator it = absorptionConfigs.beginArray(); it != absorptionConfigs.endArray(); ++it) + { + LLSD absorptionResults = LLSettingsBase::settingValidation(*it, absorptionValidations); + if (!absorptionResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + } + else + { + LLSD absorptionResults = LLSettingsBase::settingValidation(absorptionConfigs, absorptionValidations); + if (!absorptionResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + +#if 0 + LLSD& rayleigh = settings[SETTING_RAYLEIGH_CONFIG]; + LLSD& absorption = settings[SETTING_ABSORPTION_CONFIG]; + LLSD& mie = settings[SETTING_MIE_CONFIG]; + LLSD rayleighResults = LLSettingsBase::settingValidation(rayleigh, rayleighValidations); + LLSD absorptionResults = LLSettingsBase::settingValidation(absorption, absorptionValidations); + LLSD mieResults = LLSettingsBase::settingValidation(mie, mieValidations); + + if (!rayleighResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + + if (!absorptionResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + + if (!mieResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } +#endif + + settings.erase(SETTING_RAYLEIGH_CONFIG); + settings.erase(SETTING_ABSORPTION_CONFIG); + settings.erase(SETTING_MIE_CONFIG); + + if (isValid) + { + return LLSettingsBase::settingValidation(settings, validations); + } + + return LLSDMap("success", LLSD::Boolean(false)); +} + +#pragma optimize("", on) + LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { LLSD newsettings(defaults()); +// AdvancedAtmospherics TODO +// These need to be translated into density profile info in the new settings format... +#if SUPPORT_LEGACY_ATMOSPHERICS if (legacy.has(SETTING_AMBIENT)) { newsettings[SETTING_AMBIENT] = LLColor3(legacy[SETTING_AMBIENT]).getValue(); @@ -291,6 +597,39 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { newsettings[SETTING_BLUE_HORIZON] = LLColor3(legacy[SETTING_BLUE_HORIZON]).getValue(); } + if (legacy.has(SETTING_DENSITY_MULTIPLIER)) + { + newsettings[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(legacy[SETTING_DENSITY_MULTIPLIER][0].asReal()); + } + if (legacy.has(SETTING_DISTANCE_MULTIPLIER)) + { + newsettings[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(legacy[SETTING_DISTANCE_MULTIPLIER][0].asReal()); + } + if (legacy.has(SETTING_HAZE_DENSITY)) + { + newsettings[SETTING_HAZE_DENSITY] = LLSD::Real(legacy[SETTING_HAZE_DENSITY][0].asReal()); + } + if (legacy.has(SETTING_HAZE_HORIZON)) + { + newsettings[SETTING_HAZE_HORIZON] = LLSD::Real(legacy[SETTING_HAZE_HORIZON][0].asReal()); + } +#endif + + if (!legacy.has(SETTING_RAYLEIGH_CONFIG)) + { + newsettings[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); + } + + if (!legacy.has(SETTING_ABSORPTION_CONFIG)) + { + newsettings[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); + } + + if (!legacy.has(SETTING_MIE_CONFIG)) + { + newsettings[SETTING_MIE_CONFIG] = mieConfigDefault(); + } + if (legacy.has(SETTING_CLOUD_COLOR)) { newsettings[SETTING_CLOUD_COLOR] = LLColor3(legacy[SETTING_CLOUD_COLOR]).getValue(); @@ -326,14 +665,8 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { newsettings[SETTING_CLOUD_SHADOW] = LLSD::Real(legacy[SETTING_CLOUD_SHADOW][0].asReal()); } - if (legacy.has(SETTING_DENSITY_MULTIPLIER)) - { - newsettings[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(legacy[SETTING_DENSITY_MULTIPLIER][0].asReal()); - } - if (legacy.has(SETTING_DISTANCE_MULTIPLIER)) - { - newsettings[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(legacy[SETTING_DISTANCE_MULTIPLIER][0].asReal()); - } + + if (legacy.has(SETTING_GAMMA)) { newsettings[SETTING_GAMMA] = legacy[SETTING_GAMMA][0].asReal(); @@ -342,14 +675,7 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { newsettings[SETTING_GLOW] = LLColor3(legacy[SETTING_GLOW]).getValue(); } - if (legacy.has(SETTING_HAZE_DENSITY)) - { - newsettings[SETTING_HAZE_DENSITY] = LLSD::Real(legacy[SETTING_HAZE_DENSITY][0].asReal()); - } - if (legacy.has(SETTING_HAZE_HORIZON)) - { - newsettings[SETTING_HAZE_HORIZON] = LLSD::Real(legacy[SETTING_HAZE_HORIZON][0].asReal()); - } + if (legacy.has(SETTING_LIGHT_NORMAL)) { newsettings[SETTING_LIGHT_NORMAL] = LLVector3(legacy[SETTING_LIGHT_NORMAL]).getValue(); @@ -367,6 +693,44 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) newsettings[SETTING_SUNLIGHT_COLOR] = LLColor4(legacy[SETTING_SUNLIGHT_COLOR]).getValue(); } + if (legacy.has(SETTING_PLANET_RADIUS)) + { + newsettings[SETTING_PLANET_RADIUS] = LLSD::Real(legacy[SETTING_PLANET_RADIUS].asReal()); + } + else + { + newsettings[SETTING_PLANET_RADIUS] = 6360.0f; + } + + if (legacy.has(SETTING_SKY_BOTTOM_RADIUS)) + { + newsettings[SETTING_SKY_BOTTOM_RADIUS] = LLSD::Real(legacy[SETTING_SKY_BOTTOM_RADIUS].asReal()); + } + else + { + newsettings[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; + } + + if (legacy.has(SETTING_SKY_TOP_RADIUS)) + { + newsettings[SETTING_SKY_TOP_RADIUS] = LLSD::Real(legacy[SETTING_SKY_TOP_RADIUS].asReal()); + } + else + { + newsettings[SETTING_SKY_TOP_RADIUS] = 6420.0f; + } + + if (legacy.has(SETTING_SUN_ARC_RADIANS)) + { + newsettings[SETTING_SUN_ARC_RADIANS] = LLSD::Real(legacy[SETTING_SUN_ARC_RADIANS].asReal()); + } + else + { + newsettings[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; + } + + + if (legacy.has(SETTING_LEGACY_EAST_ANGLE) && legacy.has(SETTING_LEGACY_SUN_ANGLE)) { // convert the east and sun angles into a quaternion. F32 azimuth = legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); @@ -435,6 +799,8 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() void LLSettingsSky::calculateLightSettings() { + +#if SUPPORT_LEGACY_ATMOSPHERICS LLColor3 vary_HazeColor; LLColor3 vary_SunlightColor; LLColor3 vary_AmbientColor; @@ -523,6 +889,8 @@ void LLSettingsSky::calculateLightSettings() mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; mFadeColor.setAlpha(0); +#endif + } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 3c6dbdb76d..df6a310647 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -31,6 +31,8 @@ #include "llsettingsbase.h" #include "v4coloru.h" +#define SUPPORT_LEGACY_ATMOSPHERICS 1 + class LLSettingsSky: public LLSettingsBase { public: @@ -38,6 +40,11 @@ public: static const std::string SETTING_BLOOM_TEXTUREID; static const std::string SETTING_BLUE_DENSITY; static const std::string SETTING_BLUE_HORIZON; + static const std::string SETTING_DENSITY_MULTIPLIER; + static const std::string SETTING_DISTANCE_MULTIPLIER; + static const std::string SETTING_HAZE_DENSITY; + static const std::string SETTING_HAZE_HORIZON; + static const std::string SETTING_BLOOM_TEXTUREID; static const std::string SETTING_CLOUD_COLOR; static const std::string SETTING_CLOUD_POS_DENSITY1; static const std::string SETTING_CLOUD_POS_DENSITY2; @@ -50,9 +57,7 @@ public: static const std::string SETTING_DOME_OFFSET; static const std::string SETTING_DOME_RADIUS; static const std::string SETTING_GAMMA; - static const std::string SETTING_GLOW; - static const std::string SETTING_HAZE_DENSITY; - static const std::string SETTING_HAZE_HORIZON; + static const std::string SETTING_GLOW; static const std::string SETTING_LIGHT_NORMAL; static const std::string SETTING_MAX_Y; static const std::string SETTING_MOON_ROTATION; @@ -60,7 +65,24 @@ public: static const std::string SETTING_STAR_BRIGHTNESS; static const std::string SETTING_SUNLIGHT_COLOR; static const std::string SETTING_SUN_ROTATION; - static const std::string SETTING_SUN_TEXUTUREID; + static const std::string SETTING_SUN_TEXTUREID; + + static const std::string SETTING_PLANET_RADIUS; + static const std::string SETTING_SKY_BOTTOM_RADIUS; + static const std::string SETTING_SKY_TOP_RADIUS; + static const std::string SETTING_SUN_ARC_RADIANS; + + static const std::string SETTING_RAYLEIGH_CONFIG; + static const std::string SETTING_MIE_CONFIG; + static const std::string SETTING_ABSORPTION_CONFIG; + + static const std::string KEY_DENSITY_PROFILE; + static const std::string SETTING_DENSITY_PROFILE_WIDTH; + static const std::string SETTING_DENSITY_PROFILE_EXP_TERM; + static const std::string SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR; + static const std::string SETTING_DENSITY_PROFILE_LINEAR_TERM; + static const std::string SETTING_DENSITY_PROFILE_CONSTANT_TERM; + static const std::string SETTING_MIE_ANISOTROPY_FACTOR; typedef std::shared_ptr<LLSettingsSky> ptr_t; typedef std::pair<F32, F32> azimalt_t; @@ -81,7 +103,13 @@ public: static LLSD defaults(); + LLUUID getBloomTextureId() const + { + return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); + } + //--------------------------------------------------------------------- +#if SUPPORT_LEGACY_ATMOSPHERICS LLColor3 getAmbientColor() const { return LLColor3(mSettings[SETTING_AMBIENT]); @@ -117,6 +145,47 @@ public: setValue(SETTING_BLUE_HORIZON, val); } + F32 getDensityMultiplier() const + { + return mSettings[SETTING_DENSITY_MULTIPLIER].asReal(); + } + + void setDensityMultiplier(F32 val) + { + setValue(SETTING_DENSITY_MULTIPLIER, val); + } + + F32 getDistanceMultiplier() const + { + return mSettings[SETTING_DISTANCE_MULTIPLIER].asReal(); + } + + void setDistanceMultiplier(F32 val) + { + setValue(SETTING_DISTANCE_MULTIPLIER, val); + } + + F32 getHazeDensity() const + { + return mSettings[SETTING_HAZE_DENSITY].asReal(); + } + + void setHazeDensity(F32 val) + { + setValue(SETTING_HAZE_DENSITY, val); + } + + F32 getHazeHorizon() const + { + return mSettings[SETTING_HAZE_HORIZON].asReal(); + } + + void setHazeHorizon(F32 val) + { + setValue(SETTING_HAZE_HORIZON, val); + } +#endif + LLColor3 getCloudColor() const { return LLColor3(mSettings[SETTING_CLOUD_COLOR]); @@ -194,26 +263,7 @@ public: setValue(SETTING_CLOUD_SHADOW, val); } - F32 getDensityMultiplier() const - { - return mSettings[SETTING_DENSITY_MULTIPLIER].asReal(); - } - - void setDensityMultiplier(F32 val) - { - setValue(SETTING_DENSITY_MULTIPLIER, val); - } - - F32 getDistanceMultiplier() const - { - return mSettings[SETTING_DISTANCE_MULTIPLIER].asReal(); - } - - void setDistanceMultiplier(F32 val) - { - setValue(SETTING_DISTANCE_MULTIPLIER, val); - } - + F32 getDomeOffset() const { return DOME_OFFSET; @@ -247,26 +297,6 @@ public: setValue(SETTING_GLOW, val); } - F32 getHazeDensity() const - { - return mSettings[SETTING_HAZE_DENSITY].asReal(); - } - - void setHazeDensity(F32 val) - { - setValue(SETTING_HAZE_DENSITY, val); - } - - F32 getHazeHorizon() const - { - return mSettings[SETTING_HAZE_HORIZON].asReal(); - } - - void setHazeHorizon(F32 val) - { - setValue(SETTING_HAZE_HORIZON, val); - } - LLVector3 getLightNormal() const { return LLVector3(mSettings[SETTING_LIGHT_NORMAL]); @@ -347,7 +377,7 @@ public: LLUUID getSunTextureId() const { - return mSettings[SETTING_SUN_TEXUTUREID].asUUID(); + return mSettings[SETTING_SUN_TEXTUREID].asUUID(); } // Internal/calculated settings @@ -428,6 +458,15 @@ protected: virtual void updateSettings() override; private: + // validations for structured sections of sky settings data + static validation_list_t rayleighValidationList(); + static validation_list_t absorptionValidationList(); + static validation_list_t mieValidationList(); + + static LLSD rayleighConfigDefault(); + static LLSD absorptionConfigDefault(); + static LLSD mieConfigDefault(); + static const F32 NIGHTTIME_ELEVATION; static const F32 NIGHTTIME_ELEVATION_COS; diff --git a/indra/llmath/llquaternion.cpp b/indra/llmath/llquaternion.cpp index dcef2b345e..a8d9eba2a0 100644 --- a/indra/llmath/llquaternion.cpp +++ b/indra/llmath/llquaternion.cpp @@ -864,6 +864,26 @@ void LLQuaternion::getAngleAxis(F32* angle, LLVector3 &vec) const } } +const LLQuaternion& LLQuaternion::setFromAzimuthAndAltitude(F32 azimuthRadians, F32 altitudeRadians) +{ + // euler angle inputs are complements of azimuth/altitude which are measured from zenith + F32 pitch = llclamp(F_PI_BY_TWO - altitudeRadians, 0.0f, F_PI_BY_TWO); + F32 yaw = llclamp(F_PI_BY_TWO - azimuthRadians, 0.0f, F_PI_BY_TWO); + setEulerAngles(0.0f, pitch, yaw); + return *this; +} + +void LLQuaternion::getAzimuthAndAltitude(F32 &azimuthRadians, F32 &altitudeRadians) +{ + F32 rick_roll; + F32 pitch; + F32 yaw; + getEulerAngles(&rick_roll, &pitch, &yaw); + // make these measured from zenith + altitudeRadians = llclamp(F_PI_BY_TWO - pitch, 0.0f, F_PI_BY_TWO); + azimuthRadians = llclamp(F_PI_BY_TWO - yaw, 0.0f, F_PI_BY_TWO); +} + // quaternion does not need to be normalized void LLQuaternion::getEulerAngles(F32 *roll, F32 *pitch, F32 *yaw) const { diff --git a/indra/llmath/llquaternion.h b/indra/llmath/llquaternion.h index 11b6abf800..e2cdad548b 100644 --- a/indra/llmath/llquaternion.h +++ b/indra/llmath/llquaternion.h @@ -84,7 +84,8 @@ public: const LLQuaternion& set(const F32 *q); // Sets Quaternion to normalize(quat[VX], quat[VY], quat[VZ], quat[VW]) const LLQuaternion& set(const LLMatrix3 &mat); // Sets Quaternion to mat2quat(mat) const LLQuaternion& set(const LLMatrix4 &mat); // Sets Quaternion to mat2quat(mat) - + const LLQuaternion& setFromAzimuthAndAltitude(F32 azimuth, F32 altitude); + const LLQuaternion& setAngleAxis(F32 angle, F32 x, F32 y, F32 z); // Sets Quaternion to axis_angle2quat(angle, x, y, z) const LLQuaternion& setAngleAxis(F32 angle, const LLVector3 &vec); // Sets Quaternion to axis_angle2quat(angle, vec) const LLQuaternion& setAngleAxis(F32 angle, const LLVector4 &vec); // Sets Quaternion to axis_angle2quat(angle, vec) @@ -105,6 +106,7 @@ public: void getAngleAxis(F32* angle, F32* x, F32* y, F32* z) const; // returns rotation in radians about axis x,y,z void getAngleAxis(F32* angle, LLVector3 &vec) const; void getEulerAngles(F32 *roll, F32* pitch, F32 *yaw) const; + void getAzimuthAndAltitude(F32 &azimuth, F32 &altitude); F32 normalize(); // Normalizes Quaternion and returns magnitude F32 normQuat(); // deprecated diff --git a/indra/llplugin/llpluginprocesschild.cpp b/indra/llplugin/llpluginprocesschild.cpp index e24d222cb6..594793cf56 100644 --- a/indra/llplugin/llpluginprocesschild.cpp +++ b/indra/llplugin/llpluginprocesschild.cpp @@ -253,7 +253,7 @@ void LLPluginProcessChild::sleep(F64 seconds) } else { - ms_sleep((int)(seconds * 1000.0f)); + ms_sleep((int)(seconds * 1000.0f)); } } diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index 331f988382..dcfbd71dec 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -13,6 +13,7 @@ include(LLVFS) include(LLWindow) include(LLXML) include(LLVFS) +include(Atmosphere) include_directories( ${FREETYPE_INCLUDE_DIRS} @@ -24,6 +25,7 @@ include_directories( ${LLWINDOW_INCLUDE_DIRS} ${LLXML_INCLUDE_DIRS} ${LLVFS_INCLUDE_DIRS} + ${ATMOSPHERE_INCLUDE_DIR} ) include_directories(SYSTEM ${LLCOMMON_SYSTEM_INCLUDE_DIRS} @@ -31,6 +33,7 @@ include_directories(SYSTEM ) set(llrender_SOURCE_FILES + llatmosphere.cpp llcubemap.cpp llfontbitmapcache.cpp llfontfreetype.cpp @@ -56,6 +59,7 @@ set(llrender_SOURCE_FILES set(llrender_HEADER_FILES CMakeLists.txt + llatmosphere.h llcubemap.h llfontgl.h llfontfreetype.h @@ -103,7 +107,9 @@ if (BUILD_HEADLESS) ${LLXML_LIBRARIES} ${LLVFS_LIBRARIES} ${LLWINDOW_HEADLESS_LIBRARIES} - ${OPENGL_HEADLESS_LIBRARIES}) + ${LIBATMOSPHERE_LIBRARIES} + ${OPENGL_HEADLESS_LIBRARIES} + ) endif (BUILD_HEADLESS) @@ -126,5 +132,7 @@ target_link_libraries(llrender ${LLVFS_LIBRARIES} ${LLWINDOW_LIBRARIES} ${FREETYPE_LIBRARIES} - ${OPENGL_LIBRARIES}) + ${LIBATMOSPHERE_LIBRARIES} + ${OPENGL_LIBRARIES} + ) diff --git a/indra/llrender/llatmosphere.cpp b/indra/llrender/llatmosphere.cpp new file mode 100644 index 0000000000..8840f49454 --- /dev/null +++ b/indra/llrender/llatmosphere.cpp @@ -0,0 +1,221 @@ +/** + * @file llatmosphere.cpp + * @brief LLAtmosphere integration impl + * + * $LicenseInfo:firstyear=2018&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2018, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llatmosphere.h" +#include "llfasttimer.h" +#include "llsys.h" +#include "llglheaders.h" +#include "llrender.h" +#include "llshadermgr.h" +#include "llglslshader.h" + +LLAtmosphere* gAtmosphere = nullptr; + +void LLAtmosphere::initClass() +{ + if (!gAtmosphere) + { + gAtmosphere = new LLAtmosphere; + } +} + +void LLAtmosphere::cleanupClass() +{ + if(gAtmosphere) + { + delete gAtmosphere; + } + gAtmosphere = NULL; +} + +LLAtmosphere::LLAtmosphere() +{ + // Init libatmosphere model + m_config.num_scattering_orders = 4; + + // Values from "Reference Solar Spectral Irradiance: ASTM G-173", ETR column + // (see http://rredc.nrel.gov/solar/spectra/am1.5/ASTMG173/ASTMG173.html), + // summed and averaged in each bin (e.g. the value for 360nm is the average + // of the ASTM G-173 values for all wavelengths between 360 and 370nm). + // Values in W.m^-2. + const int kLambdaMin = 360; + const int kLambdaMax = 830; + const double kSolarIrradiance[48] = { + 1.11776, 1.14259, 1.01249, 1.14716, 1.72765, 1.73054, 1.6887, 1.61253, + 1.91198, 2.03474, 2.02042, 2.02212, 1.93377, 1.95809, 1.91686, 1.8298, + 1.8685, 1.8931, 1.85149, 1.8504, 1.8341, 1.8345, 1.8147, 1.78158, 1.7533, + 1.6965, 1.68194, 1.64654, 1.6048, 1.52143, 1.55622, 1.5113, 1.474, 1.4482, + 1.41018, 1.36775, 1.34188, 1.31429, 1.28303, 1.26758, 1.2367, 1.2082, + 1.18737, 1.14683, 1.12362, 1.1058, 1.07124, 1.04992 + }; + + // Values from http://www.iup.uni-bremen.de/gruppen/molspec/databases/ + // referencespectra/o3spectra2011/index.html for 233K, summed and averaged in + // each bin (e.g. the value for 360nm is the average of the original values + // for all wavelengths between 360 and 370nm). Values in m^2. + const double kOzoneCrossSection[48] = { + 1.18e-27, 2.182e-28, 2.818e-28, 6.636e-28, 1.527e-27, 2.763e-27, 5.52e-27, + 8.451e-27, 1.582e-26, 2.316e-26, 3.669e-26, 4.924e-26, 7.752e-26, 9.016e-26, + 1.48e-25, 1.602e-25, 2.139e-25, 2.755e-25, 3.091e-25, 3.5e-25, 4.266e-25, + 4.672e-25, 4.398e-25, 4.701e-25, 5.019e-25, 4.305e-25, 3.74e-25, 3.215e-25, + 2.662e-25, 2.238e-25, 1.852e-25, 1.473e-25, 1.209e-25, 9.423e-26, 7.455e-26, + 6.566e-26, 5.105e-26, 4.15e-26, 4.228e-26, 3.237e-26, 2.451e-26, 2.801e-26, + 2.534e-26, 1.624e-26, 1.465e-26, 2.078e-26, 1.383e-26, 7.105e-27 + }; + + // From https://en.wikipedia.org/wiki/Dobson_unit, in molecules.m^-2. + const double kDobsonUnit = 2.687e20; + + // Maximum number density of ozone molecules, in m^-3 (computed so at to get + // 300 Dobson units of ozone - for this we divide 300 DU by the integral of + // the ozone density profile defined below, which is equal to 15km). + const double kMaxOzoneNumberDensity = 300.0 * kDobsonUnit / 15000.0; + + const double kSunAngularRadius = 0.00935 / 2.0; + const double kBottomRadius = 6360000.0; + const double kTopRadius = 6420000.0; + const double kRayleigh = 1.24062e-6; + const double kRayleighScaleHeight = 8000.0; + const double kMieScaleHeight = 1200.0; + const double kMieAngstromAlpha = 0.0; + const double kMieAngstromBeta = 5.328e-3; + const double kMieSingleScatteringAlbedo = 0.9; + const double kMiePhaseFunctionG = 0.8; + const double max_sun_zenith_angle = F_PI * 2.0 / 3.0; + + atmosphere::DensityProfileLayer rayleigh_density(0.0, 1.0, -1.0 / kRayleighScaleHeight, 0.0, 0.0); + atmosphere::DensityProfileLayer mie_density(0.0, 1.0, -1.0 / kMieScaleHeight, 0.0, 0.0); + + // Density profile increasing linearly from 0 to 1 between 10 and 25km, and + // decreasing linearly from 1 to 0 between 25 and 40km. This is an approximate + // profile from http://www.kln.ac.lk/science/Chemistry/Teaching_Resources/ + // Documents/Introduction%20to%20atmospheric%20chemistry.pdf (page 10). + std::vector<atmosphere::DensityProfileLayer> ozone_density; + ozone_density.push_back(atmosphere::DensityProfileLayer(25000.0, 0.0, 0.0, 1.0 / 15000.0, -2.0 / 3.0)); + ozone_density.push_back(atmosphere::DensityProfileLayer(0.0, 0.0, 0.0, -1.0 / 15000.0, 8.0 / 3.0)); + + std::vector<double> wavelengths; + std::vector<double> solar_irradiance; + std::vector<double> rayleigh_scattering; + std::vector<double> mie_scattering; + std::vector<double> mie_extinction; + std::vector<double> absorption_extinction; + std::vector<double> ground_albedo; + + for (int l = kLambdaMin; l <= kLambdaMax; l += 10) + { + double lambda = static_cast<double>(l) * 1e-3; // micro-meters + double mie = kMieAngstromBeta / kMieScaleHeight * pow(lambda, -kMieAngstromAlpha); + wavelengths.push_back(l); + solar_irradiance.push_back(kSolarIrradiance[(l - kLambdaMin) / 10]); + rayleigh_scattering.push_back(kRayleigh * pow(lambda, -4)); + mie_scattering.push_back(mie * kMieSingleScatteringAlbedo); + mie_extinction.push_back(mie); + absorption_extinction.push_back(kMaxOzoneNumberDensity * kOzoneCrossSection[(l - kLambdaMin) / 10]); + ground_albedo.push_back(0.1f); + } + + m_model = new atmosphere::Model( + wavelengths, + solar_irradiance, + kSunAngularRadius, + kBottomRadius, + kTopRadius, + {rayleigh_density}, + rayleigh_scattering, + {mie_density}, + mie_scattering, + mie_extinction, + kMiePhaseFunctionG, + ozone_density, + absorption_extinction, + ground_albedo, + max_sun_zenith_angle, + 1000.0, + 15, + false, + true); + + m_model->Init(m_config, m_textures); + + m_transmittance = new LLGLTexture; + m_scattering = new LLGLTexture; + m_mie_scattering = new LLGLTexture; + + 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->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->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->setTexName(m_textures.transmittance_texture); + m_mie_scattering->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D); +}; + +LLAtmosphere::~LLAtmosphere() +{ + // Cease referencing textures from atmosphere::model from our LLGLTextures wrappers for same. + m_transmittance->setTexName(0); + m_scattering->setTexName(0); + m_mie_scattering->setTexName(0); + + delete m_model; + m_model = nullptr; +} + +LLGLTexture* LLAtmosphere::getTransmittance() const +{ + return m_transmittance; +} + +LLGLTexture* LLAtmosphere::getScattering() const +{ + return m_scattering; +} + +LLGLTexture* LLAtmosphere::getMieScattering() const +{ + return m_mie_scattering; +} + +GLuint LLAtmosphere::getAtmosphericShaderForLink() const +{ + return m_model ? m_model->GetShader() : 0; +} diff --git a/indra/llrender/llatmosphere.h b/indra/llrender/llatmosphere.h new file mode 100644 index 0000000000..4aa36be27f --- /dev/null +++ b/indra/llrender/llatmosphere.h @@ -0,0 +1,72 @@ +/** + * @file llatmosphere.h + * @brief LLAtmosphere class for integration with libatmosphere + * + * $LicenseInfo:firstyear=2018&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2018, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_ATMOSPHERE_H +#define LL_ATMOSPHERE_H + +#include "llglheaders.h" +#include "llgltexture.h" +#include "libatmosphere/model.h" + +class LLAtmosphere +{ +public: + LLAtmosphere(); + ~LLAtmosphere(); + + static void initClass(); + static void cleanupClass(); + + const LLAtmosphere& operator=(const LLAtmosphere& rhs) + { + LL_ERRS() << "Illegal operation!" << LL_ENDL; + return *this; + } + + LLGLTexture* getTransmittance() const; + LLGLTexture* getScattering() const; + LLGLTexture* getMieScattering() const; + + GLuint getAtmosphericShaderForLink() const; + +protected: + LLAtmosphere(const LLAtmosphere& rhs) + { + *this = rhs; + } + + atmosphere::ModelConfig m_config; + atmosphere::PrecomputedTextures m_textures; + atmosphere::Model* m_model = nullptr; + + LLPointer<LLGLTexture> m_transmittance; + LLPointer<LLGLTexture> m_scattering; + LLPointer<LLGLTexture> m_mie_scattering; +}; + +extern LLAtmosphere* gAtmosphere; + +#endif // LL_ATMOSPHERE_H diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 155c2402bd..2f78b6e104 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1348,8 +1348,19 @@ void LLGLManager::initExtensions() if (mHasVertexShader) { LL_INFOS() << "initExtensions() VertexShader-related procs..." << LL_ENDL; - glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetAttribLocationARB"); - glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glBindAttribLocationARB"); + + // nSight doesn't support use of ARB funcs that have been normalized in the API + if (!LLRender::sNsightDebugSupport) + { + glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetAttribLocationARB"); + glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glBindAttribLocationARB"); + } + else + { + glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGetAttribLocation"); + glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC)GLH_EXT_GET_PROC_ADDRESS("glBindAttribLocation"); + } + glGetActiveAttribARB = (PFNGLGETACTIVEATTRIBARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetActiveAttribARB"); glVertexAttrib1dARB = (PFNGLVERTEXATTRIB1DARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dARB"); glVertexAttrib1dvARB = (PFNGLVERTEXATTRIB1DVARBPROC) GLH_EXT_GET_PROC_ADDRESS("glVertexAttrib1dvARB"); diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index bba94a976f..a5939a6eb9 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -374,6 +374,8 @@ void LLGLSLShader::unloadInternal() stop_glerror(); } +#pragma optimize("", off) + BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes, std::vector<LLStaticHashedString> * uniforms, U32 varying_count, @@ -401,6 +403,11 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes, mDefines["OLD_SELECT"] = "1"; #endif + if (mExtraLinkObject) + { + attachObject(mExtraLinkObject); + } + //compile new source vector< pair<string,GLenum> >::iterator fileIter = mShaderFiles.begin(); for ( ; fileIter != mShaderFiles.end(); fileIter++ ) @@ -485,6 +492,8 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes, return success; } +#pragma optimize("", on) + BOOL LLGLSLShader::attachObject(std::string object) { if (LLShaderMgr::instance()->mShaderObjects.count(object) > 0) diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 8e9c29ea4c..a7a9e27fcd 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -205,6 +205,8 @@ public: bool mTextureStateFetched; magmin_filter_t mTextureMagMinFilter; + GLhandleARB mExtraLinkObject = 0; + private: void unloadInternal(); diff --git a/indra/llrender/llgltexture.cpp b/indra/llrender/llgltexture.cpp index 3a6eebebba..c0e5477cea 100644 --- a/indra/llrender/llgltexture.cpp +++ b/indra/llrender/llgltexture.cpp @@ -30,20 +30,20 @@ // static S32 LLGLTexture::getTotalNumOfCategories() { - return MAX_GL_IMAGE_CATEGORY - (BOOST_HIGH - BOOST_SCULPTED) + 2 ; + return MAX_GL_IMAGE_CATEGORY - (BOOST_HIGH - BOOST_SCULPTED) + 2; } // static //index starts from zero. S32 LLGLTexture::getIndexFromCategory(S32 category) { - return (category < BOOST_HIGH) ? category : category - (BOOST_HIGH - BOOST_SCULPTED) + 1 ; + return (category < BOOST_HIGH) ? category : category - (BOOST_HIGH - BOOST_SCULPTED) + 1; } //static S32 LLGLTexture::getCategoryFromIndex(S32 index) { - return (index < BOOST_HIGH) ? index : index + (BOOST_HIGH - BOOST_SCULPTED) - 1 ; + return (index < BOOST_HIGH) ? index : index + (BOOST_HIGH - BOOST_SCULPTED) - 1; } LLGLTexture::LLGLTexture(BOOL usemipmaps) @@ -55,19 +55,19 @@ LLGLTexture::LLGLTexture(BOOL usemipmaps) LLGLTexture::LLGLTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps) { init(); - mFullWidth = width ; - mFullHeight = height ; + mFullWidth = width; + mFullHeight = height; mUseMipMaps = usemipmaps; - mComponents = components ; + mComponents = components; setTexelsPerImage(); } LLGLTexture::LLGLTexture(const LLImageRaw* raw, BOOL usemipmaps) { init(); - mUseMipMaps = usemipmaps ; + mUseMipMaps = usemipmaps; // Create an empty image of the specified size and width - mGLTexturep = new LLImageGL(raw, usemipmaps) ; + mGLTexturep = new LLImageGL(raw, usemipmaps); } LLGLTexture::~LLGLTexture() @@ -81,13 +81,13 @@ void LLGLTexture::init() mFullWidth = 0; mFullHeight = 0; - mTexelsPerImage = 0 ; - mUseMipMaps = FALSE ; - mComponents = 0 ; + mTexelsPerImage = 0; + mUseMipMaps = FALSE; + mComponents = 0; - mTextureState = NO_DELETE ; + mTextureState = NO_DELETE; mDontDiscard = FALSE; - mNeedsGLTexture = FALSE ; + mNeedsGLTexture = FALSE; } void LLGLTexture::cleanup() @@ -111,287 +111,301 @@ void LLGLTexture::setBoostLevel(S32 level) { if(mBoostLevel != level) { - mBoostLevel = level ; + mBoostLevel = level; if(mBoostLevel != LLGLTexture::BOOST_NONE && mBoostLevel != LLGLTexture::BOOST_ICON) { - setNoDelete() ; + setNoDelete(); } } } void LLGLTexture::forceActive() { - mTextureState = ACTIVE ; + mTextureState = ACTIVE; } void LLGLTexture::setActive() { if(mTextureState != NO_DELETE) { - mTextureState = ACTIVE ; + mTextureState = ACTIVE; } } //set the texture to stay in memory void LLGLTexture::setNoDelete() { - mTextureState = NO_DELETE ; + mTextureState = NO_DELETE; } void LLGLTexture::generateGLTexture() { if(mGLTexturep.isNull()) { - mGLTexturep = new LLImageGL(mFullWidth, mFullHeight, mComponents, mUseMipMaps) ; + mGLTexturep = new LLImageGL(mFullWidth, mFullHeight, mComponents, mUseMipMaps); } } LLImageGL* LLGLTexture::getGLTexture() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep ; + return mGLTexturep; } BOOL LLGLTexture::createGLTexture() { if(mGLTexturep.isNull()) { - generateGLTexture() ; + generateGLTexture(); } - return mGLTexturep->createGLTexture() ; + return mGLTexturep->createGLTexture(); } BOOL LLGLTexture::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename, BOOL to_create, S32 category) { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - BOOL ret = mGLTexturep->createGLTexture(discard_level, imageraw, usename, to_create, category) ; + BOOL ret = mGLTexturep->createGLTexture(discard_level, imageraw, usename, to_create, category); if(ret) { - mFullWidth = mGLTexturep->getCurrentWidth() ; - mFullHeight = mGLTexturep->getCurrentHeight() ; - mComponents = mGLTexturep->getComponents() ; + mFullWidth = mGLTexturep->getCurrentWidth(); + mFullHeight = mGLTexturep->getCurrentHeight(); + mComponents = mGLTexturep->getComponents(); setTexelsPerImage(); } - return ret ; + return ret; } void LLGLTexture::setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes) { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - mGLTexturep->setExplicitFormat(internal_format, primary_format, type_format, swap_bytes) ; + mGLTexturep->setExplicitFormat(internal_format, primary_format, type_format, swap_bytes); } void LLGLTexture::setAddressMode(LLTexUnit::eTextureAddressMode mode) { - llassert(mGLTexturep.notNull()) ; - mGLTexturep->setAddressMode(mode) ; + llassert(mGLTexturep.notNull()); + mGLTexturep->setAddressMode(mode); } void LLGLTexture::setFilteringOption(LLTexUnit::eTextureFilterOptions option) { - llassert(mGLTexturep.notNull()) ; - mGLTexturep->setFilteringOption(option) ; + llassert(mGLTexturep.notNull()); + mGLTexturep->setFilteringOption(option); } //virtual S32 LLGLTexture::getWidth(S32 discard_level) const { - llassert(mGLTexturep.notNull()) ; - return mGLTexturep->getWidth(discard_level) ; + llassert(mGLTexturep.notNull()); + return mGLTexturep->getWidth(discard_level); } //virtual S32 LLGLTexture::getHeight(S32 discard_level) const { - llassert(mGLTexturep.notNull()) ; - return mGLTexturep->getHeight(discard_level) ; + llassert(mGLTexturep.notNull()); + return mGLTexturep->getHeight(discard_level); } S32 LLGLTexture::getMaxDiscardLevel() const { - llassert(mGLTexturep.notNull()) ; - return mGLTexturep->getMaxDiscardLevel() ; + llassert(mGLTexturep.notNull()); + return mGLTexturep->getMaxDiscardLevel(); } S32 LLGLTexture::getDiscardLevel() const { - llassert(mGLTexturep.notNull()) ; - return mGLTexturep->getDiscardLevel() ; + llassert(mGLTexturep.notNull()); + return mGLTexturep->getDiscardLevel(); } S8 LLGLTexture::getComponents() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getComponents() ; + return mGLTexturep->getComponents(); } LLGLuint LLGLTexture::getTexName() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getTexName() ; + return mGLTexturep->getTexName(); } BOOL LLGLTexture::hasGLTexture() const { if(mGLTexturep.notNull()) { - return mGLTexturep->getHasGLTexture() ; + return mGLTexturep->getHasGLTexture(); } - return FALSE ; + return FALSE; } BOOL LLGLTexture::getBoundRecently() const { if(mGLTexturep.notNull()) { - return mGLTexturep->getBoundRecently() ; + return mGLTexturep->getBoundRecently(); } - return FALSE ; + return FALSE; } LLTexUnit::eTextureType LLGLTexture::getTarget(void) const { - llassert(mGLTexturep.notNull()) ; - return mGLTexturep->getTarget() ; + llassert(mGLTexturep.notNull()); + return mGLTexturep->getTarget(); } BOOL LLGLTexture::setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height) { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->setSubImage(imageraw, x_pos, y_pos, width, height) ; + return mGLTexturep->setSubImage(imageraw, x_pos, y_pos, width, height); } BOOL LLGLTexture::setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height) { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->setSubImage(datap, data_width, data_height, x_pos, y_pos, width, height) ; + return mGLTexturep->setSubImage(datap, data_width, data_height, x_pos, y_pos, width, height); } void LLGLTexture::setGLTextureCreated (bool initialized) { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - mGLTexturep->setGLTextureCreated (initialized) ; + mGLTexturep->setGLTextureCreated (initialized); } void LLGLTexture::setCategory(S32 category) { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); + + mGLTexturep->setCategory(category); +} - mGLTexturep->setCategory(category) ; +void LLGLTexture::setTexName(LLGLuint texName) +{ + llassert(mGLTexturep.notNull()); + return mGLTexturep->setTexName(texName); +} + +void LLGLTexture::setTarget(const LLGLenum target, const LLTexUnit::eTextureType bind_target) +{ + llassert(mGLTexturep.notNull()); + return mGLTexturep->setTarget(target, bind_target); } LLTexUnit::eTextureAddressMode LLGLTexture::getAddressMode(void) const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getAddressMode() ; + return mGLTexturep->getAddressMode(); } S32Bytes LLGLTexture::getTextureMemory() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->mTextureMemory ; + return mGLTexturep->mTextureMemory; } LLGLenum LLGLTexture::getPrimaryFormat() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getPrimaryFormat() ; + return mGLTexturep->getPrimaryFormat(); } BOOL LLGLTexture::getIsAlphaMask() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getIsAlphaMask() ; + return mGLTexturep->getIsAlphaMask(); } BOOL LLGLTexture::getMask(const LLVector2 &tc) { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getMask(tc) ; + return mGLTexturep->getMask(tc); } F32 LLGLTexture::getTimePassedSinceLastBound() { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getTimePassedSinceLastBound() ; + return mGLTexturep->getTimePassedSinceLastBound(); } BOOL LLGLTexture::getMissed() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getMissed() ; + return mGLTexturep->getMissed(); } BOOL LLGLTexture::isJustBound() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->isJustBound() ; + return mGLTexturep->isJustBound(); } void LLGLTexture::forceUpdateBindStats(void) const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->forceUpdateBindStats() ; + return mGLTexturep->forceUpdateBindStats(); } U32 LLGLTexture::getTexelsInAtlas() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getTexelsInAtlas() ; + return mGLTexturep->getTexelsInAtlas(); } U32 LLGLTexture::getTexelsInGLTexture() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getTexelsInGLTexture() ; + return mGLTexturep->getTexelsInGLTexture(); } BOOL LLGLTexture::isGLTextureCreated() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->isGLTextureCreated() ; + return mGLTexturep->isGLTextureCreated(); } S32 LLGLTexture::getDiscardLevelInAtlas() const { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - return mGLTexturep->getDiscardLevelInAtlas() ; + return mGLTexturep->getDiscardLevelInAtlas(); } void LLGLTexture::destroyGLTexture() { if(mGLTexturep.notNull() && mGLTexturep->getHasGLTexture()) { - mGLTexturep->destroyGLTexture() ; - mTextureState = DELETED ; + mGLTexturep->destroyGLTexture(); + mTextureState = DELETED; } } void LLGLTexture::setTexelsPerImage() { - S32 fullwidth = llmin(mFullWidth,(S32)MAX_IMAGE_SIZE_DEFAULT); - S32 fullheight = llmin(mFullHeight,(S32)MAX_IMAGE_SIZE_DEFAULT); - mTexelsPerImage = (F32)fullwidth * fullheight; + U32 fullwidth = llmin(mFullWidth, (U32)MAX_IMAGE_SIZE_DEFAULT); + U32 fullheight = llmin(mFullHeight, (U32)MAX_IMAGE_SIZE_DEFAULT); + mTexelsPerImage = (U32)fullwidth * fullheight; } +static LLUUID sStubUUID; +const LLUUID& LLGLTexture::getID() const { return sStubUUID; }
\ No newline at end of file diff --git a/indra/llrender/llgltexture.h b/indra/llrender/llgltexture.h index 45592ee077..b8d646ed15 100644 --- a/indra/llrender/llgltexture.h +++ b/indra/llrender/llgltexture.h @@ -103,7 +103,7 @@ public: virtual void dump(); // debug info to LL_INFOS() - virtual const LLUUID& getID() const = 0; + virtual const LLUUID& getID() const; void setBoostLevel(S32 level); S32 getBoostLevel() { return mBoostLevel; } @@ -132,6 +132,8 @@ public: BOOL setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height); void setGLTextureCreated (bool initialized); void setCategory(S32 category) ; + void setTexName(LLGLuint); // for forcing w/ externally created textures only + void setTarget(const LLGLenum target, const LLTexUnit::eTextureType bind_target); LLTexUnit::eTextureAddressMode getAddressMode(void) const ; S32 getMaxDiscardLevel() const; @@ -178,11 +180,11 @@ protected: protected: S32 mBoostLevel; // enum describing priority level - S32 mFullWidth; - S32 mFullHeight; + U32 mFullWidth; + U32 mFullHeight; BOOL mUseMipMaps; S8 mComponents; - F32 mTexelsPerImage; // Texels per image. + U32 mTexelsPerImage; // Texels per image. mutable S8 mNeedsGLTexture; //GL texture diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 20cba68f84..75f6cd405a 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -352,10 +352,9 @@ BOOL LLImageGL::create(LLPointer<LLImageGL>& dest, const LLImageRaw* imageraw, B } //---------------------------------------------------------------------------- - LLImageGL::LLImageGL(BOOL usemipmaps) : LLTrace::MemTrackable<LLImageGL>("LLImageGL"), - mSaveData(0) + mSaveData(0), mExternalTexture(FALSE) { init(usemipmaps); setSize(0, 0, 0); @@ -365,7 +364,7 @@ LLImageGL::LLImageGL(BOOL usemipmaps) LLImageGL::LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps) : LLTrace::MemTrackable<LLImageGL>("LLImageGL"), - mSaveData(0) + mSaveData(0), mExternalTexture(FALSE) { llassert( components <= 4 ); init(usemipmaps); @@ -376,7 +375,7 @@ LLImageGL::LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps) LLImageGL::LLImageGL(const LLImageRaw* imageraw, BOOL usemipmaps) : LLTrace::MemTrackable<LLImageGL>("LLImageGL"), - mSaveData(0) + mSaveData(0), mExternalTexture(FALSE) { init(usemipmaps); setSize(0, 0, 0); @@ -386,12 +385,36 @@ LLImageGL::LLImageGL(const LLImageRaw* imageraw, BOOL usemipmaps) createGLTexture(0, imageraw); } +LLImageGL::LLImageGL( + LLGLuint texName, + U32 components, + LLGLenum target, + LLGLint formatInternal, + LLGLenum formatPrimary, + LLGLenum formatType, + LLTexUnit::eTextureAddressMode addressMode) + : LLTrace::MemTrackable<LLImageGL>("LLImageGL"), mSaveData(0), mExternalTexture(TRUE) +{ + init(false); + mTexName = texName; + mTarget = target; + mComponents = components; + mAddressMode = addressMode; + mFormatType = formatType; + mFormatInternal = formatInternal; + mFormatPrimary = formatPrimary; +} + + LLImageGL::~LLImageGL() { - LLImageGL::cleanup(); - sImageList.erase(this); - freePickMask(); - sCount--; + if (!mExternalTexture) + { + LLImageGL::cleanup(); + sImageList.erase(this); + freePickMask(); + sCount--; + } } void LLImageGL::init(BOOL usemipmaps) diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index ad2aea9067..bb0284a166 100644 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -84,7 +84,10 @@ public: LLImageGL(BOOL usemipmaps = TRUE); LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps = TRUE); LLImageGL(const LLImageRaw* imageraw, BOOL usemipmaps = TRUE); - + + // For wrapping textures created via GL elsewhere with our API only. Use with caution. + LLImageGL(LLGLuint mTexName, U32 components, LLGLenum target, LLGLint formatInternal, LLGLenum formatPrimary, LLGLenum formatType, LLTexUnit::eTextureAddressMode addressMode); + protected: virtual ~LLImageGL(); @@ -234,6 +237,8 @@ protected: LLGLenum mFormatType; BOOL mFormatSwapBytes;// if true, use glPixelStorei(GL_UNPACK_SWAP_BYTES, 1) + BOOL mExternalTexture; + // STATICS public: static std::set<LLImageGL*> sImageList; @@ -279,6 +284,8 @@ public: void setCategory(S32 category) {mCategory = category;} S32 getCategory()const {return mCategory;} + void setTexName(GLuint texName) { mTexName = texName; } + //for debug use: show texture size distribution //---------------------------------------- static S32 sCurTexSizeBar ; diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 76f28bb43f..a8f622d3ff 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -49,6 +49,7 @@ U32 LLRender::sUICalls = 0; U32 LLRender::sUIVerts = 0; U32 LLTexUnit::sWhiteTexture = 0; bool LLRender::sGLCoreProfile = false; +bool LLRender::sNsightDebugSupport = false; static const U32 LL_NUM_TEXTURE_LAYERS = 32; static const U32 LL_NUM_LIGHT_UNITS = 8; @@ -58,7 +59,8 @@ static const GLenum sGLTextureType[] = GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_CUBE_MAP_ARB, - GL_TEXTURE_2D_MULTISAMPLE + GL_TEXTURE_2D_MULTISAMPLE, + GL_TEXTURE_3D }; static const GLint sGLAddressMode[] = diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index a67fb8da52..9ad3a6e593 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -61,10 +61,11 @@ public: typedef enum { TT_TEXTURE = 0, // Standard 2D Texture - TT_RECT_TEXTURE, // Non power of 2 texture - TT_CUBE_MAP, // 6-sided cube map texture + TT_RECT_TEXTURE, // Non power of 2 texture + TT_CUBE_MAP, // 6-sided cube map texture TT_MULTISAMPLE_TEXTURE, // see GL_ARB_texture_multisample - TT_NONE // No texture type is currently enabled + TT_TEXTURE_3D, // standard 3D Texture + TT_NONE, // No texture type is currently enabled } eTextureType; typedef enum @@ -438,7 +439,8 @@ public: static U32 sUICalls; static U32 sUIVerts; static bool sGLCoreProfile; - + static bool sNsightDebugSupport; + private: friend class LLLightState; diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index b010a4ae64..287f22783f 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -512,16 +512,16 @@ static std::string get_object_log(GLhandleARB ret) void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns, const std::string& filename) { std::string log = get_object_log(ret); + std::string fname = filename; + if (filename.empty()) + { + fname = "unknown shader file"; + } - if (log.length() > 0 || warns) + if (log.length() > 0) { - LL_DEBUGS("ShaderLoading") << "Shader loading "; - - if (!filename.empty()) - { - LL_CONT << "From " << filename << ":\n"; - } - LL_CONT << log << LL_ENDL; + LL_INFOS() << "Shader loading from " << fname << ":\n" << LL_ENDL; + LL_INFOS() << log << LL_ENDL; } } @@ -1114,7 +1114,7 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("specularMap"); mReservedUniforms.push_back("bumpMap"); mReservedUniforms.push_back("environmentMap"); - mReservedUniforms.push_back("cloude_noise_texture"); + mReservedUniforms.push_back("cloud_noise_texture"); mReservedUniforms.push_back("fullbright"); mReservedUniforms.push_back("lightnorm"); mReservedUniforms.push_back("sunlight_color"); @@ -1267,6 +1267,16 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("origin"); mReservedUniforms.push_back("display_gamma"); + + mReservedUniforms.push_back("inscatter"); + mReservedUniforms.push_back("sun_size"); + mReservedUniforms.push_back("fog_color"); + + mReservedUniforms.push_back("transmittance_texture"); + mReservedUniforms.push_back("scattering_texture"); + mReservedUniforms.push_back("irradiance_texture"); + mReservedUniforms.push_back("single_mie_scattering_texture"); + llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS); std::set<std::string> dupe_check; diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 7bdd97200d..ac3f7d58d5 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -221,6 +221,17 @@ public: SHINY_ORIGIN, DISPLAY_GAMMA, + + INSCATTER_RT, + SUN_SIZE, + FOG_COLOR, + + // precomputed textures from libatmosphere + TRANSMITTANCE_TEX, + SCATTER_TEX, + ILLUMINANCE_TEX, + SINGLE_MIE_SCATTER_TEX, + END_RESERVED_UNIFORMS } eGLSLReservedUniforms; diff --git a/indra/llrender/lltexture.cpp b/indra/llrender/lltexture.cpp index 90fbcec2be..787a09a159 100644 --- a/indra/llrender/lltexture.cpp +++ b/indra/llrender/lltexture.cpp @@ -29,3 +29,15 @@ LLTexture::~LLTexture() { } + +S8 LLTexture::getType() const { llassert(false); return 0; } +void LLTexture::setKnownDrawSize(S32 width, S32 height) { llassert(false); } +bool LLTexture::bindDefaultImage(const S32 stage) { llassert(false); return false; } +bool LLTexture::bindDebugImage(const S32 stage) { llassert(false); return false; } +void LLTexture::forceImmediateUpdate() { llassert(false); } +void LLTexture::setActive() { llassert(false); } +S32 LLTexture::getWidth(S32 discard_level) const { llassert(false); return 0; } +S32 LLTexture::getHeight(S32 discard_level) const { llassert(false); return 0; } +bool LLTexture::isActiveFetching() { llassert(false); return false; } +LLImageGL* LLTexture::getGLTexture() const { llassert(false); return nullptr; } +void LLTexture::updateBindStatsForTester() { }
\ No newline at end of file diff --git a/indra/llrender/lltexture.h b/indra/llrender/lltexture.h index 9fca8b8cd3..41481fb8a7 100644 --- a/indra/llrender/lltexture.h +++ b/indra/llrender/lltexture.h @@ -58,21 +58,21 @@ public: // //interfaces to access LLGLTexture // - virtual S8 getType() const = 0 ; - virtual void setKnownDrawSize(S32 width, S32 height) = 0 ; - virtual bool bindDefaultImage(const S32 stage = 0) = 0 ; - virtual bool bindDebugImage(const S32 stage = 0) = 0; - virtual void forceImmediateUpdate() = 0 ; - virtual void setActive() = 0 ; - virtual S32 getWidth(S32 discard_level = -1) const = 0 ; - virtual S32 getHeight(S32 discard_level = -1) const = 0 ; - virtual bool isActiveFetching() = 0; + virtual S8 getType() const; + virtual void setKnownDrawSize(S32 width, S32 height); + virtual bool bindDefaultImage(const S32 stage = 0); + virtual bool bindDebugImage(const S32 stage = 0); + virtual void forceImmediateUpdate(); + virtual void setActive(); + virtual S32 getWidth(S32 discard_level = -1) const; + virtual S32 getHeight(S32 discard_level = -1) const; + virtual bool isActiveFetching(); private: //note: do not make this function public. - virtual LLImageGL* getGLTexture() const = 0 ; + virtual LLImageGL* getGLTexture() const; - virtual void updateBindStatsForTester() = 0 ; + virtual void updateBindStatsForTester(); }; #endif diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index ecd7c4bc36..380d7762d6 100644 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -35,7 +35,7 @@ </array> <key>tags</key> <array> - </array> + </array> </map> <map> <key>level</key><string>DEBUG</string> diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index dd07972249..06d8599e73 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10122,6 +10122,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>RenderUseAdvancedAtmospherics</key> + <map> + <key>Comment</key> + <string>Use fancy precomputed atmospherics and stuff.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>RenderUseTriStrips</key> <map> <key>Comment</key> diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 03bdb754b5..7f1a8cce0d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -397,7 +397,9 @@ void main() float da = dot(norm.xyz, sun_dir.xyz); float final_da = max(0.0,da); - final_da = min(final_da, 1.0f); + final_da = min(final_da, 1.0f); + +// why an ad hoc gamma boost here? srgb_to_linear instead? final_da = pow(final_da, 1.0/1.3); vec4 diffuse = texture2DRect(diffuseRect, tc); diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index f7832521fa..cf076d156a 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -276,10 +276,6 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) { + tmpAmbient))); //brightness of surface both sunlight and ambient - /*setSunlitColor(pow(vec3(sunlight * .5), vec3(global_gamma)) * global_gamma); - setAmblitColor(pow(vec3(tmpAmbient * .25), vec3(global_gamma)) * global_gamma); - setAdditiveColor(pow(getAdditiveColor() * vec3(1.0 - temp1), vec3(global_gamma)) * global_gamma);*/ - setSunlitColor(vec3(sunlight * .5)); setAmblitColor(vec3(tmpAmbient * .25)); setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1)); diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 81af1fdc8a..b2d9de6e73 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -238,8 +238,8 @@ void main() proj_tc.xyz /= proj_tc.w; - float fa = falloff+1.0; - float dist_atten = min(1.0-(dist-1.0*(1.0-fa))/fa, 1.0); + float fa = falloff + 1.0; + float dist_atten = min(1.0 - (dist - 1.0 * (1.0 - fa)) / fa, 1.0); dist_atten *= dist_atten; dist_atten *= 2.0; diff --git a/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl new file mode 100644 index 0000000000..d27363a60c --- /dev/null +++ b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl @@ -0,0 +1,69 @@ +/** + * @file advancedAtmoF.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_color; +#else +#define frag_color gl_FragColor +#endif + +in vec3 view_dir; + +uniform vec3 cameraPosLocal; +uniform vec3 sun_direction; + +uniform sampler2D transmittance_texture; +uniform sampler3D scattering_texture; +uniform sampler3D mie_scattering_texture; + +vec3 GetSolarLuminance(); +vec3 GetSkyLuminance(vec3 camPos, vec3 view_dir, float shadow_length, vec3 sun_dir, out vec3 transmittance); +vec3 GetSkyLuminanceToPoint(vec3 camPos, vec3 pos, float shadow_length, vec3 sun_dir, out vec3 transmittance); +vec3 GetSunAndSkyIlluminance(vec3 pos, vec3 norm, vec3 sun_dir, out vec3 sky_irradiance); + +void main() +{ + vec3 view_direction = normalize(view_dir); + + vec3 camPos = cameraPosLocal; + vec3 transmittance; + vec3 radiance = GetSkyLuminance(camPos, view_direction, 0.0f, sun_direction, transmittance); + + radiance *= transmittance; + + // If the view ray intersects the Sun, add the Sun radiance. + if (dot(view_direction, sun_direction) >= sun_size.y) + { + radiance = radiance + transmittance * GetSolarLuminance(); + } + + vec3 color = vec3(1.0) - exp(-radiance); + color = pow(color, vec3(1.0 / 2.2)); + + frag_color.rgb = color; + + frag_color.a = 1.0; +} + diff --git a/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoV.glsl b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoV.glsl new file mode 100644 index 0000000000..52a7595379 --- /dev/null +++ b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoV.glsl @@ -0,0 +1,43 @@ +/** + * @file advancedAtmoV.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +uniform mat4 modelview_projection_matrix; + +ATTRIBUTE vec3 position; + +// Inputs +uniform vec3 camPosLocal; + +out vec3 view_dir; + +void main() +{ + // World / view / projection + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + + // this will be normalized in the frag shader... + view_dir = position.xyz - camPosLocal.xyz; +} + diff --git a/indra/newview/app_settings/shaders/class3/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class3/windlight/cloudsF.glsl new file mode 100644 index 0000000000..96c70651b1 --- /dev/null +++ b/indra/newview/app_settings/shaders/class3/windlight/cloudsF.glsl @@ -0,0 +1,104 @@ +/** + * @file WLCloudsF.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_color; +#else +#define frag_color gl_FragColor +#endif + +///////////////////////////////////////////////////////////////////////// +// The fragment shader for the sky +///////////////////////////////////////////////////////////////////////// + +VARYING vec4 vary_CloudColorSun; +VARYING vec4 vary_CloudColorAmbient; +VARYING float vary_CloudDensity; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3; + +uniform sampler2D cloud_noise_texture; +uniform vec4 cloud_pos_density1; +uniform vec4 cloud_pos_density2; +uniform vec4 gamma; + +/// Soft clips the light with a gamma correction +vec3 scaleSoftClip(vec3 light) { + //soft clip effect: + light = 1. - clamp(light, vec3(0.), vec3(1.)); + light = 1. - pow(light, gamma.xxx); + + return light; +} + +void main() +{ + // Set variables + vec2 uv1 = vary_texcoord0.xy; + vec2 uv2 = vary_texcoord1.xy; + + vec4 cloudColorSun = vary_CloudColorSun; + vec4 cloudColorAmbient = vary_CloudColorAmbient; + float cloudDensity = vary_CloudDensity; + vec2 uv3 = vary_texcoord2.xy; + vec2 uv4 = vary_texcoord3.xy; + + // Offset texture coords + uv1 += cloud_pos_density1.xy; //large texture, visible density + uv2 += cloud_pos_density1.xy; //large texture, self shadow + uv3 += cloud_pos_density2.xy; //small texture, visible density + uv4 += cloud_pos_density2.xy; //small texture, self shadow + + + // Compute alpha1, the main cloud opacity + float alpha1 = (texture2D(cloud_noise_texture, uv1).x - 0.5) + (texture2D(cloud_noise_texture, uv3).x - 0.5) * cloud_pos_density2.z; + alpha1 = min(max(alpha1 + cloudDensity, 0.) * 10. * cloud_pos_density1.z, 1.); + + // And smooth + alpha1 = 1. - alpha1 * alpha1; + alpha1 = 1. - alpha1 * alpha1; + + + // Compute alpha2, for self shadowing effect + // (1 - alpha2) will later be used as percentage of incoming sunlight + float alpha2 = (texture2D(cloud_noise_texture, uv2).x - 0.5); + alpha2 = min(max(alpha2 + cloudDensity, 0.) * 2.5 * cloud_pos_density1.z, 1.); + + // And smooth + alpha2 = 1. - alpha2; + alpha2 = 1. - alpha2 * alpha2; + + // Combine + vec4 color; + color = (cloudColorSun*(1.-alpha2) + cloudColorAmbient); + color *= 2.; + + /// Gamma correct for WL (soft clip effect). + frag_color.rgb = scaleSoftClip(color.rgb); + frag_color.a = alpha1; +} + diff --git a/indra/newview/app_settings/shaders/class3/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class3/windlight/cloudsV.glsl new file mode 100644 index 0000000000..c1dd45cd67 --- /dev/null +++ b/indra/newview/app_settings/shaders/class3/windlight/cloudsV.glsl @@ -0,0 +1,190 @@ +/** + * @file WLCloudsV.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +uniform mat4 modelview_projection_matrix; + +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; + +////////////////////////////////////////////////////////////////////////// +// The vertex shader for creating the atmospheric sky +/////////////////////////////////////////////////////////////////////////////// + +// Output parameters +VARYING vec4 vary_CloudColorSun; +VARYING vec4 vary_CloudColorAmbient; +VARYING float vary_CloudDensity; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3; + +// Inputs +uniform vec3 camPosLocal; + +uniform vec4 lightnorm; +uniform vec4 sunlight_color; +uniform vec4 ambient; +uniform vec4 blue_horizon; +uniform vec4 blue_density; +uniform float haze_horizon; +uniform float haze_density; + +uniform float cloud_shadow; +uniform float density_multiplier; +uniform float max_y; + +uniform vec4 glow; + +uniform vec4 cloud_color; + +uniform float cloud_scale; + +void main() +{ + + // World / view / projection + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + + vary_texcoord0 = texcoord0; + + // Get relative position + vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0); + + // Set altitude + if (P.y > 0.) + { + P *= (max_y / P.y); + } + else + { + P *= (-32000. / P.y); + } + + // Can normalize then + vec3 Pn = normalize(P); + float Plen = length(P); + + // Initialize temp variables + vec4 temp1 = vec4(0.); + vec4 temp2 = vec4(0.); + vec4 blue_weight; + vec4 haze_weight; + vec4 sunlight = sunlight_color; + vec4 light_atten; + + + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes + light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y); + + // Calculate relative weights + temp1 = blue_density + haze_density; + blue_weight = blue_density / temp1; + haze_weight = haze_density / temp1; + + // Compute sunlight from P & lightnorm (for long rays like sky) + temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y ); + temp2.y = 1. / temp2.y; + sunlight *= exp( - light_atten * temp2.y); + + // Distance + temp2.z = Plen * density_multiplier; + + // Transparency (-> temp1) + // ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati + // compiler gets confused. + temp1 = exp(-temp1 * temp2.z); + + + // Compute haze glow + temp2.x = dot(Pn, lightnorm.xyz); + temp2.x = 1. - temp2.x; + // temp2.x is 0 at the sun and increases away from sun + temp2.x = max(temp2.x, .001); + // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) + temp2.x *= glow.x; + // Higher glow.x gives dimmer glow (because next step is 1 / "angle") + temp2.x = pow(temp2.x, glow.z); + // glow.z should be negative, so we're doing a sort of (1 / "angle") function + + // Add "minimum anti-solar illumination" + temp2.x += .25; + + // Increase ambient when there are more clouds + vec4 tmpAmbient = ambient; + tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; + + // Dim sunlight by cloud shadow percentage + sunlight *= (1. - cloud_shadow); + + // Haze color below cloud + vec4 additiveColorBelowCloud = ( blue_horizon * blue_weight * (sunlight + tmpAmbient) + + (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient) + ); + + // CLOUDS + + sunlight = sunlight_color; + temp2.y = max(0., lightnorm.y * 2.); + temp2.y = 1. / temp2.y; + sunlight *= exp( - light_atten * temp2.y); + + // Cloud color out + vary_CloudColorSun = (sunlight * temp2.x) * cloud_color; + vary_CloudColorAmbient = tmpAmbient * cloud_color; + + // Attenuate cloud color by atmosphere + temp1 = sqrt(temp1); //less atmos opacity (more transparency) below clouds + vary_CloudColorSun *= temp1; + vary_CloudColorAmbient *= temp1; + vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - temp1); + + // Make a nice cloud density based on the cloud_shadow value that was passed in. + vary_CloudDensity = 2. * (cloud_shadow - 0.25); + + + // Texture coords + vary_texcoord0 = texcoord0; + vary_texcoord0.xy -= 0.5; + vary_texcoord0.xy /= cloud_scale; + vary_texcoord0.xy += 0.5; + + vary_texcoord1 = vary_texcoord0; + vary_texcoord1.x += lightnorm.x * 0.0125; + vary_texcoord1.y += lightnorm.z * 0.0125; + + vary_texcoord2 = vary_texcoord0 * 16.; + vary_texcoord3 = vary_texcoord1 * 16.; + + // Combine these to minimize register use + vary_CloudColorAmbient += oHazeColorBelowCloud; + + // needs this to compile on mac + //vary_AtmosAttenuation = vec3(0.0,0.0,0.0); + + // END CLOUDS +} + diff --git a/indra/newview/app_settings/shaders/class3/windlight/skyF.glsl b/indra/newview/app_settings/shaders/class3/windlight/skyF.glsl new file mode 100644 index 0000000000..c71eaf4b13 --- /dev/null +++ b/indra/newview/app_settings/shaders/class3/windlight/skyF.glsl @@ -0,0 +1,71 @@ +/** + * @file advancedAtmoF.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_color; +#else +#define frag_color gl_FragColor +#endif + +in vec3 view_dir; + +uniform vec3 cameraPosLocal; +uniform vec3 sun_direction; +uniform vec2 sun_size; + +uniform sampler2D cloud_noise_texture; +uniform sampler2D transmittance_texture; +uniform sampler3D scattering_texture; +uniform sampler3D mie_scattering_texture; + +vec3 GetSolarLuminance(); +vec3 GetSkyLuminance(vec3 camPos, vec3 view_dir, float shadow_length, vec3 sun_dir, out vec3 transmittance); +vec3 GetSkyLuminanceToPoint(vec3 camPos, vec3 pos, float shadow_length, vec3 sun_dir, out vec3 transmittance); +vec3 GetSunAndSkyIlluminance(vec3 pos, vec3 norm, vec3 sun_dir, out vec3 sky_irradiance); + +void main() +{ + vec3 view_direction = normalize(view_dir); + + vec3 camPos = cameraPosLocal; + vec3 transmittance; + vec3 radiance = GetSkyLuminance(camPos, view_direction, 0.0f, sun_direction, transmittance); + + radiance *= transmittance; + + // If the view ray intersects the Sun, add the Sun radiance. + if (dot(view_direction, sun_direction) >= sun_size.y) + { + radiance = radiance + transmittance * GetSolarLuminance(); + } + + vec3 color = vec3(1.0) - exp(-radiance); + color = pow(color, vec3(1.0 / 2.2)); + + frag_color.rgb = color; + + frag_color.a = 1.0; +} + diff --git a/indra/newview/app_settings/shaders/class3/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class3/windlight/skyV.glsl new file mode 100644 index 0000000000..52a7595379 --- /dev/null +++ b/indra/newview/app_settings/shaders/class3/windlight/skyV.glsl @@ -0,0 +1,43 @@ +/** + * @file advancedAtmoV.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +uniform mat4 modelview_projection_matrix; + +ATTRIBUTE vec3 position; + +// Inputs +uniform vec3 camPosLocal; + +out vec3 view_dir; + +void main() +{ + // World / view / projection + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + + // this will be normalized in the frag shader... + view_dir = position.xyz - camPosLocal.xyz; +} + diff --git a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl new file mode 100644 index 0000000000..8a8e4cb0f6 --- /dev/null +++ b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl @@ -0,0 +1,53 @@ +/** + * @file transportF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +////////////////////////////////////////////////////////// +// The fragment shader for the terrain atmospherics +////////////////////////////////////////////////////////// + +vec3 getAdditiveColor(); +vec3 getAtmosAttenuation(); + +uniform sampler2D cloudMap; +uniform vec4 cloud_pos_density1; + +vec3 atmosTransport(vec3 light) { + light *= getAtmosAttenuation().r; + light += getAdditiveColor() * 2.0; + return light; +} + +vec3 fullbrightAtmosTransport(vec3 light) { + float brightness = dot(light.rgb, vec3(0.33333)); + + return mix(atmosTransport(light.rgb), light.rgb + getAdditiveColor().rgb, brightness * brightness); +} + +vec3 fullbrightShinyAtmosTransport(vec3 light) { + float brightness = dot(light.rgb, vec3(0.33333)); + + return mix(atmosTransport(light.rgb), (light.rgb + getAdditiveColor().rgb) * (2.0 - brightness), brightness * brightness); +} + diff --git a/indra/newview/app_settings/windlight/skies/A%2D12AM.xml b/indra/newview/app_settings/windlight/skies/A%2D12AM.xml index 0aba31214a..93ef76d73c 100644 --- a/indra/newview/app_settings/windlight/skies/A%2D12AM.xml +++ b/indra/newview/app_settings/windlight/skies/A%2D12AM.xml @@ -137,5 +137,61 @@ <real>0.65999996662139893</real> <real>0.2199999988079071</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/A%2D12PM.xml b/indra/newview/app_settings/windlight/skies/A%2D12PM.xml index 119b3e1418..87b2f09e30 100644 --- a/indra/newview/app_settings/windlight/skies/A%2D12PM.xml +++ b/indra/newview/app_settings/windlight/skies/A%2D12PM.xml @@ -137,5 +137,61 @@ <real>0.89999997615814209</real> <real>0.29999998211860657</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/A%2D3AM.xml b/indra/newview/app_settings/windlight/skies/A%2D3AM.xml index f790d3d961..cf1ce5faf2 100644 --- a/indra/newview/app_settings/windlight/skies/A%2D3AM.xml +++ b/indra/newview/app_settings/windlight/skies/A%2D3AM.xml @@ -137,5 +137,61 @@ <real>1.1399999856948853</real> <real>0.37999999523162842</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/A%2D3PM.xml b/indra/newview/app_settings/windlight/skies/A%2D3PM.xml index ec9706773e..3d94ea0d38 100644 --- a/indra/newview/app_settings/windlight/skies/A%2D3PM.xml +++ b/indra/newview/app_settings/windlight/skies/A%2D3PM.xml @@ -137,5 +137,61 @@ <real>0.89999997615813498</real> <real>0.29999998211860301</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/A%2D6AM.xml b/indra/newview/app_settings/windlight/skies/A%2D6AM.xml index bbc7aeec59..3932f67f29 100644 --- a/indra/newview/app_settings/windlight/skies/A%2D6AM.xml +++ b/indra/newview/app_settings/windlight/skies/A%2D6AM.xml @@ -137,5 +137,61 @@ <real>2.369999885559082</real> <real>0.78999996185302734</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/A%2D6PM.xml b/indra/newview/app_settings/windlight/skies/A%2D6PM.xml index ebf08e1a3f..a597a1245a 100644 --- a/indra/newview/app_settings/windlight/skies/A%2D6PM.xml +++ b/indra/newview/app_settings/windlight/skies/A%2D6PM.xml @@ -137,6 +137,62 @@ <real>2.8385701179504395</real> <real>1</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/A%2D9AM.xml b/indra/newview/app_settings/windlight/skies/A%2D9AM.xml index 413e3a27d9..76f08de1b5 100644 --- a/indra/newview/app_settings/windlight/skies/A%2D9AM.xml +++ b/indra/newview/app_settings/windlight/skies/A%2D9AM.xml @@ -137,5 +137,61 @@ <real>0.89999995470046912</real> <real>0.29999997496605069</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/A%2D9PM.xml b/indra/newview/app_settings/windlight/skies/A%2D9PM.xml index 292f6713b7..771bb564a4 100644 --- a/indra/newview/app_settings/windlight/skies/A%2D9PM.xml +++ b/indra/newview/app_settings/windlight/skies/A%2D9PM.xml @@ -137,5 +137,61 @@ <real>0.66003586768772493</real> <real>0.22001197576412324</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Barcelona.xml b/indra/newview/app_settings/windlight/skies/Barcelona.xml index ea9cab8fbb..4cc92e9005 100644 --- a/indra/newview/app_settings/windlight/skies/Barcelona.xml +++ b/indra/newview/app_settings/windlight/skies/Barcelona.xml @@ -137,5 +137,61 @@ <real>1.1699999570846558</real> <real>0.38999998569488525</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Blizzard.xml b/indra/newview/app_settings/windlight/skies/Blizzard.xml index d17d2790a8..84a923d008 100644 --- a/indra/newview/app_settings/windlight/skies/Blizzard.xml +++ b/indra/newview/app_settings/windlight/skies/Blizzard.xml @@ -137,5 +137,61 @@ <real>3</real> <real>1</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Blue%20Midday.xml b/indra/newview/app_settings/windlight/skies/Blue%20Midday.xml index 570f059961..8cb31d879a 100644 --- a/indra/newview/app_settings/windlight/skies/Blue%20Midday.xml +++ b/indra/newview/app_settings/windlight/skies/Blue%20Midday.xml @@ -137,5 +137,61 @@ <real>1.2300000190734863</real> <real>0.40999999642372131</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Coastal%20Afternoon.xml b/indra/newview/app_settings/windlight/skies/Coastal%20Afternoon.xml index 4925b29eea..17f5a60209 100644 --- a/indra/newview/app_settings/windlight/skies/Coastal%20Afternoon.xml +++ b/indra/newview/app_settings/windlight/skies/Coastal%20Afternoon.xml @@ -137,5 +137,61 @@ <real>3</real> <real>1</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Coastal%20Sunset.xml b/indra/newview/app_settings/windlight/skies/Coastal%20Sunset.xml index f4736cf4c6..4f80a3366c 100644 --- a/indra/newview/app_settings/windlight/skies/Coastal%20Sunset.xml +++ b/indra/newview/app_settings/windlight/skies/Coastal%20Sunset.xml @@ -137,5 +137,61 @@ <real>3</real> <real>1</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Default.xml b/indra/newview/app_settings/windlight/skies/Default.xml index 13a2c75046..381c7fb49d 100644 --- a/indra/newview/app_settings/windlight/skies/Default.xml +++ b/indra/newview/app_settings/windlight/skies/Default.xml @@ -137,5 +137,61 @@ <real>0.89999997615814209</real> <real>0.29999998211860657</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Desert%20Sunset.xml b/indra/newview/app_settings/windlight/skies/Desert%20Sunset.xml index b2a611163d..39d84a5ced 100644 --- a/indra/newview/app_settings/windlight/skies/Desert%20Sunset.xml +++ b/indra/newview/app_settings/windlight/skies/Desert%20Sunset.xml @@ -137,5 +137,61 @@ <real>2.8385701179504395</real> <real>1</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Fine%20Day.xml b/indra/newview/app_settings/windlight/skies/Fine%20Day.xml index e053815be1..b15e7c6236 100644 --- a/indra/newview/app_settings/windlight/skies/Fine%20Day.xml +++ b/indra/newview/app_settings/windlight/skies/Fine%20Day.xml @@ -137,5 +137,61 @@ <real>0.59999996423721313</real> <real>2.25</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Fluffy%20Big%20Clouds.xml b/indra/newview/app_settings/windlight/skies/Fluffy%20Big%20Clouds.xml index 8576ec125c..95dd872736 100644 --- a/indra/newview/app_settings/windlight/skies/Fluffy%20Big%20Clouds.xml +++ b/indra/newview/app_settings/windlight/skies/Fluffy%20Big%20Clouds.xml @@ -137,5 +137,61 @@ <real>1.0199999809265137</real> <real>1.7999999523162842</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Foggy.xml b/indra/newview/app_settings/windlight/skies/Foggy.xml index cb7395d589..313c922a4e 100644 --- a/indra/newview/app_settings/windlight/skies/Foggy.xml +++ b/indra/newview/app_settings/windlight/skies/Foggy.xml @@ -137,5 +137,61 @@ <real>0.53999996185302734</real> <real>0.17999999225139618</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Funky%20Funky%20Funky.xml b/indra/newview/app_settings/windlight/skies/Funky%20Funky%20Funky.xml index 32be0d25e6..f627575d31 100644 --- a/indra/newview/app_settings/windlight/skies/Funky%20Funky%20Funky.xml +++ b/indra/newview/app_settings/windlight/skies/Funky%20Funky%20Funky.xml @@ -137,5 +137,61 @@ <real>2.8385701179504395</real> <real>1</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Funky%20Funky.xml b/indra/newview/app_settings/windlight/skies/Funky%20Funky.xml index ae16b2d135..245fec5999 100644 --- a/indra/newview/app_settings/windlight/skies/Funky%20Funky.xml +++ b/indra/newview/app_settings/windlight/skies/Funky%20Funky.xml @@ -137,5 +137,61 @@ <real>2.2200000286102295</real> <real>0.74000000953674316</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Gelatto.xml b/indra/newview/app_settings/windlight/skies/Gelatto.xml index 66b3d317b8..69f758d4f5 100644 --- a/indra/newview/app_settings/windlight/skies/Gelatto.xml +++ b/indra/newview/app_settings/windlight/skies/Gelatto.xml @@ -137,5 +137,61 @@ <real>0.37800011038780212</real> <real>0.80999994277954102</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Ghost.xml b/indra/newview/app_settings/windlight/skies/Ghost.xml index 447202ed51..2707cae7f9 100644 --- a/indra/newview/app_settings/windlight/skies/Ghost.xml +++ b/indra/newview/app_settings/windlight/skies/Ghost.xml @@ -137,5 +137,61 @@ <real>0.33000001311302185</real> <real>1</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Incongruent%20Truths.xml b/indra/newview/app_settings/windlight/skies/Incongruent%20Truths.xml index 098844e16e..d5f2305e84 100644 --- a/indra/newview/app_settings/windlight/skies/Incongruent%20Truths.xml +++ b/indra/newview/app_settings/windlight/skies/Incongruent%20Truths.xml @@ -137,5 +137,61 @@ <real>1.170000433921814</real> <real>0.75</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Midday%201.xml b/indra/newview/app_settings/windlight/skies/Midday%201.xml index 13a2c75046..381c7fb49d 100644 --- a/indra/newview/app_settings/windlight/skies/Midday%201.xml +++ b/indra/newview/app_settings/windlight/skies/Midday%201.xml @@ -137,5 +137,61 @@ <real>0.89999997615814209</real> <real>0.29999998211860657</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Midday%202.xml b/indra/newview/app_settings/windlight/skies/Midday%202.xml index 04f2ba85ee..91d70c2228 100644 --- a/indra/newview/app_settings/windlight/skies/Midday%202.xml +++ b/indra/newview/app_settings/windlight/skies/Midday%202.xml @@ -137,5 +137,61 @@ <real>0.80999994277954102</real> <real>0.26999998092651367</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Midday%203.xml b/indra/newview/app_settings/windlight/skies/Midday%203.xml index a23dcab60b..816a4da670 100644 --- a/indra/newview/app_settings/windlight/skies/Midday%203.xml +++ b/indra/newview/app_settings/windlight/skies/Midday%203.xml @@ -137,5 +137,61 @@ <real>1.2599999904632568</real> <real>1</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Midday%204.xml b/indra/newview/app_settings/windlight/skies/Midday%204.xml index 255e314e0f..df64ed371c 100644 --- a/indra/newview/app_settings/windlight/skies/Midday%204.xml +++ b/indra/newview/app_settings/windlight/skies/Midday%204.xml @@ -137,5 +137,61 @@ <real>1.2599999904632568</real> <real>0.41999998688697815</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Midday.xml b/indra/newview/app_settings/windlight/skies/Midday.xml index 119b3e1418..87b2f09e30 100644 --- a/indra/newview/app_settings/windlight/skies/Midday.xml +++ b/indra/newview/app_settings/windlight/skies/Midday.xml @@ -137,5 +137,61 @@ <real>0.89999997615814209</real> <real>0.29999998211860657</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Midnight.xml b/indra/newview/app_settings/windlight/skies/Midnight.xml index 0aba31214a..00cfc64420 100644 --- a/indra/newview/app_settings/windlight/skies/Midnight.xml +++ b/indra/newview/app_settings/windlight/skies/Midnight.xml @@ -137,5 +137,61 @@ <real>0.65999996662139893</real> <real>0.2199999988079071</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Night.xml b/indra/newview/app_settings/windlight/skies/Night.xml index c4938949ce..c56177e821 100644 --- a/indra/newview/app_settings/windlight/skies/Night.xml +++ b/indra/newview/app_settings/windlight/skies/Night.xml @@ -137,5 +137,61 @@ <real>0.65999994893325931</real> <real>0.22000000284673543</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Pirate.xml b/indra/newview/app_settings/windlight/skies/Pirate.xml index dcb9c27ba4..1f5c18dd65 100644 --- a/indra/newview/app_settings/windlight/skies/Pirate.xml +++ b/indra/newview/app_settings/windlight/skies/Pirate.xml @@ -137,5 +137,61 @@ <real>2.8385701179504395</real> <real>1</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Purple.xml b/indra/newview/app_settings/windlight/skies/Purple.xml index 0e9ac3f36e..3d937660ad 100644 --- a/indra/newview/app_settings/windlight/skies/Purple.xml +++ b/indra/newview/app_settings/windlight/skies/Purple.xml @@ -137,5 +137,61 @@ <real>2.8385701179504395</real> <real>1</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Sailor%27s%20Delight.xml b/indra/newview/app_settings/windlight/skies/Sailor%27s%20Delight.xml index 70df6b0e60..b3a631f482 100644 --- a/indra/newview/app_settings/windlight/skies/Sailor%27s%20Delight.xml +++ b/indra/newview/app_settings/windlight/skies/Sailor%27s%20Delight.xml @@ -137,5 +137,61 @@ <real>1.0777359008789062</real> <real>0.56000000238418579</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Sheer%20Surreality.xml b/indra/newview/app_settings/windlight/skies/Sheer%20Surreality.xml index 4c44a1bdb2..252ba58a9a 100644 --- a/indra/newview/app_settings/windlight/skies/Sheer%20Surreality.xml +++ b/indra/newview/app_settings/windlight/skies/Sheer%20Surreality.xml @@ -137,5 +137,61 @@ <real>0.53999996185302734</real> <real>1.5899999141693115</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Sunrise.xml b/indra/newview/app_settings/windlight/skies/Sunrise.xml index bbc7aeec59..3932f67f29 100644 --- a/indra/newview/app_settings/windlight/skies/Sunrise.xml +++ b/indra/newview/app_settings/windlight/skies/Sunrise.xml @@ -137,5 +137,61 @@ <real>2.369999885559082</real> <real>0.78999996185302734</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/app_settings/windlight/skies/Sunset.xml b/indra/newview/app_settings/windlight/skies/Sunset.xml index ebf08e1a3f..a597a1245a 100644 --- a/indra/newview/app_settings/windlight/skies/Sunset.xml +++ b/indra/newview/app_settings/windlight/skies/Sunset.xml @@ -137,6 +137,62 @@ <real>2.8385701179504395</real> <real>1</real> </array> + <key>planet_radius</key> + <real>6360.0</real> + <key>sky_min_radius</key> + <real>6360.0</real> + <key>sky_max_radius</key> + <real>6420.0</real> + <key>rayleigh_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>absorption_config</key> + <map> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> + <key>mie_config</key> + <map> + <key>anisotropy</key> + <real>0.5f</real> + <key>density</key> + <map> + <key>width</key> + <real>0.0</real> + <key>exp_term</key> + <real>1.0</real> + <key>exp_scale</key> + <real>-0.00001</real> + <key>linear_term</key> + <real>0.0</real> + <key>constant_term</key> + <real>1.0</real> + </map> + </map> </map> </llsd> diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 32aad191d3..ff0902dae6 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -205,6 +205,7 @@ #include "llfloateroutfitsnapshot.h" #include "llfloatersnapshot.h" #include "llsidepanelinventory.h" +#include "llatmosphere.h" // includes for idle() idleShutdown() #include "llviewercontrol.h" @@ -1097,6 +1098,7 @@ bool LLAppViewer::init() } } +#if LL_RELEASE_FOR_DOWNLOAD char* PARENT = getenv("PARENT"); if (! (PARENT && std::string(PARENT) == "SL_Launcher")) { @@ -1109,6 +1111,7 @@ bool LLAppViewer::init() // him/herself in the foot. LLNotificationsUtil::add("RunLauncher"); } +#endif #if LL_WINDOWS if (gGLManager.mGLVersion < LLFeatureManager::getInstance()->getExpectedGLVersion()) @@ -1641,6 +1644,8 @@ void LLAppViewer::flushVFSIO() bool LLAppViewer::cleanup() { + LLAtmosphere::cleanupClass(); + //ditch LLVOAvatarSelf instance gAgentAvatarp = NULL; diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index f10c116555..a28041034b 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -42,6 +42,7 @@ #include "llrender.h" #include "llenvironment.h" +#include "llatmosphere.h" LLPointer<LLViewerTexture> LLDrawPoolWLSky::sCloudNoiseTexture = NULL; @@ -125,38 +126,51 @@ void LLDrawPoolWLSky::endDeferredPass(S32 pass) void LLDrawPoolWLSky::renderDome(F32 camHeightLocal, LLGLSLShader * shader) const { - LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); - - llassert_always(NULL != shader); - - gGL.pushMatrix(); - - //chop off translation - if (LLPipeline::sReflectionRender && origin.mV[2] > 256.f) - { - gGL.translatef(origin.mV[0], origin.mV[1], 256.f-origin.mV[2]*0.5f); - } - else - { - gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]); - } + llassert_always(NULL != shader); + + static LLStaticHashedString sCamPosLocal("camPosLocal"); + + LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); + + if (gPipeline.useAdvancedAtmospherics()) + { + // Draw WL Sky w/ normal cam pos (where you are) for adv atmo sky + sky_shader->uniform3f(sCamPosLocal, origin.mV[0], origin.mV[1], origin.mV[2]); + +// TBD replace this with a FS tri pass, there's little point to the tess when you have fragment shaders... + + gSky.mVOWLSkyp->drawDome(); + } + else + { + gGL.pushMatrix(); + + //chop off translation + if (LLPipeline::sReflectionRender && origin.mV[2] > 256.f) + { + gGL.translatef(origin.mV[0], origin.mV[1], 256.f-origin.mV[2]*0.5f); + } + else + { + gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]); + } - // the windlight sky dome works most conveniently in a coordinate system - // where Y is up, so permute our basis vectors accordingly. - gGL.rotatef(120.f, 1.f / F_SQRT3, 1.f / F_SQRT3, 1.f / F_SQRT3); + // the windlight sky dome works most conveniently in a coordinate system + // where Y is up, so permute our basis vectors accordingly. + gGL.rotatef(120.f, 1.f / F_SQRT3, 1.f / F_SQRT3, 1.f / F_SQRT3); - gGL.scalef(0.333f, 0.333f, 0.333f); + gGL.scalef(0.333f, 0.333f, 0.333f); - gGL.translatef(0.f,-camHeightLocal, 0.f); + gGL.translatef(0.f,-camHeightLocal, 0.f); - // Draw WL Sky - static LLStaticHashedString sCamPosLocal("camPosLocal"); - shader->uniform3f(sCamPosLocal, 0.f, camHeightLocal, 0.f); + // Draw WL Sky + shader->uniform3f(sCamPosLocal, 0.f, camHeightLocal, 0.f); - gSky.mVOWLSkyp->drawDome(); + gSky.mVOWLSkyp->drawDome(); - gGL.popMatrix(); + gGL.popMatrix(); + } } void LLDrawPoolWLSky::renderSkyHaze(F32 camHeightLocal) const @@ -167,6 +181,33 @@ void LLDrawPoolWLSky::renderSkyHaze(F32 camHeightLocal) const sky_shader->bind(); + if (gPipeline.useAdvancedAtmospherics() && gPipeline.canUseWindLightShaders() && gAtmosphere) + { + // bind precomputed textures necessary for calculating sun and sky luminance + sky_shader->bindTexture(LLShaderMgr::TRANSMITTANCE_TEX, gAtmosphere->getTransmittance()); + sky_shader->bindTexture(LLShaderMgr::SCATTER_TEX, gAtmosphere->getScattering()); + sky_shader->bindTexture(LLShaderMgr::SINGLE_MIE_SCATTER_TEX, gAtmosphere->getMieScattering()); + + static float sunSize = (float)cos(0.0005); + + sky_shader->uniform1f(LLShaderMgr::SUN_SIZE, sunSize); + + static LLVector3 solDir(0.7f, 0.2f, 0.2f); + + //neither of these appear to track with the env settings, would the real sun please stand up. + //sky_shader->uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, gPipeline.mTransformedSunDir.mV); + //sky_shader->uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, gSky.mVOSkyp->getSun().getDirection().mV); + solDir.normalize(); + + sky_shader->uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, solDir.mV); + + // clouds are rendered along with sky in adv atmo + if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && sCloudNoiseTexture.notNull()) + { + sky_shader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP, sCloudNoiseTexture); + } + } + /// Render the skydome renderDome(camHeightLocal, sky_shader); @@ -190,8 +231,9 @@ void LLDrawPoolWLSky::renderStars(void) const // *NOTE: we divide by two here and GL_ALPHA_SCALE by two below to avoid // clamping and allow the star_alpha param to brighten the stars. LLColor4 star_alpha(LLColor4::black); + // *LAPRAS - star_alpha.mV[3] = LLEnvironment::instance().getCurrentSky()->getStarBrightness() / 2.f; + star_alpha.mV[3] = LLEnvironment::instance().getCurrentSky()->getStarBrightness() / (2.f + ((rand() >> 16)/65535.0f)); // twinkle twinkle // If start_brightness is not set, exit if( star_alpha.mV[3] < 0.001 ) @@ -322,8 +364,10 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass) renderSkyHaze(camHeightLocal); - LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); - gGL.pushMatrix(); + if (!gPipeline.useAdvancedAtmospherics() && gPipeline.canUseWindLightShaders()) + { + LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); + gGL.pushMatrix(); gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]); @@ -340,13 +384,12 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass) gDeferredStarProgram.unbind(); - gGL.popMatrix(); + gGL.popMatrix(); + } renderSkyClouds(camHeightLocal); - - gGL.setColorMask(true, true); - //gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - + + gGL.setColorMask(true, true); } void LLDrawPoolWLSky::render(S32 pass) @@ -367,8 +410,10 @@ void LLDrawPoolWLSky::render(S32 pass) renderSkyHaze(camHeightLocal); - LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); - gGL.pushMatrix(); + if (!gPipeline.useAdvancedAtmospherics() && gPipeline.canUseWindLightShaders()) + { + LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); + gGL.pushMatrix(); gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]); @@ -380,9 +425,9 @@ void LLDrawPoolWLSky::render(S32 pass) renderHeavenlyBodies(); renderStars(); - - gGL.popMatrix(); + gGL.popMatrix(); + } renderSkyClouds(camHeightLocal); diff --git a/indra/newview/lldrawpoolwlsky.h b/indra/newview/lldrawpoolwlsky.h index cd15c991ee..586219e4bc 100644 --- a/indra/newview/lldrawpoolwlsky.h +++ b/indra/newview/lldrawpoolwlsky.h @@ -39,6 +39,8 @@ public: static const U32 STAR_VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXCOORD0; + static const U32 ADV_ATMO_SKY_VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX; + LLDrawPoolWLSky(void); /*virtual*/ ~LLDrawPoolWLSky(); diff --git a/indra/newview/llenvadapters.cpp b/indra/newview/llenvadapters.cpp index 34fd862655..85da9e853d 100644 --- a/indra/newview/llenvadapters.cpp +++ b/indra/newview/llenvadapters.cpp @@ -33,23 +33,28 @@ LLSkySettingsAdapter::LLSkySettingsAdapter(): mWLGamma(1.0f, LLSettingsSky::SETTING_GAMMA), + +#if SUPPORT_LEGACY_ATMOSPHERICS + mAmbient(LLColor4(0.5f, 0.75f, 1.0f, 1.19f), LLSettingsSky::SETTING_AMBIENT, "WLAmbient"), mBlueHorizon(LLColor4(0.25f, 0.25f, 1.0f, 1.0f), LLSettingsSky::SETTING_BLUE_HORIZON, "WLBlueHorizon"), - mHazeDensity(1.0f, LLSettingsSky::SETTING_HAZE_DENSITY), mBlueDensity(LLColor4(0.25f, 0.25f, 0.25f, 1.0f), LLSettingsSky::SETTING_BLUE_DENSITY, "WLBlueDensity"), + mHazeDensity(1.0f, LLSettingsSky::SETTING_HAZE_DENSITY), + mHazeHorizon(1.0f, LLSettingsSky::SETTING_HAZE_HORIZON), mDensityMult(1.0f, LLSettingsSky::SETTING_DENSITY_MULTIPLIER, 1000), - mHazeHorizon(1.0f, LLSettingsSky::SETTING_HAZE_HORIZON), + mDistanceMult(1.0f, LLSettingsSky::SETTING_DISTANCE_MULTIPLIER), mMaxAlt(4000.0f, LLSettingsSky::SETTING_MAX_Y), +#endif + // Lighting mLightnorm(LLColor4(0.f, 0.707f, -0.707f, 1.f), LLSettingsSky::SETTING_LIGHT_NORMAL), mSunlight(LLColor4(0.5f, 0.5f, 0.5f, 1.0f), LLSettingsSky::SETTING_SUNLIGHT_COLOR, "WLSunlight"), - mAmbient(LLColor4(0.5f, 0.75f, 1.0f, 1.19f), LLSettingsSky::SETTING_AMBIENT, "WLAmbient"), + mGlow(LLColor4(18.0f, 0.0f, -0.01f, 1.0f), LLSettingsSky::SETTING_GLOW), // Clouds mCloudColor(LLColor4(0.5f, 0.5f, 0.5f, 1.0f), LLSettingsSky::SETTING_CLOUD_COLOR, "WLCloudColor"), mCloudMain(LLColor4(0.5f, 0.5f, 0.125f, 1.0f), LLSettingsSky::SETTING_CLOUD_POS_DENSITY1), mCloudCoverage(0.0f, LLSettingsSky::SETTING_CLOUD_SHADOW), - mCloudDetail(LLColor4(0.0f, 0.0f, 0.0f, 1.0f), LLSettingsSky::SETTING_CLOUD_POS_DENSITY2), - mDistanceMult(1.0f, LLSettingsSky::SETTING_DISTANCE_MULTIPLIER), + mCloudDetail(LLColor4(0.0f, 0.0f, 0.0f, 1.0f), LLSettingsSky::SETTING_CLOUD_POS_DENSITY2), mCloudScale(0.42f, LLSettingsSky::SETTING_CLOUD_SCALE) { diff --git a/indra/newview/llenvadapters.h b/indra/newview/llenvadapters.h index 8b93bbbe9f..c48311863e 100644 --- a/indra/newview/llenvadapters.h +++ b/indra/newview/llenvadapters.h @@ -31,6 +31,7 @@ #include "v3color.h" #include "v4math.h" #include "llsettingsbase.h" +#include "llsettingssky.h" class WLColorControl { @@ -364,25 +365,27 @@ public: WLFloatControl mWLGamma; /// Atmospherics +#if SUPPORT_LEGACY_ATMOSPHERICS + WLColorControl mAmbient; WLColorControl mBlueHorizon; WLFloatControl mHazeDensity; WLColorControl mBlueDensity; WLFloatControl mDensityMult; + WLFloatControl mDistanceMult; WLFloatControl mHazeHorizon; WLFloatControl mMaxAlt; +#endif /// Lighting WLColorControl mLightnorm; - WLColorControl mSunlight; - WLColorControl mAmbient; + WLColorControl mSunlight; WLColorControl mGlow; /// Clouds WLColorControl mCloudColor; WLColorControl mCloudMain; WLFloatControl mCloudCoverage; - WLColorControl mCloudDetail; - WLFloatControl mDistanceMult; + WLColorControl mCloudDetail; WLFloatControl mCloudScale; }; diff --git a/indra/newview/llfloatereditsky.cpp b/indra/newview/llfloatereditsky.cpp index 1574e73caa..c2b7bb17da 100644 --- a/indra/newview/llfloatereditsky.cpp +++ b/indra/newview/llfloatereditsky.cpp @@ -152,20 +152,21 @@ void LLFloaterEditSky::initCallbacks(void) LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditSky::onRegionInfoUpdate, this)); //------------------------------------------------------------------------- +#if SUPPORT_LEGACY_ATMOSPHERICS + // ambient + getChild<LLUICtrl>("WLAmbient")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mAmbient)); - // blue horizon + // blue horizon/density getChild<LLUICtrl>("WLBlueHorizon")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mBlueHorizon)); + getChild<LLUICtrl>("WLBlueDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mBlueDensity)); // haze density, horizon, mult, and altitude getChild<LLUICtrl>("WLHazeDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mHazeDensity)); getChild<LLUICtrl>("WLHazeHorizon")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mHazeHorizon)); getChild<LLUICtrl>("WLDensityMult")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mDensityMult)); + getChild<LLUICtrl>("WLDistanceMult")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mDistanceMult)); getChild<LLUICtrl>("WLMaxAltitude")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mMaxAlt)); - - // blue density - getChild<LLUICtrl>("WLBlueDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mBlueDensity)); - - // Lighting +#endif // sunlight getChild<LLUICtrl>("WLSunlight")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mSunlight)); @@ -174,9 +175,6 @@ void LLFloaterEditSky::initCallbacks(void) getChild<LLUICtrl>("WLGlowR")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowRMoved, this, _1, &mSkyAdapter->mGlow)); getChild<LLUICtrl>("WLGlowB")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowBMoved, this, _1, &mSkyAdapter->mGlow)); - // ambient - getChild<LLUICtrl>("WLAmbient")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mAmbient)); - // time of day // getChild<LLUICtrl>("WLSunPos")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &mSkyAdapter->mLightnorm)); // multi-slider // getChild<LLTimeCtrl>("WLDayTime")->setCommitCallback(boost::bind(&LLFloaterEditSky::onTimeChanged, this)); // time ctrl @@ -204,7 +202,7 @@ void LLFloaterEditSky::initCallbacks(void) getChild<LLUICtrl>("WLCloudScale")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mCloudScale)); getChild<LLUICtrl>("WLCloudScrollX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollXMoved, this, _1)); getChild<LLUICtrl>("WLCloudScrollY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollYMoved, this, _1)); - getChild<LLUICtrl>("WLDistanceMult")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mDistanceMult)); + // Dome getChild<LLUICtrl>("WLGamma")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mWLGamma)); @@ -223,9 +221,16 @@ void LLFloaterEditSky::syncControls() mSkyPresetNameEditor->setText(name); mSkyPresetCombo->setValue(name); - // blue horizon +#if SUPPORT_LEGACY_ATMOSPHERICS + // ambient + mSkyAdapter->mAmbient.setColor3( psky->getAmbientColor() ); + setColorSwatch("WLAmbient", mSkyAdapter->mAmbient, WL_SUN_AMBIENT_SLIDER_SCALE); + + // blue horizon / density mSkyAdapter->mBlueHorizon.setColor3( psky->getBlueHorizon() ); setColorSwatch("WLBlueHorizon", mSkyAdapter->mBlueHorizon, WL_BLUE_HORIZON_DENSITY_SCALE); + mSkyAdapter->mBlueDensity.setColor3( psky->getBlueDensity() ); + setColorSwatch("WLBlueDensity", mSkyAdapter->mBlueDensity, WL_BLUE_HORIZON_DENSITY_SCALE); // haze density, horizon, mult, and altitude mSkyAdapter->mHazeDensity = psky->getHazeDensity(); @@ -235,11 +240,10 @@ void LLFloaterEditSky::syncControls() mSkyAdapter->mDensityMult = psky->getDensityMultiplier(); childSetValue("WLDensityMult", ((F32) mSkyAdapter->mDensityMult) * mSkyAdapter->mDensityMult.getMult()); mSkyAdapter->mMaxAlt = psky->getMaxY(); + mSkyAdapter->mDistanceMult = psky->getDistanceMultiplier(); + childSetValue("WLDistanceMult", (F32) mSkyAdapter->mDistanceMult); childSetValue("WLMaxAltitude", (F32) mSkyAdapter->mMaxAlt); - - // blue density - mSkyAdapter->mBlueDensity.setColor3( psky->getBlueDensity() ); - setColorSwatch("WLBlueDensity", mSkyAdapter->mBlueDensity, WL_BLUE_HORIZON_DENSITY_SCALE); +#endif // Lighting @@ -252,9 +256,7 @@ void LLFloaterEditSky::syncControls() childSetValue("WLGlowR", 2 - mSkyAdapter->mGlow.getRed() / 20.0f); childSetValue("WLGlowB", -mSkyAdapter->mGlow.getBlue() / 5.0f); - // ambient - mSkyAdapter->mAmbient.setColor3( psky->getAmbientColor() ); - setColorSwatch("WLAmbient", mSkyAdapter->mAmbient, WL_SUN_AMBIENT_SLIDER_SCALE); + // LLSettingsSky::azimalt_t azal = psky->getSunRotationAzAl(); // @@ -304,9 +306,6 @@ void LLFloaterEditSky::syncControls() childSetValue("WLCloudScrollX", scroll_rate[0] - 10.0f); childSetValue("WLCloudScrollY", scroll_rate[1] - 10.0f); - mSkyAdapter->mDistanceMult = psky->getDistanceMultiplier(); - childSetValue("WLDistanceMult", (F32) mSkyAdapter->mDistanceMult); - // Tweak extras mSkyAdapter->mWLGamma = psky->getGamma(); diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index df708013fc..6e89763ba2 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2507,7 +2507,7 @@ void LLMeshUploadThread::requestWholeModelFee() { ms_sleep(sleep_time); sleep_time = llmin(250U, sleep_time + sleep_time); - mHttpRequest->update(0); + mHttpRequest->update(0); } if (isDiscarded()) { diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 14530715df..861615b14b 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -426,25 +426,27 @@ LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky) LLSD legacy(LLSD::emptyMap()); LLSD settings = psky->getSettings(); +// These will need to be inferred from new settings' density profiles +#if SUPPORT_LEGACY_ATMOSPHERICS legacy[SETTING_AMBIENT] = ensureArray4(settings[SETTING_AMBIENT], 1.0f); legacy[SETTING_BLUE_DENSITY] = ensureArray4(settings[SETTING_BLUE_DENSITY], 1.0); legacy[SETTING_BLUE_HORIZON] = ensureArray4(settings[SETTING_BLUE_HORIZON], 1.0); + legacy[SETTING_DENSITY_MULTIPLIER] = LLSDArray(settings[SETTING_DENSITY_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f); + legacy[SETTING_DISTANCE_MULTIPLIER] = LLSDArray(settings[SETTING_DISTANCE_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f); + legacy[SETTING_HAZE_DENSITY] = LLSDArray(settings[SETTING_HAZE_DENSITY])(0.0f)(0.0f)(1.0f); + legacy[SETTING_HAZE_HORIZON] = LLSDArray(settings[SETTING_HAZE_HORIZON])(0.0f)(0.0f)(1.0f); +#endif + legacy[SETTING_CLOUD_COLOR] = ensureArray4(settings[SETTING_CLOUD_COLOR], 1.0); legacy[SETTING_CLOUD_POS_DENSITY1] = ensureArray4(settings[SETTING_CLOUD_POS_DENSITY1], 1.0); legacy[SETTING_CLOUD_POS_DENSITY2] = ensureArray4(settings[SETTING_CLOUD_POS_DENSITY2], 1.0); - legacy[SETTING_CLOUD_SCALE] = LLSDArray(settings[SETTING_CLOUD_SCALE])(LLSD::Real(0.0))(LLSD::Real(0.0))(LLSD::Real(1.0)); - + legacy[SETTING_CLOUD_SCALE] = LLSDArray(settings[SETTING_CLOUD_SCALE])(LLSD::Real(0.0))(LLSD::Real(0.0))(LLSD::Real(1.0)); legacy[SETTING_CLOUD_SCROLL_RATE] = settings[SETTING_CLOUD_SCROLL_RATE]; legacy[SETTING_LEGACY_ENABLE_CLOUD_SCROLL] = LLSDArray(LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][0].asReal()))) - (LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][1].asReal()))); - - legacy[SETTING_CLOUD_SHADOW] = LLSDArray(settings[SETTING_CLOUD_SHADOW].asReal())(0.0f)(0.0f)(1.0f); - legacy[SETTING_DENSITY_MULTIPLIER] = LLSDArray(settings[SETTING_DENSITY_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f); - legacy[SETTING_DISTANCE_MULTIPLIER] = LLSDArray(settings[SETTING_DISTANCE_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f); + (LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][1].asReal()))); + legacy[SETTING_CLOUD_SHADOW] = LLSDArray(settings[SETTING_CLOUD_SHADOW].asReal())(0.0f)(0.0f)(1.0f); legacy[SETTING_GAMMA] = LLSDArray(settings[SETTING_GAMMA])(0.0f)(0.0f)(1.0f); legacy[SETTING_GLOW] = ensureArray4(settings[SETTING_GLOW], 1.0); - legacy[SETTING_HAZE_DENSITY] = LLSDArray(settings[SETTING_HAZE_DENSITY])(0.0f)(0.0f)(1.0f); - legacy[SETTING_HAZE_HORIZON] = LLSDArray(settings[SETTING_HAZE_HORIZON])(0.0f)(0.0f)(1.0f); legacy[SETTING_LIGHT_NORMAL] = ensureArray4(psky->getLightDirection().getValue(), 0.0f); legacy[SETTING_MAX_Y] = LLSDArray(settings[SETTING_MAX_Y])(0.0f)(0.0f)(1.0f); legacy[SETTING_STAR_BRIGHTNESS] = settings[SETTING_STAR_BRIGHTNESS]; @@ -494,21 +496,26 @@ LLSettingsSky::parammapping_t LLSettingsVOSky::getParameterMap() const if (param_map.empty()) { +#if SUPPORT_LEGACY_ATMOSPHERICS param_map[SETTING_AMBIENT] = LLShaderMgr::AMBIENT; param_map[SETTING_BLUE_DENSITY] = LLShaderMgr::BLUE_DENSITY; param_map[SETTING_BLUE_HORIZON] = LLShaderMgr::BLUE_HORIZON; - param_map[SETTING_CLOUD_COLOR] = LLShaderMgr::CLOUD_COLOR; + param_map[SETTING_HAZE_DENSITY] = LLShaderMgr::HAZE_DENSITY; + param_map[SETTING_HAZE_HORIZON] = LLShaderMgr::HAZE_HORIZON; + param_map[SETTING_DENSITY_MULTIPLIER] = LLShaderMgr::DENSITY_MULTIPLIER; + param_map[SETTING_DISTANCE_MULTIPLIER] = LLShaderMgr::DISTANCE_MULTIPLIER; +#endif + param_map[SETTING_CLOUD_COLOR] = LLShaderMgr::CLOUD_COLOR; param_map[SETTING_CLOUD_POS_DENSITY2] = LLShaderMgr::CLOUD_POS_DENSITY2; param_map[SETTING_CLOUD_SCALE] = LLShaderMgr::CLOUD_SCALE; - param_map[SETTING_CLOUD_SHADOW] = LLShaderMgr::CLOUD_SHADOW; - param_map[SETTING_DENSITY_MULTIPLIER] = LLShaderMgr::DENSITY_MULTIPLIER; - param_map[SETTING_DISTANCE_MULTIPLIER] = LLShaderMgr::DISTANCE_MULTIPLIER; - param_map[SETTING_GLOW] = LLShaderMgr::GLOW; - param_map[SETTING_HAZE_DENSITY] = LLShaderMgr::HAZE_DENSITY; - param_map[SETTING_HAZE_HORIZON] = LLShaderMgr::HAZE_HORIZON; + param_map[SETTING_CLOUD_SHADOW] = LLShaderMgr::CLOUD_SHADOW; + param_map[SETTING_GLOW] = LLShaderMgr::GLOW; param_map[SETTING_MAX_Y] = LLShaderMgr::MAX_Y; param_map[SETTING_SUNLIGHT_COLOR] = LLShaderMgr::SUNLIGHT_COLOR; + +// AdvancedAtmospherics TODO +// Provide mappings for new shader params here } return param_map; diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index e40d3da338..c4fa4e86b4 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -44,6 +44,7 @@ #include "lljoint.h" #include "llskinningutil.h" #include "llenvironment.h" +#include "llatmosphere.h" #ifdef LL_RELEASE_FOR_DOWNLOAD #define UNIFORM_ERRS LL_WARNS_ONCE("Shader") @@ -92,6 +93,8 @@ LLGLSLShader gDebugProgram; LLGLSLShader gClipProgram; LLGLSLShader gDownsampleDepthProgram; LLGLSLShader gDownsampleDepthRectProgram; +LLGLSLShader gDownsampleMinMaxDepthRectProgram; +LLGLSLShader gInscatterRectProgram; LLGLSLShader gAlphaMaskProgram; LLGLSLShader gBenchmarkProgram; @@ -474,7 +477,7 @@ void LLViewerShaderMgr::setShaders() S32 env_class = 2; S32 obj_class = 2; S32 effect_class = 2; - S32 wl_class = 2; + S32 wl_class = 3; S32 water_class = 2; S32 deferred_class = 0; S32 transform_class = gGLManager.mHasTransformFeedback ? 1 : 0; @@ -498,14 +501,13 @@ void LLViewerShaderMgr::setShaders() { //no shadows deferred_class = 1; } - - //make sure hardware skinning is enabled - //gSavedSettings.setBOOL("RenderAvatarVP", TRUE); - - //make sure atmospheric shaders are enabled - //gSavedSettings.setBOOL("WindLightUseAtmosShaders", TRUE); } + // clamp to WL class 2 if we have disabled adv atmo (class 3) + if (!gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics")) + { + wl_class = llmin(wl_class, 2); + } if (!(LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders") && gSavedSettings.getBOOL("WindLightUseAtmosShaders"))) @@ -515,7 +517,6 @@ void LLViewerShaderMgr::setShaders() wl_class = 1; } - // Trigger a full rebuild of the fallback skybox / cubemap if we've toggled windlight shaders if (mVertexShaderLevel[SHADER_WINDLIGHT] != wl_class && gSky.mVOSkyp.notNull()) { @@ -543,6 +544,7 @@ void LLViewerShaderMgr::setShaders() // Load all shaders to set max levels loaded = loadShadersEnvironment(); + llassert(loaded); if (loaded) { @@ -579,14 +581,10 @@ void LLViewerShaderMgr::setShaders() if (gSavedSettings.getBOOL("RenderAvatarVP") && loadShadersObject()) { //hardware skinning is enabled and rigged attachment shaders loaded correctly BOOL avatar_cloth = gSavedSettings.getBOOL("RenderAvatarCloth"); - S32 avatar_class = 1; - - // cloth is a class3 shader - if(avatar_cloth) - { - avatar_class = 3; - } + // cloth is a class3 shader + S32 avatar_class = avatar_cloth ? 3 : 1; + // Set the actual level mVertexShaderLevel[SHADER_AVATAR] = avatar_class; loadShadersAvatar(); @@ -699,6 +697,8 @@ void LLViewerShaderMgr::unloadShaders() gClipProgram.unload(); gDownsampleDepthProgram.unload(); gDownsampleDepthRectProgram.unload(); + gDownsampleMinMaxDepthRectProgram.unload(); + gInscatterRectProgram.unload(); gBenchmarkProgram.unload(); gAlphaMaskProgram.unload(); gUIProgram.unload(); @@ -1954,15 +1954,19 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() { gDeferredWLSkyProgram.mName = "Deferred Windlight Sky Shader"; //gWLSkyProgram.mFeatures.hasGamma = true; - gDeferredWLSkyProgram.mShaderFiles.clear(); + gDeferredWLSkyProgram.mShaderFiles.clear(); gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyF.glsl", GL_FRAGMENT_SHADER_ARB)); - gDeferredWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; + gDeferredWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT]; gDeferredWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY; + if (mVertexShaderLevel[SHADER_WINDLIGHT] >= 3) + { + gDeferredWLSkyProgram.mExtraLinkObject = gAtmosphere->getAtmosphericShaderForLink(); + } success = gDeferredWLSkyProgram.createShader(NULL, NULL); } - if (success) + if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] < 3)) { gDeferredWLCloudProgram.mName = "Deferred Windlight Cloud Program"; gDeferredWLCloudProgram.mShaderFiles.clear(); @@ -3267,16 +3271,6 @@ BOOL LLViewerShaderMgr::loadShadersInterface() if (success) { - gDownsampleDepthRectProgram.mName = "DownsampleDepthRect Shader"; - gDownsampleDepthRectProgram.mShaderFiles.clear(); - gDownsampleDepthRectProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthV.glsl", GL_VERTEX_SHADER_ARB)); - gDownsampleDepthRectProgram.mShaderFiles.push_back(make_pair("interface/downsampleDepthRectF.glsl", GL_FRAGMENT_SHADER_ARB)); - gDownsampleDepthRectProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE]; - success = gDownsampleDepthRectProgram.createShader(NULL, NULL); - } - - if (success) - { gAlphaMaskProgram.mName = "Alpha Mask Shader"; gAlphaMaskProgram.mShaderFiles.clear(); gAlphaMaskProgram.mShaderFiles.push_back(make_pair("interface/alphamaskV.glsl", GL_VERTEX_SHADER_ARB)); @@ -3294,18 +3288,52 @@ BOOL LLViewerShaderMgr::loadShadersInterface() return TRUE; } +#pragma optimize("", off) + BOOL LLViewerShaderMgr::loadShadersWindLight() -{ +{ BOOL success = TRUE; if (mVertexShaderLevel[SHADER_WINDLIGHT] < 2) { gWLSkyProgram.unload(); gWLCloudProgram.unload(); + gDownsampleMinMaxDepthRectProgram.unload(); + gInscatterRectProgram.unload(); return TRUE; } - if (success) + if (mVertexShaderLevel[SHADER_WINDLIGHT] >= 3) + { + // Prepare precomputed atmospherics textures using libatmosphere + LLAtmosphere::initClass(); + } + + // this shader uses gather so it can't live with the other basic shaders safely + /*if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] >= 3)) + { + gDownsampleMinMaxDepthRectProgram.mName = "DownsampleMinMaxDepthRect Shader"; + gDownsampleMinMaxDepthRectProgram.mShaderFiles.clear(); + gDownsampleMinMaxDepthRectProgram.mShaderFiles.push_back(make_pair("windlight/downsampleMinMaxDepthV.glsl", GL_VERTEX_SHADER_ARB)); + gDownsampleMinMaxDepthRectProgram.mShaderFiles.push_back(make_pair("windlight/downsampleMinMaxDepthRectF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDownsampleMinMaxDepthRectProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT]; + success = gDownsampleMinMaxDepthRectProgram.createShader(NULL, NULL); + }*/ + + // this shader uses gather so it can't live with the other basic shaders safely + if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] >= 3)) + { + gInscatterRectProgram.mName = "Inscatter Shader"; + gInscatterRectProgram.mShaderFiles.clear(); + gInscatterRectProgram.mShaderFiles.push_back(make_pair("windlight/advancedAtmoV.glsl", GL_VERTEX_SHADER_ARB)); + gInscatterRectProgram.mShaderFiles.push_back(make_pair("windlight/advancedAtmoF.glsl", GL_FRAGMENT_SHADER_ARB)); + gInscatterRectProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT]; + llassert(gAtmosphere != nullptr); + gInscatterRectProgram.mExtraLinkObject = gAtmosphere->getAtmosphericShaderForLink(); + success = gInscatterRectProgram.createShader(NULL, NULL); + } + + if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] < 3)) { gWLSkyProgram.mName = "Windlight Sky Shader"; //gWLSkyProgram.mFeatures.hasGamma = true; @@ -3317,7 +3345,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() success = gWLSkyProgram.createShader(NULL, NULL); } - if (success) + if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] < 3)) { gWLCloudProgram.mName = "Windlight Cloud Program"; //gWLCloudProgram.mFeatures.hasGamma = true; @@ -3332,6 +3360,9 @@ BOOL LLViewerShaderMgr::loadShadersWindLight() return success; } +#pragma optimize("", on) + + BOOL LLViewerShaderMgr::loadTransformShaders() { BOOL success = TRUE; diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 923aa522ad..10c60187f3 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -184,6 +184,8 @@ extern LLGLSLShader gDebugProgram; extern LLGLSLShader gClipProgram; extern LLGLSLShader gDownsampleDepthProgram; extern LLGLSLShader gDownsampleDepthRectProgram; +extern LLGLSLShader gDownsampleMinMaxDepthRectProgram; +extern LLGLSLShader gInscatterRectProgram; extern LLGLSLShader gBenchmarkProgram; //output tex0[tc0] + tex1[tc1] diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index e5a1bed48c..e59e86529a 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -98,8 +98,8 @@ const S32 MAX_CACHED_RAW_IMAGE_AREA = 64 * 64; const S32 MAX_CACHED_RAW_SCULPT_IMAGE_AREA = LLViewerTexture::sMaxSculptRez * LLViewerTexture::sMaxSculptRez; const S32 MAX_CACHED_RAW_TERRAIN_IMAGE_AREA = 128 * 128; const S32 DEFAULT_ICON_DIMENTIONS = 32; -S32 LLViewerTexture::sMinLargeImageSize = 65536; //256 * 256. -S32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA; +U32 LLViewerTexture::sMinLargeImageSize = 65536; //256 * 256. +U32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA; BOOL LLViewerTexture::sFreezeImageScalingDown = FALSE; F32 LLViewerTexture::sCurrentTime = 0.0f; F32 LLViewerTexture::sTexelPixelRatio = 1.0f; @@ -1176,12 +1176,12 @@ void LLViewerFetchedTexture::loadFromFastCache() { return; //no need to access the fast cache. } - mInFastCacheList = FALSE; + mInFastCacheList = FALSE; mRawImage = LLAppViewer::getTextureCache()->readFromFastCache(getID(), mRawDiscardLevel); if(mRawImage.notNull()) { - mFullWidth = mRawImage->getWidth() << mRawDiscardLevel; + mFullWidth = mRawImage->getWidth() << mRawDiscardLevel; mFullHeight = mRawImage->getHeight() << mRawDiscardLevel; setTexelsPerImage(); @@ -1196,20 +1196,20 @@ void LLViewerFetchedTexture::loadFromFastCache() else { if (mBoostLevel == LLGLTexture::BOOST_ICON) + { + S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_ICON_DIMENTIONS; + S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_ICON_DIMENTIONS; + if (mRawImage && (mRawImage->getWidth() > expected_width || mRawImage->getHeight() > expected_height)) { - S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_ICON_DIMENTIONS; - S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_ICON_DIMENTIONS; - if (mRawImage && (mRawImage->getWidth() > expected_width || mRawImage->getHeight() > expected_height)) - { - // scale oversized icon, no need to give more work to gl - mRawImage->scale(expected_width, expected_height); - } + // scale oversized icon, no need to give more work to gl + mRawImage->scale(expected_width, expected_height); + } } - mRequestedDiscardLevel = mDesiredDiscardLevel + 1; - mIsRawImageValid = TRUE; - addToCreateTexture(); - } + mRequestedDiscardLevel = mDesiredDiscardLevel + 1; + mIsRawImageValid = TRUE; + addToCreateTexture(); + } } } @@ -1965,7 +1965,7 @@ bool LLViewerFetchedTexture::updateFetch() mIsFetched = TRUE; tester->updateTextureLoadingStats(this, mRawImage, LLAppViewer::getTextureFetch()->isFromLocalCache(mID)); } - mRawDiscardLevel = fetch_discard; + mRawDiscardLevel = fetch_discard; if ((mRawImage->getDataSize() > 0 && mRawDiscardLevel >= 0) && (current_discard < 0 || mRawDiscardLevel < current_discard)) { diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index c9dea17f63..5bc274ee5b 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -225,8 +225,8 @@ public: static S8 sCameraMovingDiscardBias; static F32 sCameraMovingBias; static S32 sMaxSculptRez ; - static S32 sMinLargeImageSize ; - static S32 sMaxSmallImageSize ; + static U32 sMinLargeImageSize ; + static U32 sMaxSmallImageSize ; static BOOL sFreezeImageScalingDown ;//do not scale down image res if set. static F32 sCurrentTime ; diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index ad68408836..c1ba7b1efd 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -397,6 +397,7 @@ void LLVOSky::init() calcAtmospherics(); +#if SUPPORT_LEGACY_ATMOSPHERICS // Initialize the cached normalized direction vectors for (S32 side = 0; side < 6; ++side) { @@ -412,6 +413,7 @@ void LLVOSky::init() mSkyTex[i].create(1.0f); mShinyTex[i].create(1.0f); } +#endif initCubeMap(); mInitialized = true; @@ -494,6 +496,7 @@ void LLVOSky::restoreGL() } +#if SUPPORT_LEGACY_ATMOSPHERICS void LLVOSky::initSkyTextureDirs(const S32 side, const S32 tile) { S32 tile_x = tile % NUM_TILES_X; @@ -816,6 +819,7 @@ LLColor3 LLVOSky::calcSkyColorWLFrag(LLVector3 & Pn, LLColor3 & vary_HazeColor, return res; } + LLColor3 LLVOSky::createDiffuseFromWL(LLColor3 diffuse, LLColor3 ambient, LLColor3 sundiffuse, LLColor3 sunambient) { return componentMult(diffuse, sundiffuse) * 4.0f + @@ -826,7 +830,7 @@ LLColor3 LLVOSky::createAmbientFromWL(LLColor3 ambient, LLColor3 sundiffuse, LLC { return (componentMult(ambient, sundiffuse) + sunambient) * 0.8f; } - +#endif void LLVOSky::calcAtmospherics(void) { @@ -878,6 +882,7 @@ BOOL LLVOSky::updateSky() return TRUE; } +#if SUPPORT_LEGACY_ATMOSPHERICS static S32 next_frame = 0; const S32 total_no_tiles = 6 * NUM_TILES; const S32 cycle_frame_no = total_no_tiles + 1; @@ -927,6 +932,7 @@ BOOL LLVOSky::updateSky() if (mForceUpdate) { updateFog(LLViewerCamera::getInstance()->getFar()); + for (int side = 0; side < 6; side++) { for (int tile = 0; tile < NUM_TILES; tile++) @@ -995,6 +1001,8 @@ BOOL LLVOSky::updateSky() { gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE); } +#endif + return TRUE; } @@ -1856,6 +1864,8 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, void LLVOSky::updateFog(const F32 distance) { + +#if SUPPORT_LEGACY_ATMOSPHERICS if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOG)) { if (!LLGLSLShader::sNoFixedFunction) @@ -2000,6 +2010,9 @@ void LLVOSky::updateFog(const F32 distance) glHint(GL_FOG_HINT, GL_NICEST); } stop_glerror(); + +#endif + } diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h index 9123381c3d..4f6bc55bbe 100644 --- a/indra/newview/llvosky.h +++ b/indra/newview/llvosky.h @@ -34,7 +34,7 @@ #include "llviewerobject.h" #include "llframetimer.h" #include "v3colorutil.h" - +#include "llsettingssky.h" ////////////////////////////////// // @@ -382,6 +382,8 @@ class LLVOSky : public LLStaticViewerObject public: void calcAtmospherics(void); + +#if SUPPORT_LEGACY_ATMOSPHERICS LLColor3 createDiffuseFromWL(LLColor3 diffuse, LLColor3 ambient, LLColor3 sundiffuse, LLColor3 sunambient); LLColor3 createAmbientFromWL(LLColor3 ambient, LLColor3 sundiffuse, LLColor3 sunambient); @@ -392,8 +394,17 @@ public: LLColor3 calcSkyColorWLFrag(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLColor3 & vary_CloudColorSun, LLColor3 & vary_CloudColorAmbient, F32 & vary_CloudDensity, LLVector2 vary_HorizontalProjection[2]); + LLColor4 calcSkyColorInDir(const LLVector3& dir, bool isShiny = false); + + LLColor3 calcRadianceAtPoint(const LLVector3& pos) const + { + F32 radiance = mBrightnessScaleGuess * mSun.getIntensity(); + return LLColor3(radiance, radiance, radiance); + } + void initSkyTextureDirs(const S32 side, const S32 tile); + void createSkyTexture(const S32 side, const S32 tile); +#endif -public: enum { FACE_SIDE0, @@ -429,17 +440,6 @@ public: /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); - void initSkyTextureDirs(const S32 side, const S32 tile); - void createSkyTexture(const S32 side, const S32 tile); - - LLColor4 calcSkyColorInDir(const LLVector3& dir, bool isShiny = false); - - LLColor3 calcRadianceAtPoint(const LLVector3& pos) const - { - F32 radiance = mBrightnessScaleGuess * mSun.getIntensity(); - return LLColor3(radiance, radiance, radiance); - } - const LLHeavenBody& getSun() const { return mSun; } const LLHeavenBody& getMoon() const { return mMoon; } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 0ac1bfa3e7..8f691a0453 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -381,6 +381,7 @@ bool LLPipeline::sRenderBump = true; bool LLPipeline::sBakeSunlight = false; bool LLPipeline::sNoAlpha = false; bool LLPipeline::sUseTriStrips = true; +bool LLPipeline::sUseAdvancedAtmospherics = false; bool LLPipeline::sUseFarClip = true; bool LLPipeline::sShadowRender = false; bool LLPipeline::sWaterReflections = false; @@ -480,6 +481,7 @@ void LLPipeline::init() sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD"); sRenderBump = gSavedSettings.getBOOL("RenderObjectBump"); sUseTriStrips = gSavedSettings.getBOOL("RenderUseTriStrips"); + sUseAdvancedAtmospherics = gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics"); LLVertexBuffer::sUseStreamDraw = gSavedSettings.getBOOL("RenderUseStreamVBO"); LLVertexBuffer::sUseVAO = gSavedSettings.getBOOL("RenderUseVAO"); LLVertexBuffer::sPreferStreamDraw = gSavedSettings.getBOOL("RenderPreferStreamDraw"); @@ -981,7 +983,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) for (U32 i = 0; i < 4; i++) { if (!mShadow[i].allocate(sun_shadow_map_width,U32(resY*scale), 0, TRUE, FALSE, LLTexUnit::TT_TEXTURE)) return false; - if (!mShadowOcclusion[i].allocate(mShadow[i].getWidth()/occlusion_divisor, mShadow[i].getHeight()/occlusion_divisor, 0, TRUE, FALSE, LLTexUnit::TT_TEXTURE)) return false; + if (!mShadowOcclusion[i].allocate(mShadow[i].getWidth()/occlusion_divisor, mShadow[i].getHeight()/occlusion_divisor, 0, TRUE, FALSE, LLTexUnit::TT_TEXTURE)) return false; } } else @@ -993,6 +995,13 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) } } +// for EEP atmospherics + bool allocated_inscatter = mInscatter.allocate(resX >> 2, resY >> 2, GL_RGBA16F_ARB, FALSE, FALSE, LLTexUnit::TT_TEXTURE); + if (!allocated_inscatter) + { + return false; + } + U32 width = (U32) (resX*scale); U32 height = width; @@ -1229,6 +1238,8 @@ void LLPipeline::releaseScreenBuffers() mShadow[i].release(); mShadowOcclusion[i].release(); } + + mInscatter.release(); } @@ -2646,6 +2657,65 @@ void LLPipeline::markOccluder(LLSpatialGroup* group) } } +void LLPipeline::downsampleMinMaxDepthBuffer(LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space) +{ + LLGLSLShader* last_shader = LLGLSLShader::sCurBoundShaderPtr; + + LLGLSLShader* shader = NULL; + + if (scratch_space) + { + scratch_space->copyContents(source, + 0, 0, source.getWidth(), source.getHeight(), + 0, 0, scratch_space->getWidth(), scratch_space->getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST); + } + + dest.bindTarget(); + dest.clear(GL_COLOR_BUFFER_BIT); // dest should be an RG16F target + + LLStrider<LLVector3> vert; + mDeferredVB->getVertexStrider(vert); + LLStrider<LLVector2> tc0; + + vert[0].set(-1, 1, 0); + vert[1].set(-1, -3, 0); + vert[2].set(3, 1, 0); + + if (source.getUsage() == LLTexUnit::TT_RECT_TEXTURE) + { + shader = &gDownsampleMinMaxDepthRectProgram; + shader->bind(); + shader->uniform2f(sDelta, 1.f, 1.f); + shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, source.getWidth(), source.getHeight()); + } + else + { + shader = &gDownsampleMinMaxDepthRectProgram; + shader->bind(); + shader->uniform2f(sDelta, 1.f / source.getWidth(), 1.f / source.getHeight()); + shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, 1.f, 1.f); + } + + gGL.getTexUnit(0)->bind(scratch_space ? scratch_space : &source, TRUE); + + { + LLGLDepthTest depth(GL_FALSE, GL_FALSE, GL_ALWAYS); + mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); + mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); + } + + dest.flush(); + + if (last_shader) + { + last_shader->bind(); + } + else + { + shader->unbind(); + } +} + void LLPipeline::downsampleDepthBuffer(LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space) { LLGLSLShader* last_shader = LLGLSLShader::sCurBoundShaderPtr; @@ -8282,6 +8352,21 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n } } + channel = shader.enableTexture(LLShaderMgr::INSCATTER_RT, LLTexUnit::TT_TEXTURE); + stop_glerror(); + if (channel > -1) + { + stop_glerror(); + gGL.getTexUnit(channel)->bind(&mInscatter, TRUE); + gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); + gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); + stop_glerror(); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_ALWAYS); + stop_glerror(); + } + stop_glerror(); F32 mat[16*6]; @@ -9095,6 +9180,7 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target) } } +// pretty sure this doesn't work as expected since the shaders using 'shadow_ofset' all declare it as a single uniform float, no array or vec gDeferredSunProgram.uniform3fv(LLShaderMgr::DEFERRED_SHADOW_OFFSET, slice, offset); gDeferredSunProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mDeferredLight.getWidth(), mDeferredLight.getHeight()); @@ -9911,9 +9997,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) } else { - renderGeom(camera); - } - } + renderGeom(camera); + } + } } if (LLPipeline::sRenderDeferred && materials_in_water) @@ -10412,23 +10498,25 @@ bool LLPipeline::getVisiblePointCloud(LLCamera& camera, LLVector3& min, LLVector for (U32 j = 0; j < 3; ++j) { - if (p[j] < ext[0].mV[j] || - p[j] > ext[1].mV[j]) + if (p[j] < ext[0].mV[j] || p[j] > ext[1].mV[j]) { found = false; break; } } - - for (U32 j = 0; j < LLCamera::AGENT_PLANE_NO_USER_CLIP_NUM; ++j) + + if (found) // don't bother testing user clip planes if we're already rejected... { - const LLPlane& cp = camera.getAgentPlane(j); - F32 dist = cp.dist(pp[i]); - if (dist > 0.05f) //point is above some plane, not contained - { - found = false; - break; - } + for (U32 j = 0; j < LLCamera::AGENT_PLANE_NO_USER_CLIP_NUM; ++j) + { + const LLPlane& cp = camera.getAgentPlane(j); + F32 dist = cp.dist(pp[i]); + if (dist > 0.05f) //point is above some plane, not contained + { + found = false; + break; + } + } } if (found) @@ -11959,3 +12047,7 @@ void LLPipeline::restoreHiddenObject( const LLUUID& id ) } } +bool LLPipeline::useAdvancedAtmospherics() const +{ + return sUseAdvancedAtmospherics; +}
\ No newline at end of file diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index c9670a60f2..6023a41ca2 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -168,6 +168,9 @@ public: // if source's depth buffer cannot be bound for reading, a scratch space depth buffer must be provided void downsampleDepthBuffer(LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space = NULL); + // Downsample depth buffer with gather and find local min/max depth values. Writes to a 16F RG render target. + void downsampleMinMaxDepthBuffer(LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space = NULL); + void doOcclusion(LLCamera& camera, LLRenderTarget& source, LLRenderTarget& dest, LLRenderTarget* scratch_space = NULL); void doOcclusion(LLCamera& camera); void markNotCulled(LLSpatialGroup* group, LLCamera &camera); @@ -541,6 +544,8 @@ public: void updateCamera(bool reset = false); + bool useAdvancedAtmospherics() const; + LLVector3 mFlyCamPosition; LLQuaternion mFlyCamRotation; @@ -568,6 +573,7 @@ public: static bool sBakeSunlight; static bool sNoAlpha; static bool sUseTriStrips; + static bool sUseAdvancedAtmospherics; static bool sUseFarClip; static bool sShadowRender; static bool sWaterReflections; @@ -614,12 +620,13 @@ public: //sun shadow map LLRenderTarget mShadow[6]; LLRenderTarget mShadowOcclusion[6]; - std::vector<LLVector3> mShadowFrustPoints[4]; - LLVector4 mShadowError; - LLVector4 mShadowFOV; - LLVector3 mShadowFrustOrigin[4]; - LLCamera mShadowCamera[8]; - LLVector3 mShadowExtents[4][2]; + LLRenderTarget mInscatter; + std::vector<LLVector3> mShadowFrustPoints[4]; + LLVector4 mShadowError; + LLVector4 mShadowFOV; + LLVector3 mShadowFrustOrigin[4]; + LLCamera mShadowCamera[8]; + LLVector3 mShadowExtents[4][2]; glh::matrix4f mSunShadowMatrix[6]; glh::matrix4f mShadowModelview[6]; glh::matrix4f mShadowProjection[6]; |