~ubuntu-branches/ubuntu/raring/glmark2/raring

« back to all changes in this revision

Viewing changes to data/shaders/light-advanced.frag

  • Committer: Package Import Robot
  • Author(s): Ricardo Salveti de Araujo
  • Date: 2012-08-21 15:38:09 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20120821153809-bwux72bat8qp2n5v
Tags: 2012.08-0ubuntu1
* New upstream release 2012.08 (LP: #1039736)
  - Avoid crashing if gl used is not >= 2.0 (LP: #842279)
* Bumping dh compatibility level to v9
* debian/control:
  - Update Standards-Version to 3.9.3.
  - Add libjpeg-dev build dependency.
  - Use libegl1-x11-dev as an build-dep alternative instead of libegl1-dev.
  - Update description of glmark2-data binary package.
* debian/copyright:
  - Refresh copyright based on the current upstrem version
* debian/rules:
  - Clean compiled python code from unpacked waflib/ directory, as
    described in http://wiki.debian.org/UnpackWaf

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
varying vec3 Normal;
2
 
 
3
 
void main(void)
4
 
{
5
 
    const vec4 LightSourceAmbient = vec4(0.1, 0.1, 0.1, 1.0);
6
 
    const vec4 LightSourceDiffuse = vec4(0.8, 0.8, 0.8, 1.0);
7
 
    const vec4 LightSourceSpecular = vec4(0.8, 0.8, 0.8, 1.0);
8
 
    const vec4 MaterialAmbient = vec4(1.0, 1.0, 1.0, 1.0);
9
 
    const vec4 MaterialDiffuse = vec4(0.0, 0.0, 1.0, 1.0);
10
 
    const vec4 MaterialSpecular = vec4(1.0, 1.0, 1.0, 1.0);
11
 
    const float MaterialShininess = 100.0;
12
 
 
13
 
    vec3 N = normalize(Normal);
14
 
 
15
 
    // In the lighting model we are using here (Blinn-Phong with light at
16
 
    // infinity, viewer at infinity), the light position/direction and the
17
 
    // half vector is constant for the all the fragments.
18
 
    vec3 L = normalize(LightSourcePosition.xyz);
19
 
    vec3 H = normalize(LightSourceHalfVector);
20
 
 
21
 
    // Calculate the diffuse color according to Lambertian reflectance
22
 
    vec4 diffuse = MaterialDiffuse * LightSourceDiffuse * max(dot(N, L), 0.0);
23
 
 
24
 
    // Calculate the ambient color
25
 
    vec4 ambient = MaterialAmbient * LightSourceAmbient;
26
 
 
27
 
    // Calculate the specular color according to the Blinn-Phong model
28
 
    vec4 specular = MaterialSpecular * LightSourceSpecular *
29
 
                    pow(max(dot(N,H), 0.0), MaterialShininess);
30
 
 
31
 
    // Calculate the final color
32
 
    gl_FragColor = ambient + specular + diffuse;
33
 
}
 
1
varying vec3 Normal;
 
2
 
 
3
void main(void)
 
4
{
 
5
    const vec4 LightSourceAmbient = vec4(0.1, 0.1, 0.1, 1.0);
 
6
    const vec4 LightSourceDiffuse = vec4(0.8, 0.8, 0.8, 1.0);
 
7
    const vec4 LightSourceSpecular = vec4(0.8, 0.8, 0.8, 1.0);
 
8
    const vec4 MaterialAmbient = vec4(1.0, 1.0, 1.0, 1.0);
 
9
    const vec4 MaterialDiffuse = vec4(0.0, 0.0, 1.0, 1.0);
 
10
    const vec4 MaterialSpecular = vec4(1.0, 1.0, 1.0, 1.0);
 
11
    const float MaterialShininess = 100.0;
 
12
 
 
13
    vec3 N = normalize(Normal);
 
14
 
 
15
    // In the lighting model we are using here (Blinn-Phong with light at
 
16
    // infinity, viewer at infinity), the light position/direction and the
 
17
    // half vector is constant for the all the fragments.
 
18
    vec3 L = normalize(LightSourcePosition.xyz);
 
19
    vec3 H = normalize(LightSourceHalfVector);
 
20
 
 
21
    // Calculate the diffuse color according to Lambertian reflectance
 
22
    vec4 diffuse = MaterialDiffuse * LightSourceDiffuse * max(dot(N, L), 0.0);
 
23
 
 
24
    // Calculate the ambient color
 
25
    vec4 ambient = MaterialAmbient * LightSourceAmbient;
 
26
 
 
27
    // Calculate the specular color according to the Blinn-Phong model
 
28
    vec4 specular = MaterialSpecular * LightSourceSpecular *
 
29
                    pow(max(dot(N,H), 0.0), MaterialShininess);
 
30
 
 
31
    // Calculate the final color
 
32
    gl_FragColor = vec4((ambient + specular + diffuse).xyz, 1.0);
 
33
}