intravenous

view sdr/vein.v.glsl @ 6:2723dc026c4f

collision detection
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 23 Apr 2012 21:43:10 +0300
parents c6a6a64df6de
children
line source
1 attribute vec3 attr_tang;
3 varying vec3 vpos;
4 varying vec3 ldir, vdir;
6 void main()
7 {
8 gl_Position = ftransform();
9 vpos = (gl_ModelViewMatrix * gl_Vertex).xyz;
10 vec3 norm = gl_NormalMatrix * gl_Normal;
11 vec3 tang = gl_NormalMatrix * attr_tang;
13 vec3 n = normalize(norm);
14 vec3 t = normalize(tang);
15 vec3 b = cross(n, t);
17 mat3 tbn_mat = mat3(
18 t.x, b.x, n.x,
19 t.y, b.y, n.y,
20 t.z, b.z, n.z);
21 ldir = tbn_mat * vec3(0, 0, 1);
22 vdir = tbn_mat * -vpos;
24 gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
25 }