add exe icon,

signal-slot for openFile,
resetView on openFile,
cleanup when open a new file,
triangulate quad poly now correctly, more not working, bug from previous version,
next:
fix 5,6,.. triangulation,
triClothMan, IC Helmet, still buggy,
This commit is contained in:
Anakin
2017-01-02 12:21:32 +01:00
parent 0735ef996d
commit fa8808fea8
9 changed files with 54 additions and 30 deletions

View File

@@ -10,23 +10,12 @@ GeometryEngine::GeometryEngine()
{
initializeOpenGLFunctions();
// Generate 2 VBOs
m_arrayBuf.create();
m_indexBuf.create();
// Initializes cube geometry and transfers it to VBOs
loadFile("..\\Release\\Msh\\ic_helmet.msh");
loadFile("..\\Release\\Msh\\4-Poly.msh");
}
GeometryEngine::~GeometryEngine()
{
m_arrayBuf.destroy();
m_indexBuf.destroy();
for (auto it : m_textures)
delete it;
m_textures.clear();
m_drawList.clear();
clearData();
}
@@ -35,6 +24,14 @@ GeometryEngine::~GeometryEngine()
void GeometryEngine::loadFile(const char* filePath)
{
// cleanup old stuff and recreate buffers
clearData();
m_arrayBuf.create();
m_indexBuf.create();
//reset view
emit requestResetView();
try
{
//TODO normalize
@@ -134,12 +131,28 @@ void GeometryEngine::loadTexture(const char* filePath)
m_textures.push_back(new_texture);
}
void GeometryEngine::clearData()
{
if (m_arrayBuf.isCreated())
m_arrayBuf.destroy();
if (m_indexBuf.isCreated())
m_indexBuf.destroy();
for (auto it : m_textures)
delete it;
m_textures.clear();
m_drawList.clear();
}
/////////////////////////////////////////////////////////////////////////
// public functions
void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program)
{
if (!m_arrayBuf.isCreated() || !m_indexBuf.isCreated())
return;
// Setup
// Tell OpenGL which VBOs to use
m_arrayBuf.bind();