diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-06-14 20:35:31 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-06-15 01:55:45 +0300 |
commit | 99ff1bb21aaf3be13d08badf4e253efd1d0ae407 (patch) | |
tree | d5c63e9229ba2ded1fe2ff029b16b0db41e045d1 /source/blender | |
parent | 0ca2f5affde8cb8ce7fe4e93ae27063c7c577933 (diff) |
Probe: fix clip distances showing only for one probe.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/draw/modes/object_mode.c | 19 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_lightprobe_types.h | 1 |
2 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index fecbe0f414b..c5ffbf0fca3 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -1464,13 +1464,22 @@ static void DRW_shgroup_lightprobe(OBJECT_StorageList *stl, Object *ob, SceneLay {{-1.0, 0.0, 0.0, 0.0}, {0.0, -1.0, 0.0, 0.0}, {0.0, 0.0, 1.0, 0.0}, {0.0, 0.0, 0.0, 1.0}}, }; + float **prb_mats = (float **)DRW_object_engine_data_get(ob, &draw_engine_object_type, NULL); + if (*prb_mats == NULL) { + /* we need 2 matrices */ + *prb_mats = MEM_mallocN(sizeof(float) * 16 * 6, "Probe Clip distances Matrices"); + } + for (int i = 0; i < 6; ++i) { - normalize_m4_m4(prb->clipmat[i], ob->obmat); - // invert_m4(prb->clipmat[i]); - mul_m4_m4m4(prb->clipmat[i], prb->clipmat[i], cubefacemat[i]); + float (*clipmat)[4]; + clipmat = (float (*)[4])(*prb_mats + 16 * i); + + normalize_m4_m4(clipmat, ob->obmat); + // invert_m4(clipmat); + mul_m4_m4m4(clipmat, clipmat, cubefacemat[i]); - DRW_shgroup_call_dynamic_add(stl->g_data->lamp_buflimit, color, &prb->clipsta, &prb->clipend, prb->clipmat[i]); - DRW_shgroup_call_dynamic_add(stl->g_data->lamp_buflimit_points, color, &prb->clipsta, &prb->clipend, prb->clipmat[i]); + DRW_shgroup_call_dynamic_add(stl->g_data->lamp_buflimit, color, &prb->clipsta, &prb->clipend, clipmat); + DRW_shgroup_call_dynamic_add(stl->g_data->lamp_buflimit_points, color, &prb->clipsta, &prb->clipend, clipmat); } } DRW_shgroup_call_dynamic_add(stl->g_data->lamp_center_group, ob->obmat[3]); diff --git a/source/blender/makesdna/DNA_lightprobe_types.h b/source/blender/makesdna/DNA_lightprobe_types.h index b66ea443570..f5dd22f86ed 100644 --- a/source/blender/makesdna/DNA_lightprobe_types.h +++ b/source/blender/makesdna/DNA_lightprobe_types.h @@ -64,7 +64,6 @@ typedef struct LightProbe { /* Runtime display data */ float distfalloff, pad; - float clipmat[6][4][4]; } LightProbe; /* Probe->type */ |