#pragma once #include #include #include #include #include enum Mtyp { null, dynamicMesh, cloth, bone, staticMesh, shadowMesh = 6 }; struct Bbox { float quaternion[4]; float center[3]; float extents[3]; }; struct ChunkHeader { char name[5]; std::uint32_t size; std::streampos position; }; struct Segment { std::uint32_t textureIndex = 0; float* vertex = nullptr; float* uv = nullptr; std::vector> meshIndices; // indices into vertex array }; struct Modl { std::string name = ""; std::string parent = ""; Mtyp type = null; std::int32_t renderFlags = -1; glm::mat4 m4x4Translation = glm::mat4(1.0f); std::vector segmLst; }; class Object { public: Object(const char* path); ~Object(); private: std::vector* vModls; std::fstream fsMesh; std::vector vTextures; Bbox boundingBox; private: void loadChunks(std::list &destination, std::streampos start, const std::uint32_t end); void analyseMsh2Chunks(std::list &chunkList); void analyseMatdChunks(std::list &chunkList); void analyseModlChunks(Modl* dataDestination, std::list &chunkList); void analyseGeomChunks(Modl* dataDestination, std::list &chunkList); void analyseSegmChunks(Modl* dataDestination, std::list &chunkList); void analyseClthChunks(Modl* dataDestination, std::list &chunkList); void readVertex(Segment* dataDestination, std::streampos position); void readUV(Segment* dataDestination, std::streampos position); public: std::vector* getModels() const; std::vector getTextureList() const; Bbox getBoundgBox() const; };