diff options
| author | Dave Parks <davep@lindenlab.com> | 2010-08-26 14:23:12 -0500 | 
|---|---|---|
| committer | Dave Parks <davep@lindenlab.com> | 2010-08-26 14:23:12 -0500 | 
| commit | 71de5f622a7917f78823a7e7840194e1b0f8f070 (patch) | |
| tree | 1bfa580e5262ae6a8271ade6aee08f21a019c688 /indra/newview/app_settings/shaders/class1/deferred | |
| parent | fc7a3f6daab94331aab52983caee5c68db8cd772 (diff) | |
Add missing files from viewer-experimental
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
5 files changed, 186 insertions, 0 deletions
| diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl new file mode 100644 index 0000000000..fde0e97713 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl @@ -0,0 +1,75 @@ +/**  + * @file alphaSkinnedV.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +mat4 getObjectSkinnedTransform(); +void calcAtmospherics(vec3 inPositionEye); + +float calcDirectionalLight(vec3 n, vec3 l); +float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight); + +vec3 atmosAmbient(vec3 light); +vec3 atmosAffectDirectionalLight(float lightIntensity); +vec3 scaleDownLight(vec3 light); +vec3 scaleUpLight(vec3 light); + +varying vec3 vary_position; +varying vec3 vary_ambient; +varying vec3 vary_directional; +varying vec3 vary_normal; +varying vec3 vary_light; + +void main() +{ +	gl_TexCoord[0] = gl_MultiTexCoord0; +				 +	vec4 pos; +	vec3 norm; +	 +	mat4 trans = getObjectSkinnedTransform(); +	trans = gl_ModelViewMatrix * trans; +	 +	pos = trans * gl_Vertex; +	 +	norm = gl_Vertex.xyz + gl_Normal.xyz; +	norm = normalize(( trans*vec4(norm, 1.0) ).xyz-pos.xyz); +	 +	gl_Position = gl_ProjectionMatrix * pos; +	 +	vary_position = pos.xyz; +	vary_normal = norm;	 +	 +	calcAtmospherics(pos.xyz); + +	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a); + +	// Collect normal lights (need to be divided by two, as we later multiply by 2) +	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].specular.a); +	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].specular.a); +	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].specular.a); +	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].specular.a); +	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].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].specular.a); +	col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz); +	col.rgb = scaleDownLight(col.rgb); +	 +	// Add windlight lights +	col.rgb += atmosAmbient(vec3(0.)); +	 +	vary_light = gl_LightSource[0].position.xyz; +	 +	vary_ambient = col.rgb*gl_Color.rgb; +	vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); +	 +	col.rgb = min(col.rgb*gl_Color.rgb, 1.0); +	 +	gl_FrontColor = col; + +	gl_FogFragCoord = pos.z; +} + + diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl new file mode 100644 index 0000000000..085ffddeec --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl @@ -0,0 +1,16 @@ +/**  + * @file avatarShadowF.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +uniform sampler2D diffuseMap; + + +void main()  +{ +	//gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy).a); +	gl_FragColor = vec4(1,1,1,1); +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl new file mode 100644 index 0000000000..1626e21cd8 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl @@ -0,0 +1,25 @@ +/**  + * @file diffuseSkinnedV.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#version 120 + +mat4 getObjectSkinnedTransform(); + +void main() +{ +	//transform vertex +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	 +	mat4 mat = getObjectSkinnedTransform(); +	 +	mat = gl_ModelViewMatrix * mat; +	vec3 pos = (mat*gl_Vertex).xyz; +	 +	gl_FrontColor = gl_Color; +	 +	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl new file mode 100644 index 0000000000..d884f2e4a5 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl @@ -0,0 +1,37 @@ +/**  + * @file bumpV.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#version 120 + +varying vec3 vary_mat0; +varying vec3 vary_mat1; +varying vec3 vary_mat2; + +mat4 getObjectSkinnedTransform(); + +void main() +{ +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	 +	mat4 mat = getObjectSkinnedTransform(); +	 +	mat = gl_ModelViewMatrix * mat; +	 +	vec3 pos = (mat*gl_Vertex).xyz; +	 +	 +	vec3 n = normalize((mat * vec4(gl_Normal.xyz+gl_Vertex.xyz, 1.0)).xyz-pos.xyz); +	vec3 b = normalize((mat * vec4(gl_MultiTexCoord2.xyz+gl_Vertex.xyz, 1.0)).xyz-pos.xyz); +	vec3 t = cross(b, n); +	 +	vary_mat0 = vec3(t.x, b.x, n.x); +	vary_mat1 = vec3(t.y, b.y, n.y); +	vary_mat2 = vec3(t.z, b.z, n.z); +	 +	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); +	gl_FrontColor = gl_Color; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl new file mode 100644 index 0000000000..9a45c03237 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl @@ -0,0 +1,33 @@ +/**  + * @file diffuseSkinnedV.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#version 120 + +varying vec3 vary_normal; + +mat4 getObjectSkinnedTransform(); + +void main() +{ +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	 +	mat4 mat = getObjectSkinnedTransform(); +	 +	mat = gl_ModelViewMatrix * mat; +	vec3 pos = (mat*gl_Vertex).xyz; +	 +	vec4 norm = gl_Vertex; +	norm.xyz += gl_Normal.xyz; +	norm.xyz = (mat*norm).xyz; +	norm.xyz = normalize(norm.xyz-pos.xyz); + +	vary_normal = norm.xyz; +			 +	gl_FrontColor = gl_Color; +	 +	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); +} | 
