changed everything from std to qt
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include <QOpenGlTexture>
|
||||
#include <fstream>
|
||||
#include <QFile>
|
||||
#include <QVector>
|
||||
#include <QVector2D>
|
||||
#include <QMatrix4x4>
|
||||
@@ -21,17 +21,17 @@ struct VertexData
|
||||
};
|
||||
|
||||
struct Segment {
|
||||
std::uint32_t textureIndex = 0;
|
||||
quint32 textureIndex = 0;
|
||||
QVector<VertexData> vertices;
|
||||
QVector<GLuint> indices;
|
||||
};
|
||||
|
||||
struct Model {
|
||||
std::string name = "";
|
||||
std::string parent = "";
|
||||
QString name = "";
|
||||
QString parent = "";
|
||||
QMatrix4x4 m4x4Translation;
|
||||
QQuaternion quadRotation;
|
||||
std::vector<Segment*> segmList;
|
||||
QVector<Segment*> segmList;
|
||||
};
|
||||
|
||||
struct Material {
|
||||
@@ -48,8 +48,8 @@ struct Material {
|
||||
float shininess = 80;
|
||||
bool flags[8] = { false };
|
||||
bool transparent = false;
|
||||
std::uint8_t rendertype = 0;
|
||||
std::uint8_t dataValues[2] = { 0 };
|
||||
quint8 rendertype = 0;
|
||||
quint8 dataValues[2] = { 0 };
|
||||
};
|
||||
|
||||
class FileInterface
|
||||
@@ -61,9 +61,9 @@ public:
|
||||
, m_materials(new QVector<Material>)
|
||||
{
|
||||
//open file
|
||||
m_file.open(path.toStdString().c_str(), std::ios::in | std::ios::binary);
|
||||
m_file.setFileName(path);
|
||||
|
||||
if (!m_file.is_open())
|
||||
if (!m_file.open(QIODevice::ReadOnly))
|
||||
throw std::invalid_argument(std::string("ERROR: file not found: ") += path.toStdString());
|
||||
|
||||
m_filepath = path.left(path.lastIndexOf(QRegExp("/|\\\\")));
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
|
||||
protected:
|
||||
QVector<Model*>* m_models;
|
||||
std::fstream m_file;
|
||||
QFile m_file;
|
||||
QVector<Material>* m_materials;
|
||||
BoundingBox m_sceneBbox;
|
||||
QString m_filepath;
|
||||
|
@@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
#include "..\Header\FileInterface.h"
|
||||
|
||||
#include <QList>
|
||||
|
||||
struct ChunkHeader {
|
||||
char name[5];
|
||||
std::uint32_t size;
|
||||
std::streampos position;
|
||||
QString name;
|
||||
quint32 size;
|
||||
qint64 position;
|
||||
};
|
||||
|
||||
enum ModelTyp {
|
||||
@@ -29,22 +29,22 @@ private:
|
||||
|
||||
virtual void import() Q_DECL_OVERRIDE Q_DECL_FINAL;
|
||||
|
||||
void loadChunks(std::list<ChunkHeader*> &destination, std::streampos start, const std::uint32_t length);
|
||||
void loadChunks(QList<ChunkHeader*> &destination, qint64 start, const quint32 length);
|
||||
|
||||
void analyseMsh2Chunks(std::list<ChunkHeader*> &chunkList);
|
||||
void analyseMsh2Chunks(QList<ChunkHeader*> &chunkList);
|
||||
|
||||
void analyseMatdChunks(std::list<ChunkHeader*> &chunkList);
|
||||
void analyseMatdChunks(QList<ChunkHeader*> &chunkList);
|
||||
|
||||
void analyseModlChunks(Model* dataDestination, std::list<ChunkHeader*> &chunkList);
|
||||
void analyseGeomChunks(Model* dataDestination, std::list<ChunkHeader*> &chunkList);
|
||||
void analyseSegmChunks(Model* dataDestination, std::list<ChunkHeader*> &chunkList);
|
||||
void analyseClthChunks(Model* dataDestination, std::list<ChunkHeader*> &chunkList);
|
||||
void analyseModlChunks(Model* dataDestination, QList<ChunkHeader*> &chunkList);
|
||||
void analyseGeomChunks(Model* dataDestination, QList<ChunkHeader*> &chunkList);
|
||||
void analyseSegmChunks(Model* dataDestination, QList<ChunkHeader*> &chunkList);
|
||||
void analyseClthChunks(Model* dataDestination, QList<ChunkHeader*> &chunkList);
|
||||
|
||||
void readVertex(Segment* dataDestination, std::streampos position);
|
||||
void readUV(Segment* dataDestination, std::streampos position);
|
||||
void readVertex(Segment* dataDestination, qint64 position);
|
||||
void readUV(Segment* dataDestination, qint64 position);
|
||||
|
||||
void loadTexture(QOpenGLTexture*& destination, QString filepath, QString& filename);
|
||||
|
||||
QMatrix4x4 getParentMatrix(std::string parent) const;
|
||||
QQuaternion getParentRotation(std::string parent) const;
|
||||
QMatrix4x4 getParentMatrix(QString parent) const;
|
||||
QQuaternion getParentRotation(QString parent) const;
|
||||
};
|
Reference in New Issue
Block a user