54 lines
1.3 KiB
C++
54 lines
1.3 KiB
C++
#ifndef __PLANET_H__
|
|
#define __PLANET_H__
|
|
|
|
#include "util/Common.h"
|
|
#include "util/SimplexNoise.h"
|
|
#include "Shader.h"
|
|
#include "Camera.h"
|
|
|
|
#include "planet/PlanetIndexBuffer.h"
|
|
|
|
struct PlanetNoiseParams {
|
|
float frequency;
|
|
float amplitude;
|
|
float lacunarity;
|
|
float persistence;
|
|
};
|
|
|
|
class PlanetFace;
|
|
class PlanetFaceNode;
|
|
class Planet
|
|
{
|
|
public:
|
|
Planet(glm::vec3 position, float radius, PlanetNoiseParams &noiseParams);
|
|
~Planet();
|
|
|
|
inline void setLightDirection(glm::vec3 lightDir) { m_lightDir = lightDir; }
|
|
inline glm::vec3 getLightDirection() const { return m_lightDir; }
|
|
|
|
inline float getRadius() const { return m_radius; }
|
|
inline glm::vec3 getPosition() const { return m_position; }
|
|
|
|
void tick(Camera* camera, GLfloat dtime);
|
|
void draw(Camera* camera, Shader* shader);
|
|
|
|
inline SimplexNoise& getNoise() { return m_noise; }
|
|
inline PlanetFace* getFace(const unsigned int face) { return m_faces[face]; }
|
|
PlanetIndexBuffer* getIndexBuffer(const unsigned int detailTop, const unsigned int detailRight, const unsigned int detailBottom, const unsigned int detailLeft);
|
|
|
|
glm::mat4 getTransformation();
|
|
private:
|
|
void connectFaces();
|
|
|
|
PlanetIndexBuffer* m_ibuffers[5][5][5][5];
|
|
SimplexNoise m_noise;
|
|
glm::vec3 m_position;
|
|
float m_radius;
|
|
|
|
glm::vec3 m_lightDir;
|
|
|
|
// 6 faces
|
|
PlanetFace* m_faces[6];
|
|
};
|
|
#endif // __PLANET_H__
|