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