~baltix/+junk/irrlicht-test

« back to all changes in this revision

Viewing changes to media/opengl.vert

  • Committer: Mantas Kriaučiūnas
  • Date: 2011-07-18 13:06:25 UTC
  • Revision ID: mantas@akl.lt-20110718130625-c5pvifp61e7kj1ol
Included whole irrlicht SVN libraries to work around launchpad recipe issue with quilt, see https://answers.launchpad.net/launchpad/+question/165193

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
uniform mat4 mWorldViewProj;
 
3
uniform mat4 mInvWorld;
 
4
uniform mat4 mTransWorld;
 
5
uniform vec3 mLightPos;
 
6
uniform vec4 mLightColor;
 
7
 
 
8
void main(void)
 
9
{
 
10
        gl_Position = mWorldViewProj * gl_Vertex;
 
11
        
 
12
        vec4 normal = vec4(gl_Normal, 0.0);
 
13
        normal = mInvWorld * normal;
 
14
        normal = normalize(normal);
 
15
        
 
16
        vec4 worldpos = gl_Vertex * mTransWorld;
 
17
        
 
18
        vec4 lightVector = worldpos - vec4(mLightPos,1.0);
 
19
        lightVector = normalize(lightVector);
 
20
        
 
21
        float tmp2 = dot(-lightVector, normal);
 
22
        
 
23
        vec4 tmp = mLightColor * tmp2;
 
24
        gl_FrontColor = gl_BackColor = vec4(tmp.x, tmp.y, tmp.z, 0.0);
 
25
        
 
26
        gl_TexCoord[0] = gl_MultiTexCoord0;
 
27
}