diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-23 02:59:47 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-23 02:59:47 +0400 |
commit | b7bf20d9504127ec7c3d52bc8a1448d4a2bdc3bf (patch) | |
tree | a38041dec1c240652d0e22991489ab1255d35fd4 /source/blender/blenkernel/BKE_DerivedMesh.h | |
parent | 33e52d0df4d2d9dfd248144e2aac08af4c1bbeff (diff) |
optimization: only calculate the normals for passing into derivedMesh foreachMappedVert/foreachMappedFaceCenter when needed,
this means in editmode with wire draw, face and vertex normals don't have to be calculated at all.
in most cases the normals are not used so add a flag that makes calculating them only for functions that need them.
also fix face normal calculation for CDDM, was using quad calculation for ngons too.
Diffstat (limited to 'source/blender/blenkernel/BKE_DerivedMesh.h')
-rw-r--r-- | source/blender/blenkernel/BKE_DerivedMesh.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 40fc71e82ca..8396380fd06 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -152,6 +152,11 @@ typedef enum DMDrawFlag { DM_DRAW_ALWAYS_SMOOTH = 2 } DMDrawFlag; +typedef enum DMForeachFlag { + DM_FOREACH_NOP = 0, + DM_FOREACH_USE_NORMAL = (1 << 0), /* foreachMappedVert, foreachMappedFaceCenter */ +} DMForeachFlag; + typedef enum DMDirtyFlag { /* dm has valid tessellated faces, but tessellated CDDATA need to be updated. */ DM_DIRTY_TESS_CDLAYERS = 1 << 0, @@ -285,7 +290,8 @@ struct DerivedMesh { void (*foreachMappedVert)(DerivedMesh *dm, void (*func)(void *userData, int index, const float co[3], const float no_f[3], const short no_s[3]), - void *userData); + void *userData, + DMForeachFlag flag); /** Iterate over each mapped edge in the derived mesh, calling the * given function with the original edge and the mapped edge's new @@ -303,7 +309,8 @@ struct DerivedMesh { void (*foreachMappedFaceCenter)(DerivedMesh *dm, void (*func)(void *userData, int index, const float cent[3], const float no[3]), - void *userData); + void *userData, + DMForeachFlag flag); /** Iterate over all vertex points, calling DO_MINMAX with given args. * |