sendMessage via signal plot from file to window,

add severity to messages (black, yellow, red),
add about text,
removed unused texture from resource
This commit is contained in:
Anakin
2017-01-04 14:35:27 +01:00
parent a221ed4957
commit a2f5324a3c
12 changed files with 133 additions and 37 deletions

View File

@@ -1,13 +1,16 @@
#include "..\Header\GeometryEngine.h"
#include "..\Header\MshFile.h"
#include "..\Header\OglViewerWidget.h"
#include "..\Header\MainWindow.h"
#include <cmath>
/////////////////////////////////////////////////////////////////////////
// public constructor/destructor
GeometryEngine::GeometryEngine()
: m_indexBuf(QOpenGLBuffer::IndexBuffer)
GeometryEngine::GeometryEngine(QObject *parent)
: QObject(parent)
, m_indexBuf(QOpenGLBuffer::IndexBuffer)
{
initializeOpenGLFunctions();
}
@@ -30,6 +33,7 @@ void GeometryEngine::loadFile(const char* filePath)
//reset view
emit requestResetView();
emit sendMessage("loading file..", 0);
try
{
@@ -41,7 +45,8 @@ void GeometryEngine::loadFile(const char* filePath)
QVector<GLuint> indexData;
// open file and get the information
MshFile file(filePath);
MshFile file(filePath, this);
models = file.getModels();
textureNames = file.getTextureNames();
m_boundings = file.getBoundingBox();
@@ -91,18 +96,18 @@ void GeometryEngine::loadFile(const char* filePath)
while (path.back() != '/' && path.back() != '\\')
path.pop_back();
emit sendMessage("loading textures..", 0);
// load the textures
for(auto& it : *textureNames)
loadTexture(std::string(path + it).c_str());
emit requestUpdate();
emit sendMessage("done..", 0);
}
catch (std::invalid_argument e)
{
//TODO: make a cool message box
auto msg = e.what();
emit sendMessage(QString(e.what()), 2);
}
}
void GeometryEngine::loadTexture(const char* filePath)
@@ -201,3 +206,4 @@ void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program)
glDrawElements(GL_TRIANGLES, it.size, GL_UNSIGNED_INT, (void*)(it.offset * sizeof(GLuint)));
}
}