just add some blank classes to fill later idk
This commit is contained in:
parent
04039b4e0c
commit
5354d42af8
|
@ -0,0 +1,25 @@
|
||||||
|
#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)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Chunk::~Chunk()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Chunk::destroyChunk()
|
||||||
|
{
|
||||||
|
m_active = false;
|
||||||
|
delete this;
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
#ifndef __CHUNK_H__
|
||||||
|
#define __CHUNK_H__
|
||||||
|
|
||||||
|
#include "util/Common.h"
|
||||||
|
#include "planet/Planet.h"
|
||||||
|
|
||||||
|
#define CHUNK_N 32
|
||||||
|
|
||||||
|
class Chunk
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Chunk(Planet* planet, class PlanetFace* face, int x, int y, int z);
|
||||||
|
~Chunk();
|
||||||
|
|
||||||
|
void destroyChunk();
|
||||||
|
private:
|
||||||
|
Planet* m_planet;
|
||||||
|
class PlanetFace* m_planetFace;
|
||||||
|
|
||||||
|
bool m_dirty;
|
||||||
|
bool m_active;
|
||||||
|
|
||||||
|
int m_cx, m_cy, m_cz;
|
||||||
|
|
||||||
|
GLuint m_vao, m_vbo;
|
||||||
|
};
|
||||||
|
#endif // __CHUNK_H__
|
|
@ -0,0 +1,12 @@
|
||||||
|
#include "planet/Planet.h"
|
||||||
|
#include "planet/PlanetFace.h"
|
||||||
|
|
||||||
|
Planet::Planet(glm::vec3 position, float radius) : m_position(position), m_radius(radius)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Planet::~Planet()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef __PLANET_H__
|
||||||
|
#define __PLANET_H__
|
||||||
|
|
||||||
|
#include "util/Common.h"
|
||||||
|
#include "Shader.h"
|
||||||
|
|
||||||
|
class PlanetFace;
|
||||||
|
class Planet
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Planet(glm::vec3 position, float radius);
|
||||||
|
~Planet();
|
||||||
|
|
||||||
|
inline void setLightDirection(glm::vec3 lightDir) { m_lightDir = lightDir; }
|
||||||
|
inline glm::vec3 getLightDirection() const { return m_lightDir; }
|
||||||
|
private:
|
||||||
|
glm::vec3 m_position;
|
||||||
|
float m_radius;
|
||||||
|
|
||||||
|
glm::vec3 m_lightDir;
|
||||||
|
|
||||||
|
// 6 faces
|
||||||
|
PlanetFace* m_faces[6];
|
||||||
|
};
|
||||||
|
#endif // __PLANET_H__
|
|
@ -0,0 +1,26 @@
|
||||||
|
#include "planet/PlanetFace.h"
|
||||||
|
#include "planet/Planet.h"
|
||||||
|
|
||||||
|
PlanetFace::PlanetFace(Planet* planet, const unsigned int face) :
|
||||||
|
m_planet(planet), m_face(face)
|
||||||
|
{
|
||||||
|
for(int i=0;i<CHUNKS_W;i++)
|
||||||
|
{
|
||||||
|
for(int j=0;j<CHUNKS_H;j++)
|
||||||
|
{
|
||||||
|
for(int k=0;k<CHUNKS_D;k++)
|
||||||
|
{
|
||||||
|
m_chunks[i][j][k] = new Chunk(planet, this, x + i * CHUNK_N, j * CHUNK_N, z + k * CHUNK_N);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PlanetFace::~PlanetFace()
|
||||||
|
{
|
||||||
|
for(int i=0;i<CHUNKS_W;i++)
|
||||||
|
for(int j=0;j<CHUNKS_H;j++)
|
||||||
|
for(int k=0;k<CHUNKS_D;k++)
|
||||||
|
if(m_chunks[i][j][k])
|
||||||
|
m_chunks[i][j][k]->destroyChunk();
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
#ifndef __PLANETFACE_H__
|
||||||
|
#define __PLANETFACE_H__
|
||||||
|
|
||||||
|
#include "util/Common.h"
|
||||||
|
#include "planet/Chunk.h"
|
||||||
|
#include "Shader.h"
|
||||||
|
|
||||||
|
#define CHUNKS_W 1
|
||||||
|
#define CHUNKS_D CHUNKS_W
|
||||||
|
#define CHUNKS_H 32
|
||||||
|
|
||||||
|
enum Face {
|
||||||
|
FACE_BOTTOM, FACE_TOP,
|
||||||
|
FACE_LEFT, FACE_RIGHT,
|
||||||
|
FACE_FRONT, FACE_BACK
|
||||||
|
};
|
||||||
|
|
||||||
|
class Planet;
|
||||||
|
class PlanetFace
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PlanetFace(Planet* planet, const unsigned int face = Face::FACE_BOTTOM);
|
||||||
|
~PlanetFace();
|
||||||
|
private:
|
||||||
|
Planet* m_planet;
|
||||||
|
unsigned int m_face;
|
||||||
|
|
||||||
|
int x, z;
|
||||||
|
|
||||||
|
Chunk* m_chunks[CHUNKS_W][CHUNKS_H][CHUNKS_D];
|
||||||
|
};
|
||||||
|
#endif // __PLANETFACE_H__
|
Loading…
Reference in New Issue