diff options
author | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2007-12-21 21:36:52 +0000 |
---|---|---|
committer | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2007-12-21 21:36:52 +0000 |
commit | 2660887cf21229a888c5b1c02a6f07e653d1a55b (patch) | |
tree | 84868e33064cc9a7c61aaceb898971b66986e9b8 /data/light-pp.frag | |
parent | a956795a03969c5aec307474400be402388c1430 (diff) |
Fun with shaders
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@235 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'data/light-pp.frag')
-rw-r--r-- | data/light-pp.frag | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/data/light-pp.frag b/data/light-pp.frag new file mode 100644 index 0000000..c862641 --- /dev/null +++ b/data/light-pp.frag @@ -0,0 +1,40 @@ +/* + * light-pp.frag + * + * Lighting per pixel + * + * (c) 2007 Thomas White <taw27@cam.ac.uk> + * + * dtr - Diffraction Tomography Reconstruction + * + */ + +varying vec4 col_ambi; +varying vec4 col_diff; +varying vec4 col_spec; +varying float shininess; + +varying vec3 normal; +varying vec3 halfvc; + +void main() { + + vec4 ambi; + vec4 diff; + vec4 spec; + + /* Ambient contribution */ + ambi = col_ambi * gl_LightModel.ambient; + ambi += col_ambi * gl_LightSource[0].ambient; + + /* Diffuse contribution */ + diff = col_diff * clamp(dot( vec3(normalize(gl_LightSource[0].position)), normal ), 0.0, 1.0); + + /* Specular contribution */ + spec = col_spec * pow(dot( vec3(normal), halfvc ), shininess); + + gl_FragColor = ambi + diff + spec; + gl_FragColor.a = 1.0; + +} + |