mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 12:52:46 +00:00
Get the lights working (as such).
They work nicely now when the normal map and texture are bypassed (don't know what texture is getting used currently).
This commit is contained in:
parent
8c5e278bf8
commit
a032aa5adf
2 changed files with 8 additions and 4 deletions
|
@ -35,9 +35,12 @@ calc_light (vec3 n, int ind)
|
|||
{
|
||||
vec3 d;
|
||||
light l = lights[ind];
|
||||
float mag;
|
||||
|
||||
d = l.position.xyz - position;
|
||||
return l.color.rgb * (l.position.w * dot (d, n) / dot (d, d));
|
||||
d = position - l.position.xyz;
|
||||
mag = dot (d, n);
|
||||
mag = max (0.0, mag);
|
||||
return l.color.rgb * (l.position.w * mag / dot (d, d));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -67,9 +67,10 @@ main (void)
|
|||
// but probably good enough)
|
||||
t = qmult (q0, vtangent.xyz);
|
||||
#else
|
||||
mat3 nm = mat3 (m[0].xyz, m[1].xyz, m[2].xyz);
|
||||
v = (m * vec4 (vposition, 1.0)).xyz;
|
||||
n = (m * vec4 (vnormal, 1.0)).xyz;
|
||||
t = (m * vec4 (vtangent.xyz, 1.0)).xyz;
|
||||
n = nm * vnormal;
|
||||
t = nm * vtangent.xyz;
|
||||
#endif
|
||||
position = v * 8.0;
|
||||
normal = norm_mat * n;
|
||||
|
|
Loading…
Reference in a new issue