obj loader

This commit is contained in:
2025-11-25 13:02:02 +00:00
parent c17279960c
commit 47a10623a1
4 changed files with 139 additions and 27 deletions

36
inc/engine/obj_loader.hpp Normal file
View 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