~ubuntu-branches/debian/sid/coin2/sid

« back to all changes in this revision

Viewing changes to data/shaders/lights/DirSpotLight.glsl

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2008-06-28 02:38:17 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080628023817-lgrh0u677j1gcqgf
Tags: 2.5.0-2
* debian/control: Change suggests from libopenal0 to libopenal0a.
  Closes: #488001.  Change ${Source-Version} to ${binary:Version}.
  Update to standards version 3.8.0.

* debian/rules: Do not ignore errors in clean rule.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
float DirSpotLight(in int i, 
 
2
                             in vec3 eye, 
 
3
                             in vec3 ecPosition3,
 
4
                             in vec3 normal,
 
5
                             inout vec4 ambient,
 
6
                             inout vec4 diffuse,
 
7
                             inout vec4 specular)
 
8
{
 
9
  float nDotVP;
 
10
  float nDotHV;
 
11
  float pf;
 
12
  vec3 dir = -normalize(vec3(gl_LightSource[i].spotDirection));
 
13
  vec3 hv = normalize(eye + dir);
 
14
  nDotVP = max(0.0, dot(normal, dir));
 
15
  nDotHV = max(0.0, dot(normal, hv));
 
16
  float shininess = gl_FrontMaterial.shininess;
 
17
  if (nDotVP == 0.0)
 
18
    pf = 0.0;
 
19
  else
 
20
    pf = pow(nDotHV, shininess);
 
21
 
 
22
  ambient += gl_LightSource[i].ambient;
 
23
  diffuse += gl_LightSource[i].diffuse * nDotVP;
 
24
  specular += gl_LightSource[i].specular * pf;
 
25
  return length(vec3(gl_LightSource[i].position) - ecPosition3);
 
26
}