diff options
author | Dave Parks <davep@lindenlab.com> | 2011-10-28 16:26:20 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-10-28 16:26:20 -0500 |
commit | 969aa248a4c398dd0608a447f99cf74683d09f65 (patch) | |
tree | 2324ed739146db02597a27e186b7d3841c2d45fd | |
parent | 735708583fc6e236df3ad6d4c9a5f02b6ec7605a (diff) |
SH-2633 Fix for avatar hair turning white when editing appearance
7 files changed, 34 insertions, 24 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index afb19fce55..97aeae548a 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1142,16 +1142,6 @@ void LLRender::syncMatrices() { stop_glerror(); - GLenum mode[] = - { - GL_MODELVIEW, - GL_PROJECTION, - GL_TEXTURE, - GL_TEXTURE, - GL_TEXTURE, - GL_TEXTURE, - }; - U32 name[] = { LLShaderMgr::MODELVIEW_MATRIX, @@ -1272,6 +1262,16 @@ void LLRender::syncMatrices() } else if (!LLGLSLShader::sNoFixedFunction) { + GLenum mode[] = + { + GL_MODELVIEW, + GL_PROJECTION, + GL_TEXTURE, + GL_TEXTURE, + GL_TEXTURE, + GL_TEXTURE, + }; + for (U32 i = 0; i < 2; ++i) { if (mMatHash[i] != mCurMatHash[i]) diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl index 2901e18db8..19203ab670 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl @@ -32,6 +32,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; +uniform vec4 color; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); @@ -61,8 +62,8 @@ void main() calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0,0,0,0)); - vertex_color = color; + vec4 col = calcLighting(pos.xyz, norm, color, vec4(0,0,0,0)); + vertex_color = col; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl index acbc3f7e15..d7b90978ba 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl @@ -52,6 +52,8 @@ VARYING vec2 vary_texcoord0; uniform float near_clip; +uniform vec4 color; + uniform vec4 light_position[8]; uniform vec3 light_direction[8]; uniform vec3 light_attenuation[8]; @@ -123,17 +125,17 @@ void main() col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].y, light_attenuation[6].z); col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].y, light_attenuation[7].z); - vary_pointlight_col = col.rgb; + vary_pointlight_col = col.rgb*color.rgb; col.rgb = vec3(0,0,0); // Add windlight lights col.rgb = atmosAmbient(vec3(0.)); - vary_ambient = col.rgb; - vary_directional = atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), 0.0)); + vary_ambient = col.rgb*color.rgb; + vary_directional = color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), 0.0)); - col.rgb = min(col.rgb, 1.0); + col.rgb = col.rgb * color.rgb; vertex_color = col; diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl index 706627e175..0be52a52af 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl @@ -28,6 +28,8 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; +uniform vec4 color; + ATTRIBUTE vec3 position; ATTRIBUTE vec3 normal; ATTRIBUTE vec2 texcoord0; @@ -50,8 +52,8 @@ void main() calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.)); - vertex_color = color; + vec4 col = calcLighting(pos.xyz, norm, color, vec4(0.)); + vertex_color = col; } diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl index 63c7a6b13d..9c7a332417 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl @@ -49,6 +49,7 @@ VARYING vec3 vary_pointlight_col; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; +uniform vec4 color; uniform float near_clip; uniform float shadow_offset; @@ -125,17 +126,17 @@ void main() col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].y, light_attenuation[6].z); col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].y, light_attenuation[7].z); - vary_pointlight_col = col.rgb; + vary_pointlight_col = col.rgb*color.rgb; col.rgb = vec3(0,0,0); // Add windlight lights col.rgb = atmosAmbient(vec3(0.)); - vary_ambient = col.rgb; + vary_ambient = col.rgb*color.rgb; vary_directional = atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), 0.0)); - col.rgb = min(col.rgb, 1.0); + col.rgb = col.rgb*color.rgb; vertex_color = col; diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl index 01605e5b25..ba2ed6b1ce 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl @@ -27,6 +27,7 @@ VARYING vec3 vary_AdditiveColor; VARYING float vary_AtmosAttenuation; +vec3 additive_color; vec3 atmos_attenuation; vec3 sunlit_color; vec3 amblit_color; @@ -43,7 +44,7 @@ vec3 getAmblitColor() vec3 getAdditiveColor() { - return vary_AdditiveColor; + return additive_color; } vec3 getAtmosAttenuation() { @@ -72,6 +73,7 @@ void setAmblitColor(vec3 v) void setAdditiveColor(vec3 v) { + additive_color = v; vary_AdditiveColor = v; } diff --git a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl index 7fb3cb6552..721054b5ad 100644 --- a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl @@ -37,6 +37,8 @@ vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); void calcAtmospherics(vec3 inPositionEye); +uniform vec4 color; + uniform vec4 gWindDir; uniform vec4 gSinWaveParams; uniform vec4 gGravity; @@ -125,8 +127,8 @@ void main() calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.0)); - vertex_color = color; + vec4 col = calcLighting(pos.xyz, norm, color, vec4(0.0)); + vertex_color = col; gl_Position = projection_matrix * pos; } |