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:
authorClément Foucault <foucault.clem@gmail.com>2019-05-30 00:52:37 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-05-30 14:43:33 +0300
commit596492e639f07b6a0a3f705a0f944dc57f94b7e4 (patch)
tree55f3dfa9ee3ad03c90954bec26f7c85157dc2d1b /source/blender/draw/engines/gpencil
parent32a2bfddcb4b0dedbea987ae3e335dc6aecdaed8 (diff)
DRW: Refactor to use object pointer for drawcall by default
This cleans up a bit of duplicated code and some confusion about what was culled and what wasn't. Now everything is culled based on the given object pointer. If the object pointer is NULL there is no culling performed.
Diffstat (limited to 'source/blender/draw/engines/gpencil')
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_utils.c38
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.c2
2 files changed, 9 insertions, 31 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 964b7974de3..cd35395064b 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1705,6 +1705,7 @@ static void DRW_gpencil_shgroups_create(GPENCIL_e_data *e_data,
break;
}
+ float(*obmat)[4] = (!cache_ob->is_dup_ob) ? gpf->runtime.parent_obmat : cache_ob->obmat;
switch (elm->type) {
case eGpencilBatchGroupType_Stroke: {
const int len = elm->vertex_idx - start_stroke;
@@ -1723,12 +1724,7 @@ static void DRW_gpencil_shgroups_create(GPENCIL_e_data *e_data,
scale,
cache_ob->shading_type);
if ((do_onion) || (elm->onion == false)) {
- DRW_shgroup_call_range(shgrp,
- cache->b_stroke.batch,
- (!cache_ob->is_dup_ob) ? gpf->runtime.parent_obmat :
- cache_ob->obmat,
- start_stroke,
- len);
+ DRW_shgroup_call_range_obmat(shgrp, cache->b_stroke.batch, obmat, start_stroke, len);
}
stl->storage->shgroup_id++;
start_stroke = elm->vertex_idx;
@@ -1752,12 +1748,7 @@ static void DRW_gpencil_shgroups_create(GPENCIL_e_data *e_data,
cache_ob->shading_type);
if ((do_onion) || (elm->onion == false)) {
- DRW_shgroup_call_range(shgrp,
- cache->b_point.batch,
- (!cache_ob->is_dup_ob) ? gpf->runtime.parent_obmat :
- cache_ob->obmat,
- start_point,
- len);
+ DRW_shgroup_call_range_obmat(shgrp, cache->b_point.batch, obmat, start_point, len);
}
stl->storage->shgroup_id++;
start_point = elm->vertex_idx;
@@ -1778,12 +1769,7 @@ static void DRW_gpencil_shgroups_create(GPENCIL_e_data *e_data,
cache_ob->shading_type);
if ((do_onion) || (elm->onion == false)) {
- DRW_shgroup_call_range(shgrp,
- cache->b_fill.batch,
- (!cache_ob->is_dup_ob) ? gpf->runtime.parent_obmat :
- cache_ob->obmat,
- start_fill,
- len);
+ DRW_shgroup_call_range_obmat(shgrp, cache->b_fill.batch, obmat, start_fill, len);
}
stl->storage->shgroup_id++;
start_fill = elm->vertex_idx;
@@ -1793,12 +1779,8 @@ static void DRW_gpencil_shgroups_create(GPENCIL_e_data *e_data,
if (stl->g_data->shgrps_edit_point) {
const int len = elm->vertex_idx - start_edit;
/* use always the same group */
- DRW_shgroup_call_range(stl->g_data->shgrps_edit_point,
- cache->b_edit.batch,
- (!cache_ob->is_dup_ob) ? gpf->runtime.parent_obmat :
- cache_ob->obmat,
- start_edit,
- len);
+ DRW_shgroup_call_range_obmat(
+ stl->g_data->shgrps_edit_point, cache->b_edit.batch, obmat, start_edit, len);
start_edit = elm->vertex_idx;
}
@@ -1808,12 +1790,8 @@ static void DRW_gpencil_shgroups_create(GPENCIL_e_data *e_data,
if (stl->g_data->shgrps_edit_line) {
const int len = elm->vertex_idx - start_edlin;
/* use always the same group */
- DRW_shgroup_call_range(stl->g_data->shgrps_edit_line,
- cache->b_edlin.batch,
- (!cache_ob->is_dup_ob) ? gpf->runtime.parent_obmat :
- cache_ob->obmat,
- start_edlin,
- len);
+ DRW_shgroup_call_range_obmat(
+ stl->g_data->shgrps_edit_line, cache->b_edlin.batch, obmat, start_edlin, len);
start_edlin = elm->vertex_idx;
}
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index f597797ae38..f78f7295d24 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -680,7 +680,7 @@ void GPENCIL_cache_populate(void *vedata, Object *ob)
copy_v3_v3(grid_matrix[3], ob->obmat[3]);
}
- DRW_shgroup_call(stl->g_data->shgrps_grid, e_data.batch_grid, grid_matrix);
+ DRW_shgroup_call_obmat(stl->g_data->shgrps_grid, e_data.batch_grid, grid_matrix);
}
}
}