Corrected a few allocating and copyng functions to manage polygonal meshes instead of simple triangular ones.

This commit is contained in:
Paolo Cignoni 2014-02-12 10:59:37 +00:00
parent d00d1b90e0
commit 7747e6097f
2 changed files with 10 additions and 11 deletions

View File

@ -847,11 +847,11 @@ void ResizeAttribute(ATTR_CONT &c,const int & sz , MeshType &/*m*/){
if(pos!=i)
{
m.face[pos].ImportData(m.face[i]);
m.face[pos].V(0) = m.face[i].V(0);
m.face[pos].V(1) = m.face[i].V(1);
m.face[pos].V(2) = m.face[i].V(2);
for(int j=0;j<m.face[i].VN();++j)
m.face[pos].V(i) = m.face[i].V(i);
if(HasVFAdjacency(m))
for(int j=0;j<3;++j)
for(int j=0;j<m.face[i].VN();++j)
{
if (m.face[i].IsVFInitialized(j)) {
m.face[pos].VFp(j) = m.face[i].cVFp(j);
@ -860,7 +860,7 @@ void ResizeAttribute(ATTR_CONT &c,const int & sz , MeshType &/*m*/){
else m.face[pos].VFClear(j);
}
if(HasFFAdjacency(m))
for(int j=0;j<3;++j)
for(int j=0;j<m.face[i].VN();++j)
if (m.face[i].cFFp(j)!=0) {
m.face[pos].FFp(j) = m.face[i].cFFp(j);
m.face[pos].FFi(j) = m.face[i].cFFi(j);
@ -908,7 +908,7 @@ void ResizeAttribute(ATTR_CONT &c,const int & sz , MeshType &/*m*/){
if(!(*fi).IsD())
{
if(HasVFAdjacency(m))
for(int i=0;i<3;++i)
for(int i=0;i<(*fi).VN();++i)
if ((*fi).IsVFInitialized(i) && (*fi).VFp(i)!=0 )
{
size_t oldIndex = (*fi).VFp(i) - fbase;
@ -916,7 +916,7 @@ void ResizeAttribute(ATTR_CONT &c,const int & sz , MeshType &/*m*/){
(*fi).VFp(i) = fbase+pu.remap[oldIndex];
}
if(HasFFAdjacency(m))
for(int i=0;i<3;++i)
for(int i=0;i<(*fi).VN();++i)
if ((*fi).cFFp(i)!=0)
{
size_t oldIndex = (*fi).FFp(i) - fbase;

View File

@ -293,12 +293,11 @@ static void Mesh(MeshLeft& ml, ConstMeshRight& mr, const bool selected = false,
{
FaceLeft &fl = ml.face[remap.face[Index(mr,*fi)]];
if(WTFlag)
for(int i = 0; i < 3; ++i)
for(int i = 0; i < fl.VN(); ++i)
fl.WT(i).n() +=textureOffset;
if(HasFVAdjacency(ml) && HasFVAdjacency(mr)){
fl.V(0) = &ml.vert[remap.vert[Index(mr,fi->cV(0))]];
fl.V(1) = &ml.vert[remap.vert[Index(mr,fi->cV(1))]];
fl.V(2) = &ml.vert[remap.vert[Index(mr,fi->cV(2))]];
for(int i = 0; i < fl.VN(); ++i)
fl.V(i) = &ml.vert[remap.vert[Index(mr,fi->cV(i))]];
}
ml.face[remap.face[Index(mr,*fi)]].ImportData(*fi);
if(adjFlag) ImportFaceAdj(ml,mr,ml.face[remap.face[Index(mr,*fi)]],*fi,remap);