Scale the light level index correctly before colormap lookup.

With this, lighting seems to be working. I'm not certain the normals are
100% correct, but I can see something happening on rotating models.
This commit is contained in:
Bill Currie 2012-01-03 19:57:47 +09:00
parent e8f863c76f
commit 209c4cda8b

View file

@ -18,7 +18,8 @@ main (void)
d = dot (normal, lightvec); d = dot (normal, lightvec);
d = min (d, 0.0); d = min (d, 0.0);
light = 255.0 - light;
light += d * shadelight; light += d * shadelight;
col = texture2D (colormap, vec2 (pix, light)).r; col = texture2D (colormap, vec2 (pix, light / 255.0)).r;
gl_FragColor = texture2D (palette, vec2 (col, 0.5)); gl_FragColor = texture2D (palette, vec2 (col, 0.5));
} }