diff options
author | Rider Linden <rider@lindenlab.com> | 2019-01-30 14:37:24 -0800 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2019-01-30 14:37:24 -0800 |
commit | afe5578315fa379b2078b2309bcace0a0b6f3798 (patch) | |
tree | 3cd3072813e7230ca992d89af9960844ccd78a86 /indra/newview | |
parent | c7e02b0835cbb50777c677f618c4a957e69fabee (diff) | |
parent | 16b47db736fed0995eaeeed77ba4dd0d310f1072 (diff) |
Merge
Diffstat (limited to 'indra/newview')
56 files changed, 840 insertions, 597 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 967ba2d8d9..9d4b58d216 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -605,6 +605,7 @@ set(viewer_SOURCE_FILES lltoolselectland.cpp lltoolselectrect.cpp lltracker.cpp + lltrackpicker.cpp lltransientdockablefloater.cpp lltransientfloatermgr.cpp lltranslate.cpp @@ -1219,6 +1220,7 @@ set(viewer_HEADER_FILES lltoolselectland.h lltoolselectrect.h lltracker.h + lltrackpicker.h lltransientdockablefloater.h lltransientfloatermgr.h lltranslate.h diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 132364882b..f1b7a1312f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -71,7 +71,6 @@ vec4 applyWaterFogView(vec3 pos, vec4 color); #endif vec2 encode_normal (vec3 n); -vec3 decode_normal (vec2 enc); vec3 scaleSoftClip(vec3 l); vec3 atmosFragAmbient(vec3 light, vec3 sunlit); vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten); @@ -170,7 +169,6 @@ void main() calcFragAtmospherics(pos.xyz, 1.0, sunlit, amblit, additive, atten); vec2 abnormal = encode_normal(norm.xyz); - norm.xyz = decode_normal(abnormal.xy); float sun_da = dot(norm.xyz, sun_dir.xyz); float moon_da = dot(norm.xyz, moon_dir.xyz); diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index 812f375f42..596d0274af 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl @@ -46,7 +46,6 @@ VARYING vec2 vary_fragcoord; vec4 getPosition(vec2 pos_screen); vec3 getNorm(vec2 pos_screen); -vec3 decode_normal (vec2 enc); void main() { diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl index fe336fc3a8..baf54c1fbe 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl @@ -132,7 +132,7 @@ void main() temp2.x = pow(temp2.x, glow.z); // glow.z should be negative, so we're doing a sort of (1 / "angle") function - temp2.x *= sun_up_factor; + //temp2.x *= sun_up_factor; // Add "minimum anti-solar illumination" temp2.x += .25; diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index 9d7a7f6556..e27bbce094 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl @@ -29,8 +29,6 @@ uniform sampler2DRect depthMap; uniform mat4 inv_proj; uniform vec2 screen_res; -vec3 decode_normal(vec2 enc); - vec2 getScreenCoordinate(vec2 screenpos) { vec2 sc = screenpos.xy * 2.0; @@ -43,8 +41,14 @@ vec2 getScreenCoordinate(vec2 screenpos) vec3 getNorm(vec2 screenpos) { - vec2 enc_norm = texture2DRect(normalMap, screenpos.xy).xy; - return decode_normal(enc_norm); + vec2 enc = texture2DRect(normalMap, screenpos.xy).xy; + vec2 fenc = enc*4-2; + float f = dot(fenc,fenc); + float g = sqrt(1-f/4); + vec3 n; + n.xy = fenc*g; + n.z = 1-f/2; + return n; } float getDepth(vec2 pos_screen) diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 0f7c514e94..09bb6c5bb8 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -183,7 +183,6 @@ VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; vec2 encode_normal(vec3 n); -vec3 decode_normal (vec2 enc); void main() { @@ -227,7 +226,6 @@ void main() norm.xyz = normalize(norm.xyz); vec2 abnormal = encode_normal(norm.xyz); - norm.xyz = decode_normal(abnormal.xy); vec4 final_color = diffcol; diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl index 0a68fc82f7..e1bac4f248 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl @@ -37,10 +37,11 @@ void calcAtmospherics(vec3 eye_pos); void main() { //transform vertex - vec4 vert = vec4(position.xyz, 1.0); + vec3 offset = vec3(0, 0, 50); + vec4 vert = vec4(position.xyz - offset, 1.0); vec4 pos = (modelview_matrix * vert); - gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); + gl_Position = modelview_projection_matrix*vert; calcAtmospherics(pos.xyz); diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index e8eef9b94b..29298d7c07 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -36,7 +36,6 @@ out vec4 frag_color; uniform sampler2DRect depthMap; uniform sampler2DRect diffuseRect; uniform sampler2DRect specularRect; -uniform sampler2DRect normalMap; uniform samplerCube environmentMap; uniform sampler2D noiseMap; uniform sampler2D lightFunc; @@ -57,9 +56,8 @@ uniform float far_z; uniform mat4 inv_proj; -vec3 decode_normal (vec2 enc); - vec4 getPosition(vec2 pos_screen); +vec3 getNorm(vec2 pos_screen); void main() { @@ -70,9 +68,8 @@ void main() discard; } - vec3 norm = texture2DRect(normalMap, frag.xy).xyz; - norm = decode_normal(norm.xy); // unpack norm - norm = normalize(norm); + vec3 norm = getNorm(frag.xy); + vec4 spec = texture2DRect(specularRect, frag.xy); vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb; diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index 7438fac8fc..24804c3011 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -71,8 +71,7 @@ VARYING vec4 vary_fragcoord; uniform vec2 screen_res; uniform mat4 inv_proj; - -vec3 decode_normal (vec2 enc); +vec3 getNorm(vec2 pos_screen); vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { @@ -141,12 +140,9 @@ void main() discard; } - vec3 norm = texture2DRect(normalMap, frag.xy).xyz; - float envIntensity = norm.z; + float envIntensity = texture2DRect(normalMap. frag.xy).z; + vec3 norm = getNorm(frag.xy); - norm = decode_normal(norm.xy); - - norm = normalize(norm); float l_dist = -dot(lv, proj_n); vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index df48a66fab..f8264d971c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -56,76 +56,75 @@ uniform vec2 screen_res; uniform mat4 inv_proj; uniform vec4 viewport; -vec3 decode_normal (vec2 enc); +vec3 getNorm(vec2 pos_screen); vec4 getPosition(vec2 pos_screen); void main() { - vec4 frag = vary_fragcoord; - frag.xyz /= frag.w; - frag.xyz = frag.xyz*0.5+0.5; - frag.xy *= screen_res; - - vec3 pos = getPosition(frag.xy).xyz; - vec3 lv = trans_center.xyz-pos; - float dist = length(lv); - dist /= size; - if (dist > 1.0) - { - discard; - } - - vec3 norm = texture2DRect(normalMap, frag.xy).xyz; - norm = decode_normal(norm.xy); // unpack norm - float da = dot(norm, lv); - if (da < 0.0) - { - discard; - } - - norm = normalize(norm); - lv = normalize(lv); - da = dot(norm, lv); - - float noise = texture2D(noiseMap, frag.xy/128.0).b; - - vec3 col = texture2DRect(diffuseRect, frag.xy).rgb; - float fa = falloff+1.0; - float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); - dist_atten *= dist_atten; - dist_atten *= 2.0; - - float lit = da * dist_atten * noise; + vec4 frag = vary_fragcoord; + frag.xyz /= frag.w; + frag.xyz = frag.xyz*0.5+0.5; + frag.xy *= screen_res; + + vec3 pos = getPosition(frag.xy).xyz; + vec3 lv = trans_center.xyz-pos; + float dist = length(lv); + dist /= size; + if (dist > 1.0) + { + discard; + } + + vec3 norm = getNorm(frag.xy); - col = color.rgb*lit*col; + float da = dot(norm, lv); + if (da < 0.0) + { + discard; + } + + lv = normalize(lv); + da = dot(norm, lv); + + float noise = texture2D(noiseMap, frag.xy/128.0).b; + + vec3 col = texture2DRect(diffuseRect, frag.xy).rgb; + float fa = falloff+1.0; + float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); + dist_atten *= dist_atten; + dist_atten *= 2.0; + + float lit = da * dist_atten * noise; - vec4 spec = texture2DRect(specularRect, frag.xy); - if (spec.a > 0.0) - { - lit = min(da*6.0, 1.0) * dist_atten; + col = color.rgb*lit*col; - vec3 npos = -normalize(pos); - vec3 h = normalize(lv+npos); - float nh = dot(norm, h); - float nv = dot(norm, npos); - float vh = dot(npos, h); - float sa = nh; - float fres = pow(1 - dot(h, npos), 5) * 0.4+0.5; - float gtdenom = 2 * nh; - float gt = max(0,(min(gtdenom * nv / vh, gtdenom * da / vh))); + vec4 spec = texture2DRect(specularRect, frag.xy); + if (spec.a > 0.0) + { + lit = min(da*6.0, 1.0) * dist_atten; - if (nh > 0.0) - { - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); - col += lit*scol*color.rgb*spec.rgb; - } - } - - if (dot(col, col) <= 0.0) - { - discard; - } - - frag_color.rgb = col; - frag_color.a = 0.0; + vec3 npos = -normalize(pos); + vec3 h = normalize(lv+npos); + float nh = dot(norm, h); + float nv = dot(norm, npos); + float vh = dot(npos, h); + float sa = nh; + float fres = pow(1 - dot(h, npos), 5) * 0.4+0.5; + float gtdenom = 2 * nh; + float gt = max(0,(min(gtdenom * nv / vh, gtdenom * da / vh))); + + if (nh > 0.0) + { + float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); + col += lit*scol*color.rgb*spec.rgb; + } + } + + if (dot(col, col) <= 0.0) + { + discard; + } + + frag_color.rgb = col; + frag_color.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl index 70568bc75f..cef9938192 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl @@ -48,44 +48,29 @@ uniform float shadow_bias; uniform float spot_shadow_bias; uniform float spot_shadow_offset; - +uniform float sun_up_factor; uniform mat4 inv_proj; uniform vec2 screen_res; vec3 decode_normal(vec2 enc); -float pcfShadowLegacy(sampler2DShadow shadowMap, vec4 stc) -{ - stc.xyz /= stc.w; - stc.z += shadow_bias; - - stc.x = floor(stc.x*shadow_res.x + fract(stc.y*shadow_res.y*12345))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here - - float cs = shadow2D(shadowMap, stc.xyz).x; - float shadow = cs; - - shadow += shadow2D(shadowMap, stc.xyz+vec3(2.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x; - shadow += shadow2D(shadowMap, stc.xyz+vec3(1.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x; - shadow += shadow2D(shadowMap, stc.xyz+vec3(-1.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x; - shadow += shadow2D(shadowMap, stc.xyz+vec3(-2.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x; - - return shadow*0.2; -} - -float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float bias_scale, vec2 pos_screen) +float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float bias_mul, vec2 pos_screen, vec3 light_dir) { stc.xyz /= stc.w; - stc.z += shadow_bias * bias_scale; - - stc.x = floor(stc.x*pos_screen.x + fract(stc.y*pos_screen.y*0.666666666))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here + float offset = max(0.75, light_dir.z); + stc.z += offset * shadow_bias * 3.33 * bias_mul; + + stc.x = floor(stc.x*shadow_res.x + fract(stc.y*pos_screen.y*3.14159))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here float cs = shadow2D(shadowMap, stc.xyz).x; - float shadow = cs; + float shadow = cs * 4.0; + shadow += shadow2D(shadowMap, stc.xyz+vec3(2.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x; shadow += shadow2D(shadowMap, stc.xyz+vec3(1.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x; shadow += shadow2D(shadowMap, stc.xyz+vec3(-1.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x; shadow += shadow2D(shadowMap, stc.xyz+vec3(-2.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x; - return shadow*0.2; + + return shadow*0.125; } float pcfSpotShadow(sampler2DShadow shadowMap, vec4 stc, float bias_scale, vec2 pos_screen) @@ -141,7 +126,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen) float w = 1.0; w -= max(spos.z-far_split.z, 0.0)/transition_domain.z; - shadow += pcfShadowLegacy(shadowMap3, lpos)*w; + shadow += pcfShadow(shadowMap3, lpos, 1.0, pos_screen, light_dir)*w; weight += w; shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0); } @@ -153,7 +138,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen) float w = 1.0; w -= max(spos.z-far_split.y, 0.0)/transition_domain.y; w -= max(near_split.z-spos.z, 0.0)/transition_domain.z; - shadow += pcfShadowLegacy(shadowMap2, lpos)*w; + shadow += pcfShadow(shadowMap2, lpos, 1.0, pos_screen, light_dir)*w; weight += w; } @@ -164,7 +149,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen) float w = 1.0; w -= max(spos.z-far_split.x, 0.0)/transition_domain.x; w -= max(near_split.y-spos.z, 0.0)/transition_domain.y; - shadow += pcfShadowLegacy(shadowMap1, lpos)*w; + shadow += pcfShadow(shadowMap1, lpos, 1.0, pos_screen, light_dir)*w; weight += w; } @@ -175,14 +160,15 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen) float w = 1.0; w -= max(near_split.x-spos.z, 0.0)/transition_domain.x; - shadow += pcfShadowLegacy(shadowMap0, lpos)*w; + shadow += pcfShadow(shadowMap0, lpos, 1.0, pos_screen, light_dir)*w; weight += w; } shadow /= weight; } - return min(dp_directional_light, shadow); + shadow = min(dp_directional_light, shadow); + return shadow; } float sampleSpotShadow(vec3 pos, vec3 norm, int index, vec2 pos_screen) @@ -201,11 +187,19 @@ float sampleSpotShadow(vec3 pos, vec3 norm, int index, vec2 pos_screen) float weight = 0.0; { - lpos = shadow_matrix[4 + index]*spos; float w = 1.0; w -= max(spos.z-far_split.z, 0.0)/transition_domain.z; - - shadow += pcfSpotShadow((index == 0) ? shadowMap4 : shadowMap5, lpos, 0.8, spos.xy)*w; + + if (index == 0) + { + lpos = shadow_matrix[4]*spos; + shadow += pcfSpotShadow(shadowMap4, lpos, 0.8, spos.xy)*w; + } + else + { + lpos = shadow_matrix[5]*spos; + shadow += pcfSpotShadow(shadowMap5, lpos, 0.8, spos.xy)*w; + } weight += w; shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index f0b038cc93..9e0079e0e9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -66,7 +66,7 @@ uniform vec2 screen_res; vec4 applyWaterFogView(vec3 pos, vec4 color); #endif -vec3 decode_normal (vec2 enc); +vec3 getNorm(vec2 pos_screen); vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); vec3 fullbrightAtmosTransportFrag(vec3 l, vec3 additive, vec3 atten); void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten); @@ -78,14 +78,14 @@ vec4 getPositionWithDepth(vec2 pos_screen, float depth); void main() { - vec2 tc = vary_fragcoord.xy; - float depth = texture2DRect(depthMap, tc.xy).r; - vec4 pos = getPositionWithDepth(tc, depth); - vec4 norm = texture2DRect(normalMap, tc); - float envIntensity = norm.z; - norm.xyz = decode_normal(norm.xy); // unpack norm - - float da_sun = dot(norm.xyz, normalize(sun_dir.xyz)); + vec2 tc = vary_fragcoord.xy; + float depth = texture2DRect(depthMap, tc.xy).r; + vec4 pos = getPositionWithDepth(tc, depth); + vec4 norm = texture2DRect(normalMap, tc); + float envIntensity = norm.z; + norm.xyz = getNorm(tc); + + float da_sun = dot(norm.xyz, normalize(sun_dir.xyz)); float da_moon = dot(norm.xyz, normalize(moon_dir.xyz)); float da = max(da_sun, da_moon); diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index 22488944cd..d09bc25334 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -70,7 +70,7 @@ uniform vec2 screen_res; uniform mat4 inv_proj; -vec3 decode_normal (vec2 enc); +vec3 getNorm(vec2 pos_screen); vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { @@ -142,7 +142,7 @@ void main() vec3 norm = texture2DRect(normalMap, frag.xy).xyz; float envIntensity = norm.z; - norm = decode_normal(norm.xy); + norm = getNorm(frag.xy); norm = normalize(norm); float l_dist = -dot(lv, proj_n); diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl index 3557c0766e..c66f3f62b2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl @@ -40,17 +40,21 @@ uniform sampler2D diffuseMap; uniform sampler2D altDiffuseMap; uniform float blend_factor; // interp factor between sunDisc A/B VARYING vec2 vary_texcoord0; +VARYING float sun_fade; void main() { - vec4 sunDiscA = texture2D(diffuseMap, vary_texcoord0.xy); - vec4 sunDiscB = texture2D(altDiffuseMap, vary_texcoord0.xy); + vec4 sunDiscA = texture2D(diffuseMap, vary_texcoord0.xy); + vec4 sunDiscB = texture2D(altDiffuseMap, vary_texcoord0.xy); vec4 c = mix(sunDiscA, sunDiscB, blend_factor); c.rgb = clamp(c.rgb, vec3(0), vec3(1)); - c.rgb = pow(c.rgb, vec3(0.7f)); - c.rgb = fullbrightAtmosTransport(c.rgb); + c.rgb = pow(c.rgb, vec3(0.7f)); + c.rgb = fullbrightAtmosTransport(c.rgb); c.rgb = fullbrightScaleSoftClip(c.rgb); - frag_data[0] = c; + + c.a *= sun_fade; + + frag_data[0] = c; frag_data[1] = vec4(0.0f); frag_data[2] = vec4(0.0, 1.0, 0.0, 1.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl index c67ed8e6d9..0d117c6bc7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl @@ -31,18 +31,22 @@ ATTRIBUTE vec3 position; ATTRIBUTE vec2 texcoord0; VARYING vec2 vary_texcoord0; +VARYING float sun_fade; void calcAtmospherics(vec3 eye_pos); void main() { - //transform vertex - vec4 vert = vec4(position.xyz - vec3(0, 0, 50), 1.0); - vec4 pos = modelview_projection_matrix*vert; + //transform vertex + vec3 offset = vec3(0, 0, 50); + vec4 vert = vec4(position.xyz - offset, 1.0); + vec4 pos = modelview_projection_matrix*vert; - gl_Position = pos; - + sun_fade = smoothstep(0.3, 1.0, (position.z + 50) / 512.0f); + + gl_Position = pos; + calcAtmospherics(pos.xyz); - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl index e98ab1f2eb..15f141cbe5 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl @@ -40,7 +40,7 @@ uniform sampler2DRect normalMap; // Inputs VARYING vec2 vary_fragcoord; -vec3 decode_normal (vec2 enc); +vec3 getNorm(vec2 pos_screen); vec4 getPosition(vec2 pos_screen); //calculate decreases in ambient lighting when crowded out (SSAO) @@ -53,7 +53,7 @@ void main() //try doing an unproject here vec4 pos = getPosition(pos_screen); - vec3 norm = decode_normal(texture2DRect(normalMap, pos_screen).xy); + vec3 norm = getNorm(pos_screen); frag_color[0] = 1.0; frag_color[1] = calcAmbientOcclusion(pos, norm, pos_screen); diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonV.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonV.glsl index aaa6768ed7..1c43a7332e 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/moonV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/moonV.glsl @@ -36,13 +36,14 @@ VARYING vec2 vary_texcoord0; void main() { - //transform vertex - vec4 vert = vec4(position.xyz, 1.0); - vec4 pos = (modelview_matrix * vert); + //transform vertex + vec3 offset = vec3(0, 0, 50); + vec4 vert = vec4(position.xyz - offset, 1.0); + vec4 pos = (modelview_matrix * vert); - gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); - - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - - calcAtmospherics(pos.xyz); + gl_Position = modelview_projection_matrix*vert; + + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + + calcAtmospherics(pos.xyz); } diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl index 3f2375ee4d..668379164d 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl @@ -40,15 +40,18 @@ uniform sampler2D diffuseMap; uniform sampler2D altDiffuseMap; uniform float blend_factor; // interp factor between sun A/B VARYING vec2 vary_texcoord0; +VARYING float sun_fade; void main() { - vec4 sunA = texture2D(diffuseMap, vary_texcoord0.xy); - vec4 sunB = texture2D(altDiffuseMap, vary_texcoord0.xy); + vec4 sunA = texture2D(diffuseMap, vary_texcoord0.xy); + vec4 sunB = texture2D(altDiffuseMap, vary_texcoord0.xy); vec4 c = mix(sunA, sunB, blend_factor); + c.a *= sun_fade; + c.rgb = pow(c.rgb, vec3(0.7f)); - c.rgb = fullbrightAtmosTransport(c.rgb); + c.rgb = fullbrightAtmosTransport(c.rgb); c.rgb = fullbrightScaleSoftClip(c.rgb); - frag_color = c; + frag_color = c; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscV.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscV.glsl index dd33a4be60..ca116628f1 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/sunDiscV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/sunDiscV.glsl @@ -31,18 +31,21 @@ ATTRIBUTE vec3 position; ATTRIBUTE vec2 texcoord0; VARYING vec2 vary_texcoord0; +VARYING float sun_fade; void calcAtmospherics(vec3 eye_pos); void main() { - //transform vertex - vec4 vert = vec4(position.xyz - vec3(0, 0, 50), 1.0); - vec4 pos = modelview_projection_matrix*vert; + //transform vertex + vec3 offset = vec3(0, 0, 50); + vec4 vert = vec4(position.xyz - offset, 1.0); + vec4 pos = modelview_projection_matrix*vert; - gl_Position = pos; - + sun_fade = smoothstep(0.3, 1.0, (position.z + 50) / 512.0f); + gl_Position = pos; + calcAtmospherics(pos.xyz); - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; } diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 1c5d3901f5..142b03e095 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -71,7 +71,7 @@ uniform vec2 screen_res; uniform mat4 inv_proj; -vec3 decode_normal (vec2 enc); +vec3 getNorm(vec2 pos_screen); vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { @@ -155,7 +155,7 @@ void main() float envIntensity = norm.z; - norm = decode_normal(norm.xy); + norm = getNorm(frag.xy); norm = normalize(norm); float l_dist = -dot(lv, proj_n); diff --git a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl index 6ddd7e7c86..792aa4e85c 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl @@ -153,7 +153,7 @@ void main() // Add "minimum anti-solar illumination" temp2.x += .25; - temp2.x *= sun_up_factor; + //temp2.x *= sun_up_factor; // Haze color above cloud vec4 color = ( blue_horizon * blue_weight * (sunlight + ambient) diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index c80e7fce18..4fd3e73336 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -62,7 +62,7 @@ VARYING vec2 vary_fragcoord; uniform mat4 inv_proj; uniform vec2 screen_res; -vec3 decode_normal (vec2 enc); +vec3 getNorm(vec2 pos_screen); void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten); vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); @@ -82,22 +82,22 @@ vec4 applyWaterFogView(vec3 pos, vec4 color); void main() { - vec2 tc = vary_fragcoord.xy; - float depth = texture2DRect(depthMap, tc.xy).r; - vec4 pos = getPositionWithDepth(tc, depth); - vec4 norm = texture2DRect(normalMap, tc); - float envIntensity = norm.z; - norm.xyz = decode_normal(norm.xy); // unpack norm - - float da_sun = dot(norm.xyz, normalize(sun_dir.xyz)); + vec2 tc = vary_fragcoord.xy; + float depth = texture2DRect(depthMap, tc.xy).r; + vec4 pos = getPositionWithDepth(tc, depth); + vec4 norm = texture2DRect(normalMap, tc); + float envIntensity = norm.z; + norm.xyz = getNorm(tc); // unpack norm + + float da_sun = dot(norm.xyz, normalize(sun_dir.xyz)); float da_moon = dot(norm.xyz, normalize(moon_dir.xyz)); float da = max(da_sun, da_moon); da = clamp(da, 0.0, 1.0); - da = pow(da, global_gamma + 0.3); + da = pow(da, global_gamma + 0.3); - vec4 diffuse = texture2DRect(diffuseRect, tc); - + vec4 diffuse = texture2DRect(diffuseRect, tc); + vec3 col; float bloom = 0.0; { diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 36854b0e66..9b69d8d855 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -71,7 +71,7 @@ uniform vec2 screen_res; uniform mat4 inv_proj; -vec3 decode_normal (vec2 enc); +vec3 getNorm(vec2 pos_screen); vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { @@ -153,7 +153,7 @@ void main() vec3 norm = texture2DRect(normalMap, frag.xy).xyz; float envIntensity = norm.z; - norm = decode_normal(norm.xy); + norm = getNorm(frag.xy); norm = normalize(norm); float l_dist = -dot(lv, proj_n); diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index fc5756beef..8abdeae5ae 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -42,7 +42,6 @@ uniform vec3 sun_dir; uniform float shadow_bias; vec3 getNorm(vec2 pos_screen); -vec3 decode_normal (vec2 enc); vec4 getPosition(vec2 pos_screen); float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl index 390f9fc947..64d99bae2c 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl @@ -37,7 +37,6 @@ out vec4 frag_color; // Inputs VARYING vec2 vary_fragcoord; -vec3 decode_normal (vec2 enc); vec4 getPosition(vec2 pos_screen); vec3 getNorm(vec2 pos_screen); diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl index 5cf3cd1dd2..8d1e5e3281 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl @@ -119,7 +119,7 @@ void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, //add "minimum anti-solar illumination" temp2.x += .25; - temp2.x *= sun_up_factor; + //temp2.x *= sun_up_factor; //increase ambient when there are more clouds vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow * 0.5; diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl index 8c1a7c6281..5ccf786fce 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl @@ -62,8 +62,8 @@ void calcAtmospherics(vec3 inPositionEye) { setPositionEye(P); //(TERRAIN) limit altitude - if (P.y > max_y) P *= (max_y / P.y); - if (P.y < -max_y) P *= (-max_y / P.y); + //if (P.y > max_y) P *= (max_y / P.y); + //if (P.y < -max_y) P *= (-max_y / P.y); vec3 tmpLightnorm = lightnorm.xyz; diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl index 644cd5a35b..a250cf2c45 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl @@ -131,7 +131,7 @@ void main() temp2.x = pow(temp2.x, glow.z); // glow.z should be negative, so we're doing a sort of (1 / "angle") function - temp2.x *= sun_up_factor; + //temp2.x *= sun_up_factor; // Add "minimum anti-solar illumination" temp2.x += .25; diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl index 04cf4052b8..f509f9f8d4 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl @@ -119,7 +119,7 @@ void main() temp2.x = pow(temp2.x, glow.z); // glow.z should be negative, so we're doing a sort of (1 / "angle") function - temp2.x *= sun_up_factor; + //temp2.x *= sun_up_factor; // Add "minimum anti-solar illumination" temp2.x += .25; diff --git a/indra/newview/app_settings/shaders/class3/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class3/deferred/deferredUtil.glsl index cccd01e0d7..e27bbce094 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/deferredUtil.glsl @@ -1,5 +1,5 @@ /** - * @file class3/deferred/deferredUtil.glsl + * @file class1/deferred/deferredUtil.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code @@ -29,8 +29,6 @@ uniform sampler2DRect depthMap; uniform mat4 inv_proj; uniform vec2 screen_res; -vec3 decode_normal(vec2 enc); - vec2 getScreenCoordinate(vec2 screenpos) { vec2 sc = screenpos.xy * 2.0; @@ -43,8 +41,14 @@ vec2 getScreenCoordinate(vec2 screenpos) vec3 getNorm(vec2 screenpos) { - vec2 enc_norm = texture2DRect(normalMap, screenpos.xy).xy; - return decode_normal(enc_norm); + vec2 enc = texture2DRect(normalMap, screenpos.xy).xy; + vec2 fenc = enc*4-2; + float f = dot(fenc,fenc); + float g = sqrt(1-f/4); + vec3 n; + n.xy = fenc*g; + n.z = 1-f/2; + return n; } float getDepth(vec2 pos_screen) diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl index 0848adba73..72bccc5627 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl @@ -73,7 +73,7 @@ uniform mat4 inv_proj; vec3 srgb_to_linear(vec3 cs); vec3 linear_to_srgb(vec3 cl); -vec3 decode_normal (vec2 enc); +vec3 getNorm(vec2 pos_screen); vec4 correctWithGamma(vec4 col) { @@ -166,7 +166,7 @@ void main() float envIntensity = norm.z; - norm = decode_normal(norm.xy); + norm = getNorm(frag.xy); norm = normalize(norm); float l_dist = -dot(lv, proj_n); diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index 9411e905d3..ad721a80d6 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -76,7 +76,6 @@ vec3 GetSunAndSkyIrradiance(vec3 camPos, vec3 norm, vec3 dir, out vec3 sky_irrad vec3 GetSkyLuminance(vec3 camPos, vec3 view_dir, float shadow_length, vec3 dir, out vec3 transmittance); vec3 GetSkyLuminanceToPoint(vec3 camPos, vec3 pos, float shadow_length, vec3 dir, out vec3 transmittance); -vec3 decode_normal(vec2 xy); vec3 ColorFromRadiance(vec3 radiance); vec4 getPositionWithDepth(vec2 pos_screen, float depth); vec4 getPosition(vec2 pos_screen); @@ -93,7 +92,7 @@ void main() vec3 pos = getPositionWithDepth(tc, depth).xyz; vec4 norm = texture2DRect(normalMap, tc); float envIntensity = norm.z; - norm.xyz = decode_normal(norm.xy); + norm.xyz = getNorm(tc); float da = max(dot(norm.xyz, sun_dir.xyz), 0.0); da = pow(da, global_gamma + 0.3); diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl index 80e2a9dd55..3b2b0d5718 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl @@ -71,7 +71,7 @@ uniform vec2 screen_res; uniform mat4 inv_proj; -vec3 decode_normal (vec2 enc); +vec3 getNorm(vec2 pos_screen); vec3 srgb_to_linear(vec3 cs); vec3 linear_to_srgb(vec3 cl); @@ -164,7 +164,7 @@ void main() vec3 norm = texture2DRect(normalMap, frag.xy).xyz; float envIntensity = norm.z; - norm = decode_normal(norm.xy); + norm = getNorm(frag.xy); norm = normalize(norm); float l_dist = -dot(lv, proj_n); diff --git a/indra/newview/app_settings/shaders/class3/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/sunLightF.glsl index e230ebb71c..112b498c90 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/sunLightF.glsl @@ -38,7 +38,6 @@ out vec4 frag_color; // Inputs VARYING vec2 vary_fragcoord; -vec3 decode_normal (vec2 enc); vec4 getPosition(vec2 pos_screen); vec3 getNorm(vec2 pos_screen); diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 593636b14a..e716214d72 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -145,6 +145,18 @@ S32 LLDrawPoolTerrain::getDetailMode() return sDetailMode; } +void LLDrawPoolTerrain::boostTerrainDetailTextures() +{ + // Hack! Get the region that this draw pool is rendering from! + LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); + LLVLComposition *compp = regionp->getComposition(); + for (S32 i = 0; i < 4; i++) + { + compp->mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN); + compp->mDetailTextures[i]->addTextureStats(1024.f*1024.f); // assume large pixel area + } +} + void LLDrawPoolTerrain::render(S32 pass) { LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN); @@ -154,14 +166,7 @@ void LLDrawPoolTerrain::render(S32 pass) return; } - // Hack! Get the region that this draw pool is rendering from! - LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); - LLVLComposition *compp = regionp->getComposition(); - for (S32 i = 0; i < 4; i++) - { - compp->mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN); - compp->mDetailTextures[i]->addTextureStats(1024.f*1024.f); // assume large pixel area - } + boostTerrainDetailTextures(); LLOverrideFaceColor override(this, 1.f, 1.f, 1.f, 1.f); @@ -236,6 +241,8 @@ void LLDrawPoolTerrain::renderDeferred(S32 pass) return; } + boostTerrainDetailTextures(); + renderFullShader(); // Special-case for land ownership feedback diff --git a/indra/newview/lldrawpoolterrain.h b/indra/newview/lldrawpoolterrain.h index 55f75e2644..b4ef7881a8 100644 --- a/indra/newview/lldrawpoolterrain.h +++ b/indra/newview/lldrawpoolterrain.h @@ -78,6 +78,8 @@ public: static F32 sDetailScale; // meters per texture protected: + void boostTerrainDetailTextures(); + void renderSimple(); void renderOwnership(); diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 8df898f8a9..6d0e999845 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -389,16 +389,20 @@ void LLFace::switchTexture(U32 ch, LLViewerTexture* new_texture) return; } - llassert(mTexture[ch].notNull()); - - new_texture->addTextureStats(mTexture[ch]->getMaxVirtualSize()) ; + if (mTexture[ch].notNull()) + { + new_texture->addTextureStats(mTexture[ch]->getMaxVirtualSize()) ; + } if (ch == LLRender::DIFFUSE_MAP) { - getViewerObject()->changeTEImage(mTEOffset, new_texture) ; + if (getViewerObject()) + { + getViewerObject()->changeTEImage(mTEOffset, new_texture); + } } - setTexture(ch, new_texture) ; + setTexture(ch, new_texture); dirtyTexture(); } diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index c5561fe011..abf7b7f39d 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -361,59 +361,8 @@ void LLFloaterAvatarPicker::populateFriend() void LLFloaterAvatarPicker::drawFrustum() { - if(mFrustumOrigin.get()) - { - LLView * frustumOrigin = mFrustumOrigin.get(); - LLRect origin_rect; - frustumOrigin->localRectToOtherView(frustumOrigin->getLocalRect(), &origin_rect, this); - // draw context cone connecting color picker with color swatch in parent floater - LLRect local_rect = getLocalRect(); - if (hasFocus() && frustumOrigin->isInVisibleChain() && mContextConeOpacity > 0.001f) - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLGLEnable(GL_CULL_FACE); - gGL.begin(LLRender::QUADS); - { - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(origin_rect.mLeft, origin_rect.mTop); - gGL.vertex2i(origin_rect.mRight, origin_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(origin_rect.mLeft, origin_rect.mBottom); - gGL.vertex2i(origin_rect.mLeft, origin_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(origin_rect.mRight, origin_rect.mTop); - gGL.vertex2i(origin_rect.mRight, origin_rect.mBottom); - - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(origin_rect.mRight, origin_rect.mBottom); - gGL.vertex2i(origin_rect.mLeft, origin_rect.mBottom); - } - gGL.end(); - } - - if (gFocusMgr.childHasMouseCapture(getDragHandle())) - { - mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLSmoothInterpolation::getInterpolant(mContextConeFadeTime)); - } - else - { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(mContextConeFadeTime)); - } - } + static LLCachedControl<F32> max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); + drawConeToOwner(mContextConeOpacity, max_opacity, mFrustumOrigin.get(), mContextConeFadeTime, mContextConeInAlpha, mContextConeOutAlpha); } void LLFloaterAvatarPicker::draw() diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index ec2c9740af..1a784223c2 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -485,56 +485,8 @@ BOOL LLFloaterColorPicker::isColorChanged() // void LLFloaterColorPicker::draw() { - LLRect swatch_rect; - mSwatch->localRectToOtherView(mSwatch->getLocalRect(), &swatch_rect, this); - // draw context cone connecting color picker with color swatch in parent floater - LLRect local_rect = getLocalRect(); - if (hasFocus() && mSwatch->isInVisibleChain() && mContextConeOpacity > 0.001f) - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLGLEnable(GL_CULL_FACE); - gGL.begin(LLRender::QUADS); - { - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mTop); - gGL.vertex2i(swatch_rect.mRight, swatch_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mBottom); - gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(swatch_rect.mRight, swatch_rect.mTop); - gGL.vertex2i(swatch_rect.mRight, swatch_rect.mBottom); - - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(swatch_rect.mRight, swatch_rect.mBottom); - gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mBottom); - } - gGL.end(); - } - - if (gFocusMgr.childHasMouseCapture(getDragHandle())) - { - mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), - LLSmoothInterpolation::getInterpolant(mContextConeFadeTime)); - } - else - { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(mContextConeFadeTime)); - } + static LLCachedControl<F32> max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); + drawConeToOwner(mContextConeOpacity, max_opacity, mSwatch, mContextConeFadeTime, mContextConeInAlpha, mContextConeOutAlpha); mPipetteBtn->setToggleState(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); mApplyImmediateCheck->setEnabled(mActive && mCanApplyImmediately); diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 6283008a63..aa16747fe3 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -48,6 +48,7 @@ #include "llviewerparcelmgr.h" #include "llsettingspicker.h" +#include "lltrackpicker.h" // newview #include "llagent.h" @@ -425,6 +426,7 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) void LLFloaterEditExtDayCycle::onClose(bool app_quitting) { doCloseInventoryFloater(app_quitting); + doCloseTrackFloater(app_quitting); // there's no point to change environment if we're quitting // or if we already restored environment stopPlay(); @@ -802,7 +804,48 @@ void LLFloaterEditExtDayCycle::onRemoveFrame() void LLFloaterEditExtDayCycle::onCloneTrack() { + const LLEnvironment::altitude_list_t &altitudes = LLEnvironment::instance().getRegionAltitudes(); + bool use_altitudes = altitudes.size() > 0 && ((mEditContext == CONTEXT_PARCEL) || (mEditContext == CONTEXT_REGION)); + + LLSD args = LLSD::emptyArray(); + S32 populated_counter = 0; + for (U32 i = 1; i < LLSettingsDay::TRACK_MAX; i++) + { + LLSD track; + track["id"] = LLSD::Integer(i); + bool populated = (!mEditDay->isTrackEmpty(i)) && (i != mCurrentTrack); + track["enabled"] = populated; + if (populated) + { + populated_counter++; + } + if (use_altitudes) + { + track["altitude"] = altitudes[i - 1]; + } + args.append(track); + } + + if (populated_counter > 1) + { + doOpenTrackFloater(args); + } + else if (populated_counter > 0) + { + for (U32 i = 1; i < LLSettingsDay::TRACK_MAX; i++) + { + if ((!mEditDay->isTrackEmpty(i)) && (i != mCurrentTrack)) + { + onPickerCommitTrackId(i); + } + } + } + else + { + // Should not happen + LL_WARNS("ENVDAYEDIT") << "Tried to copy tracks, but there are no available sources" << LL_ENDL; + } } @@ -1049,6 +1092,8 @@ void LLFloaterEditExtDayCycle::cloneTrack(const LLSettingsDay::ptr_t &source_day mEditDay->setSettingsAtKeyframe(psky->buildDerivedClone(), track_frame.first, dest_index); } + setDirtyFlag(); + updateSlider(); updateTabs(); updateButtons(); @@ -1228,8 +1273,7 @@ void LLFloaterEditExtDayCycle::updateButtons() } can_clear = (mCurrentTrack > 1) ? (!mEditDay->getCycleTrack(mCurrentTrack).empty()) : (mEditDay->getCycleTrack(mCurrentTrack).size() > 1); - mCloneTrack->setEnabled(can_clone && false); - mCloneTrack->setVisible(false); + mCloneTrack->setEnabled(can_clone); mLoadTrack->setEnabled(can_load); mClearTrack->setEnabled(can_clear); @@ -1509,6 +1553,7 @@ void LLFloaterEditExtDayCycle::synchronizeTabs() mEditSky = psettingS; doCloseInventoryFloater(); + doCloseTrackFloater(); setTabsData(tabs, psettingS, canedit); LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, mEditSky, mEditWater); @@ -1741,6 +1786,7 @@ bool LLFloaterEditExtDayCycle::canApplyParcel() const void LLFloaterEditExtDayCycle::startPlay() { doCloseInventoryFloater(); + doCloseTrackFloater(); mIsPlaying = true; mFramesSlider->resetCurSlider(); @@ -1814,6 +1860,38 @@ void LLFloaterEditExtDayCycle::clearDirtyFlag() } +void LLFloaterEditExtDayCycle::doOpenTrackFloater(const LLSD &args) +{ + LLFloaterTrackPicker *picker = static_cast<LLFloaterTrackPicker *>(mTrackFloater.get()); + + // Show the dialog + if (!picker) + { + picker = new LLFloaterTrackPicker(this); + + mTrackFloater = picker->getHandle(); + + picker->setCommitCallback([this](LLUICtrl *, const LLSD &data){ onPickerCommitTrackId(data.asInteger()); }); + } + + picker->showPicker(args); +} + +void LLFloaterEditExtDayCycle::doCloseTrackFloater(bool quitting) +{ + LLFloater* floaterp = mTrackFloater.get(); + + if (floaterp) + { + floaterp->closeFloater(quitting); + } +} + +void LLFloaterEditExtDayCycle::onPickerCommitTrackId(U32 track_id) +{ + cloneTrack(track_id, mCurrentTrack); +} + void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e type, LLUUID curritem) { // LLUI::sWindow->setCursor(UI_CURSOR_WAIT); @@ -1832,9 +1910,16 @@ void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e typ picker->setSettingsFilter(type); picker->setSettingsItemId(curritem); + if (type == LLSettingsType::ST_DAYCYCLE) + { + picker->setTrackMode((mCurrentTrack == LLSettingsDay::TRACK_WATER) ? LLFloaterSettingsPicker::TRACK_WATER : LLFloaterSettingsPicker::TRACK_SKY); + } + else + { + picker->setTrackMode(LLFloaterSettingsPicker::TRACK_NONE); + } picker->openFloater(); picker->setFocus(TRUE); - picker->setTrackWater(mCurrentTrack == LLSettingsDay::TRACK_WATER); } void LLFloaterEditExtDayCycle::doCloseInventoryFloater(bool quitting) @@ -1929,26 +2014,37 @@ void LLFloaterEditExtDayCycle::onAssetLoadedForInsertion(LLUUID item_id, LLUUID LLInventoryItem *inv_item = gInventory.getItem(item_id); - if (inv_item - && mInventoryItem - && mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()) - && !inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) + if (inv_item && !inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) { - LLSD args; + // Need to check if item is already no-transfer, otherwise make it no-transfer + bool no_transfer = false; + if (mInventoryItem) + { + no_transfer = mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); + } + else + { + no_transfer = mEditDay->getFlag(LLSettingsBase::FLAG_NOTRANS); + } - // create and show confirmation textbox - LLNotificationsUtil::add("SettingsMakeNoTrans", args, LLSD(), - [this, cb](const LLSD¬if, const LLSD&resp) + if (!no_transfer) { - S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); - if (opt == 0) + LLSD args; + + // create and show confirmation textbox + LLNotificationsUtil::add("SettingsMakeNoTrans", args, LLSD(), + [this, cb](const LLSD¬if, const LLSD&resp) { - mMakeNoTrans = true; - mEditDay->setFlag(LLSettingsBase::FLAG_NOTRANS); - cb(); - } - }); - return; + S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); + if (opt == 0) + { + mMakeNoTrans = true; + mEditDay->setFlag(LLSettingsBase::FLAG_NOTRANS); + cb(); + } + }); + return; + } } cb(); diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index e808ab8a46..f50c9f7e5f 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -160,6 +160,10 @@ private: void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results); void onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results); + void doOpenTrackFloater(const LLSD &args); + void doCloseTrackFloater(bool quitting = false); + void onPickerCommitTrackId(U32 track_id); + void doOpenInventoryFloater(LLSettingsType::type_e type, LLUUID curritem); void doCloseInventoryFloater(bool quitting = false); void onPickerCommitSetting(LLUUID item_id, S32 track); @@ -218,6 +222,7 @@ private: LLFlyoutComboBtnCtrl * mFlyoutControl; LLHandle<LLFloater> mInventoryFloater; + LLHandle<LLFloater> mTrackFloater; LLTrackBlenderLoopingManual::ptr_t mSkyBlender; LLTrackBlenderLoopingManual::ptr_t mWaterBlender; diff --git a/indra/newview/llfloaterexperiencepicker.cpp b/indra/newview/llfloaterexperiencepicker.cpp index bb54c57baf..c642da7b83 100644 --- a/indra/newview/llfloaterexperiencepicker.cpp +++ b/indra/newview/llfloaterexperiencepicker.cpp @@ -74,59 +74,8 @@ LLFloaterExperiencePicker* LLFloaterExperiencePicker::show( select_callback_t ca void LLFloaterExperiencePicker::drawFrustum() { - if(mFrustumOrigin.get()) - { - LLView * frustumOrigin = mFrustumOrigin.get(); - LLRect origin_rect; - frustumOrigin->localRectToOtherView(frustumOrigin->getLocalRect(), &origin_rect, this); - // draw context cone connecting color picker with color swatch in parent floater - LLRect local_rect = getLocalRect(); - if (hasFocus() && frustumOrigin->isInVisibleChain() && mContextConeOpacity > 0.001f) - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLGLEnable(GL_CULL_FACE); - gGL.begin(LLRender::QUADS); - { - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(origin_rect.mLeft, origin_rect.mTop); - gGL.vertex2i(origin_rect.mRight, origin_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(origin_rect.mLeft, origin_rect.mBottom); - gGL.vertex2i(origin_rect.mLeft, origin_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(origin_rect.mRight, origin_rect.mTop); - gGL.vertex2i(origin_rect.mRight, origin_rect.mBottom); - - gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); - gGL.vertex2i(origin_rect.mRight, origin_rect.mBottom); - gGL.vertex2i(origin_rect.mLeft, origin_rect.mBottom); - } - gGL.end(); - } - - if (gFocusMgr.childHasMouseCapture(getDragHandle())) - { - mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(mContextConeFadeTime)); - } - else - { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(mContextConeFadeTime)); - } - } + static LLCachedControl<F32> max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); + drawConeToOwner(mContextConeOpacity, max_opacity, mFrustumOrigin.get(), mContextConeFadeTime, mContextConeInAlpha, mContextConeOutAlpha); } void LLFloaterExperiencePicker::draw() diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index 67c6a1bba0..5eac6b317b 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -351,6 +351,7 @@ void LLFloaterFixedEnvironment::onAssetLoaded(LLUUID asset_id, LLSettingsBase::p updateEditEnvironment(); syncronizeTabs(); refresh(); + LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_FAST); } void LLFloaterFixedEnvironment::onNameChanged(const std::string &name) diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 55b579d0a2..8f279c07ba 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -270,9 +270,43 @@ void LLPanelEnvironmentInfo::refresh() for (S32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; ++idx) { - sld->addSlider(altitudes[idx + 1], alt_sliders[idx]); - updateAltLabel(alt_prefixes[idx], idx + 2, altitudes[idx + 1]); - mAltitudes[alt_sliders[idx]] = AltitudeData(idx+2, idx, altitudes[idx+1]); + // make sure values are in range, server is supposed to validate them, + // but issues happen, try to fix values in such case + F32 altitude = llclamp(altitudes[idx + 1], sld->getMinValue(), sld->getMaxValue()); + bool res = sld->addSlider(altitude, alt_sliders[idx]); + if (!res) + { + LL_WARNS_ONCE("ENVPANEL") << "Failed to validate altitude from server for parcel id" << getParcelId() << LL_ENDL; + // Find a spot to insert altitude. + // Assuming everything alright with slider, we should find new place in 11 steps top (step 25m, no overlap 100m) + F32 alt_step = (altitude > (sld->getMaxValue() / 2)) ? -sld->getIncrement() : sld->getIncrement(); + for (U32 i = 0; i < 30; i++) + { + altitude += alt_step; + if (altitude > sld->getMaxValue()) + { + altitude = sld->getMinValue(); + } + else if (altitude < sld->getMinValue()) + { + altitude = sld->getMaxValue(); + } + res = sld->addSlider(altitude, alt_sliders[idx]); + if (res) break; + } + if (!res) + { + // Something is very very wrong + LL_WARNS_ONCE("ENVPANEL") << "Failed to set up altitudes for parcel id " << getParcelId() << LL_ENDL; + } + else + { + // slider has some auto correction that might have kicked in + altitude = sld->getSliderValue(alt_sliders[idx]); + } + } + updateAltLabel(alt_prefixes[idx], idx + 2, altitude); + mAltitudes[alt_sliders[idx]] = AltitudeData(idx + 2, idx, altitude); } if (sld->getCurNumSliders() != ALTITUDE_SLIDER_COUNT) { @@ -309,11 +343,12 @@ std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id) std::string LLPanelEnvironmentInfo::getNameForTrackIndex(S32 index) { std::string invname; - - LL_WARNS("LAPRAS") << "mDayCycleName='" << mCurrentEnvironment->mDayCycleName << "'" << LL_ENDL; if (mCurrentEnvironment->mDayCycleName.empty()) { invname = mCurrentEnvironment->mNameList[index]; + + if (!isRegion() && invname.empty()) + invname = getString("str_region_env"); } else if (!mCurrentEnvironment->mDayCycle->isTrackEmpty(index)) { @@ -338,7 +373,7 @@ LLFloaterSettingsPicker * LLPanelEnvironmentInfo::getSettingsPicker(bool create) mSettingsFloater = picker->getHandle(); - picker->setCommitCallback([this](LLUICtrl *, const LLSD &data){ onPickerCommitted(data.asUUID()); }); + picker->setCommitCallback([this](LLUICtrl *, const LLSD &data){ onPickerCommitted(data["ItemId"].asUUID()); }); } return picker; @@ -546,41 +581,101 @@ void LLPanelEnvironmentInfo::readjustAltLabels() { // Re-adjust all labels // Very simple "adjust after the fact" method - // Note: labels can be in any ordered - for (U32 i = 0; i < ALTITUDE_SLIDER_COUNT - 1; i++) - { - LLView* view_cmp = findChild<LLView>(alt_panels[i]); + // Note: labels can be in any order + + LLMultiSliderCtrl *sld = findChild<LLMultiSliderCtrl>(SLD_ALTITUDES); + if (!sld) return; - for (U32 j = i + 1; j < ALTITUDE_SLIDER_COUNT; j++) + LLView* view_midle = NULL; + U32 midle_ind = 0; + S32 shift_up = 0; + S32 shift_down = 0; + LLRect sld_rect = sld->getRect(); + + // Find the middle one + for (U32 i = 0; i < ALTITUDE_SLIDER_COUNT; i++) + { + LLView* cmp_view = findChild<LLView>(alt_panels[i], true); + if (!cmp_view) return; + LLRect cmp_rect = cmp_view->getRect(); + S32 pos = 0; + shift_up = 0; + shift_down = 0; + + for (U32 j = 0; j < ALTITUDE_SLIDER_COUNT; j++) { - LLView* view_intr = findChild<LLView>(alt_panels[j]); - if (view_cmp && view_intr) + if (i != j) { - LLRect cmp_rect = view_cmp->getRect(); - LLRect intr_rect = view_intr->getRect(); - S32 shift = 0; - if (cmp_rect.mBottom <= intr_rect.mTop && cmp_rect.mBottom >= intr_rect.mBottom) + LLView* intr_view = findChild<LLView>(alt_panels[j], true); + if (!intr_view) return; + LLRect intr_rect = intr_view->getRect(); + if (cmp_rect.mBottom >= intr_rect.mBottom) { - // Approximate shift - // We probably will need more cycle runs over all labels to get accurate one - // At the moment single cycle should do since we have too little elements to do something complicated - shift = (cmp_rect.mBottom - intr_rect.mTop) / 2; + pos++; } - else if (cmp_rect.mTop >= intr_rect.mBottom && cmp_rect.mTop <= intr_rect.mTop) + if (intr_rect.mBottom <= cmp_rect.mTop && intr_rect.mBottom >= cmp_rect.mBottom) { - // Approximate shift - shift = (cmp_rect.mTop - intr_rect.mBottom) / 2; + shift_up = cmp_rect.mTop - intr_rect.mBottom; } - if (shift != 0) + else if (intr_rect.mTop >= cmp_rect.mBottom && intr_rect.mBottom <= cmp_rect.mBottom) { - cmp_rect.translate(0, -shift); - view_cmp->setRect(cmp_rect); - - intr_rect.translate(0, shift); - view_intr->setRect(intr_rect); + shift_down = cmp_rect.mBottom - intr_rect.mTop; } } } + if (pos == 1) // middle + { + view_midle = cmp_view; + midle_ind = i; + break; + } + } + + // Account for edges + LLRect midle_rect = view_midle->getRect(); + F32 factor = 0.5f; + S32 edge_zone_height = midle_rect.getHeight() * 1.5f; + + if (midle_rect.mBottom - sld_rect.mBottom < edge_zone_height) + { + factor = 1 - ((midle_rect.mBottom - sld_rect.mBottom) / (edge_zone_height * 2)); + } + else if (sld_rect.mTop - midle_rect.mTop < edge_zone_height ) + { + factor = ((sld_rect.mTop - midle_rect.mTop) / (edge_zone_height * 2)); + } + + S32 shift_middle = (S32)(((F32)shift_down * factor) + ((F32)shift_up * (1.f - factor))); + shift_down = shift_down - shift_middle; + shift_up = shift_up - shift_middle; + + // fix crossings + for (U32 i = 0; i < ALTITUDE_SLIDER_COUNT; i++) + { + if (i != midle_ind) + { + LLView* trn_view = findChild<LLView>(alt_panels[i], true); + LLRect trn_rect = trn_view->getRect(); + + if (trn_rect.mBottom <= midle_rect.mTop && trn_rect.mBottom >= midle_rect.mBottom) + { + // Approximate shift + trn_rect.translate(0, shift_up); + trn_view->setRect(trn_rect); + } + else if (trn_rect.mTop >= midle_rect.mBottom && trn_rect.mBottom <= midle_rect.mBottom) + { + // Approximate shift + trn_rect.translate(0, shift_down); + trn_view->setRect(trn_rect); + } + } + } + + if (shift_middle != 0) + { + midle_rect.translate(0, -shift_middle); //reversed relative to others + view_midle->setRect(midle_rect); } } diff --git a/indra/newview/llsettingspicker.cpp b/indra/newview/llsettingspicker.cpp index 7aa9cf0ae8..e2d6d43ae3 100644 --- a/indra/newview/llsettingspicker.cpp +++ b/indra/newview/llsettingspicker.cpp @@ -55,10 +55,6 @@ namespace const std::string BTN_SELECT("btn_select"); const std::string BTN_CANCEL("btn_cancel"); - const F32 CONTEXT_CONE_IN_ALPHA(0.0f); - const F32 CONTEXT_CONE_OUT_ALPHA(1.0f); - const F32 CONTEXT_FADE_TIME(0.08f); - // strings in xml const std::string STR_TITLE_PREFIX = "pick title"; @@ -76,7 +72,7 @@ LLFloaterSettingsPicker::LLFloaterSettingsPicker(LLView * owner, LLUUID initial_ mActive(true), mContextConeOpacity(0.0f), mSettingItemID(initial_item_id), - mTrackWater(true), + mTrackMode(TRACK_NONE), mImmediateFilterPermMask(PERM_NONE) { mOwnerHandle = owner->getHandle(); @@ -136,6 +132,8 @@ BOOL LLFloaterSettingsPicker::postBuild() childSetAction(BTN_CANCEL, [this](LLUICtrl*, const LLSD& param){ onButtonCancel(); }); childSetAction(BTN_SELECT, [this](LLUICtrl*, const LLSD& param){ onButtonSelect(); }); + getChild<LLPanel>(PNL_COMBO)->setVisible(mTrackMode != TRACK_NONE); + // update permission filter once UI is fully initialized mSavedFolderState.setApply(FALSE); @@ -173,13 +171,18 @@ void LLFloaterSettingsPicker::setSettingsFilter(LLSettingsType::type_e type) filter = static_cast<S64>(0x1) << static_cast<S64>(type); } - bool day_cycle = (type != LLSettingsType::ST_WATER) && (type != LLSettingsType::ST_SKY); - getChild<LLPanel>(PNL_COMBO)->setVisible(day_cycle); + mInventoryPanel->setFilterSettingsTypes(filter); +} + +void LLFloaterSettingsPicker::setTrackMode(ETrackMode mode) +{ + mTrackMode = mode; + getChild<LLPanel>(PNL_COMBO)->setVisible(mode != TRACK_NONE); + std::string prefix = getString(STR_TITLE_PREFIX); std::string label; - if (day_cycle) + if (mode != TRACK_NONE) { - label = getString(STR_TITLE_TRACK); } else @@ -187,66 +190,13 @@ void LLFloaterSettingsPicker::setSettingsFilter(LLSettingsType::type_e type) label = getString(STR_TITLE_SETTINGS); } setTitle(prefix + " " + label); - - mInventoryPanel->setFilterSettingsTypes(filter); } void LLFloaterSettingsPicker::draw() { LLView *owner = mOwnerHandle.get(); - if (owner) - { - // draw cone of context pointing back to texture swatch - LLRect owner_rect; - owner->localRectToOtherView(owner->getLocalRect(), &owner_rect, this); - LLRect local_rect = getLocalRect(); - if (gFocusMgr.childHasKeyboardFocus(this) && owner->isInVisibleChain() && mContextConeOpacity > 0.001f) - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLGLEnable(GL_CULL_FACE); - gGL.begin(LLRender::QUADS); - { - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); - gGL.vertex2i(owner_rect.mRight, owner_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mRight, owner_rect.mTop); - gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom); - - - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom); - } - gGL.end(); - } - } - - if (gFocusMgr.childHasMouseCapture(getDragHandle())) - { - mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME)); - } - else - { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME)); - } + static LLCachedControl<F32> max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); + drawConeToOwner(mContextConeOpacity, max_opacity, owner); LLFloater::draw(); } @@ -289,7 +239,6 @@ void LLFloaterSettingsPicker::onFilterEdit(const std::string& search_string) void LLFloaterSettingsPicker::onSelectionChange(const LLFloaterSettingsPicker::itemlist_t &items, bool user_action) { - bool track_picker_enabled = false; bool is_item = false; LLUUID asset_id; if (items.size()) @@ -315,15 +264,11 @@ void LLFloaterSettingsPicker::onSelectionChange(const LLFloaterSettingsPicker::i { mChangeIDSignal(mSettingItemID); } - - if (bridge_model->getSettingsType() == LLSettingsType::ST_DAYCYCLE - && !mNoCopySettingsSelected) - { - track_picker_enabled = true; - } } } } + bool track_picker_enabled = mTrackMode != TRACK_NONE; + getChild<LLView>(CMB_TRACK_SELECTION)->setEnabled(track_picker_enabled && mSettingAssetID == asset_id); getChild<LLView>(BTN_SELECT)->setEnabled(is_item && (!track_picker_enabled || mSettingAssetID == asset_id)); if (track_picker_enabled && asset_id.notNull() && mSettingAssetID != asset_id) @@ -359,11 +304,11 @@ void LLFloaterSettingsPicker::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr track_selection->removeall(); LLSettingsDay::ptr_t pday = std::dynamic_pointer_cast<LLSettingsDay>(settings); - if (mTrackWater) + if (mTrackMode == TRACK_WATER) { track_selection->add(getString(STR_TRACK_WATER), LLSD::Integer(LLSettingsDay::TRACK_WATER), ADD_TOP, true); } - else + else if (mTrackMode == TRACK_SKY) { // track 1 always present track_selection->add(getString(STR_TRACK_GROUND), LLSD::Integer(LLSettingsDay::TRACK_GROUND_LEVEL), ADD_TOP, true); diff --git a/indra/newview/llsettingspicker.h b/indra/newview/llsettingspicker.h index 941fe752b0..859f92fbe8 100644 --- a/indra/newview/llsettingspicker.h +++ b/indra/newview/llsettingspicker.h @@ -45,7 +45,12 @@ class LLInventoryPanel; class LLFloaterSettingsPicker : public LLFloater { public: - typedef std::function<void (LLUUID id)> commit_callback_t; + enum ETrackMode + { + TRACK_NONE, + TRACK_WATER, + TRACK_SKY + }; typedef std::function<void()> close_callback_t; typedef std::function<void(const LLUUID& item_id)> id_changed_callback_t; @@ -66,8 +71,9 @@ public: LLSettingsType::type_e getSettingsFilter() const { return mSettingsType; } // Only for day cycle - void setTrackWater(bool use_water) { mTrackWater = use_water; } - void setTrackSky(bool use_sky) { mTrackWater = !use_sky; } + void setTrackMode(ETrackMode mode); + void setTrackWater() { mTrackMode = TRACK_WATER; } + void setTrackSky() { mTrackMode = TRACK_SKY; } // Takes a UUID, wraps get/setImageAssetID virtual void setValue(const LLSD& value) override; @@ -109,7 +115,7 @@ private: LLHandle<LLView> mOwnerHandle; LLUUID mSettingItemID; LLUUID mSettingAssetID; - bool mTrackWater; + ETrackMode mTrackMode; LLFilterEditor * mFilterEdit; LLInventoryPanel * mInventoryPanel; @@ -117,8 +123,6 @@ private: F32 mContextConeOpacity; PermissionMask mImmediateFilterPermMask; -// PermissionMask mDnDFilterPermMask; -// PermissionMask mNonImmediateFilterPermMask; bool mActive; bool mNoCopySettingsSelected; diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index a5a2eec246..5ca77ad3c3 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -70,9 +70,6 @@ #include "lllocalbitmaps.h" #include "llerror.h" -static const F32 CONTEXT_CONE_IN_ALPHA = 0.0f; -static const F32 CONTEXT_CONE_OUT_ALPHA = 1.f; -static const F32 CONTEXT_FADE_TIME = 0.08f; static const S32 LOCAL_TRACKING_ID_COLUMN = 1; @@ -410,59 +407,8 @@ BOOL LLFloaterTexturePicker::postBuild() // virtual void LLFloaterTexturePicker::draw() { - if (mOwner) - { - // draw cone of context pointing back to texture swatch - LLRect owner_rect; - mOwner->localRectToOtherView(mOwner->getLocalRect(), &owner_rect, this); - LLRect local_rect = getLocalRect(); - if (gFocusMgr.childHasKeyboardFocus(this) && mOwner->isInVisibleChain() && mContextConeOpacity > 0.001f) - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLGLEnable(GL_CULL_FACE); - gGL.begin(LLRender::QUADS); - { - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); - gGL.vertex2i(owner_rect.mRight, owner_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mRight, owner_rect.mTop); - gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom); - - - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom); - } - gGL.end(); - } - } - - if (gFocusMgr.childHasMouseCapture(getDragHandle())) - { - mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME)); - } - else - { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME)); - } + static LLCachedControl<F32> max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); + drawConeToOwner(mContextConeOpacity, max_opacity, mOwner); updateImageStats(); diff --git a/indra/newview/lltrackpicker.cpp b/indra/newview/lltrackpicker.cpp new file mode 100644 index 0000000000..bc918f4bd7 --- /dev/null +++ b/indra/newview/lltrackpicker.cpp @@ -0,0 +1,126 @@ +/** +* @author AndreyK Productengine +* @brief LLTrackPicker class header file including related functions +* +* $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 "llviewerprecompiledheaders.h" + +#include "lltrackpicker.h" + +#include "llradiogroup.h" +#include "llviewercontrol.h" + + +//========================================================================= +namespace +{ + const std::string FLOATER_DEFINITION_XML("floater_pick_track.xml"); + + const std::string BTN_SELECT("btn_select"); + const std::string BTN_CANCEL("btn_cancel"); + const std::string RDO_TRACK_SELECTION("track_selection"); + const std::string RDO_TRACK_PREFIX("radio_sky"); +} +//========================================================================= + +LLFloaterTrackPicker::LLFloaterTrackPicker(LLView * owner, const LLSD ¶ms) : + LLFloater(params), + mContextConeOpacity(0.0f), + mOwnerHandle() +{ + mOwnerHandle = owner->getHandle(); + buildFromFile(FLOATER_DEFINITION_XML); +} + +LLFloaterTrackPicker::~LLFloaterTrackPicker() +{ +} + +BOOL LLFloaterTrackPicker::postBuild() +{ + childSetAction(BTN_CANCEL, [this](LLUICtrl*, const LLSD& param){ onButtonCancel(); }); + childSetAction(BTN_SELECT, [this](LLUICtrl*, const LLSD& param){ onButtonSelect(); }); + return TRUE; +} + +void LLFloaterTrackPicker::onClose(bool app_quitting) +{ + if (app_quitting) + return; + + LLView *owner = mOwnerHandle.get(); + if (owner) + { + owner->setFocus(TRUE); + } +} + +void LLFloaterTrackPicker::showPicker(const LLSD &args) +{ + LLSD::array_const_iterator iter; + LLSD::array_const_iterator end = args.endArray(); + + for (iter = args.beginArray(); iter != end; ++iter) + { + S32 track_id = (*iter)["id"].asInteger(); + bool can_enable = (*iter)["enabled"].asBoolean(); + LLView *view = getChild<LLCheckBoxCtrl>(RDO_TRACK_PREFIX + llformat("%d", track_id), true); + view->setEnabled(can_enable); + view->setLabelArg("[ALT]", (*iter).has("altitude") ? ((*iter)["altitude"].asString() + "m") : " "); + } + + openFloater(getKey()); + setFocus(TRUE); +} + +void LLFloaterTrackPicker::draw() +{ + LLView *owner = mOwnerHandle.get(); + static LLCachedControl<F32> max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); + drawConeToOwner(mContextConeOpacity, max_opacity, owner); + + LLFloater::draw(); +} + +void LLFloaterTrackPicker::onButtonCancel() +{ + closeFloater(); +} + +void LLFloaterTrackPicker::onButtonSelect() +{ + if (mCommitSignal) + { + (*mCommitSignal)(this, getChild<LLRadioGroup>(RDO_TRACK_SELECTION, true)->getSelectedValue()); + } + closeFloater(); +} + +void LLFloaterTrackPicker::onFocusLost() +{ + if (isInVisibleChain()) + { + closeFloater(); + } +} diff --git a/indra/newview/lltrackpicker.h b/indra/newview/lltrackpicker.h new file mode 100644 index 0000000000..dab3b72915 --- /dev/null +++ b/indra/newview/lltrackpicker.h @@ -0,0 +1,58 @@ +/** + * @file lltrackpicker.h + * @author AndreyK Productengine + * @brief LLTrackPicker class header file including related functions + * + * $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_TRACKPICKER_H +#define LL_TRACKPICKER_H + +#include "llfloater.h" + + +//========================================================================= + +class LLFloaterTrackPicker : public LLFloater +{ +public: + LLFloaterTrackPicker(LLView * owner, const LLSD ¶ms = LLSD()); + virtual ~LLFloaterTrackPicker() override; + + virtual BOOL postBuild() override; + virtual void onClose(bool app_quitting) override; + void showPicker(const LLSD &args); + + virtual void draw() override; + + void onButtonCancel(); + void onButtonSelect(); + +private: + void onFocusLost() override; + + F32 mContextConeOpacity; + LLHandle<LLView> mOwnerHandle; +}; + +#endif // LL_TRACKPICKER_H diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 2293007641..5c65a3630c 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -1006,7 +1006,6 @@ BOOL LLViewerShaderMgr::loadBasicShaders() index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/transportF.glsl", mShaderLevel[SHADER_WINDLIGHT] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "environment/waterFogF.glsl", mShaderLevel[SHADER_WATER] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "environment/encodeNormF.glsl", mShaderLevel[SHADER_ENVIRONMENT] ) ); - index_channels.push_back(-1); shaders.push_back( make_pair( "environment/decodeNormF.glsl", mShaderLevel[SHADER_ENVIRONMENT] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "environment/srgbF.glsl", mShaderLevel[SHADER_ENVIRONMENT] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/deferredUtil.glsl", mShaderLevel[SHADER_DEFERRED] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/shadowUtil.glsl", mShaderLevel[SHADER_DEFERRED] ) ); @@ -1406,7 +1405,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSkinnedAlphaProgram.mFeatures.isAlphaLighting = true; gDeferredSkinnedAlphaProgram.mFeatures.disableTextureIndex = true; gDeferredSkinnedAlphaProgram.mFeatures.hasSrgb = true; - gDeferredSkinnedAlphaProgram.mFeatures.decodesNormal = true; gDeferredSkinnedAlphaProgram.mFeatures.encodesNormal = true; gDeferredSkinnedAlphaProgram.mFeatures.calculatesAtmospherics = true; gDeferredSkinnedAlphaProgram.mFeatures.hasAtmospherics = true; @@ -1484,7 +1482,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredMaterialProgram[i].mFeatures.hasSrgb = true; gDeferredMaterialProgram[i].mFeatures.hasTransport = true; - gDeferredMaterialProgram[i].mFeatures.decodesNormal = true; gDeferredMaterialProgram[i].mFeatures.encodesNormal = true; gDeferredMaterialProgram[i].mFeatures.calculatesAtmospherics = true; gDeferredMaterialProgram[i].mFeatures.hasAtmospherics = true; @@ -1524,7 +1521,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredMaterialWaterProgram[i].mFeatures.hasWaterFog = true; gDeferredMaterialWaterProgram[i].mFeatures.hasSrgb = true; - gDeferredMaterialWaterProgram[i].mFeatures.decodesNormal = true; gDeferredMaterialWaterProgram[i].mFeatures.encodesNormal = true; gDeferredMaterialWaterProgram[i].mFeatures.calculatesAtmospherics = true; gDeferredMaterialWaterProgram[i].mFeatures.hasAtmospherics = true; @@ -1594,7 +1590,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() { gDeferredImpostorProgram.mName = "Deferred Impostor Shader"; gDeferredImpostorProgram.mFeatures.hasSrgb = true; - gDeferredImpostorProgram.mFeatures.decodesNormal = true; gDeferredImpostorProgram.mFeatures.encodesNormal = true; //gDeferredImpostorProgram.mFeatures.isDeferred = true; gDeferredImpostorProgram.mShaderFiles.clear(); @@ -1608,7 +1603,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (success) { gDeferredLightProgram.mName = "Deferred Light Shader"; - gDeferredLightProgram.mFeatures.decodesNormal = true; gDeferredLightProgram.mFeatures.isDeferred = true; gDeferredLightProgram.mFeatures.hasShadows = true; @@ -1626,7 +1620,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (success) { gDeferredMultiLightProgram[i].mName = llformat("Deferred MultiLight Shader %d", i); - gDeferredMultiLightProgram[i].mFeatures.decodesNormal = true; gDeferredMultiLightProgram[i].mFeatures.isDeferred = true; gDeferredMultiLightProgram[i].mFeatures.hasShadows = true; @@ -1645,7 +1638,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSpotLightProgram.mName = "Deferred SpotLight Shader"; gDeferredSpotLightProgram.mShaderFiles.clear(); gDeferredSpotLightProgram.mFeatures.hasSrgb = true; - gDeferredSpotLightProgram.mFeatures.decodesNormal = true; gDeferredSpotLightProgram.mFeatures.isDeferred = true; gDeferredSpotLightProgram.mFeatures.hasShadows = true; @@ -1661,7 +1653,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() { gDeferredMultiSpotLightProgram.mName = "Deferred MultiSpotLight Shader"; gDeferredMultiSpotLightProgram.mFeatures.hasSrgb = true; - gDeferredMultiSpotLightProgram.mFeatures.decodesNormal = true; gDeferredMultiSpotLightProgram.mFeatures.isDeferred = true; gDeferredMultiSpotLightProgram.mFeatures.hasShadows = true; @@ -1695,7 +1686,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() } gDeferredSunProgram.mName = "Deferred Sun Shader"; - gDeferredSunProgram.mFeatures.decodesNormal = true; gDeferredSunProgram.mFeatures.isDeferred = true; gDeferredSunProgram.mFeatures.hasShadows = true; gDeferredSunProgram.mFeatures.hasIndirect = true; @@ -1713,7 +1703,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (success) { gDeferredBlurLightProgram.mName = "Deferred Blur Light Shader"; - gDeferredBlurLightProgram.mFeatures.decodesNormal = true; gDeferredBlurLightProgram.mFeatures.isDeferred = true; gDeferredBlurLightProgram.mShaderFiles.clear(); @@ -1734,7 +1723,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAlphaProgram.mFeatures.isAlphaLighting = true; gDeferredAlphaProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels gDeferredAlphaProgram.mFeatures.hasSrgb = true; - gDeferredAlphaProgram.mFeatures.decodesNormal = true; gDeferredAlphaProgram.mFeatures.encodesNormal = true; gDeferredAlphaProgram.mFeatures.calculatesAtmospherics = true; gDeferredAlphaProgram.mFeatures.hasAtmospherics = true; @@ -1777,7 +1765,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAlphaImpostorProgram.mFeatures.hasLighting = false; gDeferredAlphaImpostorProgram.mFeatures.isAlphaLighting = true; gDeferredAlphaImpostorProgram.mFeatures.hasSrgb = true; - gDeferredAlphaImpostorProgram.mFeatures.decodesNormal = true; gDeferredAlphaImpostorProgram.mFeatures.encodesNormal = true; gDeferredAlphaImpostorProgram.mFeatures.isDeferred = true; gDeferredAlphaImpostorProgram.mFeatures.hasShadows = true; @@ -1820,7 +1807,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAlphaWaterProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels gDeferredAlphaWaterProgram.mFeatures.hasWaterFog = true; gDeferredAlphaWaterProgram.mFeatures.hasSrgb = true; - gDeferredAlphaWaterProgram.mFeatures.decodesNormal = true; gDeferredAlphaWaterProgram.mFeatures.encodesNormal = true; gDeferredAlphaWaterProgram.mFeatures.calculatesAtmospherics = true; gDeferredAlphaWaterProgram.mFeatures.hasAtmospherics = true; @@ -2069,7 +2055,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSoftenProgram.mName = "Deferred Soften Shader"; gDeferredSoftenProgram.mShaderFiles.clear(); gDeferredSoftenProgram.mFeatures.hasSrgb = true; - gDeferredSoftenProgram.mFeatures.decodesNormal = true; gDeferredSoftenProgram.mFeatures.calculatesAtmospherics = true; gDeferredSoftenProgram.mFeatures.hasAtmospherics = true; gDeferredSoftenProgram.mFeatures.hasTransport = true; @@ -2113,7 +2098,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSoftenWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER; gDeferredSoftenWaterProgram.mFeatures.hasWaterFog = true; gDeferredSoftenWaterProgram.mFeatures.hasSrgb = true; - gDeferredSoftenWaterProgram.mFeatures.decodesNormal = true; gDeferredSoftenWaterProgram.mFeatures.calculatesAtmospherics = true; gDeferredSoftenWaterProgram.mFeatures.hasAtmospherics = true; gDeferredSoftenWaterProgram.mFeatures.hasTransport = true; @@ -2261,7 +2245,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarAlphaProgram.mFeatures.disableTextureIndex = true; gDeferredAvatarAlphaProgram.mFeatures.hasSrgb = true; gDeferredAvatarAlphaProgram.mFeatures.encodesNormal = true; - gDeferredAvatarAlphaProgram.mFeatures.decodesNormal = true; gDeferredAvatarAlphaProgram.mFeatures.calculatesAtmospherics = true; gDeferredAvatarAlphaProgram.mFeatures.hasAtmospherics = true; gDeferredAvatarAlphaProgram.mFeatures.hasTransport = true; @@ -2427,8 +2410,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (success && gAtmosphere && (mShaderLevel[SHADER_WINDLIGHT] > 2)) { gDeferredGenSkyShProgram.mName = "Deferred Generate Sky Indirect SH Program"; - gDeferredGenSkyShProgram.mFeatures.decodesNormal = true; - 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)); diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp index 570273e62c..08bb2d2b2b 100644 --- a/indra/newview/llvowlsky.cpp +++ b/indra/newview/llvowlsky.cpp @@ -36,10 +36,8 @@ #include "llenvironment.h" #include "llsettingssky.h" -const F32 LLVOWLSky::DISTANCE_TO_STARS = (HORIZON_DIST - 10.f) * 0.8f; - -const U32 LLVOWLSky::MIN_SKY_DETAIL = 8; -const U32 LLVOWLSky::MAX_SKY_DETAIL = 180; +static const U32 MIN_SKY_DETAIL = 8; +static const U32 MAX_SKY_DETAIL = 180; inline U32 LLVOWLSky::getNumStacks(void) { @@ -326,6 +324,8 @@ void LLVOWLSky::drawDome(void) void LLVOWLSky::initStars() { + const F32 DISTANCE_TO_STARS = LLEnvironment::instance().getCurrentSky()->getDomeRadius(); + // Initialize star map mStarVertices.resize(getStarsNumVerts()); mStarColors.resize(getStarsNumVerts()); @@ -528,7 +528,7 @@ BOOL LLVOWLSky::updateStarGeometry(LLDrawable *drawable) LLVector3 left = at%LLVector3(0,0,1); LLVector3 up = at%left; - F32 sc = 0.8f + ll_frand()*2.5f; + F32 sc = 16.0f + (ll_frand() * 20.0f); left *= sc; up *= sc; diff --git a/indra/newview/llvowlsky.h b/indra/newview/llvowlsky.h index 3217d2a7e2..c52acba98b 100644 --- a/indra/newview/llvowlsky.h +++ b/indra/newview/llvowlsky.h @@ -31,13 +31,6 @@ class LLVOWLSky : public LLStaticViewerObject { private: - static const F32 DISTANCE_TO_STARS; - - // anything less than 3 makes it impossible to create a closed dome. - static const U32 MIN_SKY_DETAIL; - // anything bigger than about 180 will cause getStripsNumVerts() to exceed 65535. - static const U32 MAX_SKY_DETAIL; - inline static U32 getNumStacks(void); inline static U32 getNumSlices(void); inline static U32 getStripsNumVerts(void); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 9d8f98688f..0784f3acdd 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -117,10 +117,6 @@ #include "llenvironment.h" -#if LL_WINDOWS -#pragma optimize("", off) -#endif - #ifdef _DEBUG // Debug indices is disabled for now for debug performance - djs 4/24/02 //#define DEBUG_INDICES @@ -9463,12 +9459,14 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) water_clip = -1; } + S32 occlusion = LLPipeline::sUseOcclusion; + + LLPipeline::sUseOcclusion = 0; + if (!LLViewerCamera::getInstance()->cameraUnderWater()) { //generate planar reflection map //disable occlusion culling for reflection map for now - S32 occlusion = LLPipeline::sUseOcclusion; - - LLPipeline::sUseOcclusion = 0; + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); glClearColor(0,0,0,0); @@ -9607,8 +9605,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.popMatrix(); mWaterRef.flush(); - set_current_modelview(current); - LLPipeline::sUseOcclusion = occlusion; + set_current_modelview(current); } camera.setOrigin(camera_in.getOrigin()); @@ -9712,6 +9709,8 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) } last_update = LLDrawPoolWater::sNeedsReflectionUpdate && LLDrawPoolWater::sNeedsDistortionUpdate; + LLPipeline::sUseOcclusion = occlusion; + LLPipeline::sUnderWaterRender = false; LLPipeline::sReflectionRender = false; diff --git a/indra/newview/skins/default/xui/en/floater_pick_track.xml b/indra/newview/skins/default/xui/en/floater_pick_track.xml new file mode 100644 index 0000000000..d8a9877be2 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_pick_track.xml @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> + +<floater + legacy_header_height="0" + can_minimize="false" + can_resize="true" + height="140" + layout="topleft" + min_height="140" + min_width="225" + name="track picker" + help_topic="track_picker" + title="PICK: TRACK" + width="225"> + <layout_stack name="adjuster" + follows="all" + animate="false" + top="0" + left="6" + right="-6" + bottom="-10" + orientation="vertical"> + <layout_panel name="pnl_desc" + border="false" + auto_resize="false" + user_resize="false" + height="11" + min_height="10" + bg_alpha_color="blue" + background_visible="false"> + <text + type="string" + length="1" + follows="left|top" + height="10" + layout="topleft" + left="5" + name="select_description" + mouse_opaque="false" + top="0" + width="300"> + Select source sky: + </text> + </layout_panel> + <layout_panel name="pnl_traks" + border="false" + auto_resize="true" + user_resize="false" + height="29" + min_height="29" + bg_alpha_color="blue" + background_visible="false"> + <radio_group + follows="all" + height="60" + layout="topleft" + top="0" + left="3" + right="-3" + bottom="-3" + name="track_selection" + width="100"> + <radio_item + height="20" + label="Sky4 [ALT]" + layout="topleft" + left="0" + name="radio_sky4" + value="4" + top="0" + width="90" /> + <radio_item + height="20" + label="Sky3 [ALT]" + layout="topleft" + left="0" + name="radio_sky3" + value="3" + top_delta="20" + width="90" /> + <radio_item + height="20" + label="Sky2 [ALT]" + layout="topleft" + left="0" + name="radio_sky2" + value="2" + top_delta="20" + width="90" /> + <radio_item + height="20" + label="Ground" + layout="topleft" + left="0" + name="radio_sky1" + value="1" + top_delta="20" + width="90" /> + </radio_group> + </layout_panel> + <layout_panel name="pnl_ok_cancel" + border="false" + auto_resize="false" + user_resize="false" + height="29" + min_height="29"> + <button + follows="top|left" + height="20" + label="OK" + label_selected="OK" + layout="topleft" + left="2" + top="2" + name="btn_select" + width="100" /> + <button + follows="top|left" + height="20" + label="Cancel" + label_selected="Cancel" + layout="topleft" + left_delta="110" + top_delta="0" + name="btn_cancel" + width="100" /> + </layout_panel> + </layout_stack> +</floater> diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml index 32b6e56acd..77858ecbc4 100644 --- a/indra/newview/skins/default/xui/en/panel_region_environment.xml +++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml @@ -19,6 +19,7 @@ <string name="str_disallowed">The estate manager does not allow changing parcel environments in this region.</string> <string name="str_too_small">The parcel must be at least 128 square meters to support an environment.</string> <string name="str_empty">(empty)</string> + <string name="str_region_env">(region environment)</string> <layout_stack width="530" height="367" @@ -250,7 +251,6 @@ enabled="false" top_delta="3" left_pad="21" - xxxleft="-160" height="20" layout="topleft" name="edt_invname_alt1" @@ -295,7 +295,6 @@ enabled="false" top_delta="3" left_pad="21" - xxxleft="-160" height="20" layout="topleft" name="edt_invname_alt2" 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 e63b7e41b4..2aab41c5a0 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 @@ -78,7 +78,7 @@ decimal_digits="2" follows="left|top" height="16" - increment="0.25" + increment="0.01" initial_value="0" layout="topleft" left_delta="5" @@ -254,7 +254,7 @@ decimal_digits="2" follows="left|top" height="16" - increment="0.25" + increment="0.01" initial_value="0" layout="topleft" left_delta="5" |