diff options
-rw-r--r-- | autobuild.xml | 68 | ||||
-rw-r--r-- | indra/cmake/LLRender.cmake | 1 | ||||
-rw-r--r-- | indra/llrender/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/llrender/llatmosphere.cpp | 69 | ||||
-rw-r--r-- | indra/llrender/llatmosphere.h | 73 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.h | 2 | ||||
-rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/cofF.glsl | 10 | ||||
-rw-r--r-- | indra/newview/lldrawpoolwlsky.cpp | 148 | ||||
-rw-r--r-- | indra/newview/lldrawpoolwlsky.h | 3 | ||||
-rw-r--r-- | indra/newview/llenvironment.cpp | 32 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 45 | ||||
-rw-r--r-- | indra/newview/llfloaterfixedenvironment.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llviewercontrol.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llviewerdisplay.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 70 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.h | 3 | ||||
-rw-r--r-- | indra/newview/llvoavatar.cpp | 2 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 273 | ||||
-rw-r--r-- | indra/newview/pipeline.h | 7 |
21 files changed, 104 insertions, 741 deletions
diff --git a/autobuild.xml b/autobuild.xml index 6d7c161117..3db07622a9 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -44,73 +44,7 @@ </map> <key>version</key> <string>1.2.15</string> - </map> - <key>libatmosphere</key> - <map> - <key>copyright</key> - <string>Copyright © 2017 Eric Bruneton.</string> - <key>description</key> - <string>Precomputed multiple atmospheric scattering library.</string> - <key>license</key> - <string>BSD</string> - <key>license_file</key> - <string>LICENSES/libatmosphere.txt</string> - <key>name</key> - <string>libatmosphere</string> - <key>platforms</key> - <map> - <key>darwin</key> - <map> - <key>archive</key> - <map> - <key>hash</key> - <string>bca20bcdf1a2c26b16e71fb2c1316cbe</string> - <key>url</key> - <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/24187/188163/libatmosphere-1.0.0.100-darwin-519422.tar.bz2</string> - </map> - <key>name</key> - <string>darwin</string> - </map> - <key>darwin64</key> - <map> - <key>archive</key> - <map> - <key>hash</key> - <string>9ce4c97f1eda8caa556573abd6e1ebd0</string> - <key>url</key> - <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/24188/188166/libatmosphere-1.0.0.100-darwin64-519422.tar.bz2</string> - </map> - <key>name</key> - <string>darwin64</string> - </map> - <key>windows</key> - <map> - <key>archive</key> - <map> - <key>hash</key> - <string>6a61502ab1cca316f85310ded8bf9b9a</string> - <key>url</key> - <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/24190/188181/libatmosphere-1.0.0.100-windows-519422.tar.bz2</string> - </map> - <key>name</key> - <string>windows</string> - </map> - <key>windows64</key> - <map> - <key>archive</key> - <map> - <key>hash</key> - <string>496410cb43e03ddf1777cd295c2d5dba</string> - <key>url</key> - <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/24189/188175/libatmosphere-1.0.0.100-windows64-519422.tar.bz2</string> - </map> - <key>name</key> - <string>windows64</string> - </map> - </map> - <key>version</key> - <string>1.0.0.513060</string> - </map> + </map> <key>apr_suite</key> <map> <key>copyright</key> diff --git a/indra/cmake/LLRender.cmake b/indra/cmake/LLRender.cmake index 0940d1de63..868922451f 100644 --- a/indra/cmake/LLRender.cmake +++ b/indra/cmake/LLRender.cmake @@ -3,7 +3,6 @@ include(Variables) include(FreeType) include(GLH) -include(Atmosphere) set(LLRENDER_INCLUDE_DIRS ${LIBS_OPEN_DIR}/llrender diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index bcb5a847f6..0a23b6c041 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -13,7 +13,6 @@ include(LLVFS) include(LLWindow) include(LLXML) include(LLVFS) -include(Atmosphere) include_directories( ${FREETYPE_INCLUDE_DIRS} @@ -25,7 +24,6 @@ include_directories( ${LLWINDOW_INCLUDE_DIRS} ${LLXML_INCLUDE_DIRS} ${LLVFS_INCLUDE_DIRS} - ${ATMOSPHERE_INCLUDE_DIR} ) include_directories(SYSTEM ${LLCOMMON_SYSTEM_INCLUDE_DIRS} diff --git a/indra/llrender/llatmosphere.cpp b/indra/llrender/llatmosphere.cpp index 12c6685354..a0b92564c3 100644 --- a/indra/llrender/llatmosphere.cpp +++ b/indra/llrender/llatmosphere.cpp @@ -88,8 +88,8 @@ AtmosphericModelSettings::AtmosphericModelSettings() , m_sunArcRadians(0.00045f) , m_mieAnisotropy(0.8f) { - atmosphere::DensityProfileLayer rayleigh_density(0.0, 1.0, -1.0 / kRayleighScaleHeight, 0.0, 0.0); - atmosphere::DensityProfileLayer mie_density(0.0, 1.0, -1.0 / kMieScaleHeight, 0.0, 0.0); + 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); @@ -98,8 +98,8 @@ AtmosphericModelSettings::AtmosphericModelSettings() // 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(atmosphere::DensityProfileLayer(25000.0, 0.0, 0.0, 1.0 / 15000.0, -2.0 / 3.0)); - m_absorptionProfile.push_back(atmosphere::DensityProfileLayer(0.0, 0.0, 0.0, -1.0 / 15000.0, 8.0 / 3.0)); + 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( @@ -227,64 +227,12 @@ LLAtmosphere::~LLAtmosphere() { m_mie_scatter_texture->setTexName(0); } - - delete m_model; - m_model = nullptr; } bool LLAtmosphere::configureAtmosphericModel(AtmosphericModelSettings& settings) { - if ((m_model != nullptr) && (settings == m_settings)) - { - return true; - } - - if (m_model) - { - delete m_model; - } - m_model = nullptr; - - getTransmittance()->setTexName(0); - getScattering()->setTexName(0); - getMieScattering()->setTexName(0); - getIlluminance()->setTexName(0); - - // Init libatmosphere model - m_model = new atmosphere::Model( - m_config, - m_wavelengths, - m_solar_irradiance, - settings.m_sunArcRadians, - settings.m_skyBottomRadius * 1000.0f, - settings.m_skyTopRadius * 1000.0f, - settings.m_rayleighProfile, - m_rayleigh_scattering, - settings.m_mieProfile, - m_mie_scattering, - m_mie_extinction, - settings.m_mieAnisotropy, - settings.m_absorptionProfile, - m_absorption_extinction, - m_ground_albedo, - max_sun_zenith_angle, - 1000.0, - 3, - false, // do not combine_scattering...we want indep textures - false, // use 32F for 2d textures to avoid artifacts - true); // use 16F for 3d textures to reduce footprint - - if (m_model) - { - m_model->Init(m_config, m_textures); - getTransmittance()->setTexName(m_textures.transmittance_texture); - getScattering()->setTexName(m_textures.scattering_texture); - getMieScattering()->setTexName(m_textures.single_mie_scattering_texture); - getIlluminance()->setTexName(m_textures.illuminance_texture); - m_settings = settings; - } - - return m_model != nullptr; + // TBD + return true; } LLGLTexture* LLAtmosphere::getTransmittance() @@ -342,8 +290,3 @@ LLGLTexture* LLAtmosphere::getIlluminance() } return m_illuminance; } - -GLhandleARB LLAtmosphere::getAtmosphericShaderForLink() const -{ - return m_model ? m_model->GetShader() : 0; -} 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<atmosphere::DensityProfileLayer> 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<DensityLayer> 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<LLGLTexture> m_transmittance; LLPointer<LLGLTexture> m_scattering; LLPointer<LLGLTexture> m_mie_scatter_texture; diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 497c3eb231..e0a67e6198 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -226,7 +226,7 @@ public: SUN_SIZE, FOG_COLOR, - // precomputed textures from libatmosphere + // precomputed textures TRANSMITTANCE_TEX, SCATTER_TEX, SINGLE_MIE_SCATTER_TEX, diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3e8a854df3..67f311bb4f 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10277,17 +10277,6 @@ <key>Value</key> <integer>0</integer> </map> - <key>RenderUseAdvancedAtmospherics</key> - <map> - <key>Comment</key> - <string>Use fancy precomputed atmospherics and stuff.</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>0</integer> - </map> <key>RenderUseTriStrips</key> <map> <key>Comment</key> diff --git a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl index 380d382020..079d8458c9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl @@ -50,8 +50,6 @@ uniform vec2 screen_res; VARYING vec2 vary_fragcoord; -float getDepth(vec2 pos_screen); - float calc_cof(float depth) { float sc = (depth-focal_distance)/-depth*blur_constant; @@ -70,8 +68,12 @@ float calc_cof(float depth) void main() { vec2 tc = vary_fragcoord.xy; - - float depth = getDepth(tc); + + float z = texture2DRect(depthMap, tc).r; + z = z*2.0-1.0; + vec4 ndc = vec4(0.0, 0.0, z, 1.0); + vec4 p = inv_proj*ndc; + float depth = p.z/p.w; vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 7e297a05a5..07d72e3d9b 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -187,63 +187,6 @@ void LLDrawPoolWLSky::renderDome(const LLVector3& camPosLocal, F32 camHeightLoca gGL.popMatrix(); } -void LLDrawPoolWLSky::renderSkyHazeAdvanced(const LLVector3& camPosLocal, F32 camHeightLocal) const -{ - if (gPipeline.useAdvancedAtmospherics() && gPipeline.canUseWindLightShaders() && gAtmosphere) - { - LLGLSPipelineDepthTestSkyBox sky(true, false); - - sky_shader->bind(); - - // bind precomputed textures necessary for calculating sun and sky luminance - sky_shader->bindTexture(LLShaderMgr::TRANSMITTANCE_TEX, gAtmosphere->getTransmittance()); - sky_shader->bindTexture(LLShaderMgr::SCATTER_TEX, gAtmosphere->getScattering()); - sky_shader->bindTexture(LLShaderMgr::SINGLE_MIE_SCATTER_TEX, gAtmosphere->getMieScattering()); - sky_shader->bindTexture(LLShaderMgr::ILLUMINANCE_TEX, gAtmosphere->getIlluminance()); - - LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); - - LLViewerTexture* rainbow_tex = gSky.mVOSkyp->getRainbowTex(); - LLViewerTexture* halo_tex = gSky.mVOSkyp->getHaloTex(); - - sky_shader->bindTexture(LLShaderMgr::RAINBOW_MAP, rainbow_tex); - sky_shader->bindTexture(LLShaderMgr::HALO_MAP, halo_tex); - - LLVector3 sun_dir = LLEnvironment::instance().getSunDirection(); - LLVector3 moon_dir = LLEnvironment::instance().getMoonDirection(); - - F32 sunSize = (float)cosf(psky->getSunArcRadians()); - sky_shader->uniform1f(LLShaderMgr::SUN_SIZE, sunSize); - sky_shader->uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, sun_dir.mV); - sky_shader->uniform3fv(LLShaderMgr::DEFERRED_MOON_DIR, 1, moon_dir.mV); - - - F32 moisture_level = (float)psky->getSkyMoistureLevel(); - F32 droplet_radius = (float)psky->getSkyDropletRadius(); - F32 ice_level = (float)psky->getSkyIceLevel(); - - sky_shader->uniform1f(LLShaderMgr::MOISTURE_LEVEL, moisture_level); - sky_shader->uniform1f(LLShaderMgr::DROPLET_RADIUS, droplet_radius); - sky_shader->uniform1f(LLShaderMgr::ICE_LEVEL, ice_level); - - llassert(sky_shader->getUniformLocation(LLShaderMgr::INVERSE_PROJECTION_MATRIX)); - - glh::matrix4f proj_mat = get_current_projection(); - glh::matrix4f inv_proj = proj_mat.inverse(); - - sky_shader->uniformMatrix4fv(LLShaderMgr::INVERSE_PROJECTION_MATRIX, 1, FALSE, inv_proj.m); - - sky_shader->uniform1f(LLShaderMgr::SUN_MOON_GLOW_FACTOR, psky->getSunMoonGlowFactor()); - sky_shader->uniform1i(LLShaderMgr::SUN_UP_FACTOR, psky->getIsSunUp() ? 1 : 0); - - sky_shader->uniform3f(sCamPosLocal, camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]); - - renderFsSky(camPosLocal, camHeightLocal, sky_shader); - - sky_shader->unbind(); - } -} - void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 camHeightLocal) const { LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); @@ -427,78 +370,6 @@ void LLDrawPoolWLSky::renderStarsDeferred(void) const gDeferredStarProgram.unbind(); } -void LLDrawPoolWLSky::renderSkyCloudsAdvanced(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const -{ - if (gPipeline.canUseWindLightShaders() - && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) - && gSky.mVOSkyp->getCloudNoiseTex() - && gAtmosphere) - { - LLGLSPipelineBlendSkyBox pipeline(true, true); - - LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); - - cloudshader->bind(); - - LLPointer<LLViewerTexture> cloud_noise = gSky.mVOSkyp->getCloudNoiseTex(); - LLPointer<LLViewerTexture> cloud_noise_next = gSky.mVOSkyp->getCloudNoiseTexNext(); - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); - - F32 cloud_variance = psky ? psky->getCloudVariance() : 0.0f; - F32 blend_factor = psky ? psky->getBlendFactor() : 0.0f; - - // if we even have sun disc textures to work with... - if (cloud_noise || cloud_noise_next) - { - if (cloud_noise && (!cloud_noise_next || (cloud_noise == cloud_noise_next))) - { - // Bind current and next sun textures - cloudshader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP, cloud_noise, LLTexUnit::TT_TEXTURE); - blend_factor = 0; - } - else if (cloud_noise_next && !cloud_noise) - { - cloudshader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP, cloud_noise_next, LLTexUnit::TT_TEXTURE); - blend_factor = 0; - } - else if (cloud_noise_next != cloud_noise) - { - cloudshader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP, cloud_noise, LLTexUnit::TT_TEXTURE); - cloudshader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP_NEXT, cloud_noise_next, LLTexUnit::TT_TEXTURE); - } - } - - cloudshader->bindTexture(LLShaderMgr::TRANSMITTANCE_TEX, gAtmosphere->getTransmittance()); - cloudshader->bindTexture(LLShaderMgr::SCATTER_TEX, gAtmosphere->getScattering()); - cloudshader->bindTexture(LLShaderMgr::SINGLE_MIE_SCATTER_TEX, gAtmosphere->getMieScattering()); - cloudshader->bindTexture(LLShaderMgr::ILLUMINANCE_TEX, gAtmosphere->getIlluminance()); - - LLVector3 sun_dir = LLEnvironment::instance().getSunDirection(); - LLVector3 moon_dir = LLEnvironment::instance().getMoonDirection(); - - F32 sunSize = (float)cosf(psky->getSunArcRadians()); - cloudshader->uniform1f(LLShaderMgr::SUN_SIZE, sunSize); - cloudshader->uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, sun_dir.mV); - cloudshader->uniform3fv(LLShaderMgr::DEFERRED_MOON_DIR, 1, moon_dir.mV); - - cloudshader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor); - cloudshader->uniform1f(LLShaderMgr::CLOUD_VARIANCE, cloud_variance); - cloudshader->uniform1f(LLShaderMgr::SUN_MOON_GLOW_FACTOR, psky->getSunMoonGlowFactor()); - - cloudshader->uniform3f(sCamPosLocal, camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]); - - /// Render the skydome - renderDome(camPosLocal, camHeightLocal, cloudshader); - - cloudshader->unbind(); - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); - } -} - void LLDrawPoolWLSky::renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const { if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp->getCloudNoiseTex()) @@ -741,22 +612,11 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass) if (gPipeline.canUseWindLightShaders()) { - if (gPipeline.useAdvancedAtmospherics()) - { - renderSkyHazeAdvanced(origin, camHeightLocal); - renderStarsDeferred(); - renderHeavenlyBodies(); - renderSkyCloudsAdvanced(origin, camHeightLocal, cloud_shader); - } - else - { - renderSkyHazeDeferred(origin, camHeightLocal); - renderStarsDeferred(); - renderHeavenlyBodies(); - renderSkyCloudsDeferred(origin, camHeightLocal, cloud_shader); - } + renderSkyHazeDeferred(origin, camHeightLocal); + renderStarsDeferred(); + renderHeavenlyBodies(); + renderSkyCloudsDeferred(origin, camHeightLocal, cloud_shader); } - gGL.setColorMask(true, true); } diff --git a/indra/newview/lldrawpoolwlsky.h b/indra/newview/lldrawpoolwlsky.h index ea11060eb5..b05f0f8605 100644 --- a/indra/newview/lldrawpoolwlsky.h +++ b/indra/newview/lldrawpoolwlsky.h @@ -94,9 +94,6 @@ private: void renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 camHeightLocal) const; void renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const; - void renderSkyHazeAdvanced(const LLVector3& camPosLocal, F32 camHeightLocal) const; - void renderSkyCloudsAdvanced(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const; - void renderStarsDeferred(void) const; void renderStars(void) const; void renderHeavenlyBodies(); diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index f021c4a8c3..18777e53d1 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -882,6 +882,14 @@ LLSettingsWater::ptr_t LLEnvironment::getCurrentWater() const return pwater; } +void LayerConfigToDensityLayer(const LLSD& layerConfig, DensityLayer& layerOut) +{ + layerOut.constant_term = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM].asReal(); + layerOut.exp_scale = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR].asReal(); + layerOut.exp_term = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM].asReal(); + layerOut.linear_term = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM].asReal(); + layerOut.width = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH].asReal(); +} void LLEnvironment::getAtmosphericModelSettings(AtmosphericModelSettings& settingsOut, const LLSettingsSky::ptr_t &psky) { @@ -894,13 +902,9 @@ void LLEnvironment::getAtmosphericModelSettings(AtmosphericModelSettings& settin settingsOut.m_rayleighProfile.clear(); for (LLSD::array_iterator itf = rayleigh.beginArray(); itf != rayleigh.endArray(); ++itf) { - atmosphere::DensityProfileLayer layer; + DensityLayer layer; LLSD& layerConfig = (*itf); - layer.constant_term = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM].asReal(); - layer.exp_scale = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR].asReal(); - layer.exp_term = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM].asReal(); - layer.linear_term = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM].asReal(); - layer.width = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH].asReal(); + LayerConfigToDensityLayer(layerConfig, layer); settingsOut.m_rayleighProfile.push_back(layer); } @@ -908,13 +912,9 @@ void LLEnvironment::getAtmosphericModelSettings(AtmosphericModelSettings& settin settingsOut.m_mieProfile.clear(); for (LLSD::array_iterator itf = mie.beginArray(); itf != mie.endArray(); ++itf) { - atmosphere::DensityProfileLayer layer; + DensityLayer layer; LLSD& layerConfig = (*itf); - layer.constant_term = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM].asReal(); - layer.exp_scale = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR].asReal(); - layer.exp_term = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM].asReal(); - layer.linear_term = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM].asReal(); - layer.width = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH].asReal(); + LayerConfigToDensityLayer(layerConfig, layer); settingsOut.m_mieProfile.push_back(layer); } settingsOut.m_mieAnisotropy = psky->getMieAnisotropy(); @@ -923,13 +923,9 @@ void LLEnvironment::getAtmosphericModelSettings(AtmosphericModelSettings& settin settingsOut.m_absorptionProfile.clear(); for (LLSD::array_iterator itf = absorption.beginArray(); itf != absorption.endArray(); ++itf) { - atmosphere::DensityProfileLayer layer; + DensityLayer layer; LLSD& layerConfig = (*itf); - layer.constant_term = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM].asReal(); - layer.exp_scale = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR].asReal(); - layer.exp_term = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM].asReal(); - layer.linear_term = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM].asReal(); - layer.width = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH].asReal(); + LayerConfigToDensityLayer(layerConfig, layer); settingsOut.m_absorptionProfile.push_back(layer); } } diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 3f2a89be88..f05f0fb021 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -248,28 +248,6 @@ BOOL LLFloaterEditExtDayCycle::postBuild() S32 tab_count = tab_container->getTabCount(); LLSettingsEditPanel *panel = nullptr; - - // Add or remove density tab as necessary - // Must be before operation on all tabs below - if (gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics")) - { - panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->findChildView("panel_settings_sky_density")); - if (!panel) - { - panel = new LLPanelSettingsSkyDensityTab; - panel->buildFromFile("panel_settings_sky_density.xml"); - tab_container->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(false)); - } - } - else - { - panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->findChildView("panel_settings_sky_density")); - if (panel) - { - tab_container->removeTabPanel(panel); - } - delete panel; - } for (S32 idx = 0; idx < tab_count; ++idx) { @@ -1261,29 +1239,6 @@ void LLFloaterEditExtDayCycle::updateSkyTabs(const LLSettingsSkyPtr_t &p_sky) { panel->setSky(p_sky); } - - if (gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics")) - { - panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->findChildView("panel_settings_sky_density")); - if (!panel) - { - panel = new LLPanelSettingsSkyDensityTab; - panel->buildFromFile("panel_settings_sky_density.xml"); - panel->setOnDirtyFlagChanged([this](LLPanel *, bool value) { onPanelDirtyFlagChanged(value); }); - tab_container->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(false)); - } - panel->setSky(std::static_pointer_cast<LLSettingsSky>(p_sky)); - } - else - { - panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->findChildView("panel_settings_sky_density")); - if (panel) - { - tab_container->removeTabPanel(panel); - delete panel; - } - } - } void LLFloaterEditExtDayCycle::updateLabels() diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index b7e92e7e56..f08c36a7e7 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -795,14 +795,6 @@ BOOL LLFloaterFixedEnvironmentSky::postBuild() panel->setOnDirtyFlagChanged([this](LLPanel *, bool value) { onPanelDirtyFlagChanged(value); }); mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(false)); - if (gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics")) - { - panel = new LLPanelSettingsSkyDensityTab; - panel->buildFromFile("panel_settings_sky_density.xml"); - panel->setSky(std::static_pointer_cast<LLSettingsSky>(mSettings)); - panel->setOnDirtyFlagChanged([this](LLPanel *, bool value) { onPanelDirtyFlagChanged(value); }); - mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(false)); - } return TRUE; } diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index ebc55fa0dd..88984d518a 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -410,17 +410,6 @@ static bool handleRenderDeferredChanged(const LLSD& newvalue) return true; } -static bool handleRenderUseAdvancedAtmosphericsChanged(const LLSD& newvalue) -{ - if (gPipeline.isInit()) - { - LLPipeline::refreshCachedSettings(); - // Need to reload shaders when changing atmospherics implementations... - LLViewerShaderMgr::instance()->setShaders(); - } - return true; -} - // This looks a great deal like handleRenderDeferredChanged because // Advanced Lighting (Materials) implies bumps and shiny so disabling // bumps should further disable that feature. @@ -655,7 +644,6 @@ void settings_setup_listeners() gSavedSettings.getControl("RenderDebugPipeline")->getSignal()->connect(boost::bind(&handleRenderDebugPipelineChanged, _2)); gSavedSettings.getControl("RenderResolutionDivisor")->getSignal()->connect(boost::bind(&handleRenderResolutionDivisorChanged, _2)); gSavedSettings.getControl("RenderDeferred")->getSignal()->connect(boost::bind(&handleRenderDeferredChanged, _2)); - gSavedSettings.getControl("RenderUseAdvancedAtmospherics")->getSignal()->connect(boost::bind(&handleRenderUseAdvancedAtmosphericsChanged, _2)); gSavedSettings.getControl("RenderShadowDetail")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("RenderDeferredSSAO")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("RenderPerformanceTest")->getSignal()->connect(boost::bind(&handleRenderPerfTestChanged, _2)); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 2d4478bfdb..5d01e7e584 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1021,11 +1021,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) } } - if (LLPipeline::sRenderDeferred && gAtmosphere && gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics")) - { - gPipeline.generateSkyIndirect(); - } - if (LLPipeline::sRenderDeferred) { gPipeline.renderDeferredLighting(&gPipeline.mScreen); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 1e46a1cf9e..a7151c4d1b 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -3072,6 +3072,7 @@ void LLViewerObject::unlinkControlAvatar() if (mControlAvatar) { mControlAvatar->markForDeath(); + mControlAvatar->mRootVolp = NULL; mControlAvatar = NULL; } } diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 319ae3b9a7..1f5778db61 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -242,10 +242,6 @@ LLGLSLShader gDeferredSkinnedFullbrightShinyProgram; LLGLSLShader gDeferredSkinnedFullbrightProgram; LLGLSLShader gNormalMapGenProgram; -LLGLSLShader gDeferredGenSkyShProgram; -LLGLSLShader gDeferredGatherSkyShProgram; -LLGLSLShader gDeferredShVisProgram; - // Deferred materials shaders LLGLSLShader gDeferredMaterialProgram[LLMaterial::SHADER_COUNT*2]; LLGLSLShader gDeferredMaterialWaterProgram[LLMaterial::SHADER_COUNT*2]; @@ -341,10 +337,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gDeferredWLCloudProgram); mShaderList.push_back(&gDeferredWLCloudShadowProgram); mShaderList.push_back(&gDeferredWLMoonProgram); - mShaderList.push_back(&gDeferredWLSunProgram); - mShaderList.push_back(&gDeferredGenSkyShProgram); - mShaderList.push_back(&gDeferredGatherSkyShProgram); - mShaderList.push_back(&gDeferredShVisProgram); + mShaderList.push_back(&gDeferredWLSunProgram); } LLViewerShaderMgr::~LLViewerShaderMgr() @@ -1294,10 +1287,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredMaterialProgram[i].unload(); gDeferredMaterialWaterProgram[i].unload(); } - - gDeferredGenSkyShProgram.unload(); - gDeferredGatherSkyShProgram.unload(); - gDeferredShVisProgram.unload(); return TRUE; } @@ -2042,14 +2031,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() { //if using SSAO, take screen space light map into account as if shadows are enabled gDeferredSoftenProgram.mShaderLevel = llmax(gDeferredSoftenProgram.mShaderLevel, 2); } - - // insure we use class3/deferred version of softenLight for advanced atmo.. - gDeferredSoftenProgram.mShaderLevel = gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics") ? 3 : gDeferredSoftenProgram.mShaderLevel; - - if (gAtmosphere && gDeferredSoftenProgram.mShaderLevel > 2) - { - gDeferredSoftenProgram.mExtraLinkObject = gAtmosphere->getAtmosphericShaderForLink(); - } success = gDeferredSoftenProgram.createShader(NULL, NULL); llassert(success); @@ -2075,11 +2056,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSoftenWaterProgram.mFeatures.isDeferred = true; gDeferredSoftenWaterProgram.mFeatures.hasShadows = true; - if (gAtmosphere && gDeferredSoftenWaterProgram.mShaderLevel > 2) - { - gDeferredSoftenWaterProgram.mExtraLinkObject = gAtmosphere->getAtmosphericShaderForLink(); - } - if (gSavedSettings.getBOOL("RenderDeferredSSAO")) { //if using SSAO, take screen space light map into account as if shadows are enabled gDeferredSoftenWaterProgram.mShaderLevel = llmax(gDeferredSoftenWaterProgram.mShaderLevel, 2); @@ -2355,10 +2331,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredWLSkyProgram.mShaderLevel = mShaderLevel[SHADER_WINDLIGHT]; gDeferredWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY; - if (gAtmosphere && gDeferredWLSkyProgram.mShaderLevel > 2) - { - gDeferredWLSkyProgram.mExtraLinkObject = gAtmosphere->getAtmosphericShaderForLink(); - } + success = gDeferredWLSkyProgram.createShader(NULL, NULL); llassert(success); } @@ -2376,10 +2349,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsF.glsl", GL_FRAGMENT_SHADER_ARB)); gDeferredWLCloudProgram.mShaderLevel = mShaderLevel[SHADER_WINDLIGHT]; gDeferredWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY; - if (gAtmosphere && gDeferredWLCloudProgram.mShaderLevel > 2) - { - gDeferredWLCloudProgram.mExtraLinkObject = gAtmosphere->getAtmosphericShaderForLink(); - } + success = gDeferredWLCloudProgram.createShader(NULL, NULL); llassert(success); } @@ -2402,40 +2372,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() llassert(success); } - if (success && gAtmosphere && (mShaderLevel[SHADER_WINDLIGHT] > 2)) - { - gDeferredGenSkyShProgram.mName = "Deferred Generate Sky Indirect SH Program"; - gDeferredGenSkyShProgram.mShaderFiles.clear(); - gDeferredGenSkyShProgram.mShaderFiles.push_back(make_pair("deferred/genSkyShV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredGenSkyShProgram.mShaderFiles.push_back(make_pair("deferred/genSkyShF.glsl", GL_FRAGMENT_SHADER_ARB)); - gDeferredGenSkyShProgram.mShaderLevel = mShaderLevel[SHADER_WINDLIGHT]; - gDeferredGenSkyShProgram.mExtraLinkObject = gAtmosphere->getAtmosphericShaderForLink(); - success = gDeferredGenSkyShProgram.createShader(NULL, NULL); - llassert(success); - } - - if (success && gAtmosphere && (mShaderLevel[SHADER_WINDLIGHT] > 2)) - { - gDeferredGatherSkyShProgram.mName = "Deferred Gather Sky Indirect SH Program"; - gDeferredGatherSkyShProgram.mShaderFiles.clear(); - gDeferredGatherSkyShProgram.mShaderFiles.push_back(make_pair("deferred/gatherSkyShV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredGatherSkyShProgram.mShaderFiles.push_back(make_pair("deferred/gatherSkyShF.glsl", GL_FRAGMENT_SHADER_ARB)); - gDeferredGatherSkyShProgram.mShaderLevel = 3; - success = gDeferredGatherSkyShProgram.createShader(NULL, NULL); - llassert(success); - } - - if (success) - { - gDeferredShVisProgram.mName = "Deferred SH Vis Program"; - gDeferredShVisProgram.mShaderFiles.clear(); - gDeferredShVisProgram.mShaderFiles.push_back(make_pair("deferred/shVisV.glsl", GL_VERTEX_SHADER_ARB)); - gDeferredShVisProgram.mShaderFiles.push_back(make_pair("deferred/shVisF.glsl", GL_FRAGMENT_SHADER_ARB)); - gDeferredShVisProgram.mShaderLevel = 3; - success = gDeferredShVisProgram.createShader(NULL, NULL); - llassert(success); - } - if (success) { gDeferredWLSunProgram.mName = "Deferred Windlight Sun Program"; diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index e55b59d4e2..8e1801612e 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -329,9 +329,6 @@ extern LLGLSLShader gDeferredSkinnedFullbrightShinyProgram; extern LLGLSLShader gDeferredSkinnedFullbrightProgram; extern LLGLSLShader gNormalMapGenProgram; -extern LLGLSLShader gDeferredGenSkyShProgram; -extern LLGLSLShader gDeferredGatherSkyShProgram; -extern LLGLSLShader gDeferredShVisProgram; // Deferred materials shaders extern LLGLSLShader gDeferredMaterialProgram[LLMaterial::SHADER_COUNT*2]; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index cc030dfb60..d13b926930 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -9745,7 +9745,7 @@ void LLVOAvatar::updateImpostors() iter != instances_copy.end(); ++iter) { LLVOAvatar* avatar = (LLVOAvatar*) *iter; - if (!avatar->isDead() && avatar->isVisible() + if (avatar && !avatar->isDead() && avatar->isVisible() && ( (avatar->isImpostor() || LLVOAvatar::AV_DO_NOT_RENDER == avatar->getVisualMuteSettings()) && avatar->needsImpostorUpdate()) ) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 73e78aadd0..7e8e401470 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -326,7 +326,6 @@ bool LLPipeline::sRenderBump = true; bool LLPipeline::sBakeSunlight = false; bool LLPipeline::sNoAlpha = false; bool LLPipeline::sUseTriStrips = true; -bool LLPipeline::sUseAdvancedAtmospherics = false; bool LLPipeline::sUseFarClip = true; bool LLPipeline::sShadowRender = false; bool LLPipeline::sWaterReflections = false; @@ -972,18 +971,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) } } - // for EEP atmospherics - bool allocated_sh0 = mSkySH.allocate(64, 64, GL_RGBA16F_ARB, FALSE, FALSE, LLTexUnit::TT_TEXTURE); - if (!allocated_sh0) - { - return false; - } - else - { - mSkySH.addColorAttachment(GL_RGBA16F_ARB); - mSkySH.addColorAttachment(GL_RGBA16F_ARB); - } - U32 width = (U32) (resX*scale); U32 height = width; @@ -1098,7 +1085,6 @@ void LLPipeline::refreshCachedSettings() RenderAvatarVP = gSavedSettings.getBOOL("RenderAvatarVP"); WindLightUseAtmosShaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders"); RenderDeferred = gSavedSettings.getBOOL("RenderDeferred"); - sUseAdvancedAtmospherics = WindLightUseAtmosShaders && gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics"); RenderDeferredSunWash = gSavedSettings.getF32("RenderDeferredSunWash"); RenderFSAASamples = gSavedSettings.getU32("RenderFSAASamples"); RenderResolutionDivisor = gSavedSettings.getU32("RenderResolutionDivisor"); @@ -5382,55 +5368,6 @@ void LLPipeline::renderDebug() visible_selected_groups.clear(); - if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SH) && gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics") && LLPipeline::sRenderDeferred) - { - bindDeferredShader(gDeferredShVisProgram); - - S32 l1r_channel = gDeferredShVisProgram.enableTexture(LLShaderMgr::SH_INPUT_L1R, gPipeline.mSkySH.getUsage()); - if (l1r_channel > -1) - { - gPipeline.mSkySH.bindTexture(0,l1r_channel); - gGL.getTexUnit(l1r_channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); - } - - S32 l1b_channel = gDeferredShVisProgram.enableTexture(LLShaderMgr::SH_INPUT_L1G, gPipeline.mSkySH.getUsage()); - if (l1b_channel > -1) - { - gPipeline.mSkySH.bindTexture(1,l1b_channel); - gGL.getTexUnit(l1b_channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); - } - - S32 l1g_channel = gDeferredShVisProgram.enableTexture(LLShaderMgr::SH_INPUT_L1B, gPipeline.mSkySH.getUsage()); - if (l1g_channel > -1) - { - gPipeline.mSkySH.bindTexture(2,l1g_channel); - gGL.getTexUnit(l1g_channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); - } - - LLGLDisable blend(GL_BLEND); - LLGLDepthTest depth(GL_FALSE, GL_FALSE, GL_ALWAYS); - - LLVector3 pos = LLViewerCamera::instance().getOrigin(); - pos += LLViewerCamera::instance().getAtAxis() * 10.0f; - - gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); - - gGL.begin(LLRender::TRIANGLES); - gGL.texCoord2f(0.0f, 0.0f); - gGL.vertex2f(-1,-1); - - gGL.texCoord2f(0.0f, 1.0f); - gGL.vertex2f(-1,3); - - gGL.texCoord2f(1.0f, 0.0f); - gGL.vertex2f(3,-1); - - gGL.end(); - gGL.flush(); - - unbindDeferredShader(gDeferredShVisProgram); - } - if (LLGLSLShader::sNoFixedFunction) { gUIProgram.bind(); @@ -8748,27 +8685,6 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target) LLGLDepthTest depth(GL_FALSE); LLGLDisable blend(GL_BLEND); LLGLDisable test(GL_ALPHA_TEST); - - S32 l1r_channel = soften_shader.enableTexture(LLShaderMgr::SH_INPUT_L1R, mSkySH.getUsage()); - if (l1r_channel > -1) - { - mSkySH.bindTexture(0,l1r_channel); - gGL.getTexUnit(l1r_channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); - } - - S32 l1b_channel = soften_shader.enableTexture(LLShaderMgr::SH_INPUT_L1G, mSkySH.getUsage()); - if (l1b_channel > -1) - { - mSkySH.bindTexture(1,l1b_channel); - gGL.getTexUnit(l1b_channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); - } - - S32 l1g_channel = soften_shader.enableTexture(LLShaderMgr::SH_INPUT_L1B, mSkySH.getUsage()); - if (l1g_channel > -1) - { - mSkySH.bindTexture(2,l1g_channel); - gGL.getTexUnit(l1g_channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); - } //full screen blit gGL.pushMatrix(); @@ -9420,11 +9336,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) glh::matrix4f projection = get_current_projection(); glh::matrix4f mat; - stop_glerror(); - LLPlane plane; - S32 detail = RenderReflectionDetail; - bool materials_in_water = LLPipeline::sRenderDeferred && gSavedSettings.getS32("RenderWaterMaterials"); F32 water_height = gAgent.getRegion()->getWaterHeight(); @@ -9440,6 +9352,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) camera.setOriginAndLookAt(reflect_origin, LLVector3::z_axis, reflect_interest_point); //plane params + LLPlane plane; LLVector3 pnorm; S32 water_clip = 0; if (!LLViewerCamera::getInstance()->cameraUnderWater()) @@ -9605,8 +9518,10 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) LLPipeline::sUseOcclusion = occlusion; camera.setOrigin(camera_in.getOrigin()); + //render distortion map static bool last_update = true; + if (last_update) { camera.setFar(camera_in.getFar()); @@ -10232,183 +10147,6 @@ LLRenderTarget* LLPipeline::getShadowTarget(U32 i) return &mShadow[i]; } -static LLTrace::BlockTimerStatHandle FTM_GEN_SKY_INDIRECT("Gen Sky Indirect"); - -void LLPipeline::generateSkyIndirect() -{ - if (!sRenderDeferred || !gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics")) - { - return; - } - - LL_RECORD_BLOCK_TIME(FTM_GEN_SKY_INDIRECT); - - gGL.setColorMask(true, true); - - LLVertexBuffer::unbind(); - - gGL.pushMatrix(); - gGL.loadIdentity(); - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.pushMatrix(); - gGL.loadIdentity(); - - mSkySH.bindTarget(); - - bindDeferredShader(gDeferredGenSkyShProgram, &mSkySH); - - gDeferredGenSkyShProgram.bind(); - - llassert(gAtmosphere); - - int channel = -1; - - if (gAtmosphere) - { - // bind precomputed textures necessary for calculating sun and sky luminance - channel = gDeferredGenSkyShProgram.enableTexture(LLShaderMgr::TRANSMITTANCE_TEX, LLTexUnit::TT_TEXTURE); - if (channel > -1) - { - gDeferredGenSkyShProgram.bindTexture(LLShaderMgr::TRANSMITTANCE_TEX, gAtmosphere->getTransmittance()); - } - - channel = gDeferredGenSkyShProgram.enableTexture(LLShaderMgr::SCATTER_TEX, LLTexUnit::TT_TEXTURE_3D); - if (channel > -1) - { - gDeferredGenSkyShProgram.bindTexture(LLShaderMgr::SCATTER_TEX, gAtmosphere->getScattering()); - } - - channel = gDeferredGenSkyShProgram.enableTexture(LLShaderMgr::SINGLE_MIE_SCATTER_TEX, LLTexUnit::TT_TEXTURE_3D); - if (channel > -1) - { - gDeferredGenSkyShProgram.bindTexture(LLShaderMgr::SINGLE_MIE_SCATTER_TEX, gAtmosphere->getMieScattering()); - } - - channel = gDeferredGenSkyShProgram.enableTexture(LLShaderMgr::ILLUMINANCE_TEX, LLTexUnit::TT_TEXTURE); - if (channel > -1) - { - gDeferredGenSkyShProgram.bindTexture(LLShaderMgr::ILLUMINANCE_TEX, gAtmosphere->getIlluminance()); - } - } - - gDeferredGenSkyShProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, mSkySH.getWidth(), mSkySH.getHeight()); - - LLStrider<LLVector3> vertices; - LLStrider<LLVector2> texCoords; - LLStrider<U16> indices; - - if (!mDeferredVB->allocateBuffer(4, 6, TRUE)) - { - LL_WARNS() << "Failed to allocate Vertex Buffer on full screen sky update" << LL_ENDL; - } - - BOOL success = mDeferredVB->getVertexStrider(vertices) - && mDeferredVB->getTexCoord0Strider(texCoords) - && mDeferredVB->getIndexStrider(indices); - - if(!success) - { - LL_ERRS() << "Failed updating WindLight fullscreen sky geometry." << LL_ENDL; - } - - *vertices++ = LLVector3(-1.0f, -1.0f, 0.0f); - *vertices++ = LLVector3( 1.0f, -1.0f, 0.0f); - *vertices++ = LLVector3(-1.0f, 1.0f, 0.0f); - *vertices++ = LLVector3( 1.0f, 1.0f, 0.0f); - - *texCoords++ = LLVector2(0.0f, 0.0f); - *texCoords++ = LLVector2(1.0f, 0.0f); - *texCoords++ = LLVector2(0.0f, 1.0f); - *texCoords++ = LLVector2(1.0f, 1.0f); - - *indices++ = 0; - *indices++ = 1; - *indices++ = 2; - *indices++ = 1; - *indices++ = 3; - *indices++ = 2; - - mDeferredVB->flush(); - - glClearColor(0,0,0,0); - mSkySH.clear(GL_COLOR_BUFFER_BIT); - - LLGLDisable blend(GL_BLEND); - LLGLDepthTest depth(GL_FALSE, GL_FALSE, GL_ALWAYS); - - mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0); - mDeferredVB->drawRange(LLRender::TRIANGLES, 0, mDeferredVB->getNumVerts() - 1, mDeferredVB->getNumIndices(), 0); - stop_glerror(); - - gDeferredGenSkyShProgram.disableTexture(LLShaderMgr::TRANSMITTANCE_TEX); - gDeferredGenSkyShProgram.disableTexture(LLShaderMgr::SCATTER_TEX); - gDeferredGenSkyShProgram.disableTexture(LLShaderMgr::SINGLE_MIE_SCATTER_TEX); - gDeferredGenSkyShProgram.disableTexture(LLShaderMgr::ILLUMINANCE_TEX); - gDeferredGenSkyShProgram.uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, mTransformedSunDir.mV); - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->activate(); - gDeferredGenSkyShProgram.unbind(); - - mSkySH.flush(); - -#if GATHER_SKY_SH - gDeferredGatherSkyShProgram.bind(); - - S32 res = mSkySH[0].getWidth(); - S32 ping = 0; - - while (res > 1) - { - S32 pong = 1 - ping; - S32 l1r_channel = gDeferredGatherSkyShProgram.enableTexture(LLShaderMgr::SH_INPUT_L1R, mSkySH[ping].getUsage()); - if (l1r_channel > -1) - { - mSkySH[ping].bindTexture(0,l1r_channel); - gGL.getTexUnit(l1r_channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); - } - - S32 l1b_channel = gDeferredGatherSkyShProgram.enableTexture(LLShaderMgr::SH_INPUT_L1G, mSkySH[ping].getUsage()); - if (l1b_channel > -1) - { - mSkySH[ping].bindTexture(1,l1b_channel); - gGL.getTexUnit(l1b_channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); - } - - S32 l1g_channel = gDeferredGatherSkyShProgram.enableTexture(LLShaderMgr::SH_INPUT_L1B, mSkySH[ping].getUsage()); - if (l1g_channel > -1) - { - mSkySH[ping].bindTexture(2,l1g_channel); - gGL.getTexUnit(l1g_channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); - } - - gDeferredGatherSkyShProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, res >> 1, res >> 1); - - glViewport(0, 0, res >> 1, res >> 1); - - mSkySH[pong].bindTarget(); - - mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0); - mDeferredVB->drawRange(LLRender::TRIANGLES, 0, mDeferredVB->getNumVerts() - 1, mDeferredVB->getNumIndices(), 0); - stop_glerror(); - - mSkySH[pong].flush(); - - gGL.getTexUnit(l1r_channel)->unbind(mSkySH[ping].getUsage()); - gGL.getTexUnit(l1b_channel)->unbind(mSkySH[ping].getUsage()); - gGL.getTexUnit(l1g_channel)->unbind(mSkySH[ping].getUsage()); - - ping ^= 1; - res >>= 1; - } -#endif - - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.popMatrix(); - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.popMatrix(); -} - static LLTrace::BlockTimerStatHandle FTM_GEN_SUN_SHADOW("Gen Sun Shadow"); void LLPipeline::generateSunShadow(LLCamera& camera) @@ -11877,8 +11615,3 @@ void LLPipeline::restoreHiddenObject( const LLUUID& id ) } } -bool LLPipeline::useAdvancedAtmospherics() const -{ - return sUseAdvancedAtmospherics; -} - diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index c94a69eaf0..c41fd0189c 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -287,7 +287,6 @@ public: void generateSunShadow(LLCamera& camera); LLRenderTarget* getShadowTarget(U32 i); - void generateSkyIndirect(); void generateHighlight(LLCamera& camera); void renderHighlight(const LLViewerObject* obj, F32 fade); void setHighlightObject(LLDrawable* obj) { mHighlightObject = obj; } @@ -545,8 +544,6 @@ public: void updateCamera(bool reset = false); - bool useAdvancedAtmospherics() const; - LLVector3 mFlyCamPosition; LLQuaternion mFlyCamRotation; @@ -574,7 +571,6 @@ public: static bool sBakeSunlight; static bool sNoAlpha; static bool sUseTriStrips; - static bool sUseAdvancedAtmospherics; static bool sUseFarClip; static bool sShadowRender; static bool sWaterReflections; @@ -659,9 +655,6 @@ public: //texture for making the glow LLRenderTarget mGlow[3]; - // texture for SH indirect sky contribution - LLRenderTarget mSkySH; - //noise map U32 mNoiseMap; U32 mTrueNoiseMap; |