save rendertype,

evaluate rednertype specular,
changed info window always on top
This commit is contained in:
Anakin 2017-01-22 15:41:08 +01:00
parent 91488c55b2
commit cdd6ace701
5 changed files with 22 additions and 78 deletions

View File

@ -26,73 +26,6 @@ Triangles: -</string>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>

View File

@ -50,6 +50,8 @@ struct Material {
float shininess = 80;
bool flags[8] = { false };
bool transparent = false;
std::uint8_t rendertype = 0;
std::uint8_t dataValues[2] = { 0 };
};
class FileInterface : public QObject

View File

@ -7,7 +7,9 @@ FileInfoWindow::FileInfoWindow(QWidget *parent)
{
ui->setupUi(this);
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::NoDropShadowWindowHint);
setWindowFlags(Qt::Tool | Qt::NoDropShadowWindowHint);
ui->scrollArea->setStyleSheet("background-color: #ffffff");
}

View File

@ -20,7 +20,7 @@ MainWindow::MainWindow(QWidget *parent)
, ui(new Ui::MainWindowClass)
, m_curSeverity(0)
, m_output(new QLabel(this))
, m_infoWindow(new FileInfoWindow())
, m_infoWindow(new FileInfoWindow(this))
{
ui->setupUi(this);
@ -233,12 +233,16 @@ void MainWindow::setFileInfo(QString name, QVector<Material>* materials, int ver
}
m_fileInfo += "\n";
m_fileInfo += "Rendertype:\t-";
//TODO: rendertype
m_fileInfo += "Rendertype:\t";
m_fileInfo += QByteArray::number(it.rendertype);
m_fileInfo += "\n";
m_fileInfo += "Shininess:\t";
m_fileInfo += "Gloss:\t";
m_fileInfo += QByteArray::number(it.shininess);
m_fileInfo += "\tData0:\t";
m_fileInfo += QByteArray::number(it.dataValues[0]);
m_fileInfo += "\tData1:\t";
m_fileInfo += QByteArray::number(it.dataValues[1]);
m_fileInfo += "\n";
m_fileInfo += "Diffusecolor:\tR: ";

View File

@ -253,13 +253,16 @@ void MshFile::analyseMatdChunks(std::list<ChunkHeader*>& chunkList)
// attributes
else if (!strcmp("ATRB", it->name))
{
// get pointer to current material
Material* curMat = &m_materials->back();
// read the attributes
m_file.seekg(it->position);
std::uint8_t flag, render, data[2];
std::uint8_t flag;
m_file.read(F2V(flag), sizeof(flag));
m_file.read(F2V(render), sizeof(render));
m_file.read(F2V(data[0]), sizeof(data[0]));
m_file.read(F2V(data[1]), sizeof(data[1]));
m_file.read(F2V(curMat->rendertype), sizeof(std::uint8_t));
m_file.read(F2V(curMat->dataValues[0]), sizeof(std::uint8_t));
m_file.read(F2V(curMat->dataValues[1]), sizeof(std::uint8_t));
// flags
// 0: emissive
@ -272,9 +275,9 @@ void MshFile::analyseMatdChunks(std::list<ChunkHeader*>& chunkList)
// 7: specular
for (unsigned int i = 0; i < 8; i++)
m_materials->back().flags[i] = (std::uint8_t)(flag << (7 - i)) >> 7;
curMat->flags[i] = (std::uint8_t)(flag << (7 - i)) >> 7;
m_materials->back().transparent = m_materials->back().flags[2] || m_materials->back().flags[3] || m_materials->back().flags[4] || m_materials->back().flags[6];
curMat->transparent = curMat->flags[2] || curMat->flags[3] || curMat->flags[4] || curMat->flags[6] || curMat->rendertype == 4;
}