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>2012-10-19 14:40:32 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-19 14:40:32 +0400
commite527ce552e9e3864c7a2f5bb688ffa1d4cd0d5f1 (patch)
treea340f534a7d62e6f9129bbfbbd31b297b7e214b5 /source/blender/modifiers
parentb7642348e44c10710c0d3f65ccfdafdd964829a2 (diff)
add option to initialize heap with a known number of elements, since this may be known in advance - it avoids re-allocing too much.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_decimate.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c
index cb6681bfa68..171d601ea6d 100644
--- a/source/blender/modifiers/intern/MOD_decimate.c
+++ b/source/blender/modifiers/intern/MOD_decimate.c
@@ -47,6 +47,10 @@
#include "BKE_particle.h"
#include "BKE_cdderivedmesh.h"
+#include "BKE_tessmesh.h"
+
+/* testing only! - Campbell */
+// #define USE_DECIMATE_BMESH
#ifdef WITH_MOD_DECIMATE
#include "LOD_decimation.h"
@@ -70,6 +74,33 @@ static void copyData(ModifierData *md, ModifierData *target)
}
#ifdef WITH_MOD_DECIMATE
+#ifdef USE_DECIMATE_BMESH
+
+#include "bmesh.h"
+
+static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
+ DerivedMesh *derivedData,
+ ModifierApplyFlag UNUSED(flag))
+{
+ DecimateModifierData *dmd = (DecimateModifierData *) md;
+ DerivedMesh *dm = derivedData, *result = NULL;
+ BMEditMesh *em;
+ BMesh *bm;
+
+ em = DM_to_editbmesh(dm, NULL, FALSE);
+ bm = em->bm;
+
+ BM_mesh_decimate(bm, dmd->percent);
+
+ BLI_assert(em->looptris == NULL);
+ result = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE);
+ BMEdit_Free(em);
+ MEM_freeN(em);
+
+ return result;
+}
+
+#else
static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
DerivedMesh *derivedData,
ModifierApplyFlag UNUSED(flag))
@@ -192,6 +223,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
return dm;
}
}
+#endif // USE_DECIMATE_BMESH
#else // WITH_MOD_DECIMATE
static DerivedMesh *applyModifier(ModifierData *UNUSED(md), Object *UNUSED(ob),
DerivedMesh *derivedData,