voxel-engine/src/World.h
2025-11-10 23:39:58 -06:00

42 lines
761 B
C++

#ifndef WORLD_H
#define CAMERA_H
#include <unordered_set>
#include <glm/glm.hpp>
#include "Mesh.h"
// Hash function for glm::ivec3 to use with unordered_set
namespace std {
template <>
struct hash<glm::ivec3> {
size_t operator()(const glm::ivec3& v) const {
// Combine hash values of x, y, z components
size_t h1 = hash<int>()(v.x);
size_t h2 = hash<int>()(v.y);
size_t h3 = hash<int>()(v.z);
// Use a simple hash combination algorithm
return h1 ^ (h2 << 1) ^ (h3 << 2);
}
};
}
class World
{
public:
std::unordered_set<glm::ivec3> voxels;
World();
void generateMesh();
Mesh& getMesh();
private:
Mesh m_mesh;
};
#endif WORLD_H