diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/app_settings/shaders/class2/objects | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/app_settings/shaders/class2/objects')
4 files changed, 102 insertions, 0 deletions
diff --git a/linden/indra/newview/app_settings/shaders/class2/objects/alphaF.glsl b/linden/indra/newview/app_settings/shaders/class2/objects/alphaF.glsl new file mode 100644 index 0000000..97feb55 --- /dev/null +++ b/linden/indra/newview/app_settings/shaders/class2/objects/alphaF.glsl | |||
@@ -0,0 +1,18 @@ | |||
1 | vec4 getLightColor(); | ||
2 | void applyScatter(inout vec3 col); | ||
3 | |||
4 | uniform samplerCube environmentMap; | ||
5 | uniform sampler2D diffuseMap; | ||
6 | |||
7 | void main() | ||
8 | { | ||
9 | vec4 diff = texture2D(diffuseMap, gl_TexCoord[0].xy); | ||
10 | vec3 ref = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb; | ||
11 | vec4 specular = gl_TexCoord[2]; | ||
12 | vec3 col = mix(getLightColor().rgb * diff.rgb, ref, specular.a)+specular.rgb*diff.rgb; | ||
13 | |||
14 | applyScatter(col); | ||
15 | |||
16 | gl_FragColor.rgb = col.rgb; | ||
17 | gl_FragColor.a = diff.a*gl_Color.a; | ||
18 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/objects/alphaV.glsl b/linden/indra/newview/app_settings/shaders/class2/objects/alphaV.glsl new file mode 100644 index 0000000..baf5323 --- /dev/null +++ b/linden/indra/newview/app_settings/shaders/class2/objects/alphaV.glsl | |||
@@ -0,0 +1,24 @@ | |||
1 | vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol); | ||
2 | void default_scatter(vec3 viewVec, vec3 lightDir); | ||
3 | |||
4 | attribute vec4 materialColor; | ||
5 | attribute vec4 specularColor; | ||
6 | |||
7 | void main() | ||
8 | { | ||
9 | //transform vertex | ||
10 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
11 | gl_TexCoord[0] = gl_MultiTexCoord0; | ||
12 | |||
13 | vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz; | ||
14 | vec3 norm = normalize(gl_NormalMatrix * gl_Normal); | ||
15 | vec4 spec = specularColor; | ||
16 | gl_FrontColor.rgb = calcLightingSpecular(pos, norm, materialColor, spec, gl_Color).rgb; | ||
17 | gl_FrontColor.a = materialColor.a; | ||
18 | gl_TexCoord[2] = spec; | ||
19 | vec3 ref = reflect(pos,norm); | ||
20 | gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1); | ||
21 | |||
22 | default_scatter(pos.xyz, gl_LightSource[0].position.xyz); | ||
23 | } | ||
24 | |||
diff --git a/linden/indra/newview/app_settings/shaders/class2/objects/bumpshinyF.glsl b/linden/indra/newview/app_settings/shaders/class2/objects/bumpshinyF.glsl new file mode 100644 index 0000000..7462bb1 --- /dev/null +++ b/linden/indra/newview/app_settings/shaders/class2/objects/bumpshinyF.glsl | |||
@@ -0,0 +1,29 @@ | |||
1 | vec4 getLightColor(); | ||
2 | void applyScatter(inout vec3 col); | ||
3 | |||
4 | uniform samplerCube environmentMap; | ||
5 | uniform sampler2D diffuseMap; | ||
6 | uniform sampler2D bumpMap; | ||
7 | |||
8 | |||
9 | void main() | ||
10 | { | ||
11 | vec4 diff = texture2D(diffuseMap, gl_TexCoord[0].xy); | ||
12 | vec3 ref = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb; | ||
13 | |||
14 | vec4 specular = gl_TexCoord[3]; | ||
15 | |||
16 | float b = texture2D(bumpMap, gl_TexCoord[0].xy).a; | ||
17 | b -= texture2D(bumpMap, gl_TexCoord[2].xy).a; | ||
18 | |||
19 | vec3 col = mix(getLightColor().rgb * diff.rgb, ref, specular.a)+specular.rgb*diff.rgb; | ||
20 | col += col * b; | ||
21 | float m = (col.r + col.g + col.b); | ||
22 | m *= 1.0/3.0; | ||
23 | col = mix(col, vec3(m), -specular.a*specular.a); | ||
24 | |||
25 | applyScatter(col); | ||
26 | |||
27 | gl_FragColor.rgb = col; | ||
28 | gl_FragColor.a = diff.a; | ||
29 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/objects/bumpshinyV.glsl b/linden/indra/newview/app_settings/shaders/class2/objects/bumpshinyV.glsl new file mode 100644 index 0000000..037b282 --- /dev/null +++ b/linden/indra/newview/app_settings/shaders/class2/objects/bumpshinyV.glsl | |||
@@ -0,0 +1,31 @@ | |||
1 | vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol); | ||
2 | void default_scatter(vec3 viewVec, vec3 lightDir); | ||
3 | |||
4 | attribute vec4 materialColor; | ||
5 | attribute vec4 specularColor; | ||
6 | attribute vec4 binormal; | ||
7 | |||
8 | void main() | ||
9 | { | ||
10 | //transform vertex | ||
11 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
12 | gl_TexCoord[0] = gl_MultiTexCoord0; | ||
13 | |||
14 | vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz; | ||
15 | vec3 norm = normalize(gl_NormalMatrix * gl_Normal); | ||
16 | vec3 binorm = normalize(gl_NormalMatrix * binormal.xyz); | ||
17 | vec3 tangent = cross(binorm, norm); | ||
18 | binorm.xy = vec2(dot(tangent, gl_LightSource[0].position.xyz), | ||
19 | dot(binorm, gl_LightSource[0].position.xyz))*1.0/128.0; | ||
20 | |||
21 | vec4 spec = specularColor; | ||
22 | gl_FrontColor.rgb = calcLightingSpecular(pos, norm, materialColor, spec, gl_Color).rgb; | ||
23 | gl_TexCoord[3] = spec; | ||
24 | gl_FrontColor.a = materialColor.a; | ||
25 | vec3 ref = reflect(pos,norm); | ||
26 | gl_TexCoord[1].xyz = (gl_TextureMatrix[1]*vec4(ref,1.0)).xyz; | ||
27 | gl_TexCoord[2].xy = binorm.xy + gl_MultiTexCoord0.xy; | ||
28 | |||
29 | default_scatter(pos.xyz, gl_LightSource[0].position.xyz); | ||
30 | } | ||
31 | |||