From 24d26cfdfa24db36a38480ad36a50fbb79f50e6b Mon Sep 17 00:00:00 2001 From: Anakin Date: Mon, 2 Jan 2017 15:07:39 +0100 Subject: [PATCH] removed unused things from FileInterface --- QtMeshViewer/Header/FileInterface.h | 23 ++++++----------------- QtMeshViewer/Header/MshFile.h | 11 +++++++++++ QtMeshViewer/Source/MshFile.cpp | 14 ++++++++------ 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/QtMeshViewer/Header/FileInterface.h b/QtMeshViewer/Header/FileInterface.h index 4de5ad1..0508ea8 100644 --- a/QtMeshViewer/Header/FileInterface.h +++ b/QtMeshViewer/Header/FileInterface.h @@ -8,27 +8,18 @@ #include -struct VertexData -{ - QVector3D position; - QVector2D texCoord; -}; - -enum ModelTyp { - null, - dynamicMesh, - cloth, - bone, - staticMesh, - shadowMesh = 6 -}; - struct BoundingBox { QQuaternion rotation; QVector3D center; QVector3D extents; }; +struct VertexData +{ + QVector3D position; + QVector2D texCoord; +}; + struct Segment { std::uint32_t textureIndex = 0; QVector vertices; @@ -38,8 +29,6 @@ struct Segment { struct Model { std::string name = ""; std::string parent = ""; - ModelTyp type = null; //TODO: should be removed - std::int32_t renderFlags = -1; //TODO: should be removed QMatrix4x4 m4x4Translation; std::vector segmList; }; diff --git a/QtMeshViewer/Header/MshFile.h b/QtMeshViewer/Header/MshFile.h index ce15c7f..b242340 100644 --- a/QtMeshViewer/Header/MshFile.h +++ b/QtMeshViewer/Header/MshFile.h @@ -8,6 +8,14 @@ struct ChunkHeader { std::streampos position; }; +enum ModelTyp { + null, + dynamicMesh, + cloth, + bone, + staticMesh, + shadowMesh = 6 +}; class MshFile : public FileInterface { @@ -16,6 +24,9 @@ public: virtual ~MshFile(); private: + ModelTyp m_currentType = ModelTyp::null; + std::int32_t m_currentRenderFlag = -1; + virtual void import() Q_DECL_OVERRIDE Q_DECL_FINAL; void loadChunks(std::list &destination, std::streampos start, const std::uint32_t length); diff --git a/QtMeshViewer/Source/MshFile.cpp b/QtMeshViewer/Source/MshFile.cpp index b8b1105..5d52e92 100644 --- a/QtMeshViewer/Source/MshFile.cpp +++ b/QtMeshViewer/Source/MshFile.cpp @@ -190,6 +190,8 @@ void MshFile::analyseMsh2Chunks(std::list& chunkList) else if (!strcmp("MODL", it->name)) { Model* new_model = new Model; + m_currentType = ModelTyp::null; + m_currentRenderFlag = -1; // get all MODL subchunks std::list tmp_chunks; @@ -238,7 +240,7 @@ void MshFile::analyseModlChunks(Model * dataDestination, std::list m_file.seekg(it->position); std::uint32_t tmp_type; m_file.read(F2V(tmp_type), sizeof(tmp_type)); - dataDestination->type = (ModelTyp)tmp_type; + m_currentType = (ModelTyp)tmp_type; } // parent name @@ -267,7 +269,7 @@ void MshFile::analyseModlChunks(Model * dataDestination, std::list else if (!strcmp("FLGS", it->name)) { m_file.seekg(it->position); - m_file.read(F2V(dataDestination->renderFlags), sizeof(dataDestination->renderFlags)); + m_file.read(F2V(m_currentRenderFlag), sizeof(m_currentRenderFlag)); } // translation @@ -403,10 +405,10 @@ void MshFile::analyseSegmChunks(Model * dataDestination, std::list else if (!strcmp("STRP", it->name)) { // don't get null, bone, shadowMesh and hidden mesh indices - if (dataDestination->type == null || - dataDestination->type == bone || - dataDestination->type == shadowMesh || - dataDestination->renderFlags == 1) + if (m_currentType == null || + m_currentType == bone || + m_currentType == shadowMesh || + m_currentRenderFlag == 1) continue; // jump to the data section and read the size;