diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-04-20 19:18:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-04-20 21:23:28 +0300 |
commit | 677aa36632c6ed61815e9cbe04e317b290620b59 (patch) | |
tree | 654cfa1b889b83d08eaffa04fb3d048d15863594 /source/blender | |
parent | 9d1421c06961f7f302fcb25ef0faae76f65fa466 (diff) |
Curve: draw curve/surface/text geometry
Note that displists will be removed, but this wont be hard to replace.
Signed-off-by: Campbell Barton <ideasman42@gmail.com>
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_curve_render.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_displist_render.h | 33 | ||||
-rw-r--r-- | source/blender/blenkernel/CMakeLists.txt | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/curve_render.c | 37 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/displist_render.c | 167 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object_update.c | 2 | ||||
-rw-r--r-- | source/blender/draw/engines/clay/clay.c | 6 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee/eevee.c | 4 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache.c | 66 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache.h | 11 | ||||
-rw-r--r-- | source/blender/draw/modes/edit_curve_mode.c | 26 | ||||
-rw-r--r-- | source/blender/draw/modes/object_mode.c | 28 |
12 files changed, 363 insertions, 21 deletions
diff --git a/source/blender/blenkernel/BKE_curve_render.h b/source/blender/blenkernel/BKE_curve_render.h index 6c37b6e875b..79152c92979 100644 --- a/source/blender/blenkernel/BKE_curve_render.h +++ b/source/blender/blenkernel/BKE_curve_render.h @@ -37,4 +37,6 @@ struct Batch *BKE_curve_batch_cache_get_normal_edge( struct Batch *BKE_curve_batch_cache_get_overlay_edges(struct Curve *cu); struct Batch *BKE_curve_batch_cache_get_overlay_verts(struct Curve *cu); +struct Batch *BKE_curve_batch_cache_get_triangles_with_normals(struct Curve *cu, struct CurveCache *ob_curve_cache); + #endif /* __BKE_CURVE_RENDER_H__ */ diff --git a/source/blender/blenkernel/BKE_displist_render.h b/source/blender/blenkernel/BKE_displist_render.h new file mode 100644 index 00000000000..0724bdd29cd --- /dev/null +++ b/source/blender/blenkernel/BKE_displist_render.h @@ -0,0 +1,33 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ +#ifndef __BKE_DISPLIST_RENDER_H__ +#define __BKE_DISPLIST_RENDER_H__ + +/** \file BKE_displist_render.h + * \ingroup bke + */ + +struct Batch; +struct ListBase; +struct VertexBuffer; + +struct Batch *BLI_displist_batch_calc_surface(struct ListBase *lb); + +#endif /* __BKE_DISPLIST_RENDER_H__ */ diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index d8cba908f4a..fb35c08fd42 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -100,6 +100,7 @@ set(SRC intern/deform.c intern/depsgraph.c intern/displist.c + intern/displist_render.c intern/dynamicpaint.c intern/editderivedmesh.c intern/editmesh.c @@ -233,6 +234,7 @@ set(SRC BKE_deform.h BKE_depsgraph.h BKE_displist.h + BKE_displist_render.h BKE_dynamicpaint.h BKE_editmesh.h BKE_editmesh_bvh.h diff --git a/source/blender/blenkernel/intern/curve_render.c b/source/blender/blenkernel/intern/curve_render.c index 0dcee01f9d7..0543d833fad 100644 --- a/source/blender/blenkernel/intern/curve_render.c +++ b/source/blender/blenkernel/intern/curve_render.c @@ -37,6 +37,8 @@ #include "BKE_curve.h" #include "BKE_curve_render.h" +#include "BKE_displist_render.h" + #include "GPU_batch.h" #define SELECT 1 @@ -173,6 +175,8 @@ enum { CU_DATATYPE_OVERLAY = 1 << 1, /* Edit-mode normals */ CU_DATATYPE_NORMAL = 1 << 2, + /* Geometry */ + CU_DATATYPE_SURFACE = 1 << 3, }; /* @@ -297,6 +301,10 @@ typedef struct CurveBatchCache { Batch *verts; } overlay; + struct { + Batch *batch; + } surface; + /* settings to determine if cache is invalid */ bool is_dirty; @@ -410,6 +418,10 @@ void BKE_curve_batch_cache_clear(Curve *cu) BATCH_DISCARD_ALL_SAFE(cache->overlay.verts); BATCH_DISCARD_ALL_SAFE(cache->overlay.edges); + if (cache->surface.batch) { + BATCH_DISCARD_ALL_SAFE(cache->surface.batch); + } + if (cache->wire.batch) { BATCH_DISCARD_ALL_SAFE(cache->wire.batch); cache->wire.verts = NULL; @@ -759,6 +771,15 @@ static void curve_batch_cache_create_overlay_batches(Curve *cu) curve_render_data_free(rdata); } +static Batch *curve_batch_cache_get_pos_and_normals(CurveRenderData *rdata, CurveBatchCache *cache) +{ + BLI_assert(rdata->types & CU_DATATYPE_SURFACE); + if (cache->surface.batch == NULL) { + cache->surface.batch = BLI_displist_batch_calc_surface(&rdata->ob_curve_cache->disp); + } + return cache->surface.batch; +} + Batch *BKE_curve_batch_cache_get_wire_edge(Curve *cu, CurveCache *ob_curve_cache) { CurveBatchCache *cache = curve_batch_cache_get(cu); @@ -825,3 +846,19 @@ Batch *BKE_curve_batch_cache_get_overlay_verts(Curve *cu) return cache->overlay.verts; } + +struct Batch *BKE_curve_batch_cache_get_triangles_with_normals( + struct Curve *cu, struct CurveCache *ob_curve_cache) +{ + CurveBatchCache *cache = curve_batch_cache_get(cu); + + if (cache->surface.batch == NULL) { + CurveRenderData *rdata = curve_render_data_create(cu, ob_curve_cache, CU_DATATYPE_SURFACE); + + curve_batch_cache_get_pos_and_normals(rdata, cache); + + curve_render_data_free(rdata); + } + + return cache->surface.batch; +} diff --git a/source/blender/blenkernel/intern/displist_render.c b/source/blender/blenkernel/intern/displist_render.c new file mode 100644 index 00000000000..01aa0c1217e --- /dev/null +++ b/source/blender/blenkernel/intern/displist_render.c @@ -0,0 +1,167 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2017 by Blender Foundation. + * All rights reserved. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/blenkernel/intern/displist_render.c + * \ingroup bke + * + * \brief DispList API for render engines + * + * \note DispList may be removed soon! This is a utility for object types that use render. + */ + +#include "MEM_guardedalloc.h" + +#include "BLI_utildefines.h" +#include "BLI_math_vector.h" + +#include "DNA_curve_types.h" + +#include "BKE_displist.h" +#include "BKE_displist_render.h" + +#include "GPU_batch.h" + +static int dl_vert_len(const DispList *dl) +{ + switch (dl->type) { + case DL_INDEX3: + case DL_INDEX4: + return dl->nr; + case DL_SURF: + return dl->parts * dl->nr; + } + return 0; +} + +static int dl_tri_len(const DispList *dl) +{ + switch (dl->type) { + case DL_INDEX3: + return dl->parts; + case DL_INDEX4: + return dl->parts * 2; + case DL_SURF: + return dl->totindex * 2; + } + return 0; +} + +/* see: displist_get_allverts */ +static int curve_render_surface_vert_len_get(const ListBase *lb) +{ + int vert_len = 0; + for (const DispList *dl = lb->first; dl; dl = dl->next) { + vert_len += dl_vert_len(dl); + } + return vert_len; +} + +static int curve_render_surface_tri_len_get(const ListBase *lb) +{ + int tri_len = 0; + for (const DispList *dl = lb->first; dl; dl = dl->next) { + tri_len += dl_tri_len(dl); + } + return tri_len; +} + +Batch *BLI_displist_batch_calc_surface(ListBase *lb) +{ + const int tri_len = curve_render_surface_tri_len_get(lb); + if (tri_len == 0) { + return NULL; + } + + static VertexFormat format = { 0 }; + static unsigned int pos_id, nor_id; + if (format.attrib_ct == 0) { + /* initialize vertex format */ + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + nor_id = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT); + } + + const int vert_len = curve_render_surface_vert_len_get(lb); + VertexBuffer *vbo = VertexBuffer_create_with_format(&format); + { + const int vbo_len_capacity = vert_len; + int vbo_len_used = 0; + VertexBuffer_allocate_data(vbo, vbo_len_capacity); + + BKE_displist_normals_add(lb); + + for (const DispList *dl = lb->first; dl; dl = dl->next) { + const bool ndata_is_single = dl->type == DL_INDEX3; + if (ELEM(dl->type, DL_INDEX3, DL_INDEX4, DL_SURF)) { + const float *fp_co = dl->verts; + const float *fp_no = dl->nors; + const int vbo_end = vbo_len_used + dl_vert_len(dl); + while (vbo_len_used < vbo_end) { + VertexBuffer_set_attrib(vbo, pos_id, vbo_len_used, fp_co); + if (fp_no) { + VertexBuffer_set_attrib(vbo, nor_id, vbo_len_used, fp_no); + if (ndata_is_single == false) { + fp_no += 3; + } + } + fp_co += 3; + vbo_len_used += 1; + } + } + } + } + + { + ElementListBuilder elb; + ElementListBuilder_init(&elb, PRIM_TRIANGLES, tri_len, vert_len); + + int ofs = 0; + int tri_len_used = 0; + for (const DispList *dl = lb->first; dl; dl = dl->next) { + if (ELEM(dl->type, DL_INDEX3, DL_INDEX4, DL_SURF)) { + if (dl->type == DL_INDEX3) { + const int *idx = dl->index; + const int i_end = dl->parts; + for (int i = 0; i < i_end; i++) { + add_triangle_vertices(&elb, idx[0] + ofs, idx[1] + ofs, idx[2] + ofs); + tri_len_used += 1; + idx += 3; + } + } + else if (ELEM(dl->type, DL_INDEX4, DL_SURF)) { + const int *idx = dl->index; + const int i_end = dl->totindex; + for (int i = 0; i < i_end; i++) { + add_triangle_vertices(&elb, idx[0] + ofs, idx[1] + ofs, idx[2] + ofs); + tri_len_used += 1; + add_triangle_vertices(&elb, idx[0] + ofs, idx[2] + ofs, idx[3] + ofs); + tri_len_used += 1; + idx += 4; + } + } + ofs += dl_vert_len(dl); + } + } + + return Batch_create(PRIM_TRIANGLES, vbo, ElementList_build(&elb)); + } +} diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index 495857bc21b..3d9bbc338ea 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -353,6 +353,8 @@ void BKE_object_eval_uber_data(EvaluationContext *eval_ctx, BKE_lattice_batch_cache_dirty(ob->data); break; case OB_CURVE: + case OB_FONT: + case OB_SURF: BKE_curve_batch_cache_dirty(ob->data); break; } diff --git a/source/blender/draw/engines/clay/clay.c b/source/blender/draw/engines/clay/clay.c index 2d26adf1fe2..f4f00345fd9 100644 --- a/source/blender/draw/engines/clay/clay.c +++ b/source/blender/draw/engines/clay/clay.c @@ -564,7 +564,6 @@ static void CLAY_cache_populate(void *vedata, Object *ob) CLAY_PassList *psl = ((CLAY_Data *)vedata)->psl; CLAY_StorageList *stl = ((CLAY_Data *)vedata)->stl; - struct Batch *geom; DRWShadingGroup *clay_shgrp; if (!DRW_is_object_renderable(ob)) @@ -573,10 +572,9 @@ static void CLAY_cache_populate(void *vedata, Object *ob) IDProperty *ces_mode_ob = BKE_object_collection_engine_get(ob, COLLECTION_MODE_OBJECT, ""); bool do_cull = BKE_collection_engine_property_value_get_bool(ces_mode_ob, "show_backface_culling"); - /* TODO all renderable */ - if (ob->type == OB_MESH) { - geom = DRW_cache_mesh_surface_get(ob); + struct Batch *geom = DRW_cache_object_surface_get(ob); + if (geom) { /* Depth Prepass */ DRW_shgroup_call_add((do_cull) ? stl->g_data->depth_shgrp_cull : stl->g_data->depth_shgrp, geom, ob->obmat); diff --git a/source/blender/draw/engines/eevee/eevee.c b/source/blender/draw/engines/eevee/eevee.c index 0c3802b37ad..e5b92095c6d 100644 --- a/source/blender/draw/engines/eevee/eevee.c +++ b/source/blender/draw/engines/eevee/eevee.c @@ -436,10 +436,10 @@ static void EEVEE_cache_populate(void *vedata, Object *ob) EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl; EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl; - if (ob->type == OB_MESH) { + struct Batch *geom = DRW_cache_object_surface_get(ob); + if (geom) { IDProperty *ces_mode_ob = BKE_object_collection_engine_get(ob, COLLECTION_MODE_OBJECT, ""); bool do_cull = BKE_collection_engine_property_value_get_bool(ces_mode_ob, "show_backface_culling"); - struct Batch *geom = DRW_cache_mesh_surface_get(ob); /* Depth Prepass */ DRW_shgroup_call_add((do_cull) ? stl->g_data->depth_shgrp_cull : stl->g_data->depth_shgrp, geom, ob->obmat); diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index 47365e8d09e..3e59f17e52c 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -452,6 +452,30 @@ Batch *DRW_cache_screenspace_circle_get(void) /* -------------------------------------------------------------------- */ +/** \name Common Object API + * \{ */ + +Batch *DRW_cache_object_surface_get(Object *ob) +{ + switch (ob->type) { + case OB_MESH: + return DRW_cache_mesh_surface_get(ob); + case OB_CURVE: + return DRW_cache_curve_surface_get(ob); + case OB_SURF: + return DRW_cache_surf_surface_get(ob); + case OB_FONT: + return DRW_cache_text_surface_get(ob); + default: + return NULL; + } +} + +/** \} */ + + +/* -------------------------------------------------------------------- */ + /** \name Empties * \{ */ @@ -1582,7 +1606,7 @@ Batch *DRW_cache_mesh_verts_get(Object *ob) Batch *DRW_cache_curve_edge_wire_get(Object *ob) { - BLI_assert(ob->type == OB_CURVE); + BLI_assert(ELEM(ob->type, OB_CURVE, OB_FONT)); struct Curve *cu = ob->data; return BKE_curve_batch_cache_get_wire_edge(cu, ob->curve_cache); @@ -1612,6 +1636,46 @@ Batch *DRW_cache_curve_vert_overlay_get(Object *ob) return BKE_curve_batch_cache_get_overlay_verts(cu); } +Batch *DRW_cache_curve_surface_get(Object *ob) +{ + BLI_assert(ob->type == OB_CURVE); + + struct Curve *cu = ob->data; + return BKE_curve_batch_cache_get_triangles_with_normals(cu, ob->curve_cache); +} + +/** \} */ + +/* -------------------------------------------------------------------- */ + +/** \name Font + * \{ */ + +Batch *DRW_cache_text_surface_get(Object *ob) +{ + BLI_assert(ob->type == OB_FONT); + + struct Curve *cu = ob->data; + return BKE_curve_batch_cache_get_triangles_with_normals(cu, ob->curve_cache); +} + +/** \} */ + +/* -------------------------------------------------------------------- */ + +/** \name Surface + * \{ */ + +Batch *DRW_cache_surf_surface_get(Object *ob) +{ + BLI_assert(ob->type == OB_SURF); + + struct Curve *cu = ob->data; + return BKE_curve_batch_cache_get_triangles_with_normals(cu, ob->curve_cache); +} + +/** \} */ + /* -------------------------------------------------------------------- */ /** \name Lattice diff --git a/source/blender/draw/intern/draw_cache.h b/source/blender/draw/intern/draw_cache.h index 3b6488c1aa1..814b0383c5a 100644 --- a/source/blender/draw/intern/draw_cache.h +++ b/source/blender/draw/intern/draw_cache.h @@ -38,6 +38,9 @@ struct Batch *DRW_cache_single_line_get(void); struct Batch *DRW_cache_single_line_endpoints_get(void); struct Batch *DRW_cache_screenspace_circle_get(void); +/* Common Object */ +struct Batch *DRW_cache_object_surface_get(struct Object *ob); + /* Empties */ struct Batch *DRW_cache_plain_axes_get(void); struct Batch *DRW_cache_single_arrow_get(void); @@ -93,6 +96,14 @@ struct Batch *DRW_cache_curve_edge_wire_get(struct Object *ob); struct Batch *DRW_cache_curve_edge_normal_get(struct Object *ob, float normal_size); struct Batch *DRW_cache_curve_edge_overlay_get(struct Object *ob); struct Batch *DRW_cache_curve_vert_overlay_get(struct Object *ob); +struct Batch *DRW_cache_curve_surface_get(struct Object *ob); +struct Batch *DRW_cache_curve_surface_verts_get(struct Object *ob); + +/* Font */ +struct Batch *DRW_cache_text_surface_get(struct Object *ob); + +/* Surface */ +struct Batch *DRW_cache_surf_surface_get(struct Object *ob); /* Lattice */ struct Batch *DRW_cache_lattice_verts_get(struct Object *ob); diff --git a/source/blender/draw/modes/edit_curve_mode.c b/source/blender/draw/modes/edit_curve_mode.c index 5f12bfeec73..2a76f1ea403 100644 --- a/source/blender/draw/modes/edit_curve_mode.c +++ b/source/blender/draw/modes/edit_curve_mode.c @@ -30,6 +30,7 @@ /* If builtin shaders are needed */ #include "GPU_shader.h" +#include "GPU_batch.h" #include "draw_common.h" @@ -60,6 +61,7 @@ typedef struct EDIT_CURVE_PassList { /* Declare all passes here and init them in * EDIT_CURVE_cache_init(). * Only contains (DRWPass *) */ + struct DRWPass *surface_pass; struct DRWPass *wire_pass; struct DRWPass *overlay_edge_pass; struct DRWPass *overlay_vert_pass; @@ -105,6 +107,8 @@ static struct { * Add sources to source/blender/draw/modes/shaders * init in EDIT_CURVE_engine_init(); * free in EDIT_CURVE_engine_free(); */ + struct GPUShader *surface_sh; + struct GPUShader *wire_sh; struct GPUShader *overlay_edge_sh; /* handles and nurbs control cage */ @@ -116,6 +120,8 @@ typedef struct g_data { /* This keeps the references of the shading groups for * easy access in EDIT_CURVE_cache_populate() */ + DRWShadingGroup *surface_shgrp; + /* resulting curve as 'wire' for curves (and optionally normals) */ DRWShadingGroup *wire_shgrp; @@ -151,6 +157,11 @@ static void EDIT_CURVE_engine_init(void *vedata) * tex, 2); */ + + if (!e_data.surface_sh) { + e_data.surface_sh = GPU_shader_get_builtin_shader(GPU_SHADER_SIMPLE_LIGHTING); + } + if (!e_data.wire_sh) { e_data.wire_sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR); } @@ -180,6 +191,12 @@ static void EDIT_CURVE_cache_init(void *vedata) } { + /* Surface */ + psl->surface_pass = DRW_pass_create( + "Surface", + DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS); + stl->g_data->surface_shgrp = DRW_shgroup_create(e_data.surface_sh, psl->surface_pass); + /* Center-Line (wire) */ psl->wire_pass = DRW_pass_create( "Curve Wire", @@ -222,7 +239,13 @@ static void EDIT_CURVE_cache_populate(void *vedata, Object *ob) /* Get geometry cache */ struct Batch *geom; -// geom = DRW_cache_mesh_surface_get(ob); + geom = DRW_cache_curve_surface_get(ob); + if (geom) { + Batch_set_builtin_program(geom, GPU_SHADER_SIMPLE_LIGHTING); + Batch_Uniform4f(geom, "color", 1, 1, 1, 1); + Batch_Uniform3f(geom, "light", 0, 0, 1); + DRW_shgroup_call_add(stl->g_data->surface_shgrp, geom, ob->obmat); + } geom = DRW_cache_curve_edge_wire_get(ob); DRW_shgroup_call_add(stl->g_data->wire_shgrp, geom, ob->obmat); @@ -276,6 +299,7 @@ static void EDIT_CURVE_draw_scene(void *vedata) */ /* ... or just render passes on default framebuffer. */ + DRW_draw_pass(psl->surface_pass); DRW_draw_pass(psl->wire_pass); DRW_draw_pass(psl->overlay_edge_pass); DRW_draw_pass(psl->overlay_vert_pass); diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index cda5e5a9617..a5fbaea64b6 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -1162,22 +1162,24 @@ static void OBJECT_cache_populate(void *vedata, Object *ob) //bool do_wire = BKE_collection_engine_property_value_get_bool(ces_mode_ob, "show_wire"); bool do_outlines = ((ob->base_flag & BASE_SELECTED) != 0); - switch (ob->type) { - case OB_MESH: - { - Object *obedit = scene->obedit; - if (ob != obedit) { - if (do_outlines) { - struct Batch *geom = DRW_cache_mesh_surface_get(ob); - int theme_id = DRW_object_wire_theme_get(ob, sl, NULL); - DRWShadingGroup *shgroup = shgroup_theme_id_to_outline_shgroup_or(stl, theme_id, NULL); - if (shgroup != NULL) { - DRW_shgroup_call_add(shgroup, geom, ob->obmat); - } + if (do_outlines) { + Object *obedit = scene->obedit; + if (ob != obedit) { + struct Batch *geom = DRW_cache_object_surface_get(ob); + if (geom) { + int theme_id = DRW_object_wire_theme_get(ob, sl, NULL); + DRWShadingGroup *shgroup = shgroup_theme_id_to_outline_shgroup_or(stl, theme_id, NULL); + if (shgroup != NULL) { + DRW_shgroup_call_add(shgroup, geom, ob->obmat); } } - break; } + } + + switch (ob->type) { + case OB_MESH: + case OB_SURF: + break; case OB_LATTICE: { Object *obedit = scene->obedit; |