2016-12-30 12:36:05 +01:00
|
|
|
#pragma once
|
|
|
|
|
#include "..\Header\FileInterface.h"
|
2017-02-02 14:44:48 +01:00
|
|
|
#include <QList>
|
2016-12-30 12:36:05 +01:00
|
|
|
|
|
|
|
|
struct ChunkHeader {
|
2017-02-02 14:44:48 +01:00
|
|
|
QString name;
|
|
|
|
|
quint32 size;
|
|
|
|
|
qint64 position;
|
2016-12-30 12:36:05 +01:00
|
|
|
};
|
|
|
|
|
|
2017-01-02 15:07:39 +01:00
|
|
|
enum ModelTyp {
|
|
|
|
|
null,
|
|
|
|
|
dynamicMesh,
|
|
|
|
|
cloth,
|
|
|
|
|
bone,
|
|
|
|
|
staticMesh,
|
|
|
|
|
shadowMesh = 6
|
|
|
|
|
};
|
2016-12-30 12:36:05 +01:00
|
|
|
|
|
|
|
|
class MshFile : public FileInterface
|
|
|
|
|
{
|
|
|
|
|
public:
|
2017-01-29 11:35:43 +01:00
|
|
|
explicit MshFile(QString path);
|
2016-12-30 12:36:05 +01:00
|
|
|
virtual ~MshFile();
|
|
|
|
|
|
|
|
|
|
private:
|
2017-01-02 15:07:39 +01:00
|
|
|
ModelTyp m_currentType = ModelTyp::null;
|
|
|
|
|
std::int32_t m_currentRenderFlag = -1;
|
|
|
|
|
|
2016-12-30 12:36:05 +01:00
|
|
|
virtual void import() Q_DECL_OVERRIDE Q_DECL_FINAL;
|
|
|
|
|
|
2017-02-02 14:44:48 +01:00
|
|
|
void loadChunks(QList<ChunkHeader*> &destination, qint64 start, const quint32 length);
|
2016-12-30 12:36:05 +01:00
|
|
|
|
2017-02-02 14:44:48 +01:00
|
|
|
void analyseMsh2Chunks(QList<ChunkHeader*> &chunkList);
|
2016-12-30 12:36:05 +01:00
|
|
|
|
2017-02-02 14:44:48 +01:00
|
|
|
void analyseMatdChunks(QList<ChunkHeader*> &chunkList);
|
2016-12-30 12:36:05 +01:00
|
|
|
|
2017-02-02 14:44:48 +01:00
|
|
|
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);
|
2016-12-30 12:36:05 +01:00
|
|
|
|
2017-02-02 14:44:48 +01:00
|
|
|
void readVertex(Segment* dataDestination, qint64 position);
|
|
|
|
|
void readUV(Segment* dataDestination, qint64 position);
|
2016-12-31 13:04:03 +01:00
|
|
|
|
2017-01-23 12:29:10 +01:00
|
|
|
void loadTexture(QOpenGLTexture*& destination, QString filepath, QString& filename);
|
2017-01-15 12:26:15 +01:00
|
|
|
|
2017-02-02 14:44:48 +01:00
|
|
|
QMatrix4x4 getParentMatrix(QString parent) const;
|
|
|
|
|
QQuaternion getParentRotation(QString parent) const;
|
2016-12-30 12:36:05 +01:00
|
|
|
};
|