diff --git a/MshViewer/Source/OpenGlController.cpp b/MshViewer/Source/OpenGlController.cpp index 858da67..565f32d 100644 --- a/MshViewer/Source/OpenGlController.cpp +++ b/MshViewer/Source/OpenGlController.cpp @@ -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); diff --git a/README.md b/README.md index e08a9b5..3fe1dbc 100644 --- a/README.md +++ b/README.md @@ -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: