small-projects/cpp-voxel-engine/VoxelGame.h

42 lines
857 B
C
Raw Normal View History

2025-04-06 02:03:23 +00:00
#ifndef VOXELGAME_H
#define VOXELGAME_H
#include <vector>
#include "GreedyMesher.h"
2025-04-06 02:09:28 +00:00
#include "imgui.h"
#include "imgui_impl_glfw.h"
#include "imgui_impl_opengl3.h"
2025-04-06 02:03:23 +00:00
class VoxelGame {
public:
VoxelGame();
~VoxelGame();
// Initialize textures, voxel data, and mesher
bool init();
// Game loop functions
void update(float deltaTime);
void render();
void debugUI();
private:
// 3D voxel data (0 = empty, 1 = grass, 2 = dirt, 3 = wood)
std::vector<std::vector<std::vector<int>>> voxelData;
// Mesh quads produced by the greedy mesher
std::vector<Quad> meshQuads;
// OpenGL texture IDs for each block type
unsigned int textureGrass;
unsigned int textureDirt;
unsigned int textureWood;
bool loadTextures();
void generateVoxelData();
void generateMesh();
};
#endif // VOXELGAME_H