#pragma once #include #include #include //TODO: shouldn't be here enum ModelTyp { null, dynamicMesh, cloth, bone, staticMesh, shadowMesh = 6 }; struct BoundingBox { float quaternion[4]; float center[3]; float extents[3]; }; struct Segment { std::uint32_t textureIndex = 0; float* vertex = nullptr; float* uv = nullptr; std::vector> polyIndices; // indices into vertex array }; 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; }; class FileInterface { public: FileInterface(const char* path) : m_vModels(new std::vector) { //open file m_fsMesh.open(path, std::ios::in | std::ios::binary); if (!m_fsMesh.is_open()) throw std::invalid_argument(std::string("file not found: ") += path); }; virtual ~FileInterface() { // close file m_fsMesh.close(); //clean up m_vTextureNames.clear(); }; protected: std::vector* m_vModels; std::fstream m_fsMesh; std::vector m_vTextureNames; BoundingBox m_sceneBbox; virtual void import() = 0; public: virtual std::vector* getModels() const { return m_vModels; }; virtual std::vector getTextureNames() const { return m_vTextureNames; }; virtual BoundingBox getBoundingBox() const { return m_sceneBbox; }; };