From 6cc4a091b3ba4dd4842cc06e3b34af3d04dc5796 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Thu, 22 Feb 2018 00:35:24 +0000 Subject: Add settings/validations for new advanced atmo settings. --- indra/llrender/llatmosphere.h | 72 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 indra/llrender/llatmosphere.h (limited to 'indra/llrender/llatmosphere.h') 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 m_transmittance; + LLPointer m_scattering; + LLPointer m_mie_scattering; +}; + +extern LLAtmosphere* gAtmosphere; + +#endif // LL_ATMOSPHERE_H -- cgit v1.2.3 From 7ba03ede49a0850016c0b3f97863c0ec9944b251 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Tue, 6 Mar 2018 17:42:54 +0000 Subject: Modify use of linkable shader from libatmosphere. Update to use latest 3p-libatmo build packages. --- indra/llrender/llatmosphere.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llrender/llatmosphere.h') diff --git a/indra/llrender/llatmosphere.h b/indra/llrender/llatmosphere.h index 4aa36be27f..6a9d1a4438 100644 --- a/indra/llrender/llatmosphere.h +++ b/indra/llrender/llatmosphere.h @@ -50,7 +50,7 @@ public: LLGLTexture* getScattering() const; LLGLTexture* getMieScattering() const; - GLuint getAtmosphericShaderForLink() const; + GLhandleARB getAtmosphericShaderForLink() const; protected: LLAtmosphere(const LLAtmosphere& rhs) -- cgit v1.2.3 From 79e4a8c28ad29b028ddb907a6ea01f4ef71e822a Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Wed, 14 Mar 2018 00:11:19 +0100 Subject: Fix up atmospheric helpers and transport shader for adv atmo path. Basic hook-up of sky settings to llatmosphere model. Moved mie aniso to be a top-level setting instead of a per-mie-layer setting. --- indra/llrender/llatmosphere.h | 48 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) (limited to 'indra/llrender/llatmosphere.h') diff --git a/indra/llrender/llatmosphere.h b/indra/llrender/llatmosphere.h index 6a9d1a4438..53dc1dd354 100644 --- a/indra/llrender/llatmosphere.h +++ b/indra/llrender/llatmosphere.h @@ -31,6 +31,36 @@ #include "llgltexture.h" #include "libatmosphere/model.h" +typedef std::vector DensityProfile; + +class AtmosphericModelSettings +{ +public: + AtmosphericModelSettings(); + + AtmosphericModelSettings( + DensityProfile& rayleighProfile, + DensityProfile& mieProfile, + DensityProfile& absorptionProfile); + + AtmosphericModelSettings( + F32 skyBottomRadius, + F32 skyTopRadius, + DensityProfile& rayleighProfile, + DensityProfile& mieProfile, + DensityProfile& absorptionProfile, + F32 sunArcRadians, + F32 mieAniso); + + F32 m_skyBottomRadius; + F32 m_skyTopRadius; + DensityProfile m_rayleighProfile; + DensityProfile m_mieProfile; + DensityProfile m_absorptionProfile; + F32 m_sunArcRadians; + F32 m_mieAnisotropy; +}; + class LLAtmosphere { public: @@ -46,12 +76,14 @@ public: return *this; } - LLGLTexture* getTransmittance() const; - LLGLTexture* getScattering() const; - LLGLTexture* getMieScattering() const; + LLGLTexture* getTransmittance(); + LLGLTexture* getScattering(); + LLGLTexture* getMieScattering(); GLhandleARB getAtmosphericShaderForLink() const; + bool configureAtmosphericModel(AtmosphericModelSettings& settings); + protected: LLAtmosphere(const LLAtmosphere& rhs) { @@ -64,7 +96,15 @@ protected: LLPointer m_transmittance; LLPointer m_scattering; - LLPointer m_mie_scattering; + LLPointer m_mie_scatter_texture; + + std::vector m_wavelengths; + std::vector m_solar_irradiance; + std::vector m_rayleigh_scattering; + std::vector m_mie_scattering; + std::vector m_mie_extinction; + std::vector m_absorption_extinction; + std::vector m_ground_albedo; }; extern LLAtmosphere* gAtmosphere; -- cgit v1.2.3 From 3116416fcb8dfd54ef2807e9e75959429c946d79 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Tue, 1 May 2018 00:10:11 +0100 Subject: Le Merge --- indra/llrender/llatmosphere.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llrender/llatmosphere.h') diff --git a/indra/llrender/llatmosphere.h b/indra/llrender/llatmosphere.h index 53dc1dd354..0d62a069ac 100644 --- a/indra/llrender/llatmosphere.h +++ b/indra/llrender/llatmosphere.h @@ -79,6 +79,7 @@ public: LLGLTexture* getTransmittance(); LLGLTexture* getScattering(); LLGLTexture* getMieScattering(); + LLGLTexture* getIlluminance(); GLhandleARB getAtmosphericShaderForLink() const; @@ -97,6 +98,7 @@ protected: LLPointer m_transmittance; LLPointer m_scattering; LLPointer m_mie_scatter_texture; + LLPointer m_illuminance; std::vector m_wavelengths; std::vector m_solar_irradiance; -- cgit v1.2.3 From ffdd6c3d7dad87e9873067a923d4e7ce9e6d4d2c Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 10 Jul 2018 23:26:35 +0100 Subject: Make advanced atmo sky shader compile again. Make atmospheric model avoid redundant work when settings don't change. Point autobuild.xml at libatmosphere with op== to compare density profiles. --- indra/llrender/llatmosphere.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llrender/llatmosphere.h') diff --git a/indra/llrender/llatmosphere.h b/indra/llrender/llatmosphere.h index 0d62a069ac..a010803595 100644 --- a/indra/llrender/llatmosphere.h +++ b/indra/llrender/llatmosphere.h @@ -52,6 +52,8 @@ public: F32 sunArcRadians, F32 mieAniso); + bool operator==(const AtmosphericModelSettings& rhs) const; + F32 m_skyBottomRadius; F32 m_skyTopRadius; DensityProfile m_rayleighProfile; @@ -107,6 +109,8 @@ protected: std::vector m_mie_extinction; std::vector m_absorption_extinction; std::vector m_ground_albedo; + + AtmosphericModelSettings m_settings; }; extern LLAtmosphere* gAtmosphere; -- cgit v1.2.3 From d8eff424a5fb340b828802351e2b7f6b63bfa30f Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Sat, 2 Mar 2019 07:17:46 -0800 Subject: SL-10664 --- indra/llrender/llatmosphere.h | 73 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 64 insertions(+), 9 deletions(-) (limited to 'indra/llrender/llatmosphere.h') diff --git a/indra/llrender/llatmosphere.h b/indra/llrender/llatmosphere.h index a010803595..572365d864 100644 --- a/indra/llrender/llatmosphere.h +++ b/indra/llrender/llatmosphere.h @@ -1,6 +1,6 @@ /** * @file llatmosphere.h - * @brief LLAtmosphere class for integration with libatmosphere + * @brief LLAtmosphere class * * $LicenseInfo:firstyear=2018&license=viewerlgpl$ * Second Life Viewer Source Code @@ -29,9 +29,70 @@ #include "llglheaders.h" #include "llgltexture.h" -#include "libatmosphere/model.h" -typedef std::vector DensityProfile; +// An atmosphere layer of width 'width' (in m), and whose density is defined as +// 'exp_term' * exp('exp_scale' * h) + 'linear_term' * h + 'constant_term', +// clamped to [0,1], and where h is the altitude (in m). 'exp_term' and +// 'constant_term' are unitless, while 'exp_scale' and 'linear_term' are in +// m^-1. +class DensityLayer { + public: + DensityLayer() + : width(0.0f) + , exp_term(0.0f) + , exp_scale(0.0f) + , linear_term(0.0f) + , constant_term(0.0f) + { + } + + DensityLayer(float width, float exp_term, float exp_scale, float linear_term, float constant_term) + : width(width) + , exp_term(exp_term) + , exp_scale(exp_scale) + , linear_term(linear_term) + , constant_term(constant_term) + { + } + + bool operator==(const DensityLayer& rhs) const + { + if (width != rhs.width) + { + return false; + } + + if (exp_term != rhs.exp_term) + { + return false; + } + + if (exp_scale != rhs.exp_scale) + { + return false; + } + + if (linear_term != rhs.linear_term) + { + return false; + } + + if (constant_term != rhs.constant_term) + { + return false; + } + + return true; + } + + float width = 1024.0f; + float exp_term = 1.0f; + float exp_scale = 1.0f; + float linear_term = 1.0f; + float constant_term = 0.0f; +}; + +typedef std::vector DensityProfile; class AtmosphericModelSettings { @@ -83,8 +144,6 @@ public: LLGLTexture* getMieScattering(); LLGLTexture* getIlluminance(); - GLhandleARB getAtmosphericShaderForLink() const; - bool configureAtmosphericModel(AtmosphericModelSettings& settings); protected: @@ -93,10 +152,6 @@ protected: *this = rhs; } - atmosphere::ModelConfig m_config; - atmosphere::PrecomputedTextures m_textures; - atmosphere::Model* m_model = nullptr; - LLPointer m_transmittance; LLPointer m_scattering; LLPointer m_mie_scatter_texture; -- cgit v1.2.3