36 lines
719 B
C++
36 lines
719 B
C++
#ifndef OBJ_LOADER_HPP
|
|
#define OBJ_LOADER_HPP
|
|
|
|
// Includes
|
|
#include <string>
|
|
#include <vector>
|
|
#include <glm/glm.hpp>
|
|
|
|
// OBJLoader class definition
|
|
class OBJLoader {
|
|
public:
|
|
// Vertex structure
|
|
typedef struct {
|
|
glm::vec3 position;
|
|
glm::vec3 normal;
|
|
glm::vec2 texCoord;
|
|
} Vertex;
|
|
|
|
// Constructor
|
|
OBJLoader(std::string filepath);
|
|
|
|
// convert loaded data to arrays
|
|
float *getVertexData();
|
|
unsigned int *getIndexData();
|
|
size_t getVertexCount();
|
|
size_t getIndexCount();
|
|
bool isLoaded() const { return loaded; }
|
|
|
|
private:
|
|
std::string filepath;
|
|
std::vector<Vertex> vertices;
|
|
std::vector<unsigned int> indices;
|
|
bool loaded = false;
|
|
};
|
|
|
|
#endif |