diff options
26 files changed, 92 insertions, 703 deletions
diff --git a/indra/llaudio/llaudioengine_openal.cpp b/indra/llaudio/llaudioengine_openal.cpp index 18d682b554..755547bfaa 100644 --- a/indra/llaudio/llaudioengine_openal.cpp +++ b/indra/llaudio/llaudioengine_openal.cpp @@ -79,7 +79,7 @@ bool LLAudioEngine_OpenAL::init(void* userdata, const std::string &app_title) ALCdevice *device = alcGetContextsDevice(alcGetCurrentContext()); alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &major); - alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &minor); + alcGetIntegerv(device, ALC_MINOR_VERSION, 1, &minor); LL_INFOS() << "ALC version: " << major << "." << minor << LL_ENDL; LL_INFOS() << "ALC default device: " @@ -190,6 +190,8 @@ LLAudioChannelOpenAL::~LLAudioChannelOpenAL() void LLAudioChannelOpenAL::cleanup() { alSourceStop(mALSource); + alSourcei(mALSource, AL_BUFFER, AL_NONE); + mCurrentBufferp = NULL; } diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index b552aede82..d65fb16f5b 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -550,7 +550,13 @@ private: public: ll_convert(const FROM& ref): mRef(ref) {} - template <typename TO> + inline operator const FROM&() const + { + return mRef; + } + + template <typename TO, + std::enable_if_t<! std::is_same_v<std::decay_t<TO>, std::decay_t<FROM>>, bool> =true> inline operator TO() const { return ll_convert_impl<TO, std::decay_t<const FROM>>()(mRef); @@ -559,7 +565,15 @@ public: // When the TO type must be explicit, use a function template to get // ll_convert_to<TO>(from_value) API. -template<typename TO, typename FROM> +template<typename SAME> +const SAME& ll_convert_to(const SAME& in) +{ + return in; +} + +template<typename TO, + typename FROM, + std::enable_if_t<! std::is_same_v<std::decay_t<TO>, std::decay_t<FROM>>, bool> =true> TO ll_convert_to(const FROM& in) { return ll_convert_impl<TO, std::decay_t<const FROM>>()(in); diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index 26a8ff070f..04401e9bea 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -10,7 +10,6 @@ include(LLImage) include(LLWindow) set(llrender_SOURCE_FILES - llatmosphere.cpp llcubemap.cpp llcubemaparray.cpp llfontbitmapcache.cpp @@ -39,7 +38,6 @@ set(llrender_SOURCE_FILES set(llrender_HEADER_FILES CMakeLists.txt - llatmosphere.h llcubemap.h llcubemaparray.h llfontgl.h diff --git a/indra/llrender/llatmosphere.cpp b/indra/llrender/llatmosphere.cpp deleted file mode 100644 index eae5623a3c..0000000000 --- a/indra/llrender/llatmosphere.cpp +++ /dev/null @@ -1,290 +0,0 @@ -/** - * @file llatmosphere.cpp - * @brief LLAtmosphere integration impl - * - * $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$ - */ - -#include "linden_common.h" - -#include "llatmosphere.h" -#include "llfasttimer.h" -#include "llsys.h" -#include "llglheaders.h" -#include "llrender.h" -#include "llshadermgr.h" -#include "llglslshader.h" - -LLAtmosphere* gAtmosphere = nullptr; - -// Values from "Reference Solar Spectral Irradiance: ASTM G-173", ETR column -// (see http://rredc.nrel.gov/solar/spectra/am1.5/ASTMG173/ASTMG173.html), -// summed and averaged in each bin (e.g. the value for 360nm is the average -// of the ASTM G-173 values for all wavelengths between 360 and 370nm). -// Values in W.m^-2. -const int kLambdaMin = 360; -const int kLambdaMax = 830; -const double kSolarIrradiance[48] = { - 1.11776, 1.14259, 1.01249, 1.14716, 1.72765, 1.73054, 1.6887, 1.61253, - 1.91198, 2.03474, 2.02042, 2.02212, 1.93377, 1.95809, 1.91686, 1.8298, - 1.8685, 1.8931, 1.85149, 1.8504, 1.8341, 1.8345, 1.8147, 1.78158, 1.7533, - 1.6965, 1.68194, 1.64654, 1.6048, 1.52143, 1.55622, 1.5113, 1.474, 1.4482, - 1.41018, 1.36775, 1.34188, 1.31429, 1.28303, 1.26758, 1.2367, 1.2082, - 1.18737, 1.14683, 1.12362, 1.1058, 1.07124, 1.04992 -}; - -// Values from http://www.iup.uni-bremen.de/gruppen/molspec/databases/ -// referencespectra/o3spectra2011/index.html for 233K, summed and averaged in -// each bin (e.g. the value for 360nm is the average of the original values -// for all wavelengths between 360 and 370nm). Values in m^2. -const double kOzoneCrossSection[48] = { - 1.18e-27, 2.182e-28, 2.818e-28, 6.636e-28, 1.527e-27, 2.763e-27, 5.52e-27, - 8.451e-27, 1.582e-26, 2.316e-26, 3.669e-26, 4.924e-26, 7.752e-26, 9.016e-26, - 1.48e-25, 1.602e-25, 2.139e-25, 2.755e-25, 3.091e-25, 3.5e-25, 4.266e-25, - 4.672e-25, 4.398e-25, 4.701e-25, 5.019e-25, 4.305e-25, 3.74e-25, 3.215e-25, - 2.662e-25, 2.238e-25, 1.852e-25, 1.473e-25, 1.209e-25, 9.423e-26, 7.455e-26, - 6.566e-26, 5.105e-26, 4.15e-26, 4.228e-26, 3.237e-26, 2.451e-26, 2.801e-26, - 2.534e-26, 1.624e-26, 1.465e-26, 2.078e-26, 1.383e-26, 7.105e-27 -}; - -// From https://en.wikipedia.org/wiki/Dobson_unit, in molecules.m^-2. -const double kDobsonUnit = 2.687e20; -// Maximum number density of ozone molecules, in m^-3 (computed so at to get -// 300 Dobson units of ozone - for this we divide 300 DU by the integral of -// the ozone density profile defined below, which is equal to 15km). -const double kMaxOzoneNumberDensity = 300.0 * kDobsonUnit / 15000.0; -const double kRayleigh = 1.24062e-6; -const double kRayleighScaleHeight = 8000.0; -const double kMieScaleHeight = 1200.0; -const double kMieAngstromAlpha = 0.0; -const double kMieAngstromBeta = 5.328e-3; -const double kMieSingleScatteringAlbedo = 0.9; -const double kGroundAlbedo = 0.1; - -AtmosphericModelSettings::AtmosphericModelSettings() - : m_skyBottomRadius(6360.0f) - , m_skyTopRadius(6420.0f) - , m_sunArcRadians(0.00045f) - , m_mieAnisotropy(0.8f) -{ - DensityLayer rayleigh_density(0.0, 1.0, -1.0 / kRayleighScaleHeight, 0.0, 0.0); - DensityLayer mie_density(0.0, 1.0, -1.0 / kMieScaleHeight, 0.0, 0.0); - - m_rayleighProfile.push_back(rayleigh_density); - m_mieProfile.push_back(mie_density); - - // Density profile increasing linearly from 0 to 1 between 10 and 25km, and - // decreasing linearly from 1 to 0 between 25 and 40km. This is an approximate - // profile from http://www.kln.ac.lk/science/Chemistry/Teaching_Resources/ - // Documents/Introduction%20to%20atmospheric%20chemistry.pdf (page 10). - m_absorptionProfile.push_back(DensityLayer(25000.0, 0.0, 0.0, 1.0 / 15000.0, -2.0 / 3.0)); - m_absorptionProfile.push_back(DensityLayer(0.0, 0.0, 0.0, -1.0 / 15000.0, 8.0 / 3.0)); -} - -AtmosphericModelSettings::AtmosphericModelSettings( - DensityProfile& rayleighProfile, - DensityProfile& mieProfile, - DensityProfile& absorptionProfile) -: m_skyBottomRadius(6360.0f) -, m_skyTopRadius(6420.0f) -, m_rayleighProfile(rayleighProfile) -, m_mieProfile(mieProfile) -, m_absorptionProfile(absorptionProfile) -, m_sunArcRadians(0.00045f) -, m_mieAnisotropy(0.8f) -{ -} - -AtmosphericModelSettings::AtmosphericModelSettings( - F32 skyBottomRadius, - F32 skyTopRadius, - DensityProfile& rayleighProfile, - DensityProfile& mieProfile, - DensityProfile& absorptionProfile, - F32 sunArcRadians, - F32 mieAniso) -: m_skyBottomRadius(skyBottomRadius) -, m_skyTopRadius(skyTopRadius) -, m_rayleighProfile(rayleighProfile) -, m_mieProfile(mieProfile) -, m_absorptionProfile(absorptionProfile) -, m_sunArcRadians(sunArcRadians) -, m_mieAnisotropy(mieAniso) -{ -} - -bool AtmosphericModelSettings::operator==(const AtmosphericModelSettings& rhs) const -{ - if (m_skyBottomRadius != rhs.m_skyBottomRadius) - { - return false; - } - - if (m_skyTopRadius != rhs.m_skyTopRadius) - { - return false; - } - - if (m_sunArcRadians != rhs.m_sunArcRadians) - { - return false; - } - - if (m_mieAnisotropy != rhs.m_mieAnisotropy) - { - return false; - } - - if (m_rayleighProfile != rhs.m_rayleighProfile) - { - return false; - } - - if (m_mieProfile != rhs.m_mieProfile) - { - return false; - } - - if (m_absorptionProfile != rhs.m_absorptionProfile) - { - return false; - } - - return true; -} - -void LLAtmosphere::initClass() -{ - if (!gAtmosphere) - { - gAtmosphere = new LLAtmosphere; - } -} - -void LLAtmosphere::cleanupClass() -{ - if(gAtmosphere) - { - delete gAtmosphere; - } - gAtmosphere = NULL; -} - -LLAtmosphere::LLAtmosphere() -{ - for (int l = kLambdaMin; l <= kLambdaMax; l += 10) - { - double lambda = static_cast<double>(l) * 1e-3; // micro-meters - double mie = kMieAngstromBeta / kMieScaleHeight * pow(lambda, -kMieAngstromAlpha); - m_wavelengths.push_back(l); - m_solar_irradiance.push_back(kSolarIrradiance[(l - kLambdaMin) / 10]); - m_rayleigh_scattering.push_back(kRayleigh * pow(lambda, -4)); - m_mie_scattering.push_back(mie * kMieSingleScatteringAlbedo); - m_mie_extinction.push_back(mie); - m_absorption_extinction.push_back(kMaxOzoneNumberDensity * kOzoneCrossSection[(l - kLambdaMin) / 10]); - m_ground_albedo.push_back(kGroundAlbedo); - } - - AtmosphericModelSettings defaults; - configureAtmosphericModel(defaults); -} - -LLAtmosphere::~LLAtmosphere() -{ - // Cease referencing textures from atmosphere::model from our LLGLTextures wrappers for same. - if (m_transmittance) - { - m_transmittance->setTexName(0); - } - - if (m_scattering) - { - m_scattering->setTexName(0); - } - - if (m_mie_scatter_texture) - { - m_mie_scatter_texture->setTexName(0); - } -} - -bool LLAtmosphere::configureAtmosphericModel(AtmosphericModelSettings& settings) -{ - // TBD - return true; -} - -LLGLTexture* LLAtmosphere::getTransmittance() -{ - if (!m_transmittance) - { - m_transmittance = new LLGLTexture; - m_transmittance->generateGLTexture(); - m_transmittance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); - m_transmittance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_transmittance->setExplicitFormat(GL_RGB32F, GL_RGB, GL_FLOAT); - m_transmittance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE); - } - return m_transmittance; -} - -LLGLTexture* LLAtmosphere::getScattering() -{ - if (!m_scattering) - { - m_scattering = new LLGLTexture; - m_scattering->generateGLTexture(); - m_scattering->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); - m_scattering->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_scattering->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); - m_scattering->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D); - } - return m_scattering; -} - -LLGLTexture* LLAtmosphere::getMieScattering() -{ - if (!m_mie_scatter_texture) - { - m_mie_scatter_texture = new LLGLTexture; - m_mie_scatter_texture->generateGLTexture(); - m_mie_scatter_texture->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); - m_mie_scatter_texture->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_mie_scatter_texture->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); - m_mie_scatter_texture->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D); - } - return m_mie_scatter_texture; -} - -LLGLTexture* LLAtmosphere::getIlluminance() -{ - if (!m_illuminance) - { - m_illuminance = new LLGLTexture; - m_illuminance->generateGLTexture(); - m_illuminance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); - m_illuminance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_illuminance->setExplicitFormat(GL_RGB32F, GL_RGB, GL_FLOAT); - m_illuminance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE); - } - return m_illuminance; -} diff --git a/indra/llrender/llatmosphere.h b/indra/llrender/llatmosphere.h deleted file mode 100644 index 4b8c7d0819..0000000000 --- a/indra/llrender/llatmosphere.h +++ /dev/null @@ -1,173 +0,0 @@ -/** - * @file llatmosphere.h - * @brief LLAtmosphere class - * - * $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" - -// 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<DensityLayer> 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); - - bool operator==(const AtmosphericModelSettings& rhs) const; - - F32 m_skyBottomRadius; - F32 m_skyTopRadius; - DensityProfile m_rayleighProfile; - DensityProfile m_mieProfile; - DensityProfile m_absorptionProfile; - F32 m_sunArcRadians; - F32 m_mieAnisotropy; -}; - -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(); - LLGLTexture* getScattering(); - LLGLTexture* getMieScattering(); - LLGLTexture* getIlluminance(); - - bool configureAtmosphericModel(AtmosphericModelSettings& settings); - -protected: - LLAtmosphere(const LLAtmosphere& rhs) - { - *this = rhs; - } - - LLPointer<LLGLTexture> m_transmittance; - LLPointer<LLGLTexture> m_scattering; - LLPointer<LLGLTexture> m_mie_scatter_texture; - LLPointer<LLGLTexture> m_illuminance; - - std::vector<double> m_wavelengths; - std::vector<double> m_solar_irradiance; - std::vector<double> m_rayleigh_scattering; - std::vector<double> m_mie_scattering; - std::vector<double> m_mie_extinction; - std::vector<double> m_absorption_extinction; - std::vector<double> m_ground_albedo; - - AtmosphericModelSettings m_settings; -}; - -extern LLAtmosphere* gAtmosphere; - -#endif // LL_ATMOSPHERE_H diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 150277c8df..6097b09d96 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1300,9 +1300,6 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("shadow_matrix"); mReservedUniforms.push_back("env_mat"); mReservedUniforms.push_back("shadow_clip"); - mReservedUniforms.push_back("sun_wash"); - mReservedUniforms.push_back("shadow_noise"); - mReservedUniforms.push_back("blur_size"); mReservedUniforms.push_back("ssao_radius"); mReservedUniforms.push_back("ssao_max_radius"); mReservedUniforms.push_back("ssao_factor"); @@ -1318,8 +1315,6 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("moon_dir"); mReservedUniforms.push_back("shadow_res"); mReservedUniforms.push_back("proj_shadow_res"); - mReservedUniforms.push_back("depth_cutoff"); - mReservedUniforms.push_back("norm_cutoff"); mReservedUniforms.push_back("shadow_target_width"); llassert(mReservedUniforms.size() == LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH + 1); @@ -1369,9 +1364,7 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("noiseMap"); mReservedUniforms.push_back("lightFunc"); mReservedUniforms.push_back("lightMap"); - mReservedUniforms.push_back("bloomMap"); mReservedUniforms.push_back("projectionMap"); - mReservedUniforms.push_back("norm_mat"); mReservedUniforms.push_back("specular_color"); mReservedUniforms.push_back("env_intensity"); @@ -1450,10 +1443,6 @@ void LLShaderMgr::initAttribsAndUniforms() mReservedUniforms.push_back("sun_size"); mReservedUniforms.push_back("fog_color"); - mReservedUniforms.push_back("transmittance_texture"); - mReservedUniforms.push_back("scattering_texture"); - mReservedUniforms.push_back("single_mie_scattering_texture"); - mReservedUniforms.push_back("irradiance_texture"); mReservedUniforms.push_back("blend_factor"); mReservedUniforms.push_back("moisture_level"); mReservedUniforms.push_back("droplet_radius"); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 0eb9db6715..1bae0cd8a0 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -157,9 +157,6 @@ public: DEFERRED_SHADOW_MATRIX, // "shadow_matrix" DEFERRED_ENV_MAT, // "env_mat" DEFERRED_SHADOW_CLIP, // "shadow_clip" - DEFERRED_SUN_WASH, // "sun_wash" - DEFERRED_SHADOW_NOISE, // "shadow_noise" - DEFERRED_BLUR_SIZE, // "blur_size" DEFERRED_SSAO_RADIUS, // "ssao_radius" DEFERRED_SSAO_MAX_RADIUS, // "ssao_max_radius" DEFERRED_SSAO_FACTOR, // "ssao_factor" @@ -175,8 +172,6 @@ public: DEFERRED_MOON_DIR, // "moon_dir" DEFERRED_SHADOW_RES, // "shadow_res" DEFERRED_PROJ_SHADOW_RES, // "proj_shadow_res" - DEFERRED_DEPTH_CUTOFF, // "depth_cutoff" - DEFERRED_NORM_CUTOFF, // "norm_cutoff" DEFERRED_SHADOW_TARGET_WIDTH, // "shadow_target_width" DEFERRED_SSR_ITR_COUNT, // "iterationCount" @@ -221,9 +216,7 @@ public: DEFERRED_NOISE, // "noiseMap" DEFERRED_LIGHTFUNC, // "lightFunc" DEFERRED_LIGHT, // "lightMap" - DEFERRED_BLOOM, // "bloomMap" DEFERRED_PROJECTION, // "projectionMap" - DEFERRED_NORM_MATRIX, // "norm_mat" SPECULAR_COLOR, // "specular_color" ENVIRONMENT_INTENSITY, // "env_intensity" @@ -301,13 +294,7 @@ public: SUN_SIZE, // "sun_size" FOG_COLOR, // "fog_color" - // precomputed textures - TRANSMITTANCE_TEX, // "transmittance_texture" - SCATTER_TEX, // "scattering_texture" - SINGLE_MIE_SCATTER_TEX, // "single_mie_scattering_texture" - ILLUMINANCE_TEX, // "irradiance_texture" BLEND_FACTOR, // "blend_factor" - MOISTURE_LEVEL, // "moisture_level" DROPLET_RADIUS, // "droplet_radius" ICE_LEVEL, // "ice_level" diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index 23a3ca4911..41ff2913e9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl @@ -30,7 +30,6 @@ out vec4 frag_color; uniform sampler2D lightMap; uniform float dist_factor; -uniform float blur_size; uniform vec2 delta; uniform vec2 screen_res; uniform vec3 kern[4]; diff --git a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl index 0a0fa0a374..4a26b8924a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl @@ -30,8 +30,6 @@ out vec4 frag_color; uniform sampler2D diffuseRect; uniform sampler2D depthMap; -uniform float depth_cutoff; -uniform float norm_cutoff; uniform float focal_distance; uniform float blur_constant; uniform float tan_pixel_angle; diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl index 4ed778371f..809ad2f0bd 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl @@ -33,7 +33,6 @@ uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal uniform sampler2D lightFunc; uniform vec3 env_mat[3]; -uniform float sun_wash; uniform int light_count; uniform vec4 light[LIGHT_COUNT]; // .w = size; see C++ fullscreen_lights.push_back() uniform vec4 light_col[LIGHT_COUNT]; // .a = falloff diff --git a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl index 6c13757149..41a19ea1b6 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl @@ -33,7 +33,6 @@ uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal uniform sampler2D lightFunc; uniform vec3 env_mat[3]; -uniform float sun_wash; // light params uniform vec3 color; @@ -46,7 +45,6 @@ in vec3 trans_center; uniform vec2 screen_res; uniform mat4 inv_proj; -uniform vec4 viewport; void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist); float calcLegacyDistanceAttenuation(float distance, float falloff); diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index 4231d8580e..a34e97c171 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -39,9 +39,6 @@ uniform sampler2D lightMap; uniform sampler2D lightFunc; -uniform float blur_size; -uniform float blur_fidelity; - #if defined(HAS_SSAO) uniform float ssao_irradiance_scale; uniform float ssao_irradiance_max; diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl index bc4d36d10d..e99aa5ace4 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl @@ -47,7 +47,6 @@ uniform float near_clip; uniform float far_clip; uniform vec3 proj_origin; //origin of projection to be used for angular attenuation -uniform float sun_wash; uniform int proj_shadow_idx; uniform float shadow_fade; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 521e6eee1a..a4351fd350 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -219,7 +219,6 @@ #include "llfloatersimplesnapshot.h" #include "llfloatersnapshot.h" #include "llsidepanelinventory.h" -#include "llatmosphere.h" // includes for idle() idleShutdown() #include "llviewercontrol.h" @@ -1762,8 +1761,6 @@ void LLAppViewer::flushLFSIO() bool LLAppViewer::cleanup() { - LLAtmosphere::cleanupClass(); - //ditch LLVOAvatarSelf instance gAgentAvatarp = NULL; diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 87b6ce6cb3..5379bcc985 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -732,15 +732,6 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) {// If we need shaders, and we're not ALREADY using the proper shader, then bind it // (this way we won't rebind shaders unnecessarily). gPipeline.bindDeferredShaderFast(*target_shader); - - if (params.mFullbright) - { // make sure the bind the exposure map for fullbright shaders so they can cancel out exposure - S32 channel = target_shader->enableTexture(LLShaderMgr::EXPOSURE_MAP); - if (channel > -1) - { - gGL.getTexUnit(channel)->bind(&gPipeline.mExposureMap); - } - } } LLVector4 spec_color(1, 1, 1, 1); diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index bf593bff07..754fcd4c17 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -300,13 +300,6 @@ void LLDrawPoolBump::beginFullbrightShiny() shader = shader->mRiggedVariant; } - // bind exposure map so fullbright shader can cancel out exposure - S32 channel = shader->enableTexture(LLShaderMgr::EXPOSURE_MAP); - if (channel > -1) - { - gGL.getTexUnit(channel)->bind(&gPipeline.mExposureMap); - } - LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL; if (cube_map && !LLPipeline::sReflectionProbesEnabled) diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 305215f541..e6d0b036e0 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -32,7 +32,6 @@ #include "llface.h" #include "llimage.h" #include "llrender.h" -#include "llatmosphere.h" #include "llenvironment.h" #include "llglslshader.h" #include "llgl.h" diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 05bd704556..a125dcb7aa 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -54,7 +54,6 @@ #include "llregioninfomodel.h" -#include "llatmosphere.h" #include "llagent.h" #include "roles_constants.h" #include "llestateinfomodel.h" @@ -965,54 +964,6 @@ LLSettingsWater::ptr_t LLEnvironment::getCurrentWater() const return pwater; } -void LayerConfigToDensityLayer(const LLSD& layerConfig, DensityLayer& layerOut) -{ - layerOut.constant_term = (F32)layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM].asReal(); - layerOut.exp_scale = (F32)layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR].asReal(); - layerOut.exp_term = (F32)layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM].asReal(); - layerOut.linear_term = (F32)layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM].asReal(); - layerOut.width = (F32)layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH].asReal(); -} - -void LLEnvironment::getAtmosphericModelSettings(AtmosphericModelSettings& settingsOut, const LLSettingsSky::ptr_t &psky) -{ - settingsOut.m_skyBottomRadius = psky->getSkyBottomRadius(); - settingsOut.m_skyTopRadius = psky->getSkyTopRadius(); - settingsOut.m_sunArcRadians = psky->getSunArcRadians(); - settingsOut.m_mieAnisotropy = psky->getMieAnisotropy(); - - LLSD rayleigh = psky->getRayleighConfigs(); - settingsOut.m_rayleighProfile.clear(); - for (LLSD::array_iterator itf = rayleigh.beginArray(); itf != rayleigh.endArray(); ++itf) - { - DensityLayer layer; - LLSD& layerConfig = (*itf); - LayerConfigToDensityLayer(layerConfig, layer); - settingsOut.m_rayleighProfile.push_back(layer); - } - - LLSD mie = psky->getMieConfigs(); - settingsOut.m_mieProfile.clear(); - for (LLSD::array_iterator itf = mie.beginArray(); itf != mie.endArray(); ++itf) - { - DensityLayer layer; - LLSD& layerConfig = (*itf); - LayerConfigToDensityLayer(layerConfig, layer); - settingsOut.m_mieProfile.push_back(layer); - } - settingsOut.m_mieAnisotropy = psky->getMieAnisotropy(); - - LLSD absorption = psky->getAbsorptionConfigs(); - settingsOut.m_absorptionProfile.clear(); - for (LLSD::array_iterator itf = absorption.beginArray(); itf != absorption.endArray(); ++itf) - { - DensityLayer layer; - LLSD& layerConfig = (*itf); - LayerConfigToDensityLayer(layerConfig, layer); - settingsOut.m_absorptionProfile.push_back(layer); - } -} - bool LLEnvironment::canAgentUpdateParcelEnvironment() const { LLParcel *parcel(LLViewerParcelMgr::instance().getAgentOrSelectedParcel()); @@ -2744,13 +2695,6 @@ bool LLEnvironment::DayInstance::setSky(const LLSettingsSky::ptr_t &psky) mSky->update(); mBlenderSky.reset(); - if (gAtmosphere) - { - AtmosphericModelSettings settings; - LLEnvironment::getAtmosphericModelSettings(settings, psky); - gAtmosphere->configureAtmosphericModel(settings); - } - return changed; } diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index f1205a72b7..217c069705 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -36,8 +36,6 @@ #include "llsettingswater.h" #include "llsettingsdaycycle.h" -#include "llatmosphere.h" - #include "llglslshader.h" #include <boost/signals2.hpp> @@ -131,8 +129,6 @@ public: LLSettingsSky::ptr_t getCurrentSky() const; LLSettingsWater::ptr_t getCurrentWater() const; - static void getAtmosphericModelSettings(AtmosphericModelSettings& settingsOut, const LLSettingsSky::ptr_t &psky); - void update(const LLViewerCamera * cam); static void updateGLVariablesForSettings(LLShaderUniforms* uniforms, const LLSettingsBase::ptr_t &psetting); diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index ea2b2ba944..b4a0f0570e 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -35,7 +35,6 @@ #include "llvirtualtrackball.h" #include "llsettingssky.h" #include "llenvironment.h" -#include "llatmosphere.h" #include "llviewercontrol.h" namespace @@ -926,13 +925,6 @@ void LLPanelSettingsSkyDensityTab::updateProfile() mSkySettings->setAbsorptionConfigs(absorption_config); mSkySettings->update(); setIsDirty(); - - if (gAtmosphere) - { - AtmosphericModelSettings atmospheric_settings; - LLEnvironment::getAtmosphericModelSettings(atmospheric_settings, mSkySettings); - gAtmosphere->configureAtmosphericModel(atmospheric_settings); - } } void LLPanelSettingsSkyDensityTab::onRayleighExponentialChanged() diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 2f5a302b3f..2d94b4da9f 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -78,6 +78,7 @@ #include "llfloatertools.h" #include "llfloaterworldmap.h" #include "llfloaterbuildoptions.h" +#include "fsyspath.h" #include "llavataractions.h" #include "lllandmarkactions.h" #include "llgroupmgr.h" @@ -90,6 +91,7 @@ #include "llinventorybridge.h" #include "llinventorydefines.h" #include "llinventoryfunctions.h" +#include "llluamanager.h" #include "llpanellogin.h" #include "llpanelblockedlist.h" #include "llpanelmaininventory.h" @@ -9461,6 +9463,18 @@ void LLUploadCostCalculator::calculateCost(const std::string& asset_type_str) mCostStr = std::to_string(upload_cost); } +void lua_run_script(const LLSD& userdata) +{ + std::string script_path = userdata.asString(); + if (script_path.empty()) + { + LL_WARNS() << "Script name is not specified" << LL_ENDL; + return; + } + + LLLUAmanager::runScriptFile(script_path); +} + void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y) { static LLMenuGL* show_navbar_context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_hide_navbar.xml", @@ -10062,4 +10076,6 @@ void initialize_menus() view_listener_t::addMenu(new LLEditableSelected(), "EditableSelected"); view_listener_t::addMenu(new LLEditableSelectedMono(), "EditableSelectedMono"); view_listener_t::addMenu(new LLToggleUIHints(), "ToggleUIHints"); + + registrar.add("Lua.RunScript", boost::bind(&lua_run_script, _2), cb_info::UNTRUSTED_BLOCK); } diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 58b541b19b..95d3a419bc 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -37,7 +37,6 @@ #include "llrender.h" #include "llenvironment.h" #include "llerrorcontrol.h" -#include "llatmosphere.h" #include "llworld.h" #include "llsky.h" diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index eb353beb11..e36cb795bd 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -138,7 +138,6 @@ bool gShiftFrame = false; //cached settings bool LLPipeline::WindLightUseAtmosShaders; bool LLPipeline::RenderDeferred; -F32 LLPipeline::RenderDeferredSunWash; U32 LLPipeline::RenderFSAAType; U32 LLPipeline::RenderResolutionDivisor; bool LLPipeline::RenderUIBuffer; @@ -179,7 +178,6 @@ F32 LLPipeline::CameraFocusTransitionTime; F32 LLPipeline::CameraFNumber; F32 LLPipeline::CameraFocalLength; F32 LLPipeline::CameraFieldOfView; -F32 LLPipeline::RenderShadowNoise; F32 LLPipeline::RenderShadowBlurSize; F32 LLPipeline::RenderSSAOScale; U32 LLPipeline::RenderSSAOMaxScale; @@ -192,8 +190,6 @@ F32 LLPipeline::RenderShadowBias; F32 LLPipeline::RenderSpotShadowOffset; F32 LLPipeline::RenderSpotShadowBias; LLDrawable* LLPipeline::RenderSpotLight = nullptr; -F32 LLPipeline::RenderEdgeDepthCutoff; -F32 LLPipeline::RenderEdgeNormCutoff; LLVector3 LLPipeline::RenderShadowGaussian; F32 LLPipeline::RenderShadowBlurDistFactor; bool LLPipeline::RenderDeferredAtmospheric; @@ -276,7 +272,6 @@ static LLTrace::BlockTimerStatHandle FTM_STATESORT_DRAWABLE("Sort Drawables"); static LLStaticHashedString sTint("tint"); static LLStaticHashedString sAmbiance("ambiance"); static LLStaticHashedString sAlphaScale("alpha_scale"); -static LLStaticHashedString sNormMat("norm_mat"); static LLStaticHashedString sOffset("offset"); static LLStaticHashedString sScreenRes("screenRes"); static LLStaticHashedString sDelta("delta"); @@ -501,7 +496,6 @@ void LLPipeline::init() connectRefreshCachedSettingsSafe("UseOcclusion"); // DEPRECATED -- connectRefreshCachedSettingsSafe("WindLightUseAtmosShaders"); // DEPRECATED -- connectRefreshCachedSettingsSafe("RenderDeferred"); - connectRefreshCachedSettingsSafe("RenderDeferredSunWash"); connectRefreshCachedSettingsSafe("RenderFSAAType"); connectRefreshCachedSettingsSafe("RenderResolutionDivisor"); connectRefreshCachedSettingsSafe("RenderUIBuffer"); @@ -542,7 +536,6 @@ void LLPipeline::init() connectRefreshCachedSettingsSafe("CameraFNumber"); connectRefreshCachedSettingsSafe("CameraFocalLength"); connectRefreshCachedSettingsSafe("CameraFieldOfView"); - connectRefreshCachedSettingsSafe("RenderShadowNoise"); connectRefreshCachedSettingsSafe("RenderShadowBlurSize"); connectRefreshCachedSettingsSafe("RenderSSAOScale"); connectRefreshCachedSettingsSafe("RenderSSAOMaxScale"); @@ -554,8 +547,6 @@ void LLPipeline::init() connectRefreshCachedSettingsSafe("RenderShadowBias"); connectRefreshCachedSettingsSafe("RenderSpotShadowOffset"); connectRefreshCachedSettingsSafe("RenderSpotShadowBias"); - connectRefreshCachedSettingsSafe("RenderEdgeDepthCutoff"); - connectRefreshCachedSettingsSafe("RenderEdgeNormCutoff"); connectRefreshCachedSettingsSafe("RenderShadowGaussian"); connectRefreshCachedSettingsSafe("RenderShadowBlurDistFactor"); connectRefreshCachedSettingsSafe("RenderDeferredAtmospheric"); @@ -1010,7 +1001,6 @@ void LLPipeline::refreshCachedSettings() WindLightUseAtmosShaders = true; // DEPRECATED -- gSavedSettings.getBOOL("WindLightUseAtmosShaders"); RenderDeferred = true; // DEPRECATED -- gSavedSettings.getBOOL("RenderDeferred"); - RenderDeferredSunWash = gSavedSettings.getF32("RenderDeferredSunWash"); RenderFSAAType = gSavedSettings.getU32("RenderFSAAType"); RenderResolutionDivisor = gSavedSettings.getU32("RenderResolutionDivisor"); RenderUIBuffer = gSavedSettings.getBOOL("RenderUIBuffer"); @@ -1051,7 +1041,6 @@ void LLPipeline::refreshCachedSettings() CameraFNumber = gSavedSettings.getF32("CameraFNumber"); CameraFocalLength = gSavedSettings.getF32("CameraFocalLength"); CameraFieldOfView = gSavedSettings.getF32("CameraFieldOfView"); - RenderShadowNoise = gSavedSettings.getF32("RenderShadowNoise"); RenderShadowBlurSize = gSavedSettings.getF32("RenderShadowBlurSize"); RenderSSAOScale = gSavedSettings.getF32("RenderSSAOScale"); RenderSSAOMaxScale = gSavedSettings.getU32("RenderSSAOMaxScale"); @@ -1063,8 +1052,6 @@ void LLPipeline::refreshCachedSettings() RenderShadowBias = gSavedSettings.getF32("RenderShadowBias"); RenderSpotShadowOffset = gSavedSettings.getF32("RenderSpotShadowOffset"); RenderSpotShadowBias = gSavedSettings.getF32("RenderSpotShadowBias"); - RenderEdgeDepthCutoff = gSavedSettings.getF32("RenderEdgeDepthCutoff"); - RenderEdgeNormCutoff = gSavedSettings.getF32("RenderEdgeNormCutoff"); RenderShadowGaussian = gSavedSettings.getVector3("RenderShadowGaussian"); RenderShadowBlurDistFactor = gSavedSettings.getF32("RenderShadowBlurDistFactor"); RenderDeferredAtmospheric = gSavedSettings.getBOOL("RenderDeferredAtmospheric"); @@ -3475,8 +3462,6 @@ void LLPipeline::postSort(LLCamera &camera) assertInitialized(); - LL_PUSH_CALLSTACKS(); - if (!gCubeSnapshot) { // rebuild drawable geometry @@ -3492,15 +3477,12 @@ void LLPipeline::postSort(LLCamera &camera) group->rebuildGeom(); } } - LL_PUSH_CALLSTACKS(); // rebuild groups sCull->assertDrawMapsEmpty(); rebuildPriorityGroups(); } - LL_PUSH_CALLSTACKS(); - // build render map for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i) { @@ -3621,7 +3603,6 @@ void LLPipeline::postSort(LLCamera &camera) std::sort(sCull->beginRiggedAlphaGroups(), sCull->endRiggedAlphaGroups(), LLSpatialGroup::CompareRenderOrder()); } - LL_PUSH_CALLSTACKS(); // only render if the flag is set. The flag is only set if we are in edit mode or the toggle is set in the menus if (LLFloaterReg::instanceVisible("beacons") && !sShadowRender && !gCubeSnapshot) { @@ -3674,7 +3655,7 @@ void LLPipeline::postSort(LLCamera &camera) forAllVisibleDrawables(renderSoundHighlights); } } - LL_PUSH_CALLSTACKS(); + // If managing your telehub, draw beacons at telehub and currently selected spawnpoint. if (LLFloaterTelehub::renderBeacons() && !sShadowRender && !gCubeSnapshot) { @@ -3735,7 +3716,6 @@ void LLPipeline::postSort(LLCamera &camera) LLVertexBuffer::flushBuffers(); // LLSpatialGroup::sNoDelete = false; - LL_PUSH_CALLSTACKS(); } @@ -7752,8 +7732,6 @@ void LLPipeline::renderDoF(LLRenderTarget* src, LLRenderTarget* dst) gDeferredCoFProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, LLTexUnit::TFO_POINT); gDeferredCoFProgram.bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true); - gDeferredCoFProgram.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff); - gDeferredCoFProgram.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff); gDeferredCoFProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)dst->getWidth(), (GLfloat)dst->getHeight()); gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_FOCAL_DISTANCE, -subject_distance / 1000.f); gDeferredCoFProgram.uniform1f(LLShaderMgr::DOF_BLUR_CONSTANT, blur_constant); @@ -8065,32 +8043,11 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ stop_glerror(); } - channel = shader.enableTexture(LLShaderMgr::EXPOSURE_MAP); - if (channel > -1) - { - gGL.getTexUnit(channel)->bind(&mExposureMap); - } - - if (shader.getUniformLocation(LLShaderMgr::VIEWPORT) != -1) - { - shader.uniform4f(LLShaderMgr::VIEWPORT, (F32) gGLViewport[0], - (F32) gGLViewport[1], - (F32) gGLViewport[2], - (F32) gGLViewport[3]); - } - if (sReflectionRender && !shader.getUniformLocation(LLShaderMgr::MODELVIEW_MATRIX)) { shader.uniformMatrix4fv(LLShaderMgr::MODELVIEW_MATRIX, 1, false, glm::value_ptr(mReflectionModelView)); } - channel = shader.enableTexture(LLShaderMgr::DEFERRED_NOISE); - if (channel > -1) - { - gGL.getTexUnit(channel)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseMap); - gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); - } - bindLightFunc(shader); stop_glerror(); @@ -8154,34 +8111,6 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ bindReflectionProbes(shader); - if (gAtmosphere) - { - // bind precomputed textures necessary for calculating sun and sky luminance - channel = shader.enableTexture(LLShaderMgr::TRANSMITTANCE_TEX, LLTexUnit::TT_TEXTURE); - if (channel > -1) - { - shader.bindTexture(LLShaderMgr::TRANSMITTANCE_TEX, gAtmosphere->getTransmittance()); - } - - channel = shader.enableTexture(LLShaderMgr::SCATTER_TEX, LLTexUnit::TT_TEXTURE_3D); - if (channel > -1) - { - shader.bindTexture(LLShaderMgr::SCATTER_TEX, gAtmosphere->getScattering()); - } - - channel = shader.enableTexture(LLShaderMgr::SINGLE_MIE_SCATTER_TEX, LLTexUnit::TT_TEXTURE_3D); - if (channel > -1) - { - shader.bindTexture(LLShaderMgr::SINGLE_MIE_SCATTER_TEX, gAtmosphere->getMieScattering()); - } - - channel = shader.enableTexture(LLShaderMgr::ILLUMINANCE_TEX, LLTexUnit::TT_TEXTURE); - if (channel > -1) - { - shader.bindTexture(LLShaderMgr::ILLUMINANCE_TEX, gAtmosphere->getIlluminance()); - } - } - /*if (gCubeSnapshot) { // we only really care about the first two values, but the shader needs increasing separation between clip planes shader.uniform4f(LLShaderMgr::DEFERRED_SHADOW_CLIP, 1.f, 64.f, 128.f, 256.f); @@ -8190,26 +8119,6 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ { shader.uniform4fv(LLShaderMgr::DEFERRED_SHADOW_CLIP, 1, mSunClipPlanes.mV); } - shader.uniform1f(LLShaderMgr::DEFERRED_SUN_WASH, RenderDeferredSunWash); - shader.uniform1f(LLShaderMgr::DEFERRED_SHADOW_NOISE, RenderShadowNoise); - shader.uniform1f(LLShaderMgr::DEFERRED_BLUR_SIZE, RenderShadowBlurSize); - - shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_RADIUS, RenderSSAOScale); - shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_MAX_RADIUS, (GLfloat)RenderSSAOMaxScale); - - F32 ssao_factor = RenderSSAOFactor; - shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR, ssao_factor); - shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR_INV, 1.0f/ssao_factor); - - LLVector3 ssao_effect = RenderSSAOEffect; - F32 matrix_diag = (ssao_effect[0] + 2.0f*ssao_effect[1])/3.0f; - F32 matrix_nondiag = (ssao_effect[0] - ssao_effect[1])/3.0f; - // This matrix scales (proj of color onto <1/rt(3),1/rt(3),1/rt(3)>) by - // value factor, and scales remainder by saturation factor - F32 ssao_effect_mat[] = { matrix_diag, matrix_nondiag, matrix_nondiag, - matrix_nondiag, matrix_diag, matrix_nondiag, - matrix_nondiag, matrix_nondiag, matrix_diag}; - shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_SSAO_EFFECT_MAT, 1, GL_FALSE, ssao_effect_mat); //F32 shadow_offset_error = 1.f + RenderShadowOffsetError * fabsf(LLViewerCamera::getInstance()->getOrigin().mV[2]); F32 shadow_bias_error = RenderShadowBiasError * fabsf(LLViewerCamera::getInstance()->getOrigin().mV[2])/3000.f; @@ -8226,20 +8135,12 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ shader.uniform3fv(LLShaderMgr::DEFERRED_MOON_DIR, 1, mTransformedMoonDir.mV); shader.uniform2f(LLShaderMgr::DEFERRED_SHADOW_RES, (GLfloat)mRT->shadow[0].getWidth(), (GLfloat)mRT->shadow[0].getHeight()); shader.uniform2f(LLShaderMgr::DEFERRED_PROJ_SHADOW_RES, (GLfloat)mSpotShadow[0].getWidth(), (GLfloat)mSpotShadow[0].getHeight()); - shader.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff); - shader.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff); shader.uniformMatrix4fv(LLShaderMgr::MODELVIEW_DELTA_MATRIX, 1, GL_FALSE, glm::value_ptr(gGLDeltaModelView)); shader.uniformMatrix4fv(LLShaderMgr::INVERSE_MODELVIEW_DELTA_MATRIX, 1, GL_FALSE, glm::value_ptr(gGLInverseDeltaModelView)); shader.uniform1i(LLShaderMgr::CUBE_SNAPSHOT, gCubeSnapshot ? 1 : 0); - if (shader.getUniformLocation(LLShaderMgr::DEFERRED_NORM_MATRIX) >= 0) - { - glm::mat4 norm_mat = glm::transpose(glm::inverse(get_current_modelview())); - shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, false, glm::value_ptr(norm_mat)); - } - // auto adjust legacy sun color if needed static LLCachedControl<bool> should_auto_adjust(gSavedSettings, "RenderSkyAutoAdjustLegacy", true); static LLCachedControl<F32> auto_adjust_sun_color_scale(gSavedSettings, "RenderSkyAutoAdjustSunColorScale", 1.f); @@ -8339,12 +8240,31 @@ void LLPipeline::renderDeferredLighting() (GLfloat)deferred_light_target->getWidth(), (GLfloat)deferred_light_target->getHeight()); + if (RenderDeferredSSAO && !gCubeSnapshot) + { + sun_shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_RADIUS, RenderSSAOScale); + sun_shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_MAX_RADIUS, (GLfloat)RenderSSAOMaxScale); + + F32 ssao_factor = RenderSSAOFactor; + sun_shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR, ssao_factor); + sun_shader.uniform1f(LLShaderMgr::DEFERRED_SSAO_FACTOR_INV, 1.0f / ssao_factor); + + S32 channel = sun_shader.enableTexture(LLShaderMgr::DEFERRED_NOISE); + if (channel > -1) + { + gGL.getTexUnit(channel)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseMap); + gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + } + } + { LLGLDisable blend(GL_BLEND); LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS); mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); } + sun_shader.disableTexture(LLShaderMgr::DEFERRED_NOISE); + unbindDeferredShader(sun_shader); } deferred_light_target->flush(); @@ -8434,6 +8354,19 @@ void LLPipeline::renderDeferredLighting() soften_shader.uniform4fv(LLShaderMgr::WATER_WATERPLANE, 1, LLDrawPoolAlpha::sWaterPlane.mV); + if(RenderDeferredSSAO) + { + LLVector3 ssao_effect = RenderSSAOEffect; + F32 matrix_diag = (ssao_effect[0] + 2.0f * ssao_effect[1]) / 3.0f; + F32 matrix_nondiag = (ssao_effect[0] - ssao_effect[1]) / 3.0f; + // This matrix scales (proj of color onto <1/rt(3),1/rt(3),1/rt(3)>) by + // value factor, and scales remainder by saturation factor + F32 ssao_effect_mat[] = { matrix_diag, matrix_nondiag, matrix_nondiag, + matrix_nondiag, matrix_diag, matrix_nondiag, + matrix_nondiag, matrix_nondiag, matrix_diag }; + soften_shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_SSAO_EFFECT_MAT, 1, GL_FALSE, ssao_effect_mat); + } + { LLGLDepthTest depth(GL_FALSE); LLGLDisable blend(GL_BLEND); @@ -9056,7 +8989,6 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) shader.disableTexture(LLShaderMgr::DEFERRED_DEPTH, deferred_target->getUsage()); shader.disableTexture(LLShaderMgr::DEFERRED_LIGHT, deferred_light_target->getUsage()); shader.disableTexture(LLShaderMgr::DIFFUSE_MAP); - shader.disableTexture(LLShaderMgr::DEFERRED_BLOOM); for (U32 i = 0; i < 4; i++) { @@ -9074,7 +9006,6 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) } } - shader.disableTexture(LLShaderMgr::DEFERRED_NOISE); shader.disableTexture(LLShaderMgr::DEFERRED_LIGHTFUNC); if (!LLPipeline::sReflectionProbesEnabled) diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 5c9b95ef4a..c69ca863e7 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -1000,7 +1000,6 @@ public: //cached settings static bool WindLightUseAtmosShaders; static bool RenderDeferred; - static F32 RenderDeferredSunWash; static U32 RenderFSAAType; static U32 RenderResolutionDivisor; static bool RenderUIBuffer; @@ -1042,7 +1041,6 @@ public: static F32 CameraFNumber; static F32 CameraFocalLength; static F32 CameraFieldOfView; - static F32 RenderShadowNoise; static F32 RenderShadowBlurSize; static F32 RenderSSAOScale; static U32 RenderSSAOMaxScale; @@ -1055,8 +1053,6 @@ public: static F32 RenderSpotShadowOffset; static F32 RenderSpotShadowBias; static LLDrawable* RenderSpotLight; - static F32 RenderEdgeDepthCutoff; - static F32 RenderEdgeNormCutoff; static LLVector3 RenderShadowGaussian; static F32 RenderShadowBlurDistFactor; static bool RenderDeferredAtmospheric; diff --git a/indra/newview/scripts/lua/test_top_menu.lua b/indra/newview/scripts/lua/test_top_menu.lua index 780a384c92..f877cda5eb 100644 --- a/indra/newview/scripts/lua/test_top_menu.lua +++ b/indra/newview/scripts/lua/test_top_menu.lua @@ -18,17 +18,35 @@ UI.addMenuItem{name="lua_scripts",label="Scripts", --Add menu separator to the 'LUA Menu' under added menu items UI.addMenuSeparator{parent_menu=MENU_NAME} ---Add two new menu branch 'About...' to the 'LUA Menu' -local BRANCH_NAME = "about_branch" -UI.addMenuBranch{name="about_branch",label="About...",parent_menu=MENU_NAME} +--Add 'Demo scripts...' branch to the 'LUA Menu' +local DEMO_BRANCH = "demo_scripts" +UI.addMenuBranch{name=DEMO_BRANCH,label="Demo scripts...",parent_menu=MENU_NAME} + +--Add menu items to the 'Demo scripts...' branch, which will invoke specified script on click +UI.addMenuItem{name="speedometer",label="Speedometer", + param="test_luafloater_speedometer.lua", + func="Lua.RunScript", + parent_menu=DEMO_BRANCH} + +UI.addMenuItem{name="gesture_list",label="Gesture list", + param="test_luafloater_gesture_list.lua", + func="Lua.RunScript", + parent_menu=DEMO_BRANCH} + +--Add one more menu separator +UI.addMenuSeparator{parent_menu=MENU_NAME} + +--Add 'About...' branch to the 'LUA Menu' +local ABOUT_BRANCH = "about_branch" +UI.addMenuBranch{name=ABOUT_BRANCH,label="About...",parent_menu=MENU_NAME} --Add two new menu items to the 'About...' branch UI.addMenuItem{name="lua_info",label="Lua...", param="https://www.lua.org/about.html", func="Advanced.ShowURL", - parent_menu=BRANCH_NAME} + parent_menu=ABOUT_BRANCH} UI.addMenuItem{name="lua_info",label="Luau...", param="https://luau-lang.org/", func="Advanced.ShowURL", - parent_menu=BRANCH_NAME} + parent_menu=ABOUT_BRANCH} diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 848d9aca7c..6c127ece53 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -7556,7 +7556,7 @@ Message from [NAME]: type="notify"> <unique/> This land has damage enabled. -You can be hurt here. If you die, you will be teleported to your home location. +You can be hurt here. If you die, you might be teleported to your home location or to the spawn point. </notification> <notification |