2016-09-27 16:23:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "object.hpp"
|
|
|
|
|
2016-09-27 21:29:26 +00:00
|
|
|
#include <cstdlib>
|
|
|
|
|
2016-09-27 16:23:58 +00:00
|
|
|
namespace game {
|
2016-09-29 00:50:51 +00:00
|
|
|
class Planet : public Object {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Planets are build out of one material.
|
|
|
|
* TODO: support mixture or multiple material per planet.
|
|
|
|
*/
|
|
|
|
enum class Material { Rock, Metal, Sand, Gas, Ice, Water, Sun };
|
2016-09-27 21:29:26 +00:00
|
|
|
|
2016-09-29 00:50:51 +00:00
|
|
|
Planet(const glm::vec2 &pos, int id, float r)
|
|
|
|
: Planet(pos, id, r, Material::Rock) {}
|
|
|
|
|
|
|
|
Planet(const glm::vec2 &pos, int id, float r, Material mat)
|
|
|
|
: Object(pos, r), id(id), material(mat), seed(rand()) {}
|
2016-09-27 21:29:26 +00:00
|
|
|
|
2016-09-29 00:50:51 +00:00
|
|
|
glm::vec3 getColor() const {
|
|
|
|
switch (material) {
|
|
|
|
case Material::Rock:
|
|
|
|
return {x : 0.19, y : 0.19, z : 0.19};
|
|
|
|
case Material::Metal:
|
|
|
|
return {x : 0.19, y : 0.19, z : 0.19};
|
|
|
|
case Material::Sand:
|
|
|
|
return {x : 0.19, y : 0.19, z : 0.19};
|
|
|
|
case Material::Gas:
|
|
|
|
return {x : 0.19, y : 0.19, z : 0.19};
|
|
|
|
case Material::Ice:
|
|
|
|
return {x : 0.19, y : 0.19, z : 0.19};
|
|
|
|
case Material::Water:
|
|
|
|
return {x : 0.19, y : 0.40, z : 0.72};
|
|
|
|
case Material::Sun:
|
|
|
|
return {x : 0.64, y : 0.67, z : 0.19};
|
2016-09-27 16:23:58 +00:00
|
|
|
}
|
2016-09-29 00:50:51 +00:00
|
|
|
return {x : 0.1, y : 0.1, z : 0.1};
|
|
|
|
}
|
2016-09-27 21:29:26 +00:00
|
|
|
|
2016-09-29 00:50:51 +00:00
|
|
|
int id;
|
|
|
|
Material material; // for rendering and physics (can fly through sun and
|
|
|
|
// outer gas planets)
|
|
|
|
int seed; // just for rendering variation
|
|
|
|
};
|
2016-09-27 16:23:58 +00:00
|
|
|
}
|