Fix for non spot lamps calculating spot values
Logical error in D1378, also incorrectly used lamp type as a flag.
This commit is contained in:
parent
a0a66e0418
commit
72bf5d13e6
@ -2164,22 +2164,17 @@ static void gpu_lamp_calc_winmat(GPULamp *lamp)
|
||||
wsize = lamp->la->shadow_frustum_size;
|
||||
orthographic_m4(lamp->winmat, -wsize, wsize, -wsize, wsize, lamp->d, lamp->clipend);
|
||||
}
|
||||
else {
|
||||
else if (lamp->type == LA_SPOT) {
|
||||
angle = saacos(lamp->spotsi);
|
||||
temp = 0.5f * lamp->size * cosf(angle) / sinf(angle);
|
||||
pixsize = lamp->d / temp;
|
||||
wsize = pixsize * 0.5f * lamp->size;
|
||||
if (lamp->type & LA_SPOT) {
|
||||
/* compute shadows according to X and Y scaling factors */
|
||||
perspective_m4(
|
||||
lamp->winmat,
|
||||
-wsize * lamp->spotvec[0], wsize * lamp->spotvec[0],
|
||||
-wsize * lamp->spotvec[1], wsize * lamp->spotvec[1],
|
||||
lamp->d, lamp->clipend);
|
||||
}
|
||||
else {
|
||||
perspective_m4(lamp->winmat, -wsize, wsize, -wsize, wsize, lamp->d, lamp->clipend);
|
||||
}
|
||||
/* compute shadows according to X and Y scaling factors */
|
||||
perspective_m4(
|
||||
lamp->winmat,
|
||||
-wsize * lamp->spotvec[0], wsize * lamp->spotvec[0],
|
||||
-wsize * lamp->spotvec[1], wsize * lamp->spotvec[1],
|
||||
lamp->d, lamp->clipend);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user