From 194673b5ddb7960f9e9b728d6fb7d2b2524dcaec Mon Sep 17 00:00:00 2001 From: daniel borges Date: Mon, 17 Sep 2012 21:08:40 +0200 Subject: [PATCH] it's working ! \o/ suzanne in 42 strips --- DSMeshConvert/multipath.cpp | 31 ++++++++++++++++++++++++++++--- DSMeshConvert/opengl.cpp | 11 +++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/DSMeshConvert/multipath.cpp b/DSMeshConvert/multipath.cpp index c791e0d..0d94a8f 100644 --- a/DSMeshConvert/multipath.cpp +++ b/DSMeshConvert/multipath.cpp @@ -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& indices, std::vector& 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& indices, std::vector& 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; diff --git a/DSMeshConvert/opengl.cpp b/DSMeshConvert/opengl.cpp index cc9b380..35fd96d 100644 --- a/DSMeshConvert/opengl.cpp +++ b/DSMeshConvert/opengl.cpp @@ -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()