diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-06-16 21:55:37 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-06-16 21:55:37 +0300 |
commit | fbff0e68a4cb43d24f0e034b084307930114908b (patch) | |
tree | 78e49e9ecd25db46b7eea6b21a1ec6515f9b61cd /source/blender/blenkernel/intern/cdderivedmesh.c | |
parent | 5ca3f3d81169911836820d2ecd857fbc66be7c84 (diff) |
Drawing speedup:
We really don't need to iterate all edges of the mesh every frame to
search for loose edges, this calculation can be cached when filling the
edge index buffer.
Diffstat (limited to 'source/blender/blenkernel/intern/cdderivedmesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 3feea12f017..4ad7156efdb 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -432,33 +432,8 @@ static void cdDM_drawEdges(DerivedMesh *dm, bool drawLooseEdges, bool drawAllEdg static void cdDM_drawLooseEdges(DerivedMesh *dm) { - CDDerivedMesh *cddm = (CDDerivedMesh *) dm; - MEdge *medge = cddm->medge; - int i; - - int prevstart = 0; - int prevdraw = 1; - int draw = 1; - GPU_edge_setup(dm); - for (i = 0; i < dm->numEdgeData; i++, medge++) { - if (medge->flag & ME_LOOSEEDGE) { - draw = 1; - } - else { - draw = 0; - } - if (prevdraw != draw) { - if (prevdraw > 0 && (i - prevstart) > 0) { - GPU_buffer_draw_elements(dm->drawObject->edges, GL_LINES, prevstart * 2, (i - prevstart) * 2); - } - prevstart = i; - } - prevdraw = draw; - } - if (prevdraw > 0 && (i - prevstart) > 0) { - GPU_buffer_draw_elements(dm->drawObject->edges, GL_LINES, prevstart * 2, (i - prevstart) * 2); - } + GPU_buffer_draw_elements(dm->drawObject->edges, GL_LINES, dm->drawObject->loose_edge_offset * 2, dm->drawObject->tot_loose_edge * 2); GPU_buffer_unbind(); } |