diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llinventory/llsettingssky.cpp | 23 | ||||
-rw-r--r-- | indra/llrender/llatmosphere.cpp | 36 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/skyV.glsl | 4 | ||||
-rw-r--r-- | indra/newview/lldrawpoolwlsky.cpp | 19 | ||||
-rw-r--r-- | indra/newview/llenvironment.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llpaneleditsky.cpp | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_settings_sky_density.xml | 73 |
7 files changed, 58 insertions, 104 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index ba92a82174..ed8baee204 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -573,11 +573,11 @@ LLSD LLSettingsSky::createDensityProfileLayer( F32 aniso_factor) { LLSD dflt_layer; - dflt_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; - dflt_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + dflt_layer[SETTING_DENSITY_PROFILE_WIDTH] = width; // 0 -> the entire atmosphere + dflt_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = exponential_term; + dflt_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = exponential_scale_factor; + dflt_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = linear_term; + dflt_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = constant_term; if (aniso_factor != 0.0f) { @@ -670,7 +670,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; - dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; + dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00045f; dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); @@ -1160,7 +1160,7 @@ F32 LLSettingsSky::getSunArcRadians() const F32 LLSettingsSky::getMieAnisotropy() const { - return mSettings[SETTING_MIE_ANISOTROPY_FACTOR].asReal(); + return getMieConfig()[SETTING_MIE_ANISOTROPY_FACTOR].asReal(); } LLSD LLSettingsSky::getRayleighConfig() const @@ -1183,20 +1183,17 @@ LLSD LLSettingsSky::getAbsorptionConfig() const LLSD LLSettingsSky::getRayleighConfigs() const { - LLSD copy = *(mSettings[SETTING_RAYLEIGH_CONFIG].beginArray()); - return copy; + return mSettings[SETTING_RAYLEIGH_CONFIG]; } LLSD LLSettingsSky::getMieConfigs() const { - LLSD copy = *(mSettings[SETTING_MIE_CONFIG].beginArray()); - return copy; + return mSettings[SETTING_MIE_CONFIG]; } LLSD LLSettingsSky::getAbsorptionConfigs() const { - LLSD copy = *(mSettings[SETTING_ABSORPTION_CONFIG].beginArray()); - return copy; + return mSettings[SETTING_ABSORPTION_CONFIG]; } void LLSettingsSky::setRayleighConfigs(const LLSD& rayleighConfig) diff --git a/indra/llrender/llatmosphere.cpp b/indra/llrender/llatmosphere.cpp index aaa1ff65e1..12c6685354 100644 --- a/indra/llrender/llatmosphere.cpp +++ b/indra/llrender/llatmosphere.cpp @@ -232,26 +232,6 @@ LLAtmosphere::~LLAtmosphere() m_model = nullptr; } -#if DEBUG_ATMO_TEX_GEN -uint8_t* GetTexture2d(int width, int height, int components, GLuint texture) -{ - glActiveTextureARB(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, texture); - uint8_t* storage = (uint8_t*)malloc(width * height * components * sizeof(float)); - glGetTexImage(GL_TEXTURE_2D, 0, components == 3 ? GL_RGB : GL_RGBA, GL_FLOAT, storage); - return storage; -} - -uint8_t* GetTexture3d(int width, int height, int depth, int components, GLuint texture) -{ - glActiveTextureARB(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_3D, texture); - uint8_t* storage = (uint8_t*)malloc(width * height * depth * components * sizeof(float)); - glGetTexImage(GL_TEXTURE_3D, 0, components == 3 ? GL_RGB : GL_RGBA, GL_FLOAT, storage); - return storage; -} -#endif - bool LLAtmosphere::configureAtmosphericModel(AtmosphericModelSettings& settings) { if ((m_model != nullptr) && (settings == m_settings)) @@ -271,8 +251,6 @@ bool LLAtmosphere::configureAtmosphericModel(AtmosphericModelSettings& settings) getIlluminance()->setTexName(0); // Init libatmosphere model - m_config.num_scattering_orders = 4; - m_model = new atmosphere::Model( m_config, m_wavelengths, @@ -303,19 +281,7 @@ bool LLAtmosphere::configureAtmosphericModel(AtmosphericModelSettings& settings) getScattering()->setTexName(m_textures.scattering_texture); getMieScattering()->setTexName(m_textures.single_mie_scattering_texture); getIlluminance()->setTexName(m_textures.illuminance_texture); - -#if DEBUG_ATMO_TEX_GEN - // for debug only... - U8* transmittance = GetTexture2d(m_config.transmittanceTextureWidth, m_config.transmittanceTextureHeight, 3, m_textures.transmittance_texture); - U8* scattering = GetTexture3d(m_config.scatteringTextureWidth, m_config.scatteringTextureHeight, m_config.scatteringTextureDepth, 3, m_textures.scattering_texture); - U8* single_mie_scattering = GetTexture3d(m_config.scatteringTextureWidth, m_config.scatteringTextureHeight, m_config.scatteringTextureDepth, 3, m_textures.single_mie_scattering_texture); - U8* illuminance = GetTexture2d(m_config.illuminanceTextureWidth, m_config.illuminanceTextureHeight, 3, m_textures.illuminance_texture); - free(transmittance); - free(scattering); - free(single_mie_scattering); - free(illuminance); -#endif - + m_settings = settings; } return m_model != nullptr; diff --git a/indra/newview/app_settings/shaders/class3/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class3/deferred/skyV.glsl index 90217aed02..89873e83ca 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/skyV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/skyV.glsl @@ -36,8 +36,8 @@ VARYING vec2 vary_frag; void main() { - // pass through untransformed fullscreen pos (clipspace) - gl_Position = vec4(position.xyz, 1.0); + // pass through untransformed fullscreen pos at back of frustum for proper sky depth testing + gl_Position = vec4(position.xy, 0.99f, 1.0); vary_frag = texcoord0; } diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 3b3d67243a..41bf024942 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -505,22 +505,19 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass) if (gPipeline.canUseWindLightShaders()) { + if (gPipeline.useAdvancedAtmospherics()) + { + renderSkyHazeDeferred(origin, camHeightLocal); + renderHeavenlyBodies(); + } + else { // Disable depth-test for sky, but re-enable depth writes for the cloud // rendering below so the cloud shader can write out depth for the stars to test against LLGLDepthTest depth(GL_TRUE, GL_FALSE); - if (gPipeline.useAdvancedAtmospherics()) - { - renderSkyHazeDeferred(origin, camHeightLocal); - } - else - { - renderSkyHaze(origin, camHeightLocal); - - } - renderHeavenlyBodies(); + renderSkyHaze(origin, camHeightLocal); + renderHeavenlyBodies(); } - renderSkyClouds(origin, camHeightLocal); } gGL.setColorMask(true, true); diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index e437003520..4b60ed4e68 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -358,6 +358,7 @@ void LLEnvironment::getAtmosphericModelSettings(AtmosphericModelSettings& settin layer.width = layerConfig[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH].asReal(); settingsOut.m_mieProfile.push_back(layer); } + settingsOut.m_mieAnisotropy = psky->getMieAnisotropy(); LLSD absorption = psky->getAbsorptionConfigs(); settingsOut.m_absorptionProfile.clear(); @@ -1633,15 +1634,12 @@ void LLEnvironment::DayInstance::setSky(const LLSettingsSky::ptr_t &psky) mSky->update(); mBlenderSky.reset(); -#if 0 if (gAtmosphere) { AtmosphericModelSettings settings; LLEnvironment::getAtmosphericModelSettings(settings, psky); gAtmosphere->configureAtmosphericModel(settings); } -#endif - } void LLEnvironment::DayInstance::setWater(const LLSettingsWater::ptr_t &pwater) diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index a13efbc54b..1b41529795 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -662,15 +662,12 @@ void LLPanelSettingsSkyDensityTab::updateProfile() 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/skins/default/xui/en/panel_settings_sky_density.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_density.xml index 50663e94f6..e071b30c80 100644 --- a/indra/newview/skins/default/xui/en/panel_settings_sky_density.xml +++ b/indra/newview/skins/default/xui/en/panel_settings_sky_density.xml @@ -24,10 +24,10 @@ visible="true" height="14"> <slider - decimal_digits="2" + decimal_digits="6" follows="left|top" height="14" - increment="0.01" + increment="0.0000001" initial_value="0" layout="topleft" left_delta="5" @@ -40,38 +40,38 @@ label_width="160" can_edit_text="true"/> <slider - decimal_digits="2" + decimal_digits="6" follows="left|top" height="14" - increment="0.01" + increment="0.000001" initial_value="0" layout="topleft" - min_val="-1" - max_val="1" + min_val="-0.01" + max_val="0.01" name="rayleigh_exponential_scale" label="Rayleigh Exponential Scale:" width="400" label_width="160" can_edit_text="true"/> <slider - decimal_digits="2" + decimal_digits="6" follows="left|top" height="14" - increment="0.01" + increment="0.000001" initial_value="0" layout="topleft" min_val="0" - max_val="1" + max_val="0.00001" name="rayleigh_linear" label="Rayleigh Linear Term:" width="400" label_width="160" can_edit_text="true"/> <slider - decimal_digits="2" + decimal_digits="6" follows="left|top" height="14" - increment="0.01" + increment="0.0000001" initial_value="0" layout="topleft" min_val="0" @@ -82,10 +82,9 @@ label_width="160" can_edit_text="true"/> <slider - decimal_digits="2" + decimal_digits="1" follows="left|top" height="14" - increment="1" initial_value="0" layout="topleft" min_val="1000" @@ -104,10 +103,10 @@ visible="true" height="16"> <slider - decimal_digits="2" + decimal_digits="6" follows="left|top" height="14" - increment="0.01" + increment="0.0000001" initial_value="0" layout="topleft" left_delta="5" @@ -120,42 +119,42 @@ label_width="160" can_edit_text="true"/> <slider - decimal_digits="2" + decimal_digits="6" follows="left|top" height="14" - increment="0.01" + increment="0.0000001" initial_value="0" layout="topleft" - min_val="-1" - max_val="1" + min_val="-0.01" + max_val="0.01" name="mie_exponential_scale" label="Mie Exponential Scale:" width="400" label_width="160" can_edit_text="true"/> <slider - decimal_digits="2" + decimal_digits="6" follows="left|top" height="14" - increment="0.01" + increment="0.000001" initial_value="0" layout="topleft" min_val="0" - max_val="3.0" + max_val="0.000004" name="mie_linear" label="Mie Linear Term:" width="400" label_width="160" can_edit_text="true"/> <slider - decimal_digits="2" + decimal_digits="6" follows="left|top" height="14" - increment="0.01" + increment="0.0000001" initial_value="0" layout="topleft" min_val="0" - max_val="10" + max_val="1" name="mie_constant" label="Mie Constant Term:" width="400" @@ -176,10 +175,10 @@ label_width="160" can_edit_text="true"/> <slider - decimal_digits="2" + decimal_digits="1" follows="left|top" height="14" - increment="1" + increment="0.1" initial_value="0" layout="topleft" min_val="1000" @@ -198,10 +197,10 @@ visible="true" height="14"> <slider - decimal_digits="2" + decimal_digits="6" follows="left|top" height="14" - increment="0.01" + increment="0.0000001" initial_value="0" layout="topleft" left_delta="5" @@ -214,10 +213,10 @@ label_width="160" can_edit_text="true"/> <slider - decimal_digits="2" + decimal_digits="6" follows="left|top" height="14" - increment="0.01" + increment="0.0000001" initial_value="0" layout="topleft" min_val="-1" @@ -228,10 +227,10 @@ label_width="160" can_edit_text="true"/> <slider - decimal_digits="2" + decimal_digits="6" follows="left|top" height="14" - increment="0.01" + increment="0.0000001" initial_value="0" layout="topleft" min_val="0" @@ -242,10 +241,10 @@ label_width="160" can_edit_text="true"/> <slider - decimal_digits="2" + decimal_digits="6" follows="left|top" height="14" - increment="0.01" + increment="0.0000001" initial_value="0" layout="topleft" min_val="0" @@ -256,10 +255,10 @@ label_width="160" can_edit_text="true"/> <slider - decimal_digits="2" + decimal_digits="1" follows="left|top" height="14" - increment="1" + increment="0.1" initial_value="0" layout="topleft" min_val="1000" |