trying to fix the polygon mess up,
added new multipoly for testing
This commit is contained in:
parent
60cc7bb562
commit
232acedce7
@ -6,6 +6,7 @@
|
||||
#include <string>
|
||||
#include <glm\gtc\matrix_transform.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#define VERTEX_SHADER "Shader/TextureShader.vert"
|
||||
#define FRAGMENT_SHADER "Shader/TextureShader.frag"
|
||||
@ -388,11 +389,13 @@ void OpenGLController::loadMsh(const char * path)
|
||||
{
|
||||
for (auto& mshIt : segIt->meshIndices) // for every polygon
|
||||
{
|
||||
std::cout << "== Poly ==" << std::endl;
|
||||
if (mshIt->size() >= 3) // multipoly
|
||||
{
|
||||
// for every triangle of the multi polygon
|
||||
for (unsigned int tri = 0; tri < mshIt->size() - 2; tri++)
|
||||
{
|
||||
std::cout << "== Triangle ==" << std::endl;
|
||||
// for every edge of the triangle
|
||||
for (int triEdge = 0; triEdge < 3; triEdge++)
|
||||
{
|
||||
@ -400,7 +403,7 @@ void OpenGLController::loadMsh(const char * path)
|
||||
// every edge has 3 coordinates
|
||||
for (int j = 0; j < 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
|
||||
if (segIt->uv == NULL)
|
||||
{
|
||||
|
BIN
Release/Msh/4-Poly.msh
Normal file
BIN
Release/Msh/4-Poly.msh
Normal file
Binary file not shown.
BIN
Release/Msh/5-Poly.msh
Normal file
BIN
Release/Msh/5-Poly.msh
Normal file
Binary file not shown.
BIN
Release/Msh/6-poly.msh
Normal file
BIN
Release/Msh/6-poly.msh
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user