Commit cdd6ace7 authored by Anakin's avatar Anakin

save rendertype,

evaluate rednertype specular,
changed info window always on top
parent 91488c55
......@@ -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>
......
......@@ -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
......
......@@ -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");
}
......
......@@ -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: ";
......
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment