made all path relative now

This commit is contained in:
Anakin 2017-04-30 15:05:21 +02:00
parent da0b7e3c5f
commit 7e87b14fe1
8 changed files with 102 additions and 12 deletions

View File

@ -19,7 +19,9 @@
<property name="windowTitle"> <property name="windowTitle">
<string>MainWindow</string> <string>MainWindow</string>
</property> </property>
<widget class="QWidget" name="centralWidget"/> <widget class="QWidget" name="centralWidget">
<layout class="QHBoxLayout" name="horizontalLayout"/>
</widget>
<widget class="QToolBar" name="mainToolBar"> <widget class="QToolBar" name="mainToolBar">
<property name="allowedAreas"> <property name="allowedAreas">
<set>Qt::LeftToolBarArea|Qt::RightToolBarArea|Qt::TopToolBarArea</set> <set>Qt::LeftToolBarArea|Qt::RightToolBarArea|Qt::TopToolBarArea</set>
@ -32,6 +34,72 @@
</attribute> </attribute>
</widget> </widget>
<widget class="QStatusBar" name="statusBar"/> <widget class="QStatusBar" name="statusBar"/>
<widget class="QDockWidget" name="dockWidget">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="features">
<set>QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetFloatable</set>
</property>
<property name="allowedAreas">
<set>Qt::RightDockWidgetArea</set>
</property>
<property name="windowTitle">
<string>Asset library</string>
</property>
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QTreeWidget" name="treeWidget">
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::DragOnly</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectItems</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="headerHidden">
<bool>true</bool>
</property>
<property name="expandsOnDoubleClick">
<bool>false</bool>
</property>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources> <resources>

View File

@ -30,6 +30,8 @@ private:
// functions // functions
private: private:
void setupWidgets(); void setupWidgets();
void getAssetLibrary();
void searchMeshFiles(QString path);
void openFile(); void openFile();
void takeScreenShot(); void takeScreenShot();
void aboutTool(); void aboutTool();

View File

@ -1,4 +1,3 @@
#version 450
#ifdef GL_ES #ifdef GL_ES
// Set default precision to medium // Set default precision to medium
precision mediump int; precision mediump int;

View File

@ -1,4 +1,3 @@
#version 450
#ifdef GL_ES #ifdef GL_ES
// Set default precision to medium // Set default precision to medium
precision mediump int; precision mediump int;

View File

@ -49,6 +49,8 @@ MainWindow::MainWindow(QWidget *parent)
styleSheet.open(QIODevice::ReadOnly); styleSheet.open(QIODevice::ReadOnly);
this->setStyleSheet(styleSheet.readAll()); this->setStyleSheet(styleSheet.readAll());
getAssetLibrary();
printMessage("MeshViewer by Anakin", 0); 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() void MainWindow::openFile()
{ {
QString fileName = QFileDialog::getOpenFileName(this, "Open File", "", "Mesh (*.msh)"); QString fileName = QFileDialog::getOpenFileName(this, "Open File", "", "Mesh (*.msh)");

View File

@ -707,7 +707,6 @@ void MshFile::analyseSegmChunks(Model * dataDestination, QList<ChunkHeader*>& ch
for (int k = 0; k < 3; k++) for (int k = 0; k < 3; k++)
{ {
//TODO: buffer size == 1; k = 2;
// polygon normal wasn't calculated before // polygon normal wasn't calculated before
if (new_segment->vertices[tmp_buffer[k]].polygonNormal == QVector3D(0, 0, 0)) 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) if (!loadSuccess)
{ {
OutputDevice::getInstance()->print("WARNING: texture not found or corrupted: " + filename, 1); 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 = 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)); img.fill(QColor(m_materials->back().diffuseColor[0] * 255, m_materials->back().diffuseColor[1] * 255, m_materials->back().diffuseColor[2] * 255));
filename += " *"; filename += " *";

View File

@ -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 Feel free to use my code the way you like. But remember i used some public libraries. Make sure you read their
licence, too. licence, too.
### To Do
- normal map,
- list all msh in a directory
- glow/emissive
- optional display bones, shadow, collision
- change pose
- animation

Binary file not shown.