diff options
author | Graham Madarasz <graham@lindenlab.com> | 2013-04-24 07:41:30 -0700 |
---|---|---|
committer | Graham Madarasz <graham@lindenlab.com> | 2013-04-24 07:41:30 -0700 |
commit | 339770698c0152d68d9b47ab73f8c6a5d9d8edfe (patch) | |
tree | a9269949595ac8765483c3305907e527c0ac2494 /indra | |
parent | b2cd1144713e4e1bbf77edf6547f633be55ab8ea (diff) | |
parent | 79318043218a9ec6cb6e52eca936487177554903 (diff) |
Merge vwr-dev-mat
Diffstat (limited to 'indra')
5 files changed, 43 insertions, 51 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index 20042f2248..a8efd3e95b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl @@ -161,7 +161,7 @@ void main() pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); #endif - + #endif #ifdef USE_INDEXED_TEX @@ -194,7 +194,7 @@ void main() vary_directional.rgb = atmosAffectDirectionalLight(1.0f); col.rgb = col.rgb*diffuse_color.rgb; - + #ifdef USE_VERTEX_COLOR vertex_color = col; #endif diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 482d0ccc74..33ff98b0d4 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -465,7 +465,7 @@ void main() vec4 final_color = diffcol; -#if (DIFFUSE_ALPHA_MODE != DIFFUSE_ALPHA_MODE_EMISSIVE) +#if DIFFUSE_ALPHA_MODE != DIFFUSE_ALPHA_MODE_EMISSIVE final_color.a = 0; #endif @@ -483,7 +483,7 @@ void main() #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - //forward rendering, output just lit RGBA + //forward rendering, output just lit RGBA vec3 pos = vary_position; #if HAS_SUN_SHADOW @@ -556,13 +556,13 @@ void main() #endif spec = final_specular; - vec4 diffuse = final_color; - float envIntensity = final_normal.z; + vec4 diffuse = final_color; + float envIntensity = final_normal.z; vec3 col = vec3(0.0f,0.0f,0.0f); - float bloom = 0.0; - calcAtmospherics(pos.xyz, 1.0); + float bloom = 0.0; + calcAtmospherics(pos.xyz, 1.0); vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); @@ -577,43 +577,43 @@ void main() col.rgb *= diffuse.rgb; - if (spec.a > 0.0) // specular reflection - { - // the old infinite-sky shiny reflection - // + if (spec.a > 0.0) // specular reflection + { + // the old infinite-sky shiny reflection + // - float sa = dot(refnormpersp, sun_dir.xyz); - vec3 dumbshiny = vary_SunlitColor*shadow*(texture2D(lightFunc, vec2(sa, spec.a)).r); + float sa = dot(refnormpersp, sun_dir.xyz); + vec3 dumbshiny = vary_SunlitColor*shadow*(texture2D(lightFunc, vec2(sa, spec.a)).r); - // add the two types of shiny together - vec3 spec_contrib = dumbshiny * spec.rgb; - bloom = dot(spec_contrib, spec_contrib) / 6; - col += spec_contrib; - } + // add the two types of shiny together + vec3 spec_contrib = dumbshiny * spec.rgb; + bloom = dot(spec_contrib, spec_contrib) / 6; + col += spec_contrib; + } - if (envIntensity > 0.0) - { - //add environmentmap - vec3 env_vec = env_mat * refnormpersp; - col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb, - max(envIntensity-diffuse.a*2.0, 0.0)); - } + if (envIntensity > 0.0) + { + //add environmentmap + vec3 env_vec = env_mat * refnormpersp; + col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb, + max(envIntensity-diffuse.a*2.0, 0.0)); + } - col = atmosLighting(col); - col = scaleSoftClip(col); + col = atmosLighting(col); + col = scaleSoftClip(col); + + vec3 npos = normalize(-pos.xyz); - vec3 npos = normalize(-pos.xyz); - #define LIGHT_LOOP(i) \ col.rgb = col.rgb + calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); - LIGHT_LOOP(1) - LIGHT_LOOP(2) - LIGHT_LOOP(3) - LIGHT_LOOP(4) - LIGHT_LOOP(5) - LIGHT_LOOP(6) - LIGHT_LOOP(7) + LIGHT_LOOP(1) + LIGHT_LOOP(2) + LIGHT_LOOP(3) + LIGHT_LOOP(4) + LIGHT_LOOP(5) + LIGHT_LOOP(6) + LIGHT_LOOP(7) frag_color.rgb = col.rgb; frag_color.a = diffcol.a*vertex_color.a; diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index aedb9ea510..73c85c0419 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -25,10 +25,6 @@ #extension GL_ARB_texture_rectangle : enable -#define INDEXED 1 -#define NON_INDEXED 2 -#define NON_INDEXED_NO_COLOR 3 - #ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_color; #else @@ -228,9 +224,8 @@ void main() col = vec4(0.0f,0.0f,0.0f,0.0f); #define LIGHT_LOOP(i) \ - col.rgb += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, normal, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); - - + col.rgb += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, normal, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); + LIGHT_LOOP(1) LIGHT_LOOP(2) LIGHT_LOOP(3) @@ -240,8 +235,7 @@ void main() LIGHT_LOOP(7) color.rgb += diff.rgb * vary_pointlight_col * col.rgb; - + frag_color = color; - } diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl index b77da75617..127c1709b8 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl @@ -158,7 +158,7 @@ void main() pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); #endif - + #endif #ifdef USE_INDEXED_TEX diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index d760d214be..850bf9677c 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -808,7 +808,7 @@ BOOL LLViewerShaderMgr::loadBasicShaders() { sum_lights_class = 1; } - + #if LL_DARWIN // Work around driver crashes on older Macs when using deferred rendering // NORSPEC-59 @@ -1431,7 +1431,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAlphaProgram.addPermutation("USE_INDEXED_TEX", "1"); gDeferredAlphaProgram.addPermutation("USE_VERTEX_COLOR", "1"); gDeferredAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; - success = gDeferredAlphaProgram.createShader(NULL, NULL); // Hack @@ -1615,7 +1614,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarAlphaProgram.mFeatures.calculatesLighting = true; gDeferredAvatarAlphaProgram.mFeatures.hasLighting = true; } - + if (success) { gDeferredPostGammaCorrectProgram.mName = "Deferred Gamma Correction Post Process"; @@ -3045,4 +3044,3 @@ LLViewerShaderMgr::shader_iter LLViewerShaderMgr::endShaders() const { return mShaderList.end(); } - |