Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/renderconverter/intern/convertBlenderScene.c')
-rw-r--r--source/blender/renderconverter/intern/convertBlenderScene.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/source/blender/renderconverter/intern/convertBlenderScene.c b/source/blender/renderconverter/intern/convertBlenderScene.c
index 3c6af6f819b..94632f2e2c8 100644
--- a/source/blender/renderconverter/intern/convertBlenderScene.c
+++ b/source/blender/renderconverter/intern/convertBlenderScene.c
@@ -2735,36 +2735,24 @@ static void check_non_flat_quads(void)
if(vlr->mat->mode & MA_WIRE);
else {
- /* blahj, render normals are inverted in render */
- CalcNormFloat4(vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co, nor);
+ /* render normals are inverted in render! we calculate normal of single tria here */
+ CalcNormFloat(vlr->v4->co, vlr->v3->co, vlr->v1->co, nor);
xn= nor[0]*vlr->n[0] + nor[1]*vlr->n[1] + nor[2]*vlr->n[2];
- if( fabs(xn) < 0.990 ) {
+ if( fabs(xn) < 0.9990 ) { // checked on noisy fractal grid
if( xn<0.0 ) flipnorm= 1; else flipnorm= 0;
- /* recalc this nor, previous calc was with calcnormfloat4 */
- if(flipnorm) {
- if (vlr->flag & R_DIVIDE_24) CalcNormFloat(vlr->v1->co, vlr->v2->co, vlr->v4->co, vlr->n);
- else CalcNormFloat(vlr->v1->co, vlr->v2->co, vlr->v3->co, vlr->n);
- }
- else {
- if (vlr->flag & R_DIVIDE_24) CalcNormFloat(vlr->v4->co, vlr->v2->co, vlr->v1->co, vlr->n);
- else CalcNormFloat(vlr->v3->co, vlr->v2->co, vlr->v1->co, vlr->n);
- }
-
vlr1= RE_findOrAddVlak(R.totvlak++);
*vlr1= *vlr;
vlr1->flag |= R_FACE_SPLIT;
-
- if(flipnorm) VecMulf(nor, -1.0);
- VECCOPY(vlr1->n, nor);
- if (vlr->flag&R_DIVIDE_24) {
- vlr1->v1=vlr->v2;
- vlr1->v2=vlr->v3;
- vlr1->v3=vlr->v4;
- vlr->v3 =vlr->v4;
+ /* new vertex pointers */
+ if (vlr->flag & R_DIVIDE_24) {
+ vlr1->v1= vlr->v2;
+ vlr1->v2= vlr->v3;
+ vlr1->v3= vlr->v4;
+ vlr->v3 = vlr->v4;
vlr1->flag |= R_DIVIDE_24;
}
@@ -2775,8 +2763,18 @@ static void check_non_flat_quads(void)
vlr1->flag &= ~R_DIVIDE_24;
}
+ vlr->v4 = vlr1->v4 = NULL;
+
+ /* new normals */
+ if(flipnorm) {
+ CalcNormFloat(vlr->v1->co, vlr->v2->co, vlr->v3->co, vlr->n);
+ CalcNormFloat(vlr1->v1->co, vlr1->v2->co, vlr1->v3->co, vlr1->n);
+ }
+ else {
+ CalcNormFloat(vlr->v3->co, vlr->v2->co, vlr->v1->co, vlr->n);
+ CalcNormFloat(vlr1->v3->co, vlr1->v2->co, vlr1->v1->co, vlr1->n);
+ }
- vlr->v4 = vlr1->v4 = 0;
/* so later UV can be pulled from original tface, look for R_DIVIDE_24 for direction */
vlr1->tface=vlr->tface;