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:
authorNicholas Bishop <nicholasbishop@gmail.com>2012-08-18 23:54:21 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2012-08-18 23:54:21 +0400
commit12425588f2d33174e4a78873075b185ea51ebc3d (patch)
tree2a5c4a297d0461a026e42d5788d2344c8a6354e7 /source/blender/blenkernel/intern/subsurf_ccg.c
parente30ed91b9011b6eb5fae2932c002f83936c31d9d (diff)
Fix simple subsurf on wire edges
Subsurf on wire edges gave smooth results even if set to simple subdiv. Added a field to the CCG meshIFC to flag simple subdivision, then when syncing vertices simply skip moving vertices if in simple-subdiv mode. This change affects two places, the level-1 build in sync and the subdivision up to other levels. Fixes bug [#32268] Simple Subsurf Modifier gives unexpected results on edges without faces projects.blender.org/tracker/index.php?func=detail&aid=32268&group_id=9&atid=498
Diffstat (limited to 'source/blender/blenkernel/intern/subsurf_ccg.c')
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 5c387e8cee0..b2762d23ef3 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -113,7 +113,8 @@ typedef enum {
CCG_USE_ARENA = 2,
CCG_CALC_NORMALS = 4,
/* add an extra four bytes for a mask layer */
- CCG_ALLOC_MASK = 8
+ CCG_ALLOC_MASK = 8,
+ CCG_SIMPLE_SUBDIV = 16
} CCGFlags;
static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels,
@@ -133,7 +134,10 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels,
ccgSubSurf_getUseAgeCounts(prevSS, &oldUseAging, NULL, NULL, NULL);
- if (oldUseAging != useAging) {
+ if ((oldUseAging != useAging) ||
+ (ccgSubSurf_getSimpleSubdiv(prevSS) !=
+ !!(flags & CCG_SIMPLE_SUBDIV)))
+ {
ccgSubSurf_free(prevSS);
}
else {
@@ -156,6 +160,7 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels,
ifc.vertDataSize += sizeof(float) * 3;
if (flags & CCG_ALLOC_MASK)
ifc.vertDataSize += sizeof(float);
+ ifc.simpleSubdiv = !!(flags & CCG_SIMPLE_SUBDIV);
if (useArena) {
CCGAllocatorIFC allocatorIFC;
@@ -3474,7 +3479,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
float (*vertCos)[3],
SubsurfFlags flags)
{
- int useSimple = smd->subdivType == ME_SIMPLE_SUBSURF;
+ int useSimple = (smd->subdivType == ME_SIMPLE_SUBSURF) ? CCG_SIMPLE_SUBDIV : 0;
CCGFlags useAging = smd->flags & eSubsurfModifierFlag_DebugIncr ? CCG_USE_AGING : 0;
int useSubsurfUv = smd->flags & eSubsurfModifierFlag_SubsurfUv;
int drawInteriorEdges = !(smd->flags & eSubsurfModifierFlag_ControlEdges);
@@ -3483,7 +3488,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
if (flags & SUBSURF_FOR_EDIT_MODE) {
int levels = (smd->modifier.scene) ? get_render_subsurf_level(&smd->modifier.scene->r, smd->levels) : smd->levels;
- smd->emCache = _getSubSurf(smd->emCache, levels, 3, useAging | CCG_CALC_NORMALS);
+ smd->emCache = _getSubSurf(smd->emCache, levels, 3, useSimple | useAging | CCG_CALC_NORMALS);
ss_sync_from_derivedmesh(smd->emCache, dm, vertCos, useSimple);
result = getCCGDerivedMesh(smd->emCache,
@@ -3498,7 +3503,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
if (levels == 0)
return dm;
- ss = _getSubSurf(NULL, levels, 3, CCG_USE_ARENA | CCG_CALC_NORMALS);
+ ss = _getSubSurf(NULL, levels, 3, useSimple | CCG_USE_ARENA | CCG_CALC_NORMALS);
ss_sync_from_derivedmesh(ss, dm, vertCos, useSimple);
@@ -3529,7 +3534,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
}
if (useIncremental && (flags & SUBSURF_IS_FINAL_CALC)) {
- smd->mCache = ss = _getSubSurf(smd->mCache, levels, 3, useAging | CCG_CALC_NORMALS);
+ smd->mCache = ss = _getSubSurf(smd->mCache, levels, 3, useSimple | useAging | CCG_CALC_NORMALS);
ss_sync_from_derivedmesh(ss, dm, vertCos, useSimple);
@@ -3538,7 +3543,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
useSubsurfUv, dm);
}
else {
- CCGFlags ccg_flags = CCG_USE_ARENA | CCG_CALC_NORMALS;
+ CCGFlags ccg_flags = useSimple | CCG_USE_ARENA | CCG_CALC_NORMALS;
if (smd->mCache && (flags & SUBSURF_IS_FINAL_CALC)) {
ccgSubSurf_free(smd->mCache);