summaryrefslogtreecommitdiffstats
path: root/shader/default.frag
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-12-18 13:31:07 +0100
committerMatthias Schiffer <matthias@gamezock.de>2009-12-18 13:31:07 +0100
commit4e3efa239c9bcb5dd26b4ad9a4d43d4d6a266e6f (patch)
treee39e9698513687a3213ecae7eab942bce88b12d6 /shader/default.frag
parentb3b74dc2afe4c67a6b74c2a681aa7bbad7077511 (diff)
downloadzoom++-4e3efa239c9bcb5dd26b4ad9a4d43d4d6a266e6f.tar
zoom++-4e3efa239c9bcb5dd26b4ad9a4d43d4d6a266e6f.zip
Use multi-pass rendering with seperate ambient and light shaders
Diffstat (limited to 'shader/default.frag')
-rw-r--r--shader/default.frag43
1 files changed, 0 insertions, 43 deletions
diff --git a/shader/default.frag b/shader/default.frag
deleted file mode 100644
index e2acad0..0000000
--- a/shader/default.frag
+++ /dev/null
@@ -1,43 +0,0 @@
-uniform sampler2D tex;
-
-varying vec4 diffuse, ambientGlobal, ambient;
-varying vec3 normal, pos;
-
-
-void main() {
- vec3 n, l, refl, eye;
- float NdotL, RdotE;
- vec4 color, specularColor;
- float dist, att, specularFactor;
-
- color = ambientGlobal;
-
- n = normalize(normal);
-
- l = gl_LightSource[0].position.xyz - pos;
-
- dist = length(l);
- l /= dist;
-
- /* compute the dot product between normal and normalized lightdir */
- NdotL = max(dot(n, l), 0.0);
-
- if (NdotL > 0.0) {
- att = 1.0 / (gl_LightSource[0].constantAttenuation +
- gl_LightSource[0].linearAttenuation * dist +
- gl_LightSource[0].quadraticAttenuation * dist * dist);
- color += att * (diffuse * NdotL + ambient);
-
- refl = normalize(reflect(-l, n));
- eye = normalize(-pos);
-
- RdotE = max(dot(refl, eye), 0.0);
- specularFactor = att * pow(RdotE, gl_FrontMaterial.shininess);
- specularColor = specularFactor * gl_FrontMaterial.specular * gl_LightSource[0].specular;
- }
- else {
- specularColor = vec4(0, 0, 0, 1);
- }
-
- gl_FragColor = color * texture2D(tex, gl_TexCoord[0].st) + specularColor;
-}