diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-06-24 15:11:36 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-06-24 16:03:10 +0300 |
commit | a9bc880cf8c71693436d5f8b505c8069880a1635 (patch) | |
tree | 8a21c8c19312bd4276cc24a630517f102fdad61d | |
parent | 8f85cf033c75db784a18ed9f23f816107c9f226c (diff) |
Object Mode: Add Shape visual for spot and point lamps
Since Eevee and Cycles both use lamp size for point lamps, displaying
the shape is now more relevant than before.
-rw-r--r-- | source/blender/draw/modes/object_mode.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 423b07cdb97..887a1cb7721 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -178,6 +178,7 @@ typedef struct OBJECT_PrivateData { DRWShadingGroup *lamp_distance; DRWShadingGroup *lamp_buflimit; DRWShadingGroup *lamp_buflimit_points; + DRWShadingGroup *lamp_area_sphere; DRWShadingGroup *lamp_area_square; DRWShadingGroup *lamp_area_disk; DRWShadingGroup *lamp_hemi; @@ -1199,6 +1200,9 @@ static void OBJECT_cache_init(void *vedata) stl->g_data->lamp_groundline = shgroup_groundlines_uniform_color(psl->non_meshes, ts.colorLamp); stl->g_data->lamp_groundpoint = shgroup_groundpoints_uniform_color(psl->non_meshes, ts.colorLamp); + geom = DRW_cache_screenspace_circle_get(); + stl->g_data->lamp_area_sphere = shgroup_instance_screen_aligned(psl->non_meshes, geom); + geom = DRW_cache_lamp_area_square_get(); stl->g_data->lamp_area_square = shgroup_instance(psl->non_meshes, geom); @@ -1450,6 +1454,15 @@ static void DRW_shgroup_lamp(OBJECT_StorageList *stl, Object *ob, ViewLayer *vie } } + if (ELEM(la->type, LA_LOCAL, LA_SPOT)) { + /* We only want position not scale. */ + shapemat[0][0] = shapemat[1][1] = shapemat[2][2] = 1.0f; + shapemat[0][1] = shapemat[0][2] = 0.0f; + shapemat[1][0] = shapemat[1][2] = 0.0f; + shapemat[2][0] = shapemat[2][1] = 0.0f; + DRW_shgroup_call_dynamic_add(stl->g_data->lamp_area_sphere, color, &la->area_size, shapemat); + } + /* Line and point going to the ground */ DRW_shgroup_call_dynamic_add(stl->g_data->lamp_groundline, ob->obmat[3]); DRW_shgroup_call_dynamic_add(stl->g_data->lamp_groundpoint, ob->obmat[3]); |