diff --git a/include/OBJLoader.h b/include/OBJLoader.h index bd69b9e..758ec6f 100644 --- a/include/OBJLoader.h +++ b/include/OBJLoader.h @@ -631,31 +631,17 @@ namespace objl return ""; } - // Get element at given index position - template - inline const T & getElement(const std::vector &elements, std::string &index) - { - int idx = std::stoi(index); - if (idx < 0) - idx = int(elements.size()) + idx; - else - idx--; - return elements[idx]; - } } // Class: Loader // // Description: The OBJ Model Loader - class Loader - { - public: // Default Constructor - Loader() + objl::Loader::Loader() { } - ~Loader() + objl::Loader::~Loader() { LoadedMeshes.clear(); } @@ -666,7 +652,7 @@ namespace objl // // If the file is unable to be found // or unable to be loaded return false - bool LoadFile(std::string Path) + bool objl::Loader::LoadFile(std::string Path) { // If the file is not an .obj file return false if (Path.substr(Path.size() - 4, 4) != ".obj") @@ -950,19 +936,9 @@ namespace objl } } - // Loaded Mesh Objects - std::vector LoadedMeshes; - // Loaded Vertex Objects - std::vector LoadedVertices; - // Loaded Index Positions - std::vector LoadedIndices; - // Loaded Material Objects - std::vector LoadedMaterials; - - private: // Generate vertices from a list of positions, // tcoords, normals and a face line - void GenVerticesFromRawOBJ(std::vector& oVerts, + void Loader::GenVerticesFromRawOBJ(std::vector& oVerts, const std::vector& iPositions, const std::vector& iTCoords, const std::vector& iNormals, @@ -1073,7 +1049,7 @@ namespace objl // Triangulate a list of vertices into a face by printing // inducies corresponding with triangles within it - void VertexTriangluation(std::vector& oIndices, + void Loader::VertexTriangluation(std::vector& oIndices, const std::vector& iVerts) { // If there are 2 or less verts, @@ -1241,7 +1217,7 @@ namespace objl } // Load Materials from .mtl file - bool LoadMaterials(std::string path) + bool Loader::LoadMaterials(std::string path) { // If the file is not a material file return false if (path.substr(path.size() - 4, path.size()) != ".mtl") @@ -1401,7 +1377,6 @@ namespace objl else return true; } - }; } #endif