a bit more

This commit is contained in:
Benjamin Kyd
2019-02-23 17:59:52 +00:00
parent cf7b72df2a
commit baf6f2aea5
3 changed files with 26 additions and 4 deletions

View File

@@ -5,17 +5,26 @@ Mesh::Mesh() {
}
Mesh::Mesh(std::string objPath) {
Logger logger;
objl::Loader loader;
bool canLoad = loader.LoadFile(objPath);
if (!canLoad) {
logger << LOGGER_ERROR << "Cannot load obj '" << objPath << "'" << LOGGER_ENDL;
return;
}
OBJLtoGLM(loader.LoadedMeshes[0].Vertices, vertices, normals, texCoords);
}
Mesh::Mesh(objl::Mesh objMesh) {
OBJLtoGLM(objMesh.Vertices, vertices, normals, texCoords);
// objMesh.Vertices includes normals, positions and texcoords
// it must convert them to the neccesary GLM shit
UintToGLuint(objMesh.Indices, indices);
}
void Mesh::loadFromObj(objl::Mesh objmesh) {
void Mesh::loadFromObj(objl::Mesh objMesh) {
OBJLtoGLM(objMesh.Vertices, vertices, normals, texCoords);
UintToGLuint(objMesh.Indices, indices);
}
void Mesh::settup() {

View File

@@ -12,6 +12,7 @@
#include <OBJLoader.h>
#include <logger.h>
#include "./util/util.h"
class Shader;

View File

@@ -0,0 +1,12 @@
#ifndef SMHENGINE_SRC_MODEL_H_
#define SMHENGINE_SRC_MODEL_H_
#include "mesh.h"
#include "material.h"
class Mesh {
public:
};
#endif