2022-11-10 19:47:39 +01:00
|
|
|
#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);
|
2022-11-11 20:36:39 +01:00
|
|
|
~ChunkMesh();
|
|
|
|
|
2022-11-10 19:47:39 +01:00
|
|
|
void mesh();
|
|
|
|
void draw();
|
|
|
|
|
2022-11-11 20:36:39 +01:00
|
|
|
Chunk::Chunk *chunk{nullptr};
|
2022-11-10 19:47:39 +01:00
|
|
|
// static Shader theShader("shaders/shader.vs", "shaders/shader.fs");
|
2022-11-22 22:49:25 +01:00
|
|
|
glm::mat4 model = glm::mat4(1.0f);
|
2022-11-10 19:47:39 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
void quad(glm::vec3 bottomLeft, glm::vec3 topLeft, glm::vec3 topRight, glm::vec3 bottomRight, Block block, bool backFace);
|
|
|
|
|
|
|
|
std::vector<GLfloat> vertices;
|
2022-11-10 22:46:47 +01:00
|
|
|
std::vector<GLfloat> colors;
|
2022-11-10 19:47:39 +01:00
|
|
|
std::vector<GLuint> indices;
|
|
|
|
|
|
|
|
|
2022-11-10 23:29:34 +01:00
|
|
|
GLuint VAO, VBO, EBO, colorBuffer, vIndex{0};
|
2022-11-11 20:36:39 +01:00
|
|
|
Shader *theShader{nullptr};
|
2022-11-10 19:47:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|