voxspatium/src/planet/Chunk.cpp

50 lines
749 B
C++

#include "Chunk.h"
#include "planet/PlanetFace.h"
Chunk::Chunk(Planet* planet, class PlanetFace* face, int x, int y, int z) :
m_planet(planet),
m_planetFace(face),
m_cx(x),
m_cy(y),
m_cz(z),
m_dirty(false),
m_active(true)
{
// Create cells
for(int i=0;i<CHUNK_N;i++)
{
for(int j=0;j<CHUNK_N;j++)
{
for(int k=0;k<CHUNK_N;k++)
{
m_cells[i][j][k] = new Cell();
}
}
}
}
Chunk::~Chunk()
{
for(int i=0;i<CHUNK_N;i++)
for(int j=0;j<CHUNK_N;j++)
for(int k=0;k<CHUNK_N;k++)
if(m_cells[i][j][k])
delete m_cells[i][j][k];
}
void Chunk::destroyChunk()
{
m_active = false;
delete this;
}
void Chunk::tick(GLfloat dtime)
{
if (!m_active) return;
}
void Chunk::draw(Camera* camera)
{
if (!m_active) return;
}