[Bf-blender-cvs] [01f47d6] opensubdiv-modifier: Initialize osd_index of vert when adding vertex to the map
Sergey Sharybin
noreply at git.blender.org
Mon May 12 20:08:59 CEST 2014
Commit: 01f47d6cefd6873cf168a8f73c02bfaf6ee0f8c9
Author: Sergey Sharybin
Date: Sun May 11 14:43:27 2014 +0200
https://developer.blender.org/rB01f47d6cefd6873cf168a8f73c02bfaf6ee0f8c9
Initialize osd_index of vert when adding vertex to the map
Saves some time when doing evaluation or GL drawing.
===================================================================
M source/blender/blenkernel/intern/CCGSubSurf.c
===================================================================
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 3d553e4..500bfb4 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -345,8 +345,7 @@ struct CCGVert {
CCGVert *next; /* EHData.next */
CCGVertHDL vHDL; /* EHData.key */
- short numEdges, numFaces, flags, pad;
- int tag;
+ short numEdges, numFaces, flags;
int osd_index; /* Index of the vertex in the map, used by OSD. */
CCGEdge **edges;
@@ -1245,6 +1244,9 @@ CCGError ccgSubSurf_syncVert(CCGSubSurf *ss, CCGVertHDL vHDL, const void *vertDa
_ehash_insert(ss->vMap, (EHEntry *) v);
v->flags = 0;
}
+#ifdef WITH_OPENSUBDIV
+ v->osd_index = ss->vMap->numEntries - 1;
+#endif
}
if (v_r) *v_r = v;
@@ -2448,15 +2450,7 @@ static void opensubdiv_initEvaluatorFace(CCGSubSurf *ss,
static bool opensubdiv_initEvaluator(CCGSubSurf *ss)
{
- int i, osd_vert_index;
-
- /* Set an osd_index member in each one so we have consistent indexing. */
- for (i = 0, osd_vert_index = 0; i < ss->vMap->curSize; ++i) {
- CCGVert *vert = (CCGVert *) ss->vMap->buckets[i];
- for (; vert; vert = vert->next, ++osd_vert_index) {
- vert->osd_index = osd_vert_index;
- }
- }
+ int i;
for (i = 0; i < ss->fMap->curSize; i++) {
CCGFace *face = (CCGFace *) ss->fMap->buckets[i];
@@ -2478,22 +2472,10 @@ static bool check_topology_changed(CCGSubSurf *ss)
num_indices,
num_nverts;
int *indices, *nverts;
- int i, index, osd_vert_index, osd_face_index;
+ int i, index, osd_face_index;
BLI_assert(ss->osd_evaluator != NULL);
- /* Set an osd_index member in each one so we have consistent indexing.
- *
- * TODO(sergey): Currently here's a duplicated logic happens, make it
- * so osd_indices are only calculated once.
- */
- for (i = 0, osd_vert_index = 0; i < ss->vMap->curSize; ++i) {
- CCGVert *vert = (CCGVert *) ss->vMap->buckets[i];
- for (; vert; vert = vert->next, ++osd_vert_index) {
- vert->osd_index = osd_vert_index;
- }
- }
-
/* Get the topology from existing evaluator. */
openSubdiv_getEvaluatorTopology(ss->osd_evaluator,
&num_vertices,
More information about the Bf-blender-cvs
mailing list