Skip to content
Snippets Groups Projects
Commit bcdc17c3 authored by Anakin's avatar Anakin
Browse files

shorten code,

tested multipoly, there are some problems, look at the README.md,
parent b3a8b4bb
No related branches found
No related tags found
No related merge requests found
......@@ -388,33 +388,10 @@ void OpenGLController::loadMsh(const char * path)
{
for (auto& mshIt : segIt->meshIndices) // for every polygon
{
if (mshIt->size() == 3) // already triangulated
{
for (int i = 0; i < 3; i++) // for every edge of the polygon
{
Vertex tempVertex;
// every edge has 3 coordinates
for (int j = 0; j < 3; j++)
tempVertex.position[j] = (GLfloat)segIt->vertex[(*mshIt)[i] * 3 + j];
// and 2 UV
if (segIt->uv == NULL)
{
tempVertex.uv[0] = 1.0;
tempVertex.uv[1] = 1.0;
}
else
{
for (int j = 0; j < 2; j++)
tempVertex.uv[j] = (GLfloat)segIt->uv[(*mshIt)[i] * 2 + j];
}
tempBufferData.push_back(tempVertex);
}
}
else if (mshIt->size() > 3) // needs to be triangulated
if (mshIt->size() >= 3) // multipoly
{
// for every triangle of the multi polygon
for (int tri = 0; tri < mshIt->size() - 2; tri++)
for (unsigned int tri = 0; tri < mshIt->size() - 2; tri++)
{
// for every edge of the triangle
for (int triEdge = 0; triEdge < 3; triEdge++)
......@@ -438,11 +415,8 @@ void OpenGLController::loadMsh(const char * path)
tempBufferData.push_back(tempVertex);
}
}
//TODO: test triangulation
//MessageBox(NULL, "Ooops!", "MeshViewer 2.0 Error", MB_OK | MB_ICONERROR);
}
else // this shouldn't happen (polygon with less then 3 vertex)
else // this shouldn't happen (polygon with less then 3 vertex)
{
deleteVectors();
MessageBox(NULL, "You have polygons with less then 3 vertices!", "MeshViewer 2.0 Error", MB_OK | MB_ICONERROR);
......
......@@ -13,8 +13,9 @@ Feel free to use my code the way you like. But remember i used some public libra
licence, too.
### To Do
- cluster seam to use wrong textures
- multipoly testing
- cluster use wrong textures
- use normals or fix ccw and cw
- multipoly triangulation not 100% good
- cloth testing
- optional display bones, shadow, collision,...
- integrate into a software:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment