small-projects/cpp-voxel-engine/GreedyMesher.h
2025-04-05 21:03:23 -05:00

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