diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-01-21 19:32:36 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2014-01-21 19:32:47 +0400 |
commit | c691551249f3fe3982c43e4c75be40a19503dd26 (patch) | |
tree | 3332a4f50ff5e6df3884a44334b07e578d619840 /source/blender/editors/sculpt_paint/paint_vertex.c | |
parent | cda894fcfd6a19f48eeb745af49800b5165f936c (diff) |
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!
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_vertex.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 11 |
1 files changed, 1 insertions, 10 deletions
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) { |