completed the correct working of temporary data inside the refinement functions

This commit is contained in:
Paolo Cignoni 2009-06-25 06:19:00 +00:00
parent 2c3da1c3c9
commit eae78a0251
3 changed files with 9 additions and 2 deletions

View File

@ -440,7 +440,7 @@ void Sphere(MeshType &in, const int subdiv = 3 )
size_t lastsize = 0; size_t lastsize = 0;
for(int i = 0 ; i < subdiv; ++i) for(int i = 0 ; i < subdiv; ++i)
{ {
Refine< MeshType, MidPoint<MeshType> >(in, MidPoint<MeshType>(), 0); Refine< MeshType, MidPoint<MeshType> >(in, MidPoint<MeshType>(&in), 0);
for(vi = in.vert.begin() + lastsize; vi != in.vert.end(); ++vi) for(vi = in.vert.begin() + lastsize; vi != in.vert.end(); ++vi)
vi->P().Normalize(); vi->P().Normalize();

View File

@ -440,8 +440,11 @@ bool RefineE(MESH_TYPE &m, MIDPOINT mid, EDGEPRED ep,bool RefineSelected=false,
for(i=1;i<SplitTab[ind].TriNum;++i){ for(i=1;i<SplitTab[ind].TriNum;++i){
nf[i]=&*lastf; ++lastf; fca++; nf[i]=&*lastf; ++lastf; fca++;
if(RefineSelected || (*fi).IsS()) (*nf[i]).SetS(); if(RefineSelected || (*fi).IsS()) (*nf[i]).SetS();
if(tri::HasPerFaceColor(m))
nf[i]->C()=(*fi).cC();
} }
if(tri::HasPerWedgeTexCoord(m)) if(tri::HasPerWedgeTexCoord(m))
for(i=0;i<3;++i) { for(i=0;i<3;++i) {
wtt[i]=(*fi).WT(i); wtt[i]=(*fi).WT(i);

View File

@ -538,7 +538,11 @@ public:
assert((*this).Base().ColorEnabled); assert((*this).Base().ColorEnabled);
return (*this).Base().CV[(*this).Index()]; return (*this).Base().CV[(*this).Index()];
} }
const ColorType C() const { const ColorType C() const {
assert((*this).Base().ColorEnabled);
return (*this).Base().CV[(*this).Index()];
}
const ColorType cC() const {
assert((*this).Base().ColorEnabled); assert((*this).Base().ColorEnabled);
return (*this).Base().CV[(*this).Index()]; return (*this).Base().CV[(*this).Index()];
} }