diff --git a/QtMeshViewer/Form Files/MainWindow.ui b/QtMeshViewer/Form Files/MainWindow.ui index 2cfb5c4..aa3bcaa 100644 --- a/QtMeshViewer/Form Files/MainWindow.ui +++ b/QtMeshViewer/Form Files/MainWindow.ui @@ -19,7 +19,9 @@ MainWindow - + + + Qt::LeftToolBarArea|Qt::RightToolBarArea|Qt::TopToolBarArea @@ -32,6 +34,72 @@ + + + false + + + QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetFloatable + + + Qt::RightDockWidgetArea + + + Asset library + + + 2 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + false + + + true + + + QAbstractItemView::DragOnly + + + QAbstractItemView::SelectItems + + + QAbstractItemView::ScrollPerPixel + + + true + + + false + + + + 1 + + + + + + + diff --git a/QtMeshViewer/Header/MainWindow.h b/QtMeshViewer/Header/MainWindow.h index eba0e06..42c3e9e 100644 --- a/QtMeshViewer/Header/MainWindow.h +++ b/QtMeshViewer/Header/MainWindow.h @@ -30,6 +30,8 @@ private: // functions private: void setupWidgets(); + void getAssetLibrary(); + void searchMeshFiles(QString path); void openFile(); void takeScreenShot(); void aboutTool(); diff --git a/QtMeshViewer/Resources/fshader.glsl b/QtMeshViewer/Resources/fshader.glsl index 6af05f3..6b737d7 100644 --- a/QtMeshViewer/Resources/fshader.glsl +++ b/QtMeshViewer/Resources/fshader.glsl @@ -1,4 +1,3 @@ -#version 450 #ifdef GL_ES // Set default precision to medium precision mediump int; diff --git a/QtMeshViewer/Resources/vshader.glsl b/QtMeshViewer/Resources/vshader.glsl index 3b75892..6dd74f5 100644 --- a/QtMeshViewer/Resources/vshader.glsl +++ b/QtMeshViewer/Resources/vshader.glsl @@ -1,4 +1,3 @@ -#version 450 #ifdef GL_ES // Set default precision to medium precision mediump int; diff --git a/QtMeshViewer/Source/MainWindow.cpp b/QtMeshViewer/Source/MainWindow.cpp index 156d242..17fd835 100644 --- a/QtMeshViewer/Source/MainWindow.cpp +++ b/QtMeshViewer/Source/MainWindow.cpp @@ -49,6 +49,8 @@ MainWindow::MainWindow(QWidget *parent) styleSheet.open(QIODevice::ReadOnly); this->setStyleSheet(styleSheet.readAll()); + getAssetLibrary(); + printMessage("MeshViewer by Anakin", 0); } @@ -161,6 +163,33 @@ void MainWindow::setupWidgets() } +void MainWindow::getAssetLibrary() +{ + QTreeWidgetItem* item = new QTreeWidgetItem; + item->setData(0, Qt::DisplayRole, "Wuhu"); + ui->treeWidget->addTopLevelItem(item); + + searchMeshFiles("D:/workspaces/Visual Studio 2015/Projects/OpenGL/Release"); + +} + +void MainWindow::searchMeshFiles(QString path) +{ + QDir directory(path); + directory.setNameFilters(QStringList("*.msh")); + + QStringList childDirectories = directory.entryList(QDir::AllDirs | QDir::NoDotAndDotDot); + + QStringList fileNames = directory.entryList(QDir::Files); + + for (auto &it : childDirectories) + qDebug() << it; + + for (auto &it : fileNames) + qDebug() << it; + +} + void MainWindow::openFile() { QString fileName = QFileDialog::getOpenFileName(this, "Open File", "", "Mesh (*.msh)"); diff --git a/QtMeshViewer/Source/MshFile.cpp b/QtMeshViewer/Source/MshFile.cpp index 3d510a9..2ee9761 100644 --- a/QtMeshViewer/Source/MshFile.cpp +++ b/QtMeshViewer/Source/MshFile.cpp @@ -707,7 +707,6 @@ void MshFile::analyseSegmChunks(Model * dataDestination, QList& ch for (int k = 0; k < 3; k++) { - //TODO: buffer size == 1; k = 2; // polygon normal wasn't calculated before if (new_segment->vertices[tmp_buffer[k]].polygonNormal == QVector3D(0, 0, 0)) { @@ -921,7 +920,7 @@ void MshFile::loadTexture(QOpenGLTexture *& destination, QString filepath, QStri if (!loadSuccess) { OutputDevice::getInstance()->print("WARNING: texture not found or corrupted: " + filename, 1); - //TODO: use the correct diffuse color or return with null + //TODO: cloth use the wrong diffuse color. should be null img = QImage(1, 1, QImage::Format_RGB32); img.fill(QColor(m_materials->back().diffuseColor[0] * 255, m_materials->back().diffuseColor[1] * 255, m_materials->back().diffuseColor[2] * 255)); filename += " *"; diff --git a/README.md b/README.md index 7f14913..43a59f2 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,4 @@ So far it is just me. If you wanna help me, let me know :D Feel free to use my code the way you like. But remember i used some public libraries. Make sure you read their licence, too. -### To Do -- normal map, -- list all msh in a directory -- glow/emissive -- optional display bones, shadow, collision -- change pose -- animation + diff --git a/Release/QtMeshViewer.exe b/Release/QtMeshViewer.exe index e01fc7d..9e54c06 100644 Binary files a/Release/QtMeshViewer.exe and b/Release/QtMeshViewer.exe differ