#include "chunk.hpp"

namespace polygun::engine { 
	Chunk::Chunk() {
		for (int x = 0; x < CHUNK_SIZE; x++) {
			for (int y = 0; y < CHUNK_SIZE; y++) {
				for (int z = 0; z < CHUNK_SIZE; z++) {
					chunk_data[x][y][z] = 0;
				}
			}
		}
	}

	Chunk::~Chunk() {
		delete chunk_data;
	}

	void Chunk::add_node(int node_to_add, glm::vec3 pos) {
		chunk_data[(int)pos.x][(int)pos.y][(int)pos.z] = node_to_add;
	}

	bool Chunk::is_air(glm::vec3 pos) {
		return chunk_data[(int)pos.x][(int)pos.y][(int)pos.z] == 0;
	}

	int Chunk::get_node(glm::vec3 pos) {
		return chunk_data[(int)pos.x][(int)pos.y][(int)pos.z];
	}
}