Revision: 46875
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46875
Author:   campbellbarton
Date:     2012-05-22 09:53:33 +0000 (Tue, 22 May 2012)
Log Message:
-----------
solidify modifier - remove a loop on all edges.

Modified Paths:
--------------
    trunk/blender/source/blender/modifiers/intern/MOD_solidify.c

Modified: trunk/blender/source/blender/modifiers/intern/MOD_solidify.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_solidify.c        
2012-05-22 09:15:05 UTC (rev 46874)
+++ trunk/blender/source/blender/modifiers/intern/MOD_solidify.c        
2012-05-22 09:53:33 UTC (rev 46875)
@@ -240,8 +240,8 @@
 
        float (*face_nors_result)[3] = NULL;
 
-       const float ofs_orig =               -(((-smd->offset_fac + 1.0f) * 
0.5f) * smd->offset);
-       const float ofs_new = smd->offset    - (((-smd->offset_fac + 1.0f) * 
0.5f) * smd->offset);
+       const float ofs_orig = -(((-smd->offset_fac + 1.0f) * 0.5f) * 
smd->offset);
+       const float ofs_new  = smd->offset - ofs_orig;
        const float offset_fac_vg = smd->offset_fac_vg;
        const float offset_fac_vg_inv = 1.0f - smd->offset_fac_vg;
 
@@ -266,22 +266,31 @@
                unsigned int v1, v2;
                int eidx;
 
+#define INVALID_UNUSED -1
+#define INVALID_PAIR -2
+
+               edge_users = MEM_mallocN(sizeof(int) * numEdges, "solid_mod 
edges");
+               edge_order = MEM_mallocN(sizeof(char) * numEdges, "solid_mod 
eorder");
+
                for (i = 0, mv = orig_mvert; i < numVerts; i++, mv++) {
                        mv->flag &= ~ME_VERT_TMP_TAG;
                }
 
+               /* save doing 2 loops here... */
+#if 0
+               fill_vn_i(edge_users, numEdges, INVALID_UNUSED);
+#endif
+
                for (i = 0, ed = orig_medge; i < numEdges; i++, ed++) {
                        BLI_edgehash_insert(edgehash, ed->v1, ed->v2, 
SET_INT_IN_POINTER(i));
+                       edge_users[i] = INVALID_UNUSED;
                }
 
-#define INVALID_UNUSED -1
-#define INVALID_PAIR -2
-
 #define ADD_EDGE_USER(_v1, _v2, edge_ord) \
                { \
                        const unsigned int ml_v1 = _v1; \
                        const unsigned int ml_v2 = _v2; \
-                       eidx= 
GET_INT_FROM_POINTER(BLI_edgehash_lookup(edgehash, ml_v1, ml_v2)); \
+                       eidx = 
GET_INT_FROM_POINTER(BLI_edgehash_lookup(edgehash, ml_v1, ml_v2)); \
                        if (edge_users[eidx] == INVALID_UNUSED) { \
                                ed= orig_medge + eidx; \
                                edge_users[eidx] = (ml_v1 < ml_v2) == (ed->v1 < 
ed->v2) ? i : (i + numFaces); \
@@ -290,13 +299,8 @@
                        else { \
                                edge_users[eidx] = INVALID_PAIR; \
                        } \
-               }
+               } (void)0
 
-
-               edge_users = MEM_mallocN(sizeof(int) * numEdges, "solid_mod 
edges");
-               edge_order = MEM_mallocN(sizeof(char) * numEdges, "solid_mod 
eorder");
-               fill_vn_i(edge_users, numEdges, INVALID_UNUSED);
-               
                for (i = 0, mp = orig_mpoly; i < numFaces; i++, mp++) {
                        MLoop *ml;
                        

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to