Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-03-21 08:01:26 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-03-21 08:02:37 +0300
commit72bf5d13e6e65b055326e840d68f8fd9e237c1df (patch)
tree737317bd1e313a7a0b83fa2088858fdcf4bfd526 /source/blender/gpu/intern/gpu_material.c
parenta0a66e041898f9bdba9ac249265a0b37e459b398 (diff)
Fix for non spot lamps calculating spot values
Logical error in D1378, also incorrectly used lamp type as a flag.
Diffstat (limited to 'source/blender/gpu/intern/gpu_material.c')
-rw-r--r--source/blender/gpu/intern/gpu_material.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index c32326889d1..2624bf2865a 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -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);
}
}