diff options
author | Daniel Dunbar <daniel@zuster.org> | 2005-08-21 11:19:20 +0400 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2005-08-21 11:19:20 +0400 |
commit | 7804860cf61b8fc522405740180d10181d174187 (patch) | |
tree | 6331ac308c233fca06416e95d0c0473d3606aa20 /source/blender/radiosity/intern | |
parent | d29f7c2c8489442bbca4a76774d4f961dad0173b (diff) |
- added mesh_strip_loose_faces, works in conjunction with make_edges
to get rid of faces with MFace.v3==0
- change all Mesh's to have ->medge now. This is forced by make_edges
on readfile, and in the various exotic important routines, and on
conversion back in python.
- make python NMesh structure always have medges now (needs testing)
- with above two changes it is guarenteed that mf->v3 is never ==0
in main blender code (i.e., all MFace's are actually triangles
or quads) and so I went through and removed all the historic tests
to deal with MFace.v3==0. Equals lots of deleting, I am in heaven!
- removed MEdge edcode flag, no longer needed
- added experimental replacement for edge flag system
Still are some inconsistencies in FACESELECT mode edge drawing to
be ironed out.
NOTE: This commit adds an experimental edge flag calc system, based
on 10-seconds-of-thought algorithm by yours truly. Would appreciate
feedback on how this system works, esp compared to old one and esp
on complex or interesting models.
To Use: New system is enabled by setting G.rt to a value between
1 and 1000 (Value of 0 uses old system). Value 1000 is reserved for
"auto" edge, which is more or less identical to old system but also
makes sure that at least 10% of edges are drawn (solves errors for
super subdivided meshes). Values between 1 and 999 act as percent
(out of 1000) of edges that should be drawn, starting with "most
interesting" edges first. Please try it and comment!
Diffstat (limited to 'source/blender/radiosity/intern')
-rw-r--r-- | source/blender/radiosity/intern/source/radpostprocess.c | 2 | ||||
-rw-r--r-- | source/blender/radiosity/intern/source/radpreprocess.c | 190 |
2 files changed, 94 insertions, 98 deletions
diff --git a/source/blender/radiosity/intern/source/radpostprocess.c b/source/blender/radiosity/intern/source/radpostprocess.c index a722d881200..49ff4183780 100644 --- a/source/blender/radiosity/intern/source/radpostprocess.c +++ b/source/blender/radiosity/intern/source/radpostprocess.c @@ -979,8 +979,6 @@ void rad_addmesh(void) mface->v2= *((unsigned int *)face->v2+3); mface->v3= *((unsigned int *)face->v3+3); if(face->v4) mface->v4= *((unsigned int *)face->v4+3); - - mface->edcode= 3; test_index_face(mface, NULL, NULL, face->v4 ? 4 : 3); mface->mat_nr= face->matindex; diff --git a/source/blender/radiosity/intern/source/radpreprocess.c b/source/blender/radiosity/intern/source/radpreprocess.c index f343db2cee8..cf7385edd0c 100644 --- a/source/blender/radiosity/intern/source/radpreprocess.c +++ b/source/blender/radiosity/intern/source/radpreprocess.c @@ -420,103 +420,101 @@ void rad_collect_meshes() index= -1; for(a=0; a<me->totface; a++, mface++) { - if(mface->v3) { - TFace *tface = me->tface ? &((TFace*)me->tface)[a] : NULL; - - if (tface == NULL || (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++; + TFace *tface = me->tface ? &((TFace*)me->tface)[a] : NULL; + + if (tface == NULL || (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; |