diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-11-12 18:05:51 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-11-12 18:05:51 +0300 |
commit | 331d1b1b5009bf764c4de428fbc75560ca547dc3 (patch) | |
tree | dafba51015ead75e327d4c90236f534d40dfa711 /source/blender/blenkernel/intern/CCGSubSurf.c | |
parent | 9d6787c3e1861d182e702442a4750c2e5ffb3b28 (diff) |
sintel's normals were rendering black around her eye.
Subsurf FLT_EPSILON from float.h was too high, using a smaller value fixes
Diffstat (limited to 'source/blender/blenkernel/intern/CCGSubSurf.c')
-rw-r--r-- | source/blender/blenkernel/intern/CCGSubSurf.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index cee032f364e..355ea70b178 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -3,12 +3,15 @@ #include <stdlib.h> #include <string.h> #include <math.h> -#include <float.h> #include "CCGSubSurf.h" #include "BLO_sys_types.h" // for intptr_t support +/* used for normalize_v3 in BLI_math_vector + * float.h's FLT_EPSILON causes trouble with subsurf normals - campbell */ +#define EPSILON (1.0e-35f) + /***/ typedef unsigned char byte; @@ -593,7 +596,7 @@ void _face_calcIFNo(CCGFace *f, int lvl, int S, int x, int y, float *no, int lev length = sqrt(no[0]*no[0] + no[1]*no[1] + no[2]*no[2]); - if (length>FLT_EPSILON) { + if (length>EPSILON) { float invLength = 1.f/length; no[0] *= invLength; @@ -1934,7 +1937,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { length = sqrt(no[0]*no[0] + no[1]*no[1] + no[2]*no[2]); - if (length>FLT_EPSILON) { + if (length>EPSILON) { float invLength = 1.0f/length; no[0] *= invLength; no[1] *= invLength; @@ -1993,7 +1996,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { float *no = FACE_getIFNo(f, lvl, S, x, y); float length = sqrt(no[0]*no[0] + no[1]*no[1] + no[2]*no[2]); - if (length>FLT_EPSILON) { + if (length>EPSILON) { float invLength = 1.0f/length; no[0] *= invLength; no[1] *= invLength; |