2023-02-12 14:36:59 +01:00
|
|
|
#ifndef CHUNKMESH_H
|
|
|
|
#define CHUNKMESH_H
|
|
|
|
|
2023-03-23 21:17:06 +01:00
|
|
|
#include <string>
|
2023-02-12 14:36:59 +01:00
|
|
|
#include <vector>
|
|
|
|
|
2023-05-20 21:19:44 +02:00
|
|
|
#include <glad/glad.h>
|
|
|
|
#include <GLFW/glfw3.h>
|
|
|
|
#include <oneapi/tbb/concurrent_queue.h>
|
|
|
|
|
2023-02-12 14:36:59 +01:00
|
|
|
#include "chunk.hpp"
|
|
|
|
#include "globals.hpp"
|
|
|
|
#include "shader.hpp"
|
2023-03-03 21:33:11 +01:00
|
|
|
|
|
|
|
namespace chunkmesher{
|
2023-05-20 21:19:44 +02:00
|
|
|
struct MeshData{
|
|
|
|
Chunk::Chunk* chunk;
|
2023-05-26 23:05:29 +02:00
|
|
|
GLuint numVertices{0};
|
|
|
|
|
2023-05-20 21:19:44 +02:00
|
|
|
std::vector<GLfloat> vertices;
|
2023-07-19 12:56:55 +02:00
|
|
|
std::vector<GLfloat> extents;
|
|
|
|
std::vector<GLfloat> texinfo;
|
2023-05-20 21:19:44 +02:00
|
|
|
};
|
|
|
|
oneapi::tbb::concurrent_queue<MeshData*>& getMeshDataQueue();
|
2023-03-03 21:33:11 +01:00
|
|
|
|
2023-05-20 21:19:44 +02:00
|
|
|
void mesh(Chunk::Chunk* chunk);
|
|
|
|
void sendtogpu(MeshData* mesh_data);
|
|
|
|
void quad(MeshData* mesh_data, glm::vec3 bottomLeft, glm::vec3 topLeft, glm::vec3 topRight,
|
2023-04-10 00:21:49 +02:00
|
|
|
glm::vec3 bottomRight, glm::vec3 normal, Block block, int dim, bool backFace);
|
2023-03-03 21:33:11 +01:00
|
|
|
}
|
2023-02-12 14:36:59 +01:00
|
|
|
|
|
|
|
|
2023-03-23 16:19:25 +01:00
|
|
|
#endif
|