Program Listing for File Mesh.ixx#
↰ Return to documentation for file (Src/GraphicsEngineOpenGL/scene/Mesh.ixx)
module;
#include <glad/glad.h>
#include <glm/glm.hpp>
#include <limits>
#include <vector>
#include "host_device/GlobalValues.hpp"
export module kataglyphis.opengl.mesh;
import kataglyphis.shared.scene.vertex;
export class Mesh
{
public:
Mesh(std::vector<Vertex> &vertices, std::vector<unsigned int> &indices);
Mesh();
Mesh(const Mesh &) = delete;
Mesh &operator=(const Mesh &) = delete;
Mesh(Mesh &&) = delete;
Mesh &operator=(Mesh &&) = delete;
void render() const;
const std::vector<Vertex> &get_vertices() const { return this->vertices; }
const std::vector<unsigned int> &get_indices() const { return this->indices; }
~Mesh();
private:
// render data
// unsigned int VAO, VBO, EBO;
enum {
POSITION = 0,
NORMAL = 1,
COLOR = 2,
TEXTURECOORD = 3
};
enum { POSITION_VB, NUM_BUFFERS };
// Vertex Array Object — sentinel value means "not yet created by GL".
static constexpr GLuint INVALID_GL_NAME = std::numeric_limits<GLuint>::max();
GLuint vao{INVALID_GL_NAME}, ibo{INVALID_GL_NAME};
// Vertex array buffer
GLuint vab[NUM_BUFFERS]{INVALID_GL_NAME};
uint32_t draw_count;
std::vector<Vertex> vertices;
std::vector<uint32_t> indices;
};