From f45f87e07df963f5d3629649f1416cd4a58dba89 Mon Sep 17 00:00:00 2001
From: Jonathan Wolk <jwolk@lindenlab.com>
Date: Wed, 26 May 2010 15:43:28 -0700
Subject: [PATCH] Fixes for DEV-50619 Have the low graphics settings be the
 lowest possible settings for settings with slider bars and DEV-50618 Have
 Draw Classic Clouds be off for low graphics settings and DEV-50616 Toggling
 Draw Classic Clouds does not actually prevent them from being drawn if clouds
 have been drawn once.  Reviewed by qarl

---
 indra/newview/featuretable.txt       | 13 +++++-----
 indra/newview/featuretable_linux.txt | 12 ++++++----
 indra/newview/featuretable_mac.txt   | 12 ++++++----
 indra/newview/llcloud.cpp            | 22 ++++++++---------
 indra/newview/llworld.cpp            | 36 ++++++++++++++++++++++++----
 indra/newview/llworld.h              |  2 ++
 6 files changed, 65 insertions(+), 32 deletions(-)

diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt
index f1c1a142adb..b4add267fe4 100644
--- a/indra/newview/featuretable.txt
+++ b/indra/newview/featuretable.txt
@@ -56,7 +56,7 @@ Disregard128DefaultDrawDistance	1	1
 Disregard96DefaultDrawDistance	1	1
 RenderTextureMemoryMultiple		1	1.0
 RenderShaderLightingMaxLevel	1	3
-
+SkyUseClassicClouds			1	1
 
 //
 // Low Graphics Settings
@@ -64,25 +64,26 @@ RenderShaderLightingMaxLevel	1	3
 list Low
 RenderAnisotropic			1	0
 RenderAvatarCloth			1	0
-RenderAvatarLODFactor		1	0.5
+RenderAvatarLODFactor		1	0
 RenderAvatarMaxVisible      1   3
 RenderAvatarVP				1	0
 RenderFarClip				1	64
-RenderFlexTimeFactor		1	0.5
+RenderFlexTimeFactor		1	0
 RenderGlowResolutionPow		1	8
 RenderLightingDetail		1	0
-RenderMaxPartCount			1	1024
+RenderMaxPartCount			1	0
 RenderObjectBump			1	0
 RenderReflectionDetail		1	0
 RenderTerrainDetail			1	0
 RenderTerrainLODFactor		1	1
-RenderTreeLODFactor			1	0.5
+RenderTreeLODFactor			1	0
 RenderUseImpostors			1	1
-RenderVolumeLODFactor		1	1.125
+RenderVolumeLODFactor		1	0
 RenderWaterReflections		1	0
 VertexShaderEnable			1	0
 WindLightUseAtmosShaders	1	0
 WLSkyDetail					1	48
+SkyUseClassicClouds			1	0
 
 //
 // Mid Graphics Settings
diff --git a/indra/newview/featuretable_linux.txt b/indra/newview/featuretable_linux.txt
index d1d11ee1736..4fb529ab394 100644
--- a/indra/newview/featuretable_linux.txt
+++ b/indra/newview/featuretable_linux.txt
@@ -55,6 +55,7 @@ WLSkyDetail					1	128
 Disregard128DefaultDrawDistance	1	1
 Disregard96DefaultDrawDistance	1	1
 RenderTextureMemoryMultiple		1	1.0
+SkyUseClassicClouds			1	1
 
 //
 // Low Graphics Settings
@@ -62,25 +63,26 @@ RenderTextureMemoryMultiple		1	1.0
 list Low
 RenderAnisotropic			1	0
 RenderAvatarCloth			1	0
-RenderAvatarLODFactor		1	0.5
+RenderAvatarLODFactor		1	0
 RenderAvatarMaxVisible      1   3
 RenderAvatarVP				1	0
 RenderFarClip				1	64
-RenderFlexTimeFactor		1	0.5
+RenderFlexTimeFactor		1	0
 RenderGlowResolutionPow		1	8
 RenderLightingDetail		1	0
-RenderMaxPartCount			1	1024
+RenderMaxPartCount			1	0
 RenderObjectBump			1	0
 RenderReflectionDetail		1	0
 RenderTerrainDetail			1	0
 RenderTerrainLODFactor		1	1
-RenderTreeLODFactor			1	0.5
+RenderTreeLODFactor			1	0
 RenderUseImpostors			1	1
-RenderVolumeLODFactor		1	1.125
+RenderVolumeLODFactor		1	0
 RenderWaterReflections		1	0
 VertexShaderEnable			1	0
 WindLightUseAtmosShaders	1	0
 WLSkyDetail					1	48
+SkyUseClassicClouds			1	0
 
 //
 // Mid Graphics Settings
diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt
index efd7ec7a912..fbc589d3e7c 100644
--- a/indra/newview/featuretable_mac.txt
+++ b/indra/newview/featuretable_mac.txt
@@ -57,6 +57,7 @@ Disregard96DefaultDrawDistance	1	1
 RenderTextureMemoryMultiple		1	0.5
 Disregard128DefaultDrawDistance	1	1
 Disregard96DefaultDrawDistance	1	1
+SkyUseClassicClouds			1	1
 
 //
 // Low Graphics Settings
@@ -64,25 +65,26 @@ Disregard96DefaultDrawDistance	1	1
 list Low
 RenderAnisotropic			1	0
 RenderAvatarCloth			1	0
-RenderAvatarLODFactor		1	0.5
+RenderAvatarLODFactor		1	0
 RenderAvatarMaxVisible      1   3
 RenderAvatarVP				1	0
 RenderFarClip				1	64
-RenderFlexTimeFactor		1	0.5
+RenderFlexTimeFactor		1	0
 RenderGlowResolutionPow		1	8
 RenderLightingDetail		1	0
-RenderMaxPartCount			1	1024
+RenderMaxPartCount			1	0
 RenderObjectBump			1	0
 RenderReflectionDetail		1	0
 RenderTerrainDetail			1	0
 RenderTerrainLODFactor		1	1
-RenderTreeLODFactor			1	0.5
+RenderTreeLODFactor			1	0
 RenderUseImpostors			1	1
-RenderVolumeLODFactor		1	1.125
+RenderVolumeLODFactor		1	0
 RenderWaterReflections		1	0
 VertexShaderEnable			1	0
 WindLightUseAtmosShaders	1	0
 WLSkyDetail					1	48
+SkyUseClassicClouds			1	0
 
 //
 // Mid Graphics Settings
diff --git a/indra/newview/llcloud.cpp b/indra/newview/llcloud.cpp
index af6f4e3286f..a4104923e49 100644
--- a/indra/newview/llcloud.cpp
+++ b/indra/newview/llcloud.cpp
@@ -329,16 +329,7 @@ void LLCloudLayer::setRegion(LLViewerRegion *regionp)
 
 void LLCloudLayer::destroy()
 {
-	// Kill all of the existing puffs
-	S32 i, j;
-	
-	for (i = 0; i < CLOUD_GROUPS_PER_EDGE; i++)
-	{
-		for (j = 0; j < CLOUD_GROUPS_PER_EDGE; j++)
-		{
-			mCloudGroups[i][j].cleanup();
-		}
-	}
+	reset();
 
 	delete [] mDensityp;
 	mDensityp = NULL;
@@ -348,8 +339,17 @@ void LLCloudLayer::destroy()
 
 void LLCloudLayer::reset()
 {
-}
+	// Kill all of the existing puffs
+	S32 i, j;
 
+	for (i = 0; i < CLOUD_GROUPS_PER_EDGE; i++)
+	{
+		for (j = 0; j < CLOUD_GROUPS_PER_EDGE; j++)
+		{
+			mCloudGroups[i][j].cleanup();
+		}
+	}
+}
 
 void LLCloudLayer::setWindPointer(LLWind *windp)
 {
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 58b9f5ce188..f30567f4816 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -91,7 +91,8 @@ LLWorld::LLWorld() :
 	mLastPacketsIn(0),
 	mLastPacketsOut(0),
 	mLastPacketsLost(0),
-	mSpaceTimeUSec(0)
+	mSpaceTimeUSec(0),
+	mClassicCloudsEnabled(TRUE)
 {
 	for (S32 i = 0; i < 8; i++)
 	{
@@ -662,16 +663,41 @@ void LLWorld::updateClouds(const F32 dt)
 	static LLFastTimer::DeclareTimer ftm("World Clouds");
 	LLFastTimer t(ftm);
 
-	if (gSavedSettings.getBOOL("FreezeTime") ||
-		!gSavedSettings.getBOOL("SkyUseClassicClouds"))
+	if ( gSavedSettings.getBOOL("FreezeTime") )
 	{
 		// don't move clouds in snapshot mode
 		return;
 	}
+
+	if (
+		mClassicCloudsEnabled !=
+		gSavedSettings.getBOOL("SkyUseClassicClouds") )
+	{
+		// The classic cloud toggle has been flipped
+		// gotta update all of the cloud layers
+		mClassicCloudsEnabled =
+			gSavedSettings.getBOOL("SkyUseClassicClouds");
+
+		if ( !mClassicCloudsEnabled && mActiveRegionList.size() )
+		{
+			// We've transitioned to having classic clouds disabled
+			// reset all cloud layers.
+			for (
+				region_list_t::iterator iter = mActiveRegionList.begin();
+				iter != mActiveRegionList.end();
+				++iter)
+			{
+				LLViewerRegion* regionp = *iter;
+				regionp->mCloudLayer.reset();
+			}
+
+			return;
+		}
+	}
+	else if ( !mClassicCloudsEnabled ) return;
+
 	if (mActiveRegionList.size())
 	{
-		// Update all the cloud puff positions, and timer based stuff
-		// such as death decay
 		for (region_list_t::iterator iter = mActiveRegionList.begin();
 			 iter != mActiveRegionList.end(); ++iter)
 		{
diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h
index 502f7b0320b..5310009d7cc 100644
--- a/indra/newview/llworld.h
+++ b/indra/newview/llworld.h
@@ -184,6 +184,8 @@ class LLWorld : public LLSingleton<LLWorld>
 
 	U64 mSpaceTimeUSec;
 
+	BOOL mClassicCloudsEnabled;
+
 	////////////////////////////
 	//
 	// Data for "Fake" objects
-- 
GitLab