Commit 232acedc authored by Anakin's avatar Anakin
Browse files

trying to fix the polygon mess up,

added new multipoly for testing
parent 60cc7bb5
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <string> #include <string>
#include <glm\gtc\matrix_transform.hpp> #include <glm\gtc\matrix_transform.hpp>
#include <iostream>
#define VERTEX_SHADER "Shader/TextureShader.vert" #define VERTEX_SHADER "Shader/TextureShader.vert"
#define FRAGMENT_SHADER "Shader/TextureShader.frag" #define FRAGMENT_SHADER "Shader/TextureShader.frag"
...@@ -388,11 +389,13 @@ void OpenGLController::loadMsh(const char * path) ...@@ -388,11 +389,13 @@ void OpenGLController::loadMsh(const char * path)
{ {
for (auto& mshIt : segIt->meshIndices) // for every polygon for (auto& mshIt : segIt->meshIndices) // for every polygon
{ {
std::cout << "== Poly ==" << std::endl;
if (mshIt->size() >= 3) // multipoly if (mshIt->size() >= 3) // multipoly
{ {
// for every triangle of the multi polygon // for every triangle of the multi polygon
for (unsigned int tri = 0; tri < mshIt->size() - 2; tri++) for (unsigned int tri = 0; tri < mshIt->size() - 2; tri++)
{ {
std::cout << "== Triangle ==" << std::endl;
// for every edge of the triangle // for every edge of the triangle
for (int triEdge = 0; triEdge < 3; triEdge++) for (int triEdge = 0; triEdge < 3; triEdge++)
{ {
...@@ -400,7 +403,7 @@ void OpenGLController::loadMsh(const char * path) ...@@ -400,7 +403,7 @@ void OpenGLController::loadMsh(const char * path)
// every edge has 3 coordinates // every edge has 3 coordinates
for (int j = 0; j < 3; j++) for (int j = 0; j < 3; j++)
tempVertex.position[j] = (GLfloat)segIt->vertex[(*mshIt)[triEdge > 0 ? tri + triEdge : 0] * 3 + j]; tempVertex.position[j] = (GLfloat)segIt->vertex[(*mshIt)[triEdge > 0 ? tri + triEdge : 0] * 3 + j];
std::cout << (triEdge > 0 ? tri + triEdge : 0) << std::endl;
// and 2 UV // and 2 UV
if (segIt->uv == NULL) if (segIt->uv == NULL)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment