Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-06-20 06:47:53 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-06-20 07:39:13 +0300
commit2d60c496a200288f100c11845ccb196f04e45ba3 (patch)
tree4f115960d47a2ec92fd584d746da3a9182c87082 /source/blender/blenkernel/intern
parent513f566b40a5bde4d89797aecf7c0ad3e4d1a20b (diff)
Mesh: minor optimization to concave quad check for tessellation
Use the face normal (when available) for a faster concave quad test.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/mesh_tessellate.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/mesh_tessellate.c b/source/blender/blenkernel/intern/mesh_tessellate.c
index 98a93dbc4b5..0cd1b211e4d 100644
--- a/source/blender/blenkernel/intern/mesh_tessellate.c
+++ b/source/blender/blenkernel/intern/mesh_tessellate.c
@@ -476,10 +476,19 @@ BLI_INLINE void mesh_calc_tessellation_for_face_impl(const MLoop *mloop,
ML_TO_MLT(0, 2, 3);
MLoopTri *mlt_b = mlt;
- if (UNLIKELY(is_quad_flip_v3_first_third_fast(mvert[mloop[mlt_a->tri[0]].v].co,
- mvert[mloop[mlt_a->tri[1]].v].co,
- mvert[mloop[mlt_a->tri[2]].v].co,
- mvert[mloop[mlt_b->tri[2]].v].co))) {
+ if (UNLIKELY(face_normal ? is_quad_flip_v3_first_third_fast_with_normal(
+ /* Simpler calculation (using the normal). */
+ mvert[mloop[mlt_a->tri[0]].v].co,
+ mvert[mloop[mlt_a->tri[1]].v].co,
+ mvert[mloop[mlt_a->tri[2]].v].co,
+ mvert[mloop[mlt_b->tri[2]].v].co,
+ normal_precalc) :
+ is_quad_flip_v3_first_third_fast(
+ /* Expensive calculation (no normal). */
+ mvert[mloop[mlt_a->tri[0]].v].co,
+ mvert[mloop[mlt_a->tri[1]].v].co,
+ mvert[mloop[mlt_a->tri[2]].v].co,
+ mvert[mloop[mlt_b->tri[2]].v].co))) {
/* Flip out of degenerate 0-2 state. */
mlt_a->tri[2] = mlt_b->tri[2];
mlt_b->tri[0] = mlt_a->tri[1];