parent
8c2ca44f20
commit
f5ee8a973d
|
@ -3,6 +3,7 @@
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QVector2D>
|
#include <QVector2D>
|
||||||
#include <QVector3D>
|
#include <QVector3D>
|
||||||
|
#include <QStringList>
|
||||||
#include <QMatrix4x4>
|
#include <QMatrix4x4>
|
||||||
#include <QQuaternion>
|
#include <QQuaternion>
|
||||||
#include <QOpenGLFunctions>
|
#include <QOpenGLFunctions>
|
||||||
|
@ -41,16 +42,16 @@ class FileInterface : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FileInterface(const char* path, QObject *parent)
|
explicit FileInterface(QString path, QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_models(new QVector<Model*>)
|
, m_models(new QVector<Model*>)
|
||||||
, m_textureNames(new QVector<std::string>)
|
, m_textureNames(new QStringList)
|
||||||
{
|
{
|
||||||
//open file
|
//open file
|
||||||
m_file.open(path, std::ios::in | std::ios::binary);
|
m_file.open(path.toStdString().c_str(), std::ios::in | std::ios::binary);
|
||||||
|
|
||||||
if (!m_file.is_open())
|
if (!m_file.is_open())
|
||||||
throw std::invalid_argument(std::string("ERROR: file not found: ") += path);
|
throw std::invalid_argument(std::string("ERROR: file not found: ") += path.toStdString());
|
||||||
|
|
||||||
MainWindow* tmp = dynamic_cast<MainWindow*>(parent->parent()->parent());
|
MainWindow* tmp = dynamic_cast<MainWindow*>(parent->parent()->parent());
|
||||||
if(tmp != NULL)
|
if(tmp != NULL)
|
||||||
|
@ -87,14 +88,14 @@ public:
|
||||||
protected:
|
protected:
|
||||||
QVector<Model*>* m_models;
|
QVector<Model*>* m_models;
|
||||||
std::fstream m_file;
|
std::fstream m_file;
|
||||||
QVector<std::string>* m_textureNames;
|
QStringList* m_textureNames;
|
||||||
BoundingBox m_sceneBbox;
|
BoundingBox m_sceneBbox;
|
||||||
|
|
||||||
virtual void import() = 0;
|
virtual void import() = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual QVector<Model*>* getModels() const { return m_models; };
|
virtual QVector<Model*>* getModels() const { return m_models; };
|
||||||
virtual QVector<std::string>* getTextureNames() const { return m_textureNames; };
|
virtual QStringList* getTextureNames() const { return m_textureNames; };
|
||||||
virtual BoundingBox getBoundingBox() const { return m_sceneBbox; };
|
virtual BoundingBox getBoundingBox() const { return m_sceneBbox; };
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
@ -29,16 +29,17 @@ private:
|
||||||
QVector<DrawInformation> m_drawList;
|
QVector<DrawInformation> m_drawList;
|
||||||
BoundingBox m_boundings;
|
BoundingBox m_boundings;
|
||||||
|
|
||||||
void loadTexture(const char* filePath, const char* fileName);
|
void loadTexture(QString filePath, QString fileName);
|
||||||
void clearData();
|
void clearData();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void loadFile(const char* filePath);
|
void loadFile(QString filePath);
|
||||||
void drawGeometry(QOpenGLShaderProgram *program);
|
void drawGeometry(QOpenGLShaderProgram *program);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void requestResetView();
|
void requestResetView();
|
||||||
void sendMessage(QString message, int severity);
|
void sendMessage(QString message, int severity);
|
||||||
void requestUpdate();
|
void requestUpdate();
|
||||||
|
void sendFileInfo(QString name, QStringList textures, int vertices, int triangle);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QtWidgets/QMainWindow>
|
#include <QtWidgets/QMainWindow>
|
||||||
|
#include <QByteArray>
|
||||||
|
#include <QStringList>
|
||||||
#include "ui_MainWindow.h"
|
#include "ui_MainWindow.h"
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
|
@ -15,6 +17,7 @@ private:
|
||||||
Ui::MainWindowClass* ui;
|
Ui::MainWindowClass* ui;
|
||||||
int m_curSeverity;
|
int m_curSeverity;
|
||||||
void setupWidgets();
|
void setupWidgets();
|
||||||
|
QByteArray m_fileInfo;
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -24,7 +27,8 @@ private slots:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void printMessage(QString message, int severity);
|
void printMessage(QString message, int severity);
|
||||||
|
void setFileInfo(QString name, QStringList textures, int vertices, int triangle);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void loadFile(const char*);
|
void loadFile(QString);
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,7 +20,7 @@ enum ModelTyp {
|
||||||
class MshFile : public FileInterface
|
class MshFile : public FileInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit MshFile(const char* path, QObject *parent = Q_NULLPTR);
|
explicit MshFile(QString path, QObject *parent = Q_NULLPTR);
|
||||||
virtual ~MshFile();
|
virtual ~MshFile();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
~OglViewerWidget();
|
~OglViewerWidget();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void loadFile(const char*);
|
void loadFile(QString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct {
|
struct {
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
QImage loadTga(const char* filePath, bool &success)
|
QImage loadTga(QString filePath, bool &success)
|
||||||
{
|
{
|
||||||
QImage img;
|
QImage img;
|
||||||
if (!img.load(filePath))
|
if (!img.load(filePath))
|
||||||
{
|
{
|
||||||
|
|
||||||
// open the file
|
// open the file
|
||||||
std::fstream fsPicture(filePath, std::ios::in | std::ios::binary);
|
std::fstream fsPicture(filePath.toStdString().c_str(), std::ios::in | std::ios::binary);
|
||||||
|
|
||||||
if (!fsPicture.is_open())
|
if (!fsPicture.is_open())
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "..\Header\MainWindow.h"
|
#include "..\Header\MainWindow.h"
|
||||||
#include "..\Header\tga.h"
|
#include "..\Header\tga.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <QRegExp>
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -25,106 +26,19 @@ GeometryEngine::~GeometryEngine()
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// private functions
|
// private functions
|
||||||
|
|
||||||
void GeometryEngine::loadFile(const char* filePath)
|
void GeometryEngine::loadTexture(QString filePath, QString fileName)
|
||||||
{
|
|
||||||
// cleanup old stuff and recreate buffers
|
|
||||||
clearData();
|
|
||||||
m_arrayBuf.create();
|
|
||||||
m_indexBuf.create();
|
|
||||||
|
|
||||||
//reset view
|
|
||||||
emit requestResetView();
|
|
||||||
emit sendMessage("loading file..", 0);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
QVector<Model*>* models;
|
|
||||||
QVector<std::string>* textureNames;
|
|
||||||
QVector<VertexData> vertexData;
|
|
||||||
QVector<GLuint> indexData;
|
|
||||||
|
|
||||||
// open file and get the information
|
|
||||||
MshFile file(filePath, this);
|
|
||||||
|
|
||||||
models = file.getModels();
|
|
||||||
textureNames = file.getTextureNames();
|
|
||||||
m_boundings = file.getBoundingBox();
|
|
||||||
|
|
||||||
// collect data
|
|
||||||
unsigned int indexOffset(0);
|
|
||||||
unsigned int vertexOffset(0);
|
|
||||||
for (auto& modelIterator : *models)
|
|
||||||
{
|
|
||||||
for (auto& segmentIterator : modelIterator->segmList)
|
|
||||||
{
|
|
||||||
// get draw information
|
|
||||||
DrawInformation new_info;
|
|
||||||
new_info.offset = indexOffset;
|
|
||||||
new_info.size = segmentIterator->indices.size();
|
|
||||||
new_info.textureIndex = segmentIterator->textureIndex;
|
|
||||||
new_info.modelMatrix = modelIterator->m4x4Translation;
|
|
||||||
new_info.modelMatrix.rotate(modelIterator->quadRotation);
|
|
||||||
|
|
||||||
// add offset to indices, no need to do it for the first one (maybe it's very big)
|
|
||||||
if(vertexOffset != 0)
|
|
||||||
for (auto& it : segmentIterator->indices)
|
|
||||||
it += vertexOffset;
|
|
||||||
|
|
||||||
// save data
|
|
||||||
vertexData += segmentIterator->vertices;
|
|
||||||
indexData += segmentIterator->indices;
|
|
||||||
m_drawList.push_back(new_info);
|
|
||||||
|
|
||||||
// update offset
|
|
||||||
indexOffset += new_info.size;
|
|
||||||
vertexOffset += segmentIterator->vertices.size();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Transfer vertex data to VBO 0
|
|
||||||
m_arrayBuf.bind();
|
|
||||||
m_arrayBuf.allocate(vertexData.data(), vertexData.size() * sizeof(VertexData));
|
|
||||||
|
|
||||||
// Transfer index data to VBO 1
|
|
||||||
m_indexBuf.bind();
|
|
||||||
m_indexBuf.allocate(indexData.data(), indexData.size() * sizeof(GLuint));
|
|
||||||
|
|
||||||
// get textures path
|
|
||||||
std::string path = filePath;
|
|
||||||
|
|
||||||
while (path.back() != '/' && path.back() != '\\')
|
|
||||||
path.pop_back();
|
|
||||||
|
|
||||||
emit sendMessage("loading textures..", 0);
|
|
||||||
// load the textures
|
|
||||||
for(auto& it : *textureNames)
|
|
||||||
loadTexture(path.c_str(), it.c_str());
|
|
||||||
|
|
||||||
loadTexture("", "");
|
|
||||||
|
|
||||||
emit requestUpdate();
|
|
||||||
emit sendMessage("done..", 0);
|
|
||||||
}
|
|
||||||
catch (std::invalid_argument e)
|
|
||||||
{
|
|
||||||
clearData();
|
|
||||||
emit sendMessage(QString(e.what()), 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void GeometryEngine::loadTexture(const char* filePath, const char* fileName)
|
|
||||||
{
|
{
|
||||||
bool loadSuccess(false);
|
bool loadSuccess(false);
|
||||||
QImage img;
|
QImage img;
|
||||||
|
|
||||||
if (!strcmp(fileName, ""))
|
if (fileName.isEmpty())
|
||||||
{
|
{
|
||||||
loadSuccess = true;
|
loadSuccess = true;
|
||||||
img = QImage(1, 1, QImage::Format_RGB32);
|
img = QImage(1, 1, QImage::Format_RGB32);
|
||||||
img.fill(Qt::red);
|
img.fill(Qt::red);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
img = loadTga((std::string(filePath) + std::string(fileName)).c_str(), loadSuccess);
|
img = loadTga(filePath + "/" + fileName, loadSuccess);
|
||||||
|
|
||||||
if (!loadSuccess)
|
if (!loadSuccess)
|
||||||
emit sendMessage("WARNING: texture not found or corrupted: " + QString(fileName), 1);
|
emit sendMessage("WARNING: texture not found or corrupted: " + QString(fileName), 1);
|
||||||
|
@ -160,7 +74,91 @@ void GeometryEngine::clearData()
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// public functions
|
// public slots
|
||||||
|
|
||||||
|
void GeometryEngine::loadFile(QString filePath)
|
||||||
|
{
|
||||||
|
// cleanup old stuff and recreate buffers
|
||||||
|
clearData();
|
||||||
|
m_arrayBuf.create();
|
||||||
|
m_indexBuf.create();
|
||||||
|
|
||||||
|
//reset view
|
||||||
|
emit requestResetView();
|
||||||
|
emit sendMessage("loading file..", 0);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
QVector<Model*>* models;
|
||||||
|
QStringList* textureNames;
|
||||||
|
QVector<VertexData> vertexData;
|
||||||
|
QVector<GLuint> indexData;
|
||||||
|
|
||||||
|
// open file and get the information
|
||||||
|
MshFile file(filePath, this);
|
||||||
|
|
||||||
|
models = file.getModels();
|
||||||
|
textureNames = file.getTextureNames();
|
||||||
|
m_boundings = file.getBoundingBox();
|
||||||
|
|
||||||
|
// collect data
|
||||||
|
unsigned int indexOffset(0);
|
||||||
|
unsigned int vertexOffset(0);
|
||||||
|
for (auto& modelIterator : *models)
|
||||||
|
{
|
||||||
|
for (auto& segmentIterator : modelIterator->segmList)
|
||||||
|
{
|
||||||
|
// get draw information
|
||||||
|
DrawInformation new_info;
|
||||||
|
new_info.offset = indexOffset;
|
||||||
|
new_info.size = segmentIterator->indices.size();
|
||||||
|
new_info.textureIndex = segmentIterator->textureIndex;
|
||||||
|
new_info.modelMatrix = modelIterator->m4x4Translation;
|
||||||
|
new_info.modelMatrix.rotate(modelIterator->quadRotation);
|
||||||
|
|
||||||
|
// add offset to indices, no need to do it for the first one (maybe it's very big)
|
||||||
|
if (vertexOffset != 0)
|
||||||
|
for (auto& it : segmentIterator->indices)
|
||||||
|
it += vertexOffset;
|
||||||
|
|
||||||
|
// save data
|
||||||
|
vertexData += segmentIterator->vertices;
|
||||||
|
indexData += segmentIterator->indices;
|
||||||
|
m_drawList.push_back(new_info);
|
||||||
|
|
||||||
|
// update offset
|
||||||
|
indexOffset += new_info.size;
|
||||||
|
vertexOffset += segmentIterator->vertices.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Transfer vertex data to VBO 0
|
||||||
|
m_arrayBuf.bind();
|
||||||
|
m_arrayBuf.allocate(vertexData.data(), vertexData.size() * sizeof(VertexData));
|
||||||
|
|
||||||
|
// Transfer index data to VBO 1
|
||||||
|
m_indexBuf.bind();
|
||||||
|
m_indexBuf.allocate(indexData.data(), indexData.size() * sizeof(GLuint));
|
||||||
|
|
||||||
|
emit sendMessage("loading textures..", 0);
|
||||||
|
|
||||||
|
// load the textures
|
||||||
|
int split = filePath.lastIndexOf(QRegExp("/|\\\\"));
|
||||||
|
for (auto& it : *textureNames)
|
||||||
|
loadTexture(filePath.left(split), it);
|
||||||
|
|
||||||
|
loadTexture("", "");
|
||||||
|
|
||||||
|
emit requestUpdate();
|
||||||
|
emit sendMessage("done..", 0);
|
||||||
|
emit sendFileInfo(filePath.right(filePath.size() - split - 1), QStringList(*textureNames), vertexData.size(), indexData.size() / 3);
|
||||||
|
}
|
||||||
|
catch (std::invalid_argument e)
|
||||||
|
{
|
||||||
|
clearData();
|
||||||
|
emit sendMessage(QString(e.what()), 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program)
|
void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,10 +3,11 @@
|
||||||
#include <QSurfaceFormat>
|
#include <QSurfaceFormat>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QFile>
|
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QSignalMapper>
|
#include <QSignalMapper>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QSizePolicy>
|
||||||
#include "..\Header\FileInterface.h"
|
#include "..\Header\FileInterface.h"
|
||||||
|
|
||||||
#define WINDOW_NAME "Mesh Viewer"
|
#define WINDOW_NAME "Mesh Viewer"
|
||||||
|
@ -28,6 +29,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
setupWidgets();
|
setupWidgets();
|
||||||
|
|
||||||
ui->statusBar->showMessage("MeshViewer by Anakin", 0);
|
ui->statusBar->showMessage("MeshViewer by Anakin", 0);
|
||||||
|
|
||||||
|
m_fileInfo += "Filename: -\nMaterials: -\nVertices: -\nTriangle: -\n<detail>No file is open";
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
@ -38,7 +41,8 @@ MainWindow::~MainWindow()
|
||||||
void MainWindow::openFile()
|
void MainWindow::openFile()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, "Open File", "", "Mesh (*.msh)");
|
QString fileName = QFileDialog::getOpenFileName(this, "Open File", "", "Mesh (*.msh)");
|
||||||
emit loadFile(fileName.toStdString().c_str());
|
if(!fileName.isEmpty())
|
||||||
|
emit loadFile(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setupWidgets()
|
void MainWindow::setupWidgets()
|
||||||
|
@ -91,14 +95,17 @@ void MainWindow::setupWidgets()
|
||||||
|
|
||||||
void MainWindow::aboutFile()
|
void MainWindow::aboutFile()
|
||||||
{
|
{
|
||||||
QMessageBox* dialog = new QMessageBox(QMessageBox::Information,
|
QMessageBox* dialog = new QMessageBox(QMessageBox::NoIcon,
|
||||||
WINDOW_NAME,
|
WINDOW_NAME,
|
||||||
"When i find some time, i'll add some information about\nthe file in the detailed text",
|
QString(m_fileInfo.left(m_fileInfo.indexOf("<detail>"))),
|
||||||
QMessageBox::StandardButton::Close,
|
QMessageBox::StandardButton::Close,
|
||||||
this,
|
this,
|
||||||
Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
|
Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
|
||||||
dialog->setDetailedText("This is the cool detailed text\n");
|
|
||||||
|
dialog->setStyleSheet("QLabel{min-width: 200px;}");
|
||||||
|
dialog->setDetailedText(QString(m_fileInfo.right(m_fileInfo.size() - m_fileInfo.indexOf("<detail>") - 8)));
|
||||||
dialog->exec();
|
dialog->exec();
|
||||||
|
delete dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::aboutTool()
|
void MainWindow::aboutTool()
|
||||||
|
@ -111,13 +118,36 @@ void MainWindow::aboutTool()
|
||||||
QString(file.readAll()),
|
QString(file.readAll()),
|
||||||
QMessageBox::StandardButton::Close,
|
QMessageBox::StandardButton::Close,
|
||||||
this,
|
this,
|
||||||
Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint
|
Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
|
||||||
);
|
|
||||||
|
|
||||||
//dialog->setDetailedText(QString(file.readAll()));
|
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
dialog->exec();
|
dialog->exec();
|
||||||
|
|
||||||
|
delete dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::setFileInfo(QString name, QStringList textures, int vertices, int triangle)
|
||||||
|
{
|
||||||
|
m_fileInfo = QByteArray("Filename: ");
|
||||||
|
m_fileInfo += name;
|
||||||
|
m_fileInfo += "\nMaterials: ";
|
||||||
|
m_fileInfo += QByteArray::number(textures.size());
|
||||||
|
m_fileInfo += "\nVertices: ";
|
||||||
|
m_fileInfo += QByteArray::number(vertices);
|
||||||
|
m_fileInfo += "\nTriangle: ";
|
||||||
|
m_fileInfo += QByteArray::number(triangle);
|
||||||
|
m_fileInfo += "<detail>";
|
||||||
|
|
||||||
|
int count(0);
|
||||||
|
for (auto& it : textures)
|
||||||
|
{
|
||||||
|
m_fileInfo += "Material ";
|
||||||
|
m_fileInfo += QByteArray::number(count++);
|
||||||
|
m_fileInfo += " - ";
|
||||||
|
m_fileInfo += it;
|
||||||
|
m_fileInfo += "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::printMessage(QString message, int severity)
|
void MainWindow::printMessage(QString message, int severity)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// public constructor/destructor
|
// public constructor/destructor
|
||||||
|
|
||||||
MshFile::MshFile(const char * path, QObject * parent)
|
MshFile::MshFile(QString path, QObject * parent)
|
||||||
: FileInterface(path, parent)
|
: FileInterface(path, parent)
|
||||||
{
|
{
|
||||||
import();
|
import();
|
||||||
|
@ -497,21 +497,13 @@ void MshFile::analyseClthChunks(Model * dataDestination, std::list<ChunkHeader*>
|
||||||
|
|
||||||
// search if it is already known
|
// search if it is already known
|
||||||
bool tmp_found(false);
|
bool tmp_found(false);
|
||||||
for (unsigned int i = 0; i < m_textureNames->size(); i++)
|
|
||||||
{
|
|
||||||
if (!strcmp(buffer, m_textureNames->at(i).c_str()))
|
|
||||||
{
|
|
||||||
// if found, save the index and stop searching
|
|
||||||
new_segment->textureIndex = i;
|
|
||||||
tmp_found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if it was not found add the texturename to the list
|
int index = m_textureNames->indexOf(QString::fromStdString(buffer));
|
||||||
if (!tmp_found)
|
if (index != -1)
|
||||||
|
new_segment->textureIndex = index;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
m_textureNames->push_back(std::string(buffer));
|
m_textureNames->push_back(QString::fromStdString(buffer));
|
||||||
new_segment->textureIndex = m_textureNames->size() - 1;
|
new_segment->textureIndex = m_textureNames->size() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ void OglViewerWidget::dragEnterEvent(QDragEnterEvent *e)
|
||||||
|
|
||||||
void OglViewerWidget::dropEvent(QDropEvent * e)
|
void OglViewerWidget::dropEvent(QDropEvent * e)
|
||||||
{
|
{
|
||||||
emit loadFile(e->mimeData()->urls().first().toLocalFile().toStdString().c_str());
|
emit loadFile(e->mimeData()->urls().first().toLocalFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
void OglViewerWidget::keyPressEvent(QKeyEvent *e)
|
void OglViewerWidget::keyPressEvent(QKeyEvent *e)
|
||||||
|
@ -226,10 +226,12 @@ void OglViewerWidget::initShaders()
|
||||||
void OglViewerWidget::setConnections()
|
void OglViewerWidget::setConnections()
|
||||||
{
|
{
|
||||||
connect(m_dataEngine, &GeometryEngine::requestResetView, this, &OglViewerWidget::resetView);
|
connect(m_dataEngine, &GeometryEngine::requestResetView, this, &OglViewerWidget::resetView);
|
||||||
connect(parentWidget(), SIGNAL(loadFile(const char*)), m_dataEngine, SLOT(loadFile(const char*)));
|
connect(parentWidget(), SIGNAL(loadFile(QString)), m_dataEngine, SLOT(loadFile(QString)));
|
||||||
connect(this, SIGNAL(loadFile(const char*)), m_dataEngine, SLOT(loadFile(const char*)));
|
connect(this, SIGNAL(loadFile(QString)), m_dataEngine, SLOT(loadFile(QString)));
|
||||||
connect(m_dataEngine, SIGNAL(sendMessage(QString, int)), parentWidget(), SLOT(printMessage(QString, int)));
|
connect(m_dataEngine, SIGNAL(sendMessage(QString, int)), parentWidget(), SLOT(printMessage(QString, int)));
|
||||||
connect(m_dataEngine, SIGNAL(requestUpdate()), this, SLOT(update()));
|
connect(m_dataEngine, SIGNAL(requestUpdate()), this, SLOT(update()));
|
||||||
|
connect(m_dataEngine, SIGNAL(sendFileInfo(QString, QStringList, int, int)), parentWidget(), SLOT(setFileInfo(QString, QStringList, int, int)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue