24 lines
645 B
C
24 lines
645 B
C
|
#ifndef GREEDYMESHER_H
|
||
|
#define GREEDYMESHER_H
|
||
|
|
||
|
#include <vector>
|
||
|
|
||
|
// Simple structure to hold a quad (a single face of a voxel block)
|
||
|
struct Quad {
|
||
|
// Starting position of the quad in world space
|
||
|
float x, y, z;
|
||
|
// Dimensions of the quad (for this demo we assume unit quads)
|
||
|
float width, height;
|
||
|
// Texture ID (1 = grass, 2 = dirt, 3 = wood)
|
||
|
int textureID;
|
||
|
};
|
||
|
|
||
|
class GreedyMesher {
|
||
|
public:
|
||
|
// Very basic greedy meshing algorithm:
|
||
|
// For demonstration, each non-zero voxel produces a quad.
|
||
|
static std::vector<Quad> mesh(const std::vector<std::vector<std::vector<int>>>& voxelData);
|
||
|
};
|
||
|
|
||
|
#endif // GREEDYMESHER_H
|