~harrison-rt/+junk/jaguar_company

« back to all changes in this revision

Viewing changes to tags/1.6/jaguar_company_1.6.oxp/Shaders/jaguar_company_griff_normalmap_ships.vertex

  • Committer: Richard Harrison
  • Date: 2013-01-19 22:39:57 UTC
  • Revision ID: harrison.rt@gmail.com-20130119223957-lcuzmbsrx6o2bk8o
Tags: 1.6.2
* Bug fix for the ship script.
* Bug fix to the waypoint AI. Never exited the stock AI.
* Cascade Weapon detection actually works for pre v1.77
* Took the opportunity to clean up some files and re-do the textures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifdef OO_TANGENT_ATTR
 
2
attribute vec3  tangent;
 
3
#else
 
4
const vec3      tangent = vec3(1.0, 0.0, 0.0);
 
5
#endif
 
6
 
 
7
varying vec2    vTexCoord;
 
8
varying vec3    vEyeVector;   // These are all in tangent space
 
9
varying vec3    vLight0Vector;
 
10
varying vec3    vLight1Vector;
 
11
 
 
12
void main()
 
13
{
 
14
    vTexCoord = gl_MultiTexCoord0.st;
 
15
    gl_Position = ftransform();
 
16
 
 
17
    // Build tangent basis
 
18
    vec3 n = normalize(gl_NormalMatrix * gl_Normal);
 
19
    vec3 t = normalize(gl_NormalMatrix * tangent);
 
20
    vec3 b = cross(n, t);
 
21
    mat3 TBN = mat3(t, b, n);
 
22
 
 
23
    vec3 eyeVector = -vec3(gl_ModelViewMatrix * gl_Vertex);
 
24
    vEyeVector = eyeVector * TBN;
 
25
 
 
26
#ifdef OO_LIGHT_0_FIX
 
27
    vec3 light0Vector = gl_LightSource[0].position.xyz + eyeVector;
 
28
    vLight0Vector = light0Vector * TBN;
 
29
#endif
 
30
    vec3 light1Vector = gl_LightSource[1].position.xyz + eyeVector;
 
31
    vLight1Vector = light1Vector * TBN;
 
32
}