#ifndef OBJ_h__ #define OBJ_h__ #include #include #include #include #include #include #include #include #include "logging.h" class OBJ { public: struct MaterialInfo { std::string TextureFile; std::tuple AmbientColor; std::tuple DiffuseColor; std::tuple SpecularColor; std::tuple TransmissionFilter; float OpticalDensity; float Alpha; float Shininess; int IlluminationModel; }; struct FaceDefinition { int VertexIndex; int TextureCoordIndex; int NormalIndex; }; struct Face { Face() : Material(nullptr) { } std::vector Definitions; MaterialInfo* Material; }; OBJ() : m_CurrentMaterial(nullptr) { } OBJ(std::string filename) : m_CurrentMaterial(nullptr) { LoadFromFile(filename); } std::vector> Vertices; std::vector> Normals; std::vector> TextureCoords; std::vector Faces; std::map Materials; bool LoadFromFile(std::string filename); boost::filesystem::path Path() const { return m_Path; } private: boost::filesystem::path m_Path; boost::filesystem::path m_MaterialPath; MaterialInfo* m_CurrentMaterial; void ParseMaterial(); }; #endif // OBJ_h__