aboutsummaryrefslogtreecommitdiff
path: root/data/shaders/lighting.vert
diff options
context:
space:
mode:
Diffstat (limited to 'data/shaders/lighting.vert')
-rw-r--r--data/shaders/lighting.vert16
1 files changed, 8 insertions, 8 deletions
diff --git a/data/shaders/lighting.vert b/data/shaders/lighting.vert
index 7f9d606..59d026d 100644
--- a/data/shaders/lighting.vert
+++ b/data/shaders/lighting.vert
@@ -9,13 +9,14 @@
*
*/
+varying vec3 pos;
varying vec3 normal;
varying vec3 light0vc;
-varying vec3 light0hvc;
+varying float light0dist;
+
varying vec3 light1vc;
varying vec3 light2vc;
-varying vec3 light2hvc;
varying vec3 col_ambi_diff;
varying vec3 col_emit;
@@ -23,16 +24,16 @@ varying vec3 col_emit;
void main() {
vec4 vert;
- vec4 E;
+ vec3 vert_to_light;
vert = gl_ModelViewMatrix * gl_Vertex;
+ pos = vec3(vert);
normal = gl_NormalMatrix * gl_Normal;
- E = vec4(0.0, 0.0, 1.0, 0.0) - vert;
/* Spotlight - positional light */
- light0vc = vec3(gl_LightSource[0].position - vert);
- light0hvc = normalize(vec3(E) + light0hvc);
- light0vc = normalize(light0vc);
+ vert_to_light = vec3(gl_LightSource[0].position - vert);
+ light0dist = length(vert_to_light);
+ light0vc = normalize(vert_to_light);
/* Diffuse "background glow" - this can be normalised only once, here, since 'position'
* is really 'direction' and is the same for all vertices. */
@@ -40,7 +41,6 @@ void main() {
/* Fill-in light */
light2vc = normalize(vec3(gl_LightSource[2].position));
- light2hvc = normalize(vec3(E) + light2vc);
/* Material properties */
col_ambi_diff = gl_Color.rgb;