diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-06-27 17:37:34 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-06-27 18:02:22 +0300 |
commit | 4b124143b1038f406d38167e892ecda64ef6db5e (patch) | |
tree | 7f2724fe4c6097c5b72372c7f57a13c6760f930b /source/blender | |
parent | c74ccf6a97098a53b36dab86092da1d47f5edbf9 (diff) |
ObjectMode: Fix selection points of LightGrids
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/draw/modes/object_mode.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 2fbcda11500..330b24f5e1a 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -535,7 +535,10 @@ static void OBJECT_engine_init(void *vedata) /* Lightprobes */ sh_data->lightprobe_grid = GPU_shader_create_from_arrays({ - .vert = (const char *[]){sh_cfg_data->lib, datatoc_object_lightprobe_grid_vert_glsl, NULL}, + .vert = (const char *[]){sh_cfg_data->lib, + datatoc_common_globals_lib_glsl, + datatoc_object_lightprobe_grid_vert_glsl, + NULL}, .frag = (const char *[]){datatoc_gpu_shader_flat_id_frag_glsl, NULL}, .defs = (const char *[]){sh_cfg_data->def, NULL}, }); @@ -2794,7 +2797,7 @@ static void DRW_shgroup_lightprobe(OBJECT_Shaders *sh_data, OBJECT_LightProbeEngineData *prb_data = (OBJECT_LightProbeEngineData *)DRW_drawdata_ensure( &ob->id, &draw_engine_object_type, sizeof(OBJECT_LightProbeEngineData), NULL, NULL); - if ((DRW_state_is_select() || do_outlines) && ((prb->flag & LIGHTPROBE_FLAG_SHOW_DATA) != 0)) { + if (DRW_state_is_select() || do_outlines) { int *call_id = shgroup_theme_id_to_probe_outline_counter(stl, theme_id, ob->base_flag); if (prb->type == LIGHTPROBE_TYPE_GRID) { @@ -2832,6 +2835,7 @@ static void DRW_shgroup_lightprobe(OBJECT_Shaders *sh_data, uint cell_count = prb->grid_resolution_x * prb->grid_resolution_y * prb->grid_resolution_z; DRWShadingGroup *grp = DRW_shgroup_create(sh_data->lightprobe_grid, psl->lightprobes); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_int_copy(grp, "call_id", *call_id); DRW_shgroup_uniform_int(grp, "baseId", call_id, 1); /* that's correct */ DRW_shgroup_uniform_vec3(grp, "corner", prb_data->corner, 1); @@ -2839,10 +2843,11 @@ static void DRW_shgroup_lightprobe(OBJECT_Shaders *sh_data, DRW_shgroup_uniform_vec3(grp, "increment_y", prb_data->increment_y, 1); DRW_shgroup_uniform_vec3(grp, "increment_z", prb_data->increment_z, 1); DRW_shgroup_uniform_ivec3(grp, "grid_resolution", &prb->grid_resolution_x, 1); - DRW_shgroup_call_procedural_points(grp, NULL, cell_count); if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_state_enable(grp, DRW_STATE_CLIP_PLANES); } + DRW_shgroup_call_procedural_points(grp, NULL, cell_count); + *call_id += 1; } else if (prb->type == LIGHTPROBE_TYPE_CUBE) { float draw_size = 1.0f; @@ -2857,14 +2862,14 @@ static void DRW_shgroup_lightprobe(OBJECT_Shaders *sh_data, * to keep the call ids correct. */ zero_m4(probe_cube_mat); DRW_buffer_add_entry(buf, call_id, &draw_size, probe_cube_mat); + *call_id += 1; } - else { + else if (prb->flag & LIGHTPROBE_FLAG_SHOW_DATA) { float draw_size = 1.0f; DRWCallBuffer *buf = buffer_theme_id_to_probe_planar_outline_shgrp(stl, theme_id); DRW_buffer_add_entry(buf, call_id, &draw_size, ob->obmat); + *call_id += 1; } - - *call_id += 1; } switch (prb->type) { |