23
23
//---------------------------------------------------------------------------
25
#include "WGELighting-vertex.glsl"
27
#include "WGETransformationTools.glsl"
28
// The ray's starting point in texture space
29
varying vec3 v_rayStart;
31
// The ray direction in texture space
34
27
// the Surface normal at this point
35
28
varying vec3 v_normal;
37
// The light source in local coordinates
38
varying vec3 v_lightSource;
45
// transform the ray direction to texture space, which equals object space
46
// Therefore use two points, as we transform a vector
47
vec4 camLookAt = vec4( 0.0, 0.0, -1.0, 1.0 );
48
vec4 camPos = vec4( 0.0, 0.0, 0.0, 1.0 );
49
v_ray = worldToLocal( camLookAt, camPos ).xyz;
51
// also get the coordinates of the light
52
vec4 lpos = gl_LightSource[0].position;
53
lpos = vec4( 0.0, 0.0, 1000.0, 1.0 );
54
v_lightSource = worldToLocal( lpos ).xyz;
32
v_normal = gl_NormalMatrix * gl_Normal;
55
34
gl_FrontColor = gl_Color;
57
35
gl_Position = ftransform();