Initial commit
This commit is contained in:
49
src/mesh.hpp
Normal file
49
src/mesh.hpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef FAN_MESH_HPP_
|
||||
#define FAN_MESH_HPP_
|
||||
|
||||
#include <vector>
|
||||
#include <glad/gl.h>
|
||||
|
||||
#include "vertex.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
namespace Fan
|
||||
{
|
||||
|
||||
class Mesh
|
||||
{
|
||||
public:
|
||||
static Rc<Mesh> create(const std::vector<Vertex>& vertices,
|
||||
const std::vector<GLuint>& indices = {});
|
||||
Mesh(const std::vector<Vertex>& vertices,
|
||||
const std::vector<GLuint>& indices,
|
||||
bool has_indices,
|
||||
GLuint VBO, GLuint VAO, GLuint EBO)
|
||||
: m_vertices(vertices)
|
||||
, m_indices(indices)
|
||||
, m_has_indices(has_indices)
|
||||
, m_VBO(VBO)
|
||||
, m_VAO(VAO)
|
||||
, m_EBO(EBO) {}
|
||||
|
||||
~Mesh();
|
||||
Mesh(const Mesh&) = delete;
|
||||
Mesh& operator=(const Mesh&) = delete;
|
||||
Mesh(Mesh&& other) noexcept;
|
||||
Mesh& operator=(Mesh&& other) noexcept;
|
||||
|
||||
void draw() const;
|
||||
|
||||
private:
|
||||
std::vector<Vertex> m_vertices{};
|
||||
std::vector<GLuint> m_indices{};
|
||||
bool m_has_indices{};
|
||||
|
||||
GLuint m_VBO{};
|
||||
GLuint m_VAO{};
|
||||
GLuint m_EBO{};
|
||||
};
|
||||
|
||||
} // namespace Fan
|
||||
|
||||
#endif // FAN_MESH_HPP_
|
||||
Reference in New Issue
Block a user