obj loader
This commit is contained in:
36
inc/engine/obj_loader.hpp
Normal file
36
inc/engine/obj_loader.hpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user