voxel-engine/include/chunkmesh.hpp

38 lines
749 B
C++

#ifndef CHUNKMESH_H
#define CHUNKMESH_H
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <vector>
#include "chunk.hpp"
#include "shader.hpp"
class ChunkMesh
{
public:
ChunkMesh(Chunk::Chunk *c);
~ChunkMesh();
void mesh();
void draw();
Chunk::Chunk *chunk{nullptr};
// static Shader theShader("shaders/shader.vs", "shaders/shader.fs");
private:
void quad(glm::vec3 bottomLeft, glm::vec3 topLeft, glm::vec3 topRight, glm::vec3 bottomRight, Block block, bool backFace);
std::vector<GLfloat> vertices;
std::vector<GLfloat> colors;
std::vector<GLuint> indices;
glm::mat4 model = glm::mat4(1.0f);
GLuint VAO, VBO, EBO, colorBuffer, vIndex{0};
Shader *theShader{nullptr};
};
#endif