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:
authorAlexander Ewering <blender@instinctive.de>2005-07-16 05:06:55 +0400
committerAlexander Ewering <blender@instinctive.de>2005-07-16 05:06:55 +0400
commit3be3e68e2fbfa3de73dd3d24e69c3068a9f6a6de (patch)
treed6f92356c4e7334cb2cf1b6de7c1f8f9023cd8e5 /source/blender/radiosity
parent8d2176bfeb863429cc5d689d8da14e76e8ce8135 (diff)
Fix radiosity "Collect Meshes" to ignore TFaces set to "Invisible".
I hope this doesn't break anything - works fine here.
Diffstat (limited to 'source/blender/radiosity')
-rw-r--r--source/blender/radiosity/intern/source/radpreprocess.c193
1 files changed, 97 insertions, 96 deletions
diff --git a/source/blender/radiosity/intern/source/radpreprocess.c b/source/blender/radiosity/intern/source/radpreprocess.c
index 22e12104a32..0c22717e696 100644
--- a/source/blender/radiosity/intern/source/radpreprocess.c
+++ b/source/blender/radiosity/intern/source/radpreprocess.c
@@ -42,8 +42,8 @@
*************************************** */
#include <stdlib.h>
-#include <string.h>
#include <stdio.h>
+#include <string.h>
#include <math.h>
#include "MEM_guardedalloc.h"
@@ -421,102 +421,103 @@ void rad_collect_meshes()
for(a=0; a<me->totface; a++, mface++) {
if(mface->v3) {
- TFace *tface;
-
- rp= callocPatch();
- BLI_addtail(&(RG.patchbase), rp);
- rp->from= ob;
-
- if(mface->v4) rp->type= 4;
- else rp->type= 3;
-
- rp->first= rn= callocNode();
-
- if(mface->flag & ME_SMOOTH) rp->f1= RAD_NO_SPLIT;
+ TFace *tface = me->tface ? &((TFace*)me->tface)[a] : (TFace*)NULL;
- /* temporal: we store the venoco in the node */
- rn->v1= (float *)(RG.verts+mface->v1+offs);
- v1= (RG.verts+mface->v1+offs)->v;
- rn->v2= (float *)(RG.verts+mface->v2+offs);
- v2= (RG.verts+mface->v2+offs)->v;
- rn->v3= (float *)(RG.verts+mface->v3+offs);
- v3= (RG.verts+mface->v3+offs)->v;
-
- if(mface->v4) {
- rn->v4= (float *)(RG.verts+mface->v4+offs);
- v4= (RG.verts+mface->v4+offs)->v;
- }
- rn->par= rp;
- rn->f= RAD_PATCH; /* this node is a Patch */
- rn->type= rp->type;
-
- if(rn->type==4) {
- rp->area= AreaQ3Dfl(v1, v2, v3, v4);
- CalcNormFloat4(v1, v2, v3, v4, rp->norm);
- }
- else {
- rp->area= AreaT3Dfl(v1, v2, v3);
- CalcNormFloat(v1, v2, v3, rp->norm);
- }
-
- tface = me->tface ? &((TFace*)me->tface)[a] : (TFace*)NULL;
-
- if (tface) {
- memcpy(rn->uv, tface->uv, sizeof(float) * 4 * 2);
- rn->tface = tface;
- }
- else {
- rn->uv[0][0] = 0.0f;
- rn->uv[0][1] = 0.0f;
- rn->uv[1][0] = 1.0f;
- rn->uv[1][1] = 0.0f;
- rn->uv[2][0] = 1.0f;
- rn->uv[2][1] = 1.0f;
- rn->uv[3][0] = 0.0f;
- rn->uv[3][1] = 1.0f;
- rn->tface = NULL;
- }
-
- rn->area= rp->area;
-
- /* color and emit */
- if(mface->mat_nr != index) {
- index= mface->mat_nr;
- ma= give_current_material(ob, index+1);
- if(ma==0) ma= &defmaterial;
- }
- rp->ref[0]= ma->r;
- rp->ref[1]= ma->g;
- rp->ref[2]= ma->b;
-
- if(ma->emit) RG.totlamp++;
-
- rp->emit[0]= rp->emit[1]= rp->emit[2]= ma->emit;
- rp->emit[0]*= rp->ref[0];
- rp->emit[1]*= rp->ref[1];
- rp->emit[2]*= rp->ref[2];
-
-// uncommented, this is not satisfying, but i leave it in code for now (ton)
-// if(ma->translucency!=0.0) rn->f |= RAD_TWOSIDED;
-
- nodevert= (VeNoCo **)&(rn->v1);
- for(b=0; b<rp->type; b++) {
- rp->cent[0]+= (*nodevert)->v[0];
- rp->cent[1]+= (*nodevert)->v[1];
- rp->cent[2]+= (*nodevert)->v[2];
- nodevert++;
- }
- rp->cent[0]/= (float)rp->type;
- rp->cent[1]/= (float)rp->type;
- rp->cent[2]/= (float)rp->type;
-
- /* for reconstruction materials */
- rp->matindex= materialIndex(ma);
- if(rp->matindex==-1) rp->matindex= 1;
-
- RG.totelem++;
- RG.totpatch++;
- }
+ if ((tface->mode & TF_INVISIBLE)==0) {
+
+ rp= callocPatch();
+ BLI_addtail(&(RG.patchbase), rp);
+ rp->from= ob;
+
+ if(mface->v4) rp->type= 4;
+ else rp->type= 3;
+
+ rp->first= rn= callocNode();
+
+ if(mface->flag & ME_SMOOTH) rp->f1= RAD_NO_SPLIT;
+
+ /* temporal: we store the venoco in the node */
+ rn->v1= (float *)(RG.verts+mface->v1+offs);
+ v1= (RG.verts+mface->v1+offs)->v;
+ rn->v2= (float *)(RG.verts+mface->v2+offs);
+ v2= (RG.verts+mface->v2+offs)->v;
+ rn->v3= (float *)(RG.verts+mface->v3+offs);
+ v3= (RG.verts+mface->v3+offs)->v;
+
+ if(mface->v4) {
+ rn->v4= (float *)(RG.verts+mface->v4+offs);
+ v4= (RG.verts+mface->v4+offs)->v;
+ }
+ rn->par= rp;
+ rn->f= RAD_PATCH; /* this node is a Patch */
+ rn->type= rp->type;
+
+ if(rn->type==4) {
+ rp->area= AreaQ3Dfl(v1, v2, v3, v4);
+ CalcNormFloat4(v1, v2, v3, v4, rp->norm);
+ }
+ else {
+ rp->area= AreaT3Dfl(v1, v2, v3);
+ CalcNormFloat(v1, v2, v3, rp->norm);
+ }
+
+ if (tface) {
+ memcpy(rn->uv, tface->uv, sizeof(float) * 4 * 2);
+ rn->tface = tface;
+ }
+ else {
+ rn->uv[0][0] = 0.0f;
+ rn->uv[0][1] = 0.0f;
+ rn->uv[1][0] = 1.0f;
+ rn->uv[1][1] = 0.0f;
+ rn->uv[2][0] = 1.0f;
+ rn->uv[2][1] = 1.0f;
+ rn->uv[3][0] = 0.0f;
+ rn->uv[3][1] = 1.0f;
+ rn->tface = NULL;
+ }
+
+ rn->area= rp->area;
+
+ /* color and emit */
+ if(mface->mat_nr != index) {
+ index= mface->mat_nr;
+ ma= give_current_material(ob, index+1);
+ if(ma==0) ma= &defmaterial;
+ }
+ rp->ref[0]= ma->r;
+ rp->ref[1]= ma->g;
+ rp->ref[2]= ma->b;
+
+ if(ma->emit) RG.totlamp++;
+
+ rp->emit[0]= rp->emit[1]= rp->emit[2]= ma->emit;
+ rp->emit[0]*= rp->ref[0];
+ rp->emit[1]*= rp->ref[1];
+ rp->emit[2]*= rp->ref[2];
+
+ // uncommented, this is not satisfying, but i leave it in code for now (ton)
+ // if(ma->translucency!=0.0) rn->f |= RAD_TWOSIDED;
+
+ nodevert= (VeNoCo **)&(rn->v1);
+ for(b=0; b<rp->type; b++) {
+ rp->cent[0]+= (*nodevert)->v[0];
+ rp->cent[1]+= (*nodevert)->v[1];
+ rp->cent[2]+= (*nodevert)->v[2];
+ nodevert++;
+ }
+ rp->cent[0]/= (float)rp->type;
+ rp->cent[1]/= (float)rp->type;
+ rp->cent[2]/= (float)rp->type;
+
+ /* for reconstruction materials */
+ rp->matindex= materialIndex(ma);
+ if(rp->matindex==-1) rp->matindex= 1;
+
+ RG.totelem++;
+ RG.totpatch++;
+ }
+ }
}
offs+= me->totvert;
}