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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-03-30 06:05:10 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-03-30 06:05:10 +0400
commit77e3eac3897975a82e1c68468002a5eb0f00a8b5 (patch)
tree5a12e118a94792aa3252bb56edefaddf7abda255 /source
parent31700740111073c05dbec457d6b205fe53772aac (diff)
Fix for old bug with subsurf not initializing normals for edges that had no faces,
Noted that a floating point exception caused by this r28953. With the render engine using DerivedMesh normals this came up as a memory error when rendering some files. for now zero the normals, could interpolate between vertex normals if needed.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c11
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c6
2 files changed, 16 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 2cfd17a95f3..a311ca15e5e 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -1342,6 +1342,17 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
NormCopy(EDGE_getNo(e, lvl, x),
_face_getIFNoEdge(f, e, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset));
}
+ else {
+ /* set to zero here otherwise the normals are uninitialized memory
+ * render: tests/animation/knight.blend with valgrind.
+ * we could be more clever and interpolate vertex normals but these are
+ * most likely not used so just zero out. */
+ int x;
+
+ for (x=0; x<edgeSize; x++) {
+ NormZero(EDGE_getNo(e, lvl, x));
+ }
+ }
}
}
#undef FACE_getIFNo
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 54bd4a86a5e..3041a4c59e6 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -851,7 +851,11 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert)
for(x = 1; x < edgeSize - 1; x++, i++) {
vd= ccgSubSurf_getEdgeData(ss, e, x);
copy_v3_v3(mvert[i].co, vd->co);
- /* XXX, This gives errors with -fpe, the normals dont seem to be unit length - campbell */
+ /* This gives errors with -debug-fpe
+ * the normals dont seem to be unit length.
+ * this is most likely caused by edges with no
+ * faces which are now zerod out, see comment in:
+ * ccgSubSurf__calcVertNormals(), - campbell */
normal_float_to_short_v3(mvert[i].no, vd->no);
}
}