Initial commit

This commit is contained in:
2026-09-27 01:33:35 +02:00
commit 3ac329a21b
1185 changed files with 543634 additions and 0 deletions

49
src/mesh.hpp Normal file
View 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_