forked from bartvdbraak/blender
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.
This commit is contained in:
parent
3170074011
commit
77e3eac389
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user