This commit is contained in:
daniel borges
2012-09-18 19:18:57 +02:00
parent 591239b339
commit de74b97937
2 changed files with 39 additions and 22 deletions

View File

@@ -126,8 +126,8 @@ int Convert(const char* input, const char* output)
| aiProcess_FindDegenerates | aiProcess_FindDegenerates
| aiProcess_SortByPType | aiProcess_SortByPType
| aiProcess_FindInstances | aiProcess_FindInstances
| aiProcess_OptimizeMeshes //| aiProcess_OptimizeMeshes
| aiProcess_ImproveCacheLocality //| aiProcess_ImproveCacheLocality
| aiProcess_RemoveComponent); | aiProcess_RemoveComponent);
puts(" done"); puts(" done");

View File

@@ -194,7 +194,7 @@ void DrawEdge(Face* a, Face* b)
glEnd(); glEnd();
} }
void DrawStrip(LIST_DECLARE(Face, stripLink)& strip, u32 color) void DrawStrip(LIST_DECLARE(Face, stripLink)& strip, u32 color, float alpha, bool headtail)
{ {
if ( strip.Head() == 0 ) if ( strip.Head() == 0 )
return; return;
@@ -204,17 +204,20 @@ void DrawStrip(LIST_DECLARE(Face, stripLink)& strip, u32 color)
Face* f = strip.Head(); Face* f = strip.Head();
while ( f ) while ( f )
{ {
ColorOpenGL(color, .5f); ColorOpenGL(color, alpha);
DrawFace(*f); DrawFace(*f);
f = f->stripLink.Next(); f = f->stripLink.Next();
} }
glEnd(); glEnd();
if ( headtail )
{
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
ColorOpenGL(1); ColorOpenGL(1);
DrawBorder(*strip.Head()); DrawBorder(*strip.Head());
ColorOpenGL(0); ColorOpenGL(0);
DrawBorder(*strip.Tail()); DrawBorder(*strip.Tail());
}
} }
void DrawAdjacency(Face* f) void DrawAdjacency(Face* f)
@@ -236,7 +239,7 @@ void ShowDebug(Face* faces, u32 nbTris, Face* f0, Face* f1, LIST_DECLARE(Face, s
for ( u32 i = 0 ; i < nbStrips ; i++ ) for ( u32 i = 0 ; i < nbStrips ; i++ )
{ {
DrawStrip(strips[i], i); DrawStrip(strips[i], i, .5f, TRUE);
} }
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
@@ -262,6 +265,19 @@ void ShowDebug(Face* faces, u32 nbTris, Face* f0, Face* f1, LIST_DECLARE(Face, s
} }
} }
void ShowStrips(LIST_DECLARE(Face, stripLink) strips[MAX_STRIPS], u32 nbStrips)
{
while ( EndSceneOpenGL() )
{
BeginSceneOpenGL();
for ( u32 i = 0 ; i < nbStrips ; i++ )
{
DrawStrip(strips[i], i, 1.f, FALSE);
}
}
}
void MultiPathStripper(const std::vector<u32>& indices, std::vector<u32>& stripLengths, std::vector<u32>& stripIndices) void MultiPathStripper(const std::vector<u32>& indices, std::vector<u32>& stripLengths, std::vector<u32>& stripIndices)
{ {
u32 nbTris = indices.size() / 3; u32 nbTris = indices.size() / 3;
@@ -334,18 +350,18 @@ void MultiPathStripper(const std::vector<u32>& indices, std::vector<u32>& stripL
for ( u32 e = 0 ; e < nbEdges ; e++ ) for ( u32 e = 0 ; e < nbEdges ; e++ )
{ {
#ifdef _DEBUG #ifdef _DEBUG
if ( e % 32 == 0 ) //if ( e % 32 == 0 )
{ //{
u32 realNbStrips = 0; // u32 realNbStrips = 0;
for ( u32 i = 0 ; i < nbStrips ; i++ ) // for ( u32 i = 0 ; i < nbStrips ; i++ )
if ( !strips[i].Empty() ) // if ( !strips[i].Empty() )
realNbStrips++; // realNbStrips++;
printf("[%d] strips:%d(%d) U0:%d U1:%d C1:%d U2:%d C2:%d U3:%d\n", // printf("[%d] strips:%d(%d) U0:%d U1:%d C1:%d U2:%d C2:%d U3:%d\n",
e, realNbStrips, nbStrips, // e, realNbStrips, nbStrips,
Length(unconnected[0]), Length(unconnected[1]), Length(connected[0]), // Length(unconnected[0]), Length(unconnected[1]), Length(connected[0]),
Length(unconnected[2]), Length(connected[1]), Length(unconnected[3])); // Length(unconnected[2]), Length(connected[1]), Length(unconnected[3]));
} //}
#endif #endif
Face* face[2] = { 0, 0 }; Face* face[2] = { 0, 0 };
if ( !unconnected[1].Empty() ) if ( !unconnected[1].Empty() )
@@ -744,7 +760,8 @@ void MultiPathStripper(const std::vector<u32>& indices, std::vector<u32>& stripL
Length(unconnected[2]), Length(connected[1]), Length(unconnected[3])); Length(unconnected[2]), Length(connected[1]), Length(unconnected[3]));
#endif #endif
ShowDebug(faces, nbTris, 0, 0, strips, nbStrips); glEnable(GL_DEPTH_TEST);
ShowStrips(strips, nbStrips);
delete[] faces; delete[] faces;
} }