improved performance using my own tga load function always instead of QImage

improved Profiler
This commit is contained in:
Anakin
2017-01-30 16:00:14 +01:00
parent d1c68e8ba6
commit 4342260e6d
4 changed files with 125 additions and 119 deletions

View File

@@ -3,6 +3,8 @@
#include "..\Header\OutputDevice.h"
#include <QColor>
#include "..\Header\Profiler.h"
// helper function to save data from file to any variable type
#define F2V(variableName) reinterpret_cast<char*>(&variableName)
@@ -278,7 +280,6 @@ void MshFile::analyseMatdChunks(std::list<ChunkHeader*>& chunkList)
curMat->flags[i] = (std::uint8_t)(flag << (7 - i)) >> 7;
curMat->transparent = curMat->flags[2] || curMat->flags[3] || curMat->flags[4] || curMat->flags[6] || curMat->rendertype == 4;
}
// texture 0
@@ -310,7 +311,6 @@ void MshFile::analyseMatdChunks(std::list<ChunkHeader*>& chunkList)
if (!m_materials->back().tx1d.isEmpty())
loadTexture(m_materials->back().texture1, m_filepath, m_materials->back().tx1d);
}
// texture 2
@@ -719,6 +719,7 @@ void MshFile::readUV(Segment * dataDestination, std::streampos position)
void MshFile::loadTexture(QOpenGLTexture *& destination, QString filepath, QString& filename)
{
bool loadSuccess(false);
QImage img = loadTga(filepath + "/" + filename, loadSuccess);
if (!loadSuccess)

View File

@@ -428,8 +428,12 @@ void OglViewerWidget::setAmbCoef(double value)
void OglViewerWidget::setHeadlight(bool value)
{
m_light.headlight = value;
if (m_lightOn)
if (m_lightOn && value)
{
updateLightPosition();
update();
}
}
void OglViewerWidget::setBackfaceCulling(bool value)