ObjLMesh
This commit is contained in:
15
src/mesh.cpp
15
src/mesh.cpp
@@ -7,13 +7,10 @@ Mesh::Mesh() {
|
||||
Mesh::Mesh(std::string objPath) {
|
||||
Logger logger;
|
||||
|
||||
tinyobj::attrib_t attrib;
|
||||
std::vector<tinyobj::shape_t> shapes;
|
||||
std::vector<tinyobj::material_t> materials;
|
||||
std::string warn;
|
||||
std::string err;
|
||||
ObjLMesh mesh;
|
||||
std::string warn, err;
|
||||
|
||||
bool canLoad = tinyobj::LoadObj(&attrib, &shapes, &materials, &warn, &err, objPath.c_str());
|
||||
bool canLoad = tinyobj::LoadObj(&mesh.attrib, &mesh.shapes, &mesh.materials, &warn, &err, objPath.c_str());
|
||||
|
||||
if (!err.empty() || !canLoad) {
|
||||
logger << LOGGER_ERROR << "Cannot load obj '" << objPath << "' :" << err << LOGGER_ENDL;
|
||||
@@ -26,14 +23,14 @@ Mesh::Mesh(std::string objPath) {
|
||||
|
||||
logger << LOGGER_INFO << "Loaded: " << objPath << LOGGER_ENDL;
|
||||
|
||||
loadFromObj(attrib);
|
||||
loadFromObj(mesh);
|
||||
}
|
||||
|
||||
Mesh::Mesh(tinyobj::attrib_t attribArr) {
|
||||
Mesh::Mesh(ObjLMesh mesh) {
|
||||
// loadFromObj(objMesh);
|
||||
}
|
||||
|
||||
void Mesh::loadFromObj(tinyobj::attrib_t atrribArr) {
|
||||
void Mesh::loadFromObj(ObjLMesh mesh) {
|
||||
// OBJLtoGLM(objMesh.Vertices, vertices, normals, texCoords);
|
||||
// indices = objMesh.Indices;
|
||||
// name = objMesh.MeshName;
|
||||
|
||||
13
src/mesh.h
13
src/mesh.h
@@ -26,13 +26,22 @@ struct Vertex {
|
||||
glm::vec2 texCoord;
|
||||
};
|
||||
|
||||
|
||||
// For easy passing around of the tinyobj
|
||||
// mesh structures
|
||||
struct ObjLMesh {
|
||||
tinyobj::attrib_t attrib;
|
||||
std::vector<tinyobj::shape_t> shapes;
|
||||
std::vector<tinyobj::material_t> materials;
|
||||
};
|
||||
|
||||
class Mesh {
|
||||
public:
|
||||
Mesh();
|
||||
Mesh(std::string objPath);
|
||||
Mesh(tinyobj::attrib_t attribArr);
|
||||
Mesh(ObjLMesh mesh);
|
||||
|
||||
void loadFromObj(tinyobj::attrib_t attribArr);
|
||||
void loadFromObj(ObjLMesh mesh);
|
||||
void setup();
|
||||
|
||||
void bind();
|
||||
|
||||
Reference in New Issue
Block a user