diff --git a/indra/newview/app_settings/settings_ascent.xml b/indra/newview/app_settings/settings_ascent.xml index 38e39bb7a..7e4b4a794 100644 --- a/indra/newview/app_settings/settings_ascent.xml +++ b/indra/newview/app_settings/settings_ascent.xml @@ -222,6 +222,17 @@ Boolean Value 0 + + AlchemyWLCloudTexture + + Comment + Name of local cloud texture to use for windlight + Persist + 1 + Type + String + Value + Default.tga AscentPowerfulWizard diff --git a/indra/newview/app_settings/windlight/clouds/Altocumulus.tga b/indra/newview/app_settings/windlight/clouds/Altocumulus.tga new file mode 100644 index 000000000..675cb1609 Binary files /dev/null and b/indra/newview/app_settings/windlight/clouds/Altocumulus.tga differ diff --git a/indra/newview/app_settings/windlight/clouds/Cumulo-Nimbus.tga b/indra/newview/app_settings/windlight/clouds/Cumulo-Nimbus.tga new file mode 100644 index 000000000..88d5582eb Binary files /dev/null and b/indra/newview/app_settings/windlight/clouds/Cumulo-Nimbus.tga differ diff --git a/indra/newview/app_settings/windlight/clouds2.tga b/indra/newview/app_settings/windlight/clouds/Default.tga similarity index 100% rename from indra/newview/app_settings/windlight/clouds2.tga rename to indra/newview/app_settings/windlight/clouds/Default.tga diff --git a/indra/newview/app_settings/windlight/clouds/Layered.tga b/indra/newview/app_settings/windlight/clouds/Layered.tga new file mode 100644 index 000000000..1321d2378 Binary files /dev/null and b/indra/newview/app_settings/windlight/clouds/Layered.tga differ diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index dbe7b2911..46fd81b5b 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -47,6 +47,7 @@ #include "llviewerregion.h" #include "llface.h" #include "llrender.h" +#include "llviewercontrol.h" LLPointer LLDrawPoolWLSky::sCloudNoiseTexture = NULL; @@ -59,7 +60,11 @@ static LLGLSLShader* star_shader = NULL; LLDrawPoolWLSky::LLDrawPoolWLSky(void) : LLDrawPool(POOL_WL_SKY) { - const std::string cloudNoiseFilename(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", "clouds2.tga")); + std::string cloudNoiseFilename(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/clouds", gSavedSettings.getString("AlchemyWLCloudTexture"))); + if (!gDirUtilp->fileExists(cloudNoiseFilename)) + { + cloudNoiseFilename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/clouds", "Default.tga"); + } llinfos << "loading WindLight cloud noise from " << cloudNoiseFilename << llendl; LLPointer cloudNoiseFile(LLImageFormatted::createFromExtension(cloudNoiseFilename)); diff --git a/indra/newview/lldrawpoolwlsky.h b/indra/newview/lldrawpoolwlsky.h index 1057ef7bd..89daefa7a 100644 --- a/indra/newview/lldrawpoolwlsky.h +++ b/indra/newview/lldrawpoolwlsky.h @@ -82,7 +82,7 @@ private: void renderSkyClouds(F32 camHeightLocal) const; void renderHeavenlyBodies(); -private: +public: static LLPointer sCloudNoiseTexture; static LLPointer sCloudNoiseRawImage; }; diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index c34069e94..b34ba208d 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -77,6 +77,8 @@ #include "llworldmapview.h" #include "llnetmap.h" #include "llrender.h" +#include "lldrawpoolwlsky.h" +#include "llwlparammanager.h" #include "aistatemachine.h" #include "aithreadsafe.h" #include "lldrawpoolbump.h" @@ -573,6 +575,44 @@ bool handleVelocityInterpolate(const LLSD& newvalue) return true; } +bool handleWindlightCloudChanged(const LLSD& new_value) +{ + std::string cloudNoiseFilename(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/clouds", new_value.asString())); + if (!gDirUtilp->fileExists(cloudNoiseFilename)) + { + cloudNoiseFilename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/clouds", "Default.tga"); + } + llinfos << "loading WindLight cloud noise from " << cloudNoiseFilename << LL_ENDL; + + LLPointer cloudNoiseFile(LLImageFormatted::createFromExtension(cloudNoiseFilename)); + + if (cloudNoiseFile.isNull()) + { + llwarns << "Error: Failed to load cloud noise image " << cloudNoiseFilename << LL_ENDL; + return true; + } + + if (cloudNoiseFile->load(cloudNoiseFilename)) + { + LLDrawPoolWLSky::sCloudNoiseRawImage = new LLImageRaw(); + + if (cloudNoiseFile->decode(LLDrawPoolWLSky::sCloudNoiseRawImage, 0.0f)) + { + //debug use + lldebugs << "cloud noise raw image width: " << LLDrawPoolWLSky::sCloudNoiseRawImage->getWidth() << " : height: " << LLDrawPoolWLSky::sCloudNoiseRawImage->getHeight() << " : components: " << + (S32) LLDrawPoolWLSky::sCloudNoiseRawImage->getComponents() << " : data size: " << LLDrawPoolWLSky::sCloudNoiseRawImage->getDataSize() << LL_ENDL; + llassert_always(LLDrawPoolWLSky::sCloudNoiseRawImage->getData()); + + LLDrawPoolWLSky::sCloudNoiseTexture = LLViewerTextureManager::getLocalTexture(LLDrawPoolWLSky::sCloudNoiseRawImage.get(), TRUE); + } + else + { + LLDrawPoolWLSky::sCloudNoiseRawImage = NULL; + } + } + return true; +} + bool handleCloudSettingsChanged(const LLSD& newvalue) { bool bCloudsEnabled = gSavedSettings.getBOOL("CloudsEnabled"); @@ -782,6 +822,7 @@ void settings_setup_listeners() gSavedSettings.getControl("CloudsEnabled")->getSignal()->connect(boost::bind(&handleCloudSettingsChanged, _2)); gSavedSettings.getControl("SkyUseClassicClouds")->getSignal()->connect(boost::bind(&handleCloudSettingsChanged, _2)); gSavedSettings.getControl("RenderTransparentWater")->getSignal()->connect(boost::bind(&handleRenderTransparentWaterChanged, _2)); + gSavedSettings.getControl("AlchemyWLCloudTexture")->getSignal()->connect(boost::bind(&handleWindlightCloudChanged, _2)); gSavedSettings.getControl("AscentAvatarXModifier")->getSignal()->connect(boost::bind(&handleAscentAvatarModifier, _2)); gSavedSettings.getControl("AscentAvatarYModifier")->getSignal()->connect(boost::bind(&handleAscentAvatarModifier, _2)); diff --git a/indra/newview/skins/default/xui/en-us/floater_windlight_options.xml b/indra/newview/skins/default/xui/en-us/floater_windlight_options.xml index cd8cff527..9210a2c9b 100644 --- a/indra/newview/skins/default/xui/en-us/floater_windlight_options.xml +++ b/indra/newview/skins/default/xui/en-us/floater_windlight_options.xml @@ -585,6 +585,40 @@ name="DrawClassicClouds" width="200" />