Revamped model loading interface.

This commit is contained in:
2014-03-11 13:27:01 +01:00
parent c0c1cf113e
commit fb471aae51
14 changed files with 124 additions and 53 deletions
+22 -9
View File
@@ -8,7 +8,6 @@
#include <vector>
#include <memory>
#define _CRT_SECURE_NO_WARNINGS
#include <GL/glew.h>
#define GLFW_INCLUDE_GLU
#include <GLFW/glfw3.h>
@@ -19,26 +18,42 @@
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include "glerror.h"
#include <cstdlib>
#include <stack>
#include "glerror.h"
#include "Texture.h"
#include "OBJ.h"
class Model
{
public:
Model(OBJ &obj);
Model(const char* path);
struct TextureGroup
{
std::shared_ptr<Texture> Texture;
unsigned int StartIndex;
unsigned int EndIndex;
};
GLuint VAO;
std::vector<TextureGroup> TextureGroups;
std::vector<std::shared_ptr<Texture>> texture;
glm::mat4 GetMatrix();
std::vector<glm::vec3> Vertices;
private:
std::vector<glm::vec3> Normals;
std::vector<glm::vec2> TextureCoords;
GLuint VertexBuffer;
GLuint NormalBuffer;
GLuint TextureCoordBuffer;
GLuint VAO;
std::vector<std::shared_ptr<Texture>> texture;
Model(const char* path);
bool Loadobj(
const char* path,
@@ -47,8 +62,6 @@ public:
std::vector <glm::vec2> & out_TextureCoords
);
glm::mat4 GetMatrix();
void CreateBuffers(
std::vector<glm::vec3> _Vertices,
std::vector<glm::vec3> _Normals,