it's working ! \o/

suzanne in 42 strips
This commit is contained in:
daniel borges
2012-09-17 21:08:40 +02:00
parent a4ec1322fe
commit 194673b5dd
2 changed files with 39 additions and 3 deletions

View File

@@ -72,9 +72,16 @@ void Disconnect(Face* f, Face* except, LIST_DECLARE(Face, dualLink) unconnected[
}
else if ( f->adj[i]->set == Face::CONNECTED )
{
u32 c = f->adj[i]->dualConnectivity - 1;
assert(c < 2);
connected[c].InsertTail(f->adj[i]);
if ( f->adj[i]->dualConnectivity == 0 )
{
Disconnect(f->adj[i], 0, unconnected, connected);
}
else
{
u32 c = f->adj[i]->dualConnectivity - 1;
assert(c < 2);
connected[c].InsertTail(f->adj[i]);
}
}
f->dual[i] = false;
}
@@ -636,6 +643,12 @@ void MultiPathStripper(const std::vector<u32>& indices, std::vector<u32>& stripL
assert(0 && "disconnecting a fully connected node !");
}
}
else
{
face[f]->dualLink.Unlink();
face[f]->RemoveFromDual(face[(f + 1) % 2]);
unconnected[face[f]->dualConnectivity].InsertTail(face[f]);
}
}
}
@@ -656,6 +669,18 @@ void MultiPathStripper(const std::vector<u32>& indices, std::vector<u32>& stripL
strip.InsertHead(f);
}
#ifdef _DEBUG
u32 realNbStrips = 0;
for ( u32 i = 0 ; i < nbStrips ; i++ )
if ( !strips[i].Empty() )
realNbStrips++;
printf("[end] strips:%d(%d) U0:%d U1:%d C1:%d U2:%d C2:%d U3:%d\n",
realNbStrips, nbStrips,
Length(unconnected[0]), Length(unconnected[1]), Length(connected[0]),
Length(unconnected[2]), Length(connected[1]), Length(unconnected[3]));
#endif
ShowDebug(faces, nbTris, 0, 0, strips, nbStrips);
delete[] faces;

View File

@@ -130,6 +130,17 @@ void BeginSceneOpenGL()
sinf(rotatePhi) * cosf(rotateTheta) * dist,
0.f, h, 0.f,
0., 1., 0.);
glBegin(GL_LINES);
glColor3f(1.f, 0.f, 0.f);
glVertex3f(0.f, 0.f, 0.f);
glVertex3f(1000.f, 0.f, 0.f);
glColor3f(0.f, 1.f, 0.f);
glVertex3f(0.f, 0.f, 0.f);
glVertex3f(0.f, 1000.f, 0.f);
glColor3f(0.f, 0.f, 1.f);
glVertex3f(0.f, 0.f, 0.f);
glVertex3f(0.f, 0.f, 1000.f);
glEnd();
}
bool EndSceneOpenGL()