diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-30 06:05:10 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-30 06:05:10 +0400 |
commit | 77e3eac3897975a82e1c68468002a5eb0f00a8b5 (patch) | |
tree | 5a12e118a94792aa3252bb56edefaddf7abda255 /source/blender/blenkernel/intern/CCGSubSurf.c | |
parent | 31700740111073c05dbec457d6b205fe53772aac (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/blender/blenkernel/intern/CCGSubSurf.c')
-rw-r--r-- | source/blender/blenkernel/intern/CCGSubSurf.c | 11 |
1 files changed, 11 insertions, 0 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 |