Fix T49179: Parts of mesh disappear with adaptive subdivision

Problem was zero length normal caused by a precision issue in patch evaluation.
This is somewhat of a quick fix, but is better than allowing possible NaNs to
occur and cause problems elsewhere.
This commit is contained in:
Mai Lavelle 2016-09-14 19:34:43 -04:00 committed by Sergey Sharybin
parent 91966eeefa
commit 0960d523a2
1 changed files with 6 additions and 1 deletions

View File

@ -284,7 +284,12 @@ struct OsdPatch : Patch {
if(dPdu) *dPdu = du;
if(dPdv) *dPdv = dv;
if(N) *N = normalize(cross(du, dv));
if(N) {
*N = cross(du, dv);
float t = len(*N);
*N = (t != 0.0f) ? *N/t : make_float3(0.0f, 0.0f, 1.0f);
}
}
BoundBox bound() { return BoundBox::empty; }