diff options
author | Dave Parks <davep@lindenlab.com> | 2011-08-19 16:34:34 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-08-19 16:34:34 -0500 |
commit | 233e42b3314c17b2e24334587d960af6e3dc963c (patch) | |
tree | 480e571bf913bb0743c3c6c6ce846a69aa405504 /indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl | |
parent | 0e496309d6cb7581c9f69b7da244699c382750ac (diff) | |
parent | 80398b3ccb0c4a6ff3ac20b3565619fe5cecc2f9 (diff) |
merge
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index f6a280462e..7a2f34ca1d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl @@ -23,7 +23,10 @@ * $/LicenseInfo$ */ - +attribute vec4 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -80,22 +83,22 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa void main() { //transform vertex - vec4 vert = vec4(gl_Vertex.xyz, 1.0); - vary_texture_index = gl_Vertex.w; - gl_Position = gl_ModelViewProjectionMatrix * vert; + vec4 vert = vec4(position.xyz, 1.0); + vary_texture_index = position.w; + vec4 pos = (gl_ModelViewMatrix * vert); + gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); - vec4 pos = (gl_ModelViewMatrix * vert); - vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + vec3 norm = normalize(gl_NormalMatrix * normal); float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz)); vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset; calcAtmospherics(pos.xyz); - //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); - vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a); + //vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); + vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a); // Collect normal lights col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a); @@ -105,7 +108,7 @@ void main() col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a); col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a); - vary_pointlight_col = col.rgb*gl_Color.rgb; + vary_pointlight_col = col.rgb*diffuse_color.rgb; col.rgb = vec3(0,0,0); @@ -114,10 +117,10 @@ void main() vary_light = gl_LightSource[0].position.xyz; - vary_ambient = col.rgb*gl_Color.rgb; - vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); + vary_ambient = col.rgb*diffuse_color.rgb; + vary_directional.rgb = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a))); - col.rgb = col.rgb*gl_Color.rgb; + col.rgb = col.rgb*diffuse_color.rgb; gl_FrontColor = col; |