Selectable cloud textures (from Alchemy)

Option is in Clouds tab of the Advanced Sky Editor.
This commit is contained in:
Inusaito Sayori
2015-05-19 06:57:26 -04:00
parent 9ed99176f7
commit 63d7e18456
9 changed files with 93 additions and 2 deletions

View File

@@ -222,6 +222,17 @@
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>AlchemyWLCloudTexture</key>
<map>
<key>Comment</key>
<string>Name of local cloud texture to use for windlight</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>Default.tga</string>
</map>
<key>AscentPowerfulWizard</key>
<map>

View File

@@ -47,6 +47,7 @@
#include "llviewerregion.h"
#include "llface.h"
#include "llrender.h"
#include "llviewercontrol.h"
LLPointer<LLViewerTexture> 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<LLImageFormatted> cloudNoiseFile(LLImageFormatted::createFromExtension(cloudNoiseFilename));

View File

@@ -82,7 +82,7 @@ private:
void renderSkyClouds(F32 camHeightLocal) const;
void renderHeavenlyBodies();
private:
public:
static LLPointer<LLViewerTexture> sCloudNoiseTexture;
static LLPointer<LLImageRaw> sCloudNoiseRawImage;
};

View File

@@ -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<LLImageFormatted> 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));

View File

@@ -585,6 +585,40 @@
name="DrawClassicClouds" width="200" />
<button bottom="-102" follows="left|top" font="SansSerifSmall" height="18" label="?"
left="608" name="WLClassicCloudsHelp" width="18" />
<text
name="cloud_settings_title"
follows="top|left"
height="16"
left="480"
bottom_delta="-17"
width="76">
Cloud Setting
</text>
<combo_box
follows="top|left"
control_name="AlchemyWLCloudTexture"
name="cloud_settings_preset_combo"
left_delta="76"
bottom_delta="2"
height="14"
width="110">
<combo_box.item
label="Altocumulus"
name="altocumulus_cloud"
value="Altocumulus.tga"/>
<combo_box.item
label="Cumulo-Nimbus"
name="cumulonimbus_cloud"
value="Cumulo-Nimbus.tga"/>
<combo_box.item
label="Default"
name="default_cloud"
value="Default.tga"/>
<combo_box.item
label="Layered"
name="layered_cloud"
value="Layered.tga"/>
</combo_box>
</panel>
</tab_container>
<string name="WLDefaultSkyNames">