removed unused things from FileInterface

This commit is contained in:
Anakin 2017-01-02 15:07:39 +01:00
parent 876c689a1d
commit 24d26cfdfa
3 changed files with 25 additions and 23 deletions

View File

@ -8,27 +8,18 @@
#include <QOpenGLFunctions> #include <QOpenGLFunctions>
struct VertexData
{
QVector3D position;
QVector2D texCoord;
};
enum ModelTyp {
null,
dynamicMesh,
cloth,
bone,
staticMesh,
shadowMesh = 6
};
struct BoundingBox { struct BoundingBox {
QQuaternion rotation; QQuaternion rotation;
QVector3D center; QVector3D center;
QVector3D extents; QVector3D extents;
}; };
struct VertexData
{
QVector3D position;
QVector2D texCoord;
};
struct Segment { struct Segment {
std::uint32_t textureIndex = 0; std::uint32_t textureIndex = 0;
QVector<VertexData> vertices; QVector<VertexData> vertices;
@ -38,8 +29,6 @@ struct Segment {
struct Model { struct Model {
std::string name = ""; std::string name = "";
std::string parent = ""; std::string parent = "";
ModelTyp type = null; //TODO: should be removed
std::int32_t renderFlags = -1; //TODO: should be removed
QMatrix4x4 m4x4Translation; QMatrix4x4 m4x4Translation;
std::vector<Segment*> segmList; std::vector<Segment*> segmList;
}; };

View File

@ -8,6 +8,14 @@ struct ChunkHeader {
std::streampos position; std::streampos position;
}; };
enum ModelTyp {
null,
dynamicMesh,
cloth,
bone,
staticMesh,
shadowMesh = 6
};
class MshFile : public FileInterface class MshFile : public FileInterface
{ {
@ -16,6 +24,9 @@ public:
virtual ~MshFile(); virtual ~MshFile();
private: private:
ModelTyp m_currentType = ModelTyp::null;
std::int32_t m_currentRenderFlag = -1;
virtual void import() Q_DECL_OVERRIDE Q_DECL_FINAL; 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(std::list<ChunkHeader*> &destination, std::streampos start, const std::uint32_t length);

View File

@ -190,6 +190,8 @@ void MshFile::analyseMsh2Chunks(std::list<ChunkHeader*>& chunkList)
else if (!strcmp("MODL", it->name)) else if (!strcmp("MODL", it->name))
{ {
Model* new_model = new Model; Model* new_model = new Model;
m_currentType = ModelTyp::null;
m_currentRenderFlag = -1;
// get all MODL subchunks // get all MODL subchunks
std::list<ChunkHeader*> tmp_chunks; std::list<ChunkHeader*> tmp_chunks;
@ -238,7 +240,7 @@ void MshFile::analyseModlChunks(Model * dataDestination, std::list<ChunkHeader*>
m_file.seekg(it->position); m_file.seekg(it->position);
std::uint32_t tmp_type; std::uint32_t tmp_type;
m_file.read(F2V(tmp_type), sizeof(tmp_type)); m_file.read(F2V(tmp_type), sizeof(tmp_type));
dataDestination->type = (ModelTyp)tmp_type; m_currentType = (ModelTyp)tmp_type;
} }
// parent name // parent name
@ -267,7 +269,7 @@ void MshFile::analyseModlChunks(Model * dataDestination, std::list<ChunkHeader*>
else if (!strcmp("FLGS", it->name)) else if (!strcmp("FLGS", it->name))
{ {
m_file.seekg(it->position); m_file.seekg(it->position);
m_file.read(F2V(dataDestination->renderFlags), sizeof(dataDestination->renderFlags)); m_file.read(F2V(m_currentRenderFlag), sizeof(m_currentRenderFlag));
} }
// translation // translation
@ -403,10 +405,10 @@ void MshFile::analyseSegmChunks(Model * dataDestination, std::list<ChunkHeader*>
else if (!strcmp("STRP", it->name)) else if (!strcmp("STRP", it->name))
{ {
// don't get null, bone, shadowMesh and hidden mesh indices // don't get null, bone, shadowMesh and hidden mesh indices
if (dataDestination->type == null || if (m_currentType == null ||
dataDestination->type == bone || m_currentType == bone ||
dataDestination->type == shadowMesh || m_currentType == shadowMesh ||
dataDestination->renderFlags == 1) m_currentRenderFlag == 1)
continue; continue;
// jump to the data section and read the size; // jump to the data section and read the size;