[Bf-blender-cvs] [9bfdc4826a7] master: Wireframe: Create dupli fast path using DRW_duplidata_get
Clément Foucault
noreply at git.blender.org
Wed May 8 17:59:09 CEST 2019
Commit: 9bfdc4826a79bd3b0f3a6e1c4dd037f4a07ae87f
Author: Clément Foucault
Date: Tue May 7 20:56:55 2019 +0200
Branches: master
https://developer.blender.org/rB9bfdc4826a79bd3b0f3a6e1c4dd037f4a07ae87f
Wireframe: Create dupli fast path using DRW_duplidata_get
===================================================================
M source/blender/draw/modes/overlay_mode.c
===================================================================
diff --git a/source/blender/draw/modes/overlay_mode.c b/source/blender/draw/modes/overlay_mode.c
index 90fac136f73..fe4bb2db18e 100644
--- a/source/blender/draw/modes/overlay_mode.c
+++ b/source/blender/draw/modes/overlay_mode.c
@@ -46,6 +46,11 @@
/* Structures */
+typedef struct OVERLAY_DupliData {
+ DRWShadingGroup *shgrp;
+ struct GPUBatch *geom;
+} OVERLAY_DupliData;
+
typedef struct OVERLAY_StorageList {
struct OVERLAY_PrivateData *g_data;
} OVERLAY_StorageList;
@@ -337,12 +342,25 @@ static void overlay_cache_populate(void *vedata, Object *ob)
if (DRW_object_is_renderable(ob) && pd->overlay.flag & V3D_OVERLAY_FACE_ORIENTATION) {
struct GPUBatch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
- DRW_shgroup_call_add(pd->face_orientation_shgrp, geom, ob->obmat);
+ DRW_shgroup_call_object_add(pd->face_orientation_shgrp, geom, ob);
}
}
if ((pd->overlay.flag & V3D_OVERLAY_WIREFRAMES) || (v3d->shading.type == OB_WIRE) ||
(ob->dtx & OB_DRAWWIRE) || (ob->dt == OB_WIRE)) {
+
+ /* Fast path for duplis. */
+ OVERLAY_DupliData **dupli_data = (OVERLAY_DupliData **)DRW_duplidata_get(vedata);
+ if (dupli_data) {
+ if (*dupli_data == NULL) {
+ *dupli_data = MEM_callocN(sizeof(OVERLAY_DupliData), "OVERLAY_DupliData");
+ }
+ else {
+ DRW_shgroup_call_object_add((*dupli_data)->shgrp, (*dupli_data)->geom, ob);
+ return;
+ }
+ }
+
const bool is_edit_mode = BKE_object_is_in_editmode(ob);
bool has_edit_mesh_cage = false;
if (ob->type == OB_MESH) {
@@ -392,9 +410,15 @@ static void overlay_cache_populate(void *vedata, Object *ob)
DRW_shgroup_call_sculpt_add(shgrp, ob, true, false, false);
}
else {
- DRW_shgroup_call_add(shgrp, geom, ob->obmat);
+ DRW_shgroup_call_object_add(shgrp, geom, ob);
}
}
+
+ if (dupli_data) {
+ (*dupli_data)->shgrp = shgrp;
+ (*dupli_data)->geom = geom;
+ }
+
if (is_wire && shgrp != NULL) {
/* If object is wireframe, don't try to use stencil test. */
DRW_shgroup_state_disable(shgrp, DRW_STATE_STENCIL_EQUAL);
More information about the Bf-blender-cvs
mailing list