From c691551249f3fe3982c43e4c75be40a19503dd26 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 21 Jan 2014 16:32:36 +0100 Subject: Optimize tessellation code (min 20% better, up to 300% with some CD layers to tessellate). The main idea is to store (during tessellation) or recreate (during tessdata update) a tessfaceverts-to-loops mapping, and then update all tessdata in one pass, instead of calling `BKE_mesh_loops_to_mface_corners` repeatedly for all tfaces! Differential Revision: https://developer.blender.org/D226 Reviewed by Campbell, thanks a lot! --- source/blender/editors/sculpt_paint/paint_vertex.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'source/blender/editors/sculpt_paint') diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index e03c5b5600c..9c9b8d84a21 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2847,15 +2847,6 @@ static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const fl return 1; } -BLI_INLINE int mesh_tessface_vertex_index(MFace *tessface, unsigned int v) -{ - if (tessface->v1 == v) return 0; - if (tessface->v2 == v) return 1; - if (tessface->v3 == v) return 2; - if (v && (tessface->v4 == v)) return 3; - return -1; -} - static void vpaint_paint_poly(VPaint *vp, VPaintData *vpd, Mesh *me, const unsigned int index, const float mval[2], const float brush_size_pressure, const float brush_alpha_pressure) @@ -2945,7 +2936,7 @@ static void vpaint_paint_poly(VPaint *vp, VPaintData *vpd, Mesh *me, for (j = 0; j < totloop; j++, ml++, mlc++) { /* search for the loop vertex within the tessface */ - const int fidx = mesh_tessface_vertex_index(mf, ml->v); + const int fidx = BKE_MESH_TESSFACE_VINDEX_ORDER(mf, ml->v); if (fidx != -1) { MESH_MLOOPCOL_TO_MCOL(mlc, mc + fidx); if (mlooptag) { -- cgit v1.2.3