Add meshes as classes
This commit is contained in:
parent
bb880d6d0b
commit
bb587f809c
|
@ -0,0 +1,19 @@
|
|||
#ifndef _MESH_HPP_
|
||||
#define _MESH_HPP_
|
||||
|
||||
#include "gl.hpp"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
class Mesh
|
||||
{
|
||||
public:
|
||||
std::vector<glm::vec3> positions;
|
||||
std::vector<glm::vec3> normals;
|
||||
|
||||
std::vector<GLushort> elements;
|
||||
};
|
||||
|
||||
#endif // _MESH_HPP_
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "mtllib.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
|
|
|
@ -2,16 +2,17 @@
|
|||
#define _MODEL_HPP_
|
||||
|
||||
#include "resource.hpp"
|
||||
#include "textured_mesh.hpp"
|
||||
#include "gl.hpp"
|
||||
#include "material.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
class Model:
|
||||
public Resource
|
||||
public Resource,
|
||||
public TexturedMesh
|
||||
{
|
||||
RESOURCE(Model)
|
||||
|
||||
|
@ -19,16 +20,10 @@ public:
|
|||
void draw() const;
|
||||
|
||||
private:
|
||||
std::vector<glm::vec3> positions;
|
||||
GLuint positions_id;
|
||||
|
||||
std::vector<glm::vec2> tex_coords;
|
||||
GLuint tex_coords_id;
|
||||
|
||||
std::vector<glm::vec3> normals;
|
||||
GLuint normals_id;
|
||||
|
||||
std::vector<GLushort> elements;
|
||||
GLuint id;
|
||||
|
||||
const Material *_material;
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef _TEXTURED_MESH_HPP_
|
||||
#define _TEXTURED_MESH_HPP_
|
||||
|
||||
#include "mesh.hpp"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
class TexturedMesh:
|
||||
public Mesh
|
||||
{
|
||||
public:
|
||||
std::vector<glm::vec2> tex_coords;
|
||||
};
|
||||
|
||||
#endif // _TEXTURED_MESH_HPP_
|
Reference in New Issue