void World::RebuildChunkMeshes() {
	for(int i = 0; i < m_vpChunks.size(); i++) {
		Chunk* pChunk = m_vpChunks[i];
		pChunk->BuildMesh();
		//pChunk->RebuildNeighbours();
	}
}
void World::UpdateMeshQueue() {
	std::sort(m_vpChunksToMesh.begin(), m_vpChunksToMesh.end(), SortByDistance());

	int count = 0;
	std::vector<Chunk*>::iterator it = m_vpChunksToMesh.begin();
	while(it != m_vpChunksToMesh.end()) {
		if(count >= m_meshPerFrame) break;
		Chunk* pChunk = *it;
		pChunk->BuildMesh();
		pChunk->RebuildNeighbours();
		//it = m_vpChunksToGenerate.erase(std::remove(m_vpChunksToGenerate.begin(), m_vpChunksToGenerate.end(), pChunk), m_vpChunksToGenerate.end());
		//it++;
		m_vpChunksToMesh.erase(it++);
		count++;
	}
}