From 78ac287344cf77f1afe3f1558cad12bcb2117c44 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Sat, 23 Oct 2021 23:07:17 -0400
Subject: [PATCH] More sky opts

---
 indra/newview/lllegacyatmospherics.cpp | 6 +++---
 indra/newview/llvowlsky.cpp            | 9 +++++----
 indra/newview/llvowlsky.h              | 3 ++-
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp
index fef77f24dae..e78f2397c79 100644
--- a/indra/newview/lllegacyatmospherics.cpp
+++ b/indra/newview/lllegacyatmospherics.cpp
@@ -458,9 +458,9 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in)
     vars.total_density = psky->getTotalDensity();
     vars.gamma = psky->getGamma();
 
-	res_color[0] = calcSkyColorInDir(vars, tosun);
-	res_color[1] = calcSkyColorInDir(vars, perp_tosun);
-	res_color[2] = calcSkyColorInDir(vars, tosun_45);
+	res_color[0] = calcSkyColorInDir(psky, vars, tosun);
+	res_color[1] = calcSkyColorInDir(psky, vars, perp_tosun);
+	res_color[2] = calcSkyColorInDir(psky, vars, tosun_45);
 
 	sky_fog_color = color_norm(res_color[0] + res_color[1] + res_color[2]);
 
diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp
index f462188b6c0..4d80d53a79f 100644
--- a/indra/newview/llvowlsky.cpp
+++ b/indra/newview/llvowlsky.cpp
@@ -211,6 +211,8 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
 		LLTimer timer;
 		timer.start();
 
+		const F32 DOME_RADIUS = LLEnvironment::instance().getCurrentSky()->getDomeRadius();
+
 		for (U32 i = 0; i < strips_segments ;++i)
 		{
 			LLVertexBuffer * segment = new LLVertexBuffer(LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW);
@@ -255,7 +257,7 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
             U32 index_count  = 0;
 
 			// fill it
-			buildStripsBuffer(begin_stack, end_stack, vertex_count, index_count, vertices, texCoords, indices);
+			buildStripsBuffer(begin_stack, end_stack, vertex_count, index_count, vertices, texCoords, indices, DOME_RADIUS);
 
 			// and unlock the buffer
 			segment->flush();
@@ -368,10 +370,9 @@ void LLVOWLSky::buildStripsBuffer(U32 begin_stack,
                                   U32& index_count,
 								  LLStrider<LLVector3> & vertices,
 								  LLStrider<LLVector2> & texCoords,
-								  LLStrider<U16> & indices)
+								  LLStrider<U16> & indices,
+								  const F32 RADIUS)
 {
-    const F32 RADIUS = LLEnvironment::instance().getCurrentSky()->getDomeRadius();
-
 	U32 i, j, num_slices, num_stacks;
 	F32 phi0, theta, x0, y0, z0;
 
diff --git a/indra/newview/llvowlsky.h b/indra/newview/llvowlsky.h
index d4ac32dacc0..8f072f94bf2 100644
--- a/indra/newview/llvowlsky.h
+++ b/indra/newview/llvowlsky.h
@@ -70,7 +70,8 @@ class LLVOWLSky final : public LLStaticViewerObject {
                                   U32& index_count,
 								  LLStrider<LLVector3> & vertices,
 								  LLStrider<LLVector2> & texCoords,
-								  LLStrider<U16> & indices);
+								  LLStrider<U16> & indices,
+								  const F32 RADIUS);
 
 	// helper function for updating the stars colors.
 	void updateStarColors();
-- 
GitLab