From 59433aa42e302d0ddf95ae1944b90bb8bd85576f Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 21 Jun 2004 17:58:53 +0000 Subject: [PATCH] Report #1391 The work i did end of may on render normals (displacemap especially) caused refraction code to work wrong... took a while to find out, but just removed a couple of lines too much. Added clear comment there what it is, and what danger of removing is! --- .../blender/render/intern/source/renderHelp.c | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/source/blender/render/intern/source/renderHelp.c b/source/blender/render/intern/source/renderHelp.c index 89213008f7d..60150655e8f 100644 --- a/source/blender/render/intern/source/renderHelp.c +++ b/source/blender/render/intern/source/renderHelp.c @@ -269,17 +269,22 @@ void set_normalflags(void) if((a1 & 255)==0) vlr= R.blovl[a1>>8]; else vlr++; - vec[0]= vlr->v1->co[0]; - vec[1]= vlr->v1->co[1]; - vec[2]= vlr->v1->co[2]; + /* abuse of this flag... this is code that just sets face normal in direction of camera */ + /* that convention we should get rid of */ + if((vlr->flag & R_NOPUNOFLIP)==0) { - if( (vec[0]*vlr->n[0] +vec[1]*vlr->n[1] +vec[2]*vlr->n[2])<0.0 ) { - vlr->puno= vlr->puno ^ 15; - vlr->n[0]= -vlr->n[0]; - vlr->n[1]= -vlr->n[1]; - vlr->n[2]= -vlr->n[2]; + vec[0]= vlr->v1->co[0]; + vec[1]= vlr->v1->co[1]; + vec[2]= vlr->v1->co[2]; + + if( (vec[0]*vlr->n[0] +vec[1]*vlr->n[1] +vec[2]*vlr->n[2])<0.0 ) { + vlr->puno= vlr->puno ^ 15; + vlr->n[0]= -vlr->n[0]; + vlr->n[1]= -vlr->n[1]; + vlr->n[2]= -vlr->n[2]; + } } - + /* recalculate puno. Displace & flipped matrices can screw up */ vlr->puno= 0; if( Inpf(vlr->n, vlr->v1->n) < 0.0 ) vlr->puno |= ME_FLIPV1;