#ifndef WORLD_H
#define WORLD_H

#include <unordered_map>
#include <optional>
#include <vector>

#include <glm/glm.hpp>

#include "Chunk.h"

class World
{
  public:
    std::unordered_map<glm::ivec3, Chunk> chunks;

    World();

    void set_voxel(glm::ivec3 position, VoxelKind kind);

    std::optional<std::pair<glm::ivec3, glm::ivec3>> raycast_voxel(glm::vec3 start, glm::vec3 direction, float max_dist);

    VoxelKind get_voxel(glm::ivec3 position);

    Chunk* get_or_create_chunk(glm::ivec3 chunk_position);

  private:
    std::vector<int> noise_permutation;
};

#endif WORLD_H
