From 5354d42af86207dbcc92eabfbeefc69214f67881 Mon Sep 17 00:00:00 2001 From: Evert Date: Sun, 15 Apr 2018 18:49:03 +0300 Subject: [PATCH] just add some blank classes to fill later idk --- src/planet/Chunk.cpp | 25 +++++++++++++++++++++++++ src/planet/Chunk.h | 27 +++++++++++++++++++++++++++ src/planet/Planet.cpp | 12 ++++++++++++ src/planet/Planet.h | 25 +++++++++++++++++++++++++ src/planet/PlanetFace.cpp | 26 ++++++++++++++++++++++++++ src/planet/PlanetFace.h | 32 ++++++++++++++++++++++++++++++++ 6 files changed, 147 insertions(+) create mode 100644 src/planet/Chunk.cpp create mode 100644 src/planet/Chunk.h create mode 100644 src/planet/Planet.cpp create mode 100644 src/planet/Planet.h create mode 100644 src/planet/PlanetFace.cpp create mode 100644 src/planet/PlanetFace.h diff --git a/src/planet/Chunk.cpp b/src/planet/Chunk.cpp new file mode 100644 index 0000000..0a66d75 --- /dev/null +++ b/src/planet/Chunk.cpp @@ -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; +} diff --git a/src/planet/Chunk.h b/src/planet/Chunk.h new file mode 100644 index 0000000..ded89f4 --- /dev/null +++ b/src/planet/Chunk.h @@ -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__ diff --git a/src/planet/Planet.cpp b/src/planet/Planet.cpp new file mode 100644 index 0000000..5a41e86 --- /dev/null +++ b/src/planet/Planet.cpp @@ -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() +{ + +} diff --git a/src/planet/Planet.h b/src/planet/Planet.h new file mode 100644 index 0000000..19b8bb7 --- /dev/null +++ b/src/planet/Planet.h @@ -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__ diff --git a/src/planet/PlanetFace.cpp b/src/planet/PlanetFace.cpp new file mode 100644 index 0000000..e7bfc12 --- /dev/null +++ b/src/planet/PlanetFace.cpp @@ -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;idestroyChunk(); +} diff --git a/src/planet/PlanetFace.h b/src/planet/PlanetFace.h new file mode 100644 index 0000000..406f8a9 --- /dev/null +++ b/src/planet/PlanetFace.h @@ -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__