diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/moonF.glsl | 15 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/windlight/moonF.glsl | 18 | ||||
-rw-r--r-- | indra/newview/lldrawpoolwlsky.cpp | 22 | ||||
-rw-r--r-- | indra/newview/llpaneleditsky.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llpaneleditsky.h | 1 | ||||
-rw-r--r-- | indra/newview/llworld.cpp | 51 | ||||
-rw-r--r-- | indra/newview/llworld.h | 3 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 57 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml | 6 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml | 29 |
10 files changed, 177 insertions, 37 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl index e86bca3ddd..f65a6eb32b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl @@ -39,6 +39,7 @@ vec3 fullbrightScaleSoftClip(vec3 light); uniform vec4 color; uniform vec4 sunlight_color; uniform vec3 lumWeights; +uniform float moon_brightness; uniform float minLuminance; uniform sampler2D diffuseMap; uniform sampler2D altDiffuseMap; @@ -51,15 +52,23 @@ void main() vec4 moonB = texture2D(altDiffuseMap, vary_texcoord0.xy); vec4 c = mix(moonA, moonB, blend_factor); + if (c.a < 0.1f) + { + discard; + } + c.rgb = pow(c.rgb, vec3(0.7f)); c.rgb = fullbrightAtmosTransport(c.rgb); c.rgb = fullbrightScaleSoftClip(c.rgb); // mix factor which blends when sunlight is brighter // and shows true moon color at night - vec3 luma_weights = vec3(0.1, 0.3, 0.0); - float mix = 1.0f - dot(sunlight_color.rgb, luma_weights); - frag_data[0] = vec4(c.rgb, mix * c.a); + vec3 luma_weights = vec3(0.2, 0.3, 0.2); + float mix = 1.0f - dot(normalize(sunlight_color.rgb), luma_weights); + + c.rgb = pow(c.rgb, 1.2 - vec3(mix * moon_brightness)); + + frag_data[0] = vec4(c.rgb, mix * (moon_brightness + (c.a * 0.25))); frag_data[1] = vec4(0.0); frag_data[2] = vec4(0.0f); } diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl index 933625986c..8cc7fc3bb5 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl @@ -39,6 +39,7 @@ vec3 fullbrightScaleSoftClip(vec3 light); uniform vec4 color; uniform vec4 sunlight_color; uniform vec3 lumWeights; +uniform float moon_brightness; uniform float minLuminance; uniform sampler2D diffuseMap; uniform sampler2D altDiffuseMap; @@ -51,13 +52,22 @@ void main() vec4 moonB = texture2D(altDiffuseMap, vary_texcoord0.xy); vec4 c = mix(moonA, moonB, blend_factor); - c.rgb = pow(c.rgb, vec3(0.45f)); + if (c.a < 0.1f) + { + discard; + } + + c.rgb = pow(c.rgb, vec3(0.7f)); c.rgb = fullbrightAtmosTransport(c.rgb); c.rgb = fullbrightScaleSoftClip(c.rgb); + // mix factor which blends when sunlight is brighter // and shows true moon color at night - vec3 luma_weights = vec3(0.1, 0.3, 0.0); - float mix = 1.0f - dot(sunlight_color.rgb, luma_weights); - frag_color = vec4(c.rgb, mix * c.a); + vec3 luma_weights = vec3(0.2, 0.3, 0.2); + float mix = 1.0f - dot(normalize(sunlight_color.rgb), luma_weights); + + c.rgb = pow(c.rgb, 1.2 - vec3(mix * moon_brightness)); + + frag_color = vec4(c.rgb, mix * (moon_brightness + (c.a * 0.25))); } diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index d82cff516e..b89588a463 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -224,6 +224,22 @@ void LLDrawPoolWLSky::renderSkyHaze(const LLVector3& camPosLocal, F32 camHeightL LLGLDisable blend(GL_BLEND); sky_shader->bind(); + 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); + + 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); + /// Render the skydome renderDome(origin, camHeightLocal, sky_shader); @@ -484,6 +500,12 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() moon_shader->bindTexture(LLShaderMgr::ALTERNATE_DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); } + LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); + + F32 moon_brightness = (float)psky->getMoonBrightness(); + + moon_shader->uniform1f(LLShaderMgr::MOON_BRIGHTNESS, moon_brightness); + moon_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV); moon_shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor); diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index faba2b7ed1..0d8c9a988a 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -72,6 +72,7 @@ namespace const std::string FIELD_SKY_MOON_ROTATION("moon_rotation"); const std::string FIELD_SKY_MOON_IMAGE("moon_image"); const std::string FIELD_SKY_MOON_SCALE("moon_scale"); + const std::string FIELD_SKY_MOON_BRIGHTNESS("moon_brightness"); const std::string FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL("rayleigh_exponential"); const std::string FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL_SCALE("rayleigh_exponential_scale"); @@ -398,6 +399,7 @@ BOOL LLPanelSettingsSkySunMoonTab::postBuild() getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setAllowNoTexture(TRUE); getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setAllowLocalTexture(FALSE); getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonScaleChanged(); }); + getChild<LLUICtrl>(FIELD_SKY_MOON_BRIGHTNESS)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonBrightnessChanged(); }); refresh(); @@ -411,6 +413,9 @@ void LLPanelSettingsSkySunMoonTab::setEnabled(BOOL enabled) getChild<LLUICtrl>(FIELD_SKY_GLOW_FOCUS)->setEnabled(enabled); getChild<LLUICtrl>(FIELD_SKY_GLOW_SIZE)->setEnabled(enabled); getChild<LLUICtrl>(FIELD_SKY_STAR_BRIGHTNESS)->setEnabled(enabled); + getChild<LLUICtrl>(FIELD_SKY_SUN_SCALE)->setEnabled(enabled); + getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->setEnabled(enabled); + getChild<LLUICtrl>(FIELD_SKY_MOON_BRIGHTNESS)->setEnabled(enabled); } void LLPanelSettingsSkySunMoonTab::refresh() @@ -438,6 +443,7 @@ void LLPanelSettingsSkySunMoonTab::refresh() getChild<LLVirtualTrackball>(FIELD_SKY_MOON_ROTATION)->setRotation(mSkySettings->getMoonRotation()); getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setValue(mSkySettings->getMoonTextureId()); getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->setValue(mSkySettings->getMoonScale()); + getChild<LLUICtrl>(FIELD_SKY_MOON_BRIGHTNESS)->setValue(mSkySettings->getMoonBrightness()); } //------------------------------------------------------------------------- @@ -513,6 +519,12 @@ void LLPanelSettingsSkySunMoonTab::onMoonScaleChanged() setIsDirty(); } +void LLPanelSettingsSkySunMoonTab::onMoonBrightnessChanged() +{ + mSkySettings->setMoonBrightness((getChild<LLUICtrl>(FIELD_SKY_MOON_BRIGHTNESS)->getValue().asReal())); + mSkySettings->update(); + setIsDirty(); +} LLPanelSettingsSkyDensityTab::LLPanelSettingsSkyDensityTab() { diff --git a/indra/newview/llpaneleditsky.h b/indra/newview/llpaneleditsky.h index e9d956de74..829a65dae5 100644 --- a/indra/newview/llpaneleditsky.h +++ b/indra/newview/llpaneleditsky.h @@ -123,6 +123,7 @@ private: void onSunImageChanged(); void onMoonRotationChanged(); void onMoonScaleChanged(); + void onMoonBrightnessChanged(); void onMoonImageChanged(); }; diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index cee47a591e..a519b5a957 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -873,6 +873,57 @@ void LLWorld::waterHeightRegionInfo(std::string const& sim_name, F32 water_heigh } } +void LLWorld::precullWaterObjects(LLCamera& camera, LLCullResult* cull, bool include_void_water) +{ + if (!gAgent.getRegion()) + { + return; + } + + if (mRegionList.empty()) + { + LL_WARNS() << "No regions!" << LL_ENDL; + return; + } + + for (region_list_t::iterator iter = mRegionList.begin(); + iter != mRegionList.end(); ++iter) + { + LLViewerRegion* regionp = *iter; + LLVOWater* waterp = regionp->getLand().getWaterObj(); + if (waterp && waterp->mDrawable) + { + waterp->mDrawable->setVisible(camera); + cull->pushDrawable(waterp->mDrawable); + } + } + + if (include_void_water) + { + for (std::list<LLVOWater*>::iterator iter = mHoleWaterObjects.begin(); + iter != mHoleWaterObjects.end(); ++ iter) + { + LLVOWater* waterp = *iter; + if (waterp && waterp->mDrawable) + { + waterp->mDrawable->setVisible(camera); + cull->pushDrawable(waterp->mDrawable); + } + } + } + + S32 dir; + for (dir = 0; dir < 8; dir++) + { + LLVOWater* waterp = mEdgeWaterObjects[dir]; + if (waterp && waterp->mDrawable) + { + waterp->mDrawable->setVisible(camera); + cull->pushDrawable(waterp->mDrawable); + } + } +} + void LLWorld::updateWaterObjects() { if (!gAgent.getRegion()) diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index c9ac241d5a..9722448746 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -138,6 +138,9 @@ public: LLViewerTexture *getDefaultWaterTexture(); void updateWaterObjects(); + + void precullWaterObjects(LLCamera& camera, LLCullResult* cull, bool include_void_water); + void waterHeightRegionInfo(std::string const& sim_name, F32 water_height); void shiftRegions(const LLVector3& offset); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index a513588568..c1b7fdc780 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -88,6 +88,7 @@ #include "llvocache.h" #include "llvoground.h" #include "llvosky.h" +#include "llvowlsky.h" #include "llvotree.h" #include "llvovolume.h" #include "llvosurfacepatch.h" @@ -2415,21 +2416,14 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl { LLVector3 pnorm; F32 height = region->getWaterHeight(); - if (water_clip < 0) - { //camera is above water, clip plane points up - pnorm.setVec(0,0,1); - plane.setVec(pnorm, -height); - } - else if (water_clip > 0) - { //camera is below water, clip plane points down - pnorm = LLVector3(0,0,-1); - plane.setVec(pnorm, height); - } + pnorm.setVec(0,0,-(F32)water_clip); + plane.setVec(pnorm, height * pnorm.mV[VZ]); } } glh::matrix4f modelview = get_last_modelview(); - glh::matrix4f proj = get_last_projection(); + glh::matrix4f proj = get_last_projection(); + LLGLUserClipPlane clip(plane, modelview, proj, water_clip != 0 && LLPipeline::sReflectionRender); LLGLDepthTest depth(GL_TRUE, GL_FALSE); @@ -2455,9 +2449,9 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { LLViewerRegion* region = *iter; - if (water_clip != 0) + if (water_clip != 0 && LLPipeline::sReflectionRender) { - LLPlane plane(LLVector3(0,0, (F32) -water_clip), (F32) water_clip*region->getWaterHeight()); + LLPlane plane(LLVector3(0,0, -(F32)water_clip), water_clip * region->getWaterHeight()); camera.setUserClipPlane(plane); } else @@ -2513,7 +2507,20 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl sCull->pushDrawable(gSky.mVOGroundp->mDrawable); } + if (hasRenderType(LLPipeline::RENDER_TYPE_WL_SKY) && + gPipeline.canUseWindLightShaders() && + gSky.mVOWLSkyp.notNull() && + gSky.mVOWLSkyp->mDrawable.notNull()) + { + gSky.mVOWLSkyp->mDrawable->setVisible(camera); + sCull->pushDrawable(gSky.mVOWLSkyp->mDrawable); + } + if (hasRenderType(LLPipeline::RENDER_TYPE_WATER)) + { + LLWorld::getInstance()->precullWaterObjects(camera, sCull, hasRenderType(LLPipeline::RENDER_TYPE_VOIDWATER)); + } + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.popMatrix(); gGL.matrixMode(LLRender::MM_MODELVIEW); @@ -9823,21 +9830,23 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) F32 plane_d; S32 water_clip = 0; - if (!LLViewerCamera::getInstance()->cameraUnderWater()) - { //camera is above water, clip plane points up - pnorm.setVec(0,0,1); - plane_d = -water_height; - plane.setVec(pnorm, -distance_to_water); - water_clip = -1; + + if (LLViewerCamera::getInstance()->cameraUnderWater()) + { + //camera is below water, clip plane points down + water_clip = 1; } else - { //camera is below water, clip plane points down - pnorm = LLVector3(0,0,-1); - plane_d = water_height; - plane.setVec(pnorm, distance_to_water); - water_clip = 1; + { + //camera is above water, clip plane points up + water_clip = -1; } + //camera is below water, clip plane points down + pnorm = LLVector3(0,0,-(F32)water_clip); + plane_d = water_height * pnorm.mV[VZ]; + plane.setVec(pnorm, distance_to_water * pnorm.mV[VZ]); + bool materials_in_water = false; #if MATERIALS_IN_REFLECTIONS diff --git a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml index e1c08a24f2..9aa7c6f499 100644 --- a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml +++ b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml @@ -6,9 +6,9 @@ save_rect="false" title="Edit Day Cycle" width="705" - height="650" + height="700" min_width="705" - min_height="650" + min_height="700" single_instance="true" can_resize="false"> @@ -25,7 +25,7 @@ <!-- Layout --> <layout_stack name="outer_stack" width="705" - height="650" + height="700" follows="all" animate="false" top="0" diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml index 6d12f6bb94..1332ecd965 100644 --- a/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml +++ b/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml @@ -14,14 +14,14 @@ top="5" right="-5" bottom="-5" - orientation="hoizontal"> + orientation="horizontal"> <layout_panel border="true" bevel_style="in" auto_resize="true" user_resize="false" visible="true" - height="350"> + height="400"> <text follows="left|top" height="10" @@ -176,6 +176,29 @@ top_delta="15" width="250" can_edit_text="true"/> + <text + follows="left|top" + height="10" + layout="topleft" + left_delta="-5" + top_delta="22" + width="200"> + Moon Brightness: + </text> + <slider + decimal_digits="2" + follows="left|top" + height="16" + increment="0.01" + initial_value="0" + layout="topleft" + left_delta="5" + min_val="0.0" + max_val="1.0" + name="moon_brightness" + top_delta="15" + width="250" + can_edit_text="true"/> </layout_panel> <layout_panel border="false" @@ -183,7 +206,7 @@ auto_resize="true" user_resize="false" visible="true" - height="350"> + height="400"> <layout_stack left="5" top="5" |