60 lines
1.2 KiB
C++
60 lines
1.2 KiB
C++
#pragma once
|
|
#include <glm/glm.hpp>
|
|
#include <vector>
|
|
|
|
namespace deerith
|
|
{
|
|
class mesh_2d_t
|
|
{
|
|
public:
|
|
mesh_2d_t(const glm::vec2 *vertices, size_t vertex_size, const unsigned int *indices, size_t index_count);
|
|
|
|
void bind() const;
|
|
void draw() const;
|
|
|
|
~mesh_2d_t();
|
|
|
|
private:
|
|
unsigned int vao = 0;
|
|
unsigned int vbo = 0;
|
|
unsigned int ebo = 0;
|
|
|
|
size_t index_count;
|
|
};
|
|
|
|
struct vertex_3d_t
|
|
{
|
|
glm::vec3 position;
|
|
glm::vec3 normal;
|
|
glm::vec2 uv;
|
|
};
|
|
|
|
struct mesh_3d_data_t
|
|
{
|
|
std::vector<vertex_3d_t> vertices;
|
|
std::vector<unsigned int> indices;
|
|
};
|
|
|
|
class mesh_3d_t
|
|
{
|
|
public:
|
|
// obsolete
|
|
mesh_3d_t(const glm::vec3 *vertices, size_t vertex_size, const unsigned int *indices, size_t index_count);
|
|
mesh_3d_t(const mesh_3d_data_t &mesh_data);
|
|
|
|
void bind() const;
|
|
void draw() const;
|
|
void draw_lines() const;
|
|
|
|
~mesh_3d_t();
|
|
|
|
private:
|
|
unsigned int vao;
|
|
unsigned int vbo;
|
|
unsigned int ebo;
|
|
|
|
size_t index_count = 0;
|
|
size_t vertex_count = 0;
|
|
};
|
|
|
|
} |