GlobeEngine
Planet.h
Go to the documentation of this file.
1 
8 #ifndef AtmosphereEngine_Planet_h
9 #define AtmosphereEngine_Planet_h
10 #include "Sun.h"
11 #include "AtmosphereShell.h"
12 #include "PlanetNight.h"
13 #include "Camera.h"
14 #include "Texture.h"
15 #include <ctime>
16 
17 namespace at {
18  class Planet : public ge::Sphere
19  {
20  public:
21  Planet();
22  ~Planet();
23  void setSunEnvironment(std::vector<at::Sun*> _sunVec);
24  void updateUniforms();
25  void setRadius(float _radius, float _scaling);
26  float getRadius();
27  void addAtmosphereShell(std::shared_ptr<at::AtmosphereShell> s);
28  bool addAtmosphereShell(int innerRadius, int outerRadius, double density);
29  void deleteAtmosphereShell(int position_);
30  void setAtmosphereEnvironment(std::vector<std::shared_ptr<at::AtmosphereShell> > _atVec);
31  std::vector<std::shared_ptr<at::AtmosphereShell> > getAtmosphereEnvironment();
32  void activateNightMode(std::shared_ptr<ge::Shader> _shader, GLuint _texhandle);
33  void deactivateNightMode();
34  void toggleNightMode(bool b_);
35  void toggleAtmosphereRenderingMode(int i_);
36  void toggleAutoscale();
37  void scaleAtmosphere();
38 
39  void setPlanetSunDist(double dist_);
40  double getPlanetSunDist();
41  void updateAtmosphere();
42  void loadPresets(std::string name_, std::string projectPath_, float scaling_, std::vector<Sun*> sunEnv_, float _radius, float _sunDist, GLuint _handle);
43  void loadPresets(int order_, std::string projectPath_, float scaling_, std::vector<Sun*> sunEnv_);
44  void linkAtmosphareShader(std::shared_ptr<ge::Shader> shader_);
45  void loadPresetTextures(std::string projectPath_);
47  void setSpectrum(int rl, int rh, int gl, int gh, int bl, int bh);
48 
49  std::string getPlanetName();
50 
51  double interpolateEarthNumberDensity(double heightInKm_);
52  double getAverageEarthNumberDensity(int lowBound_, int highBound_, int iterations_);
53  std::shared_ptr<at::AtmosphereComposition> constructChemicalCompounds(int earthAtmosphereLayer_);
54 
55  /*
56  *Override
57  */
58  void draw(std::shared_ptr<ge::Camera> _cam);
59  void setRotation(vmml::Vector3d r);
60  void setShader(std::shared_ptr<ge::Shader> _shader);
61  void setPosition(vmml::Vector3f _pos);
62 
63  protected:
64  float EARTH_RADIUS;
65  double distanceFromSun; //Km
68  float planetRadius;
72  bool preloaded;
73  bool nightMode;
74  void drawAtmosphere(std::shared_ptr<ge::Camera> _cam);
75  std::vector<at::Sun*> sunEnvironment;
76  std::vector<std::shared_ptr<at::AtmosphereShell> > atmosphereEnvironment;
77 
78  std::string planetName;
79  std::string projectPath;
80 
81  std::shared_ptr<ge::Shader> atmosphereShader;
82 
83  GLfloat* sunPositions;
84 
89 
90 
97 
102 
103  vmml::Vector4f centerColor;
104  vmml::Vector4f borderColor;
105 
106  int lowRed;
107  int highRed;
108  int lowGreen;
110  int lowBlue;
111  int highBlue;
112 
113  std::shared_ptr<ge::Texture2Drgba> whitetex;
114 
115  std::shared_ptr<ge::Texture2Drgba> mercuryTexture;
116  std::shared_ptr<ge::Texture2Drgba> venusTexture;
117  std::shared_ptr<ge::Texture2Drgba> earthTexture;
118  std::shared_ptr<ge::Texture2Drgba> earthNightTexture;
119  std::shared_ptr<ge::Texture2Drgba> marsTexture;
120  std::shared_ptr<ge::Texture2Drgba> jupiterTexture;
121  std::shared_ptr<ge::Texture2Drgba> saturnTexture;
122  std::shared_ptr<ge::Texture2Drgba> uranusTexture;
123  std::shared_ptr<ge::Texture2Drgba> neptuneTexture;
124  std::shared_ptr<ge::Texture2Drgba> plutoTexture;
125  };
126 }
127 #endif
std::string planetName
Definition: Planet.h:78
void setSpectrum(int rl, int rh, int gl, int gh, int bl, int bh)
Definition: Planet.cpp:831
std::string projectPath
Definition: Planet.h:79
~Planet()
Definition: Planet.cpp:37
int lowBlue
Definition: Planet.h:110
double getAverageEarthNumberDensity(int lowBound_, int highBound_, int iterations_)
Definition: Planet.cpp:915
GLint uniformCenterColor
Definition: Planet.h:98
GLint uniformLowRed
Definition: Planet.h:91
void drawAtmosphere(std::shared_ptr< ge::Camera > _cam)
Definition: Planet.cpp:241
void deactivateNightMode()
Definition: Planet.cpp:279
bool nightMode
Definition: Planet.h:73
Definition: PlanetNight.h:16
std::shared_ptr< ge::Texture2Drgba > saturnTexture
Definition: Planet.h:121
GLint uniformNightmodeLocation
Definition: Planet.h:88
void deleteAtmosphereShell(int position_)
Definition: Planet.cpp:225
GLint uniformAtmosphereRadius
Definition: Planet.h:101
GLint uniformHighRed
Definition: Planet.h:92
void toggleAtmosphereRenderingMode(int i_)
Definition: Planet.cpp:290
void setPosition(vmml::Vector3f _pos)
Definition: Planet.cpp:140
std::shared_ptr< ge::Texture2Drgba > venusTexture
Definition: Planet.h:116
GLint uniformLowBlue
Definition: Planet.h:95
bool preloaded
Definition: Planet.h:72
int renderingMode
Definition: Planet.h:66
void updateAtmosphere()
Definition: Planet.cpp:850
GLint uniformLowGreen
Definition: Planet.h:93
void addAtmosphereShell(std::shared_ptr< at::AtmosphereShell > s)
Definition: Planet.cpp:156
std::shared_ptr< ge::Texture2Drgba > jupiterTexture
Definition: Planet.h:120
void loadPresets(std::string name_, std::string projectPath_, float scaling_, std::vector< Sun * > sunEnv_, float _radius, float _sunDist, GLuint _handle)
Definition: Planet.cpp:394
Definition: Sphere.h:18
vmml::Vector4f centerColor
Definition: Planet.h:103
void calculatePlanetSurfaceLighting()
Definition: Planet.cpp:724
GLint uniformBorderColor
Definition: Planet.h:99
double distanceFromSun
Definition: Planet.h:65
std::vector< at::Sun * > sunEnvironment
Definition: Planet.h:75
void setAtmosphereEnvironment(std::vector< std::shared_ptr< at::AtmosphereShell > > _atVec)
Definition: Planet.cpp:306
void toggleAutoscale()
Definition: Planet.cpp:296
vmml::Vector4f borderColor
Definition: Planet.h:104
float EARTH_RADIUS
Definition: Planet.h:64
void updateUniforms()
Definition: Planet.cpp:134
std::shared_ptr< ge::Texture2Drgba > neptuneTexture
Definition: Planet.h:123
void setRadius(float _radius, float _scaling)
Definition: Planet.cpp:147
void draw(std::shared_ptr< ge::Camera > _cam)
Definition: Planet.cpp:51
float getRadius()
Definition: Planet.cpp:152
void loadPresetTextures(std::string projectPath_)
Definition: Planet.cpp:696
std::shared_ptr< ge::Shader > atmosphereShader
Definition: Planet.h:81
std::shared_ptr< ge::Texture2Drgba > uranusTexture
Definition: Planet.h:122
void setRotation(vmml::Vector3d r)
Definition: Planet.cpp:40
void linkAtmosphareShader(std::shared_ptr< ge::Shader > shader_)
Definition: Planet.cpp:692
void scaleAtmosphere()
Definition: Planet.cpp:299
std::shared_ptr< ge::Texture2Drgba > whitetex
Definition: Planet.h:113
bool autoscaleAtmosphere
Definition: Planet.h:71
double interpolateEarthNumberDensity(double heightInKm_)
Definition: Planet.cpp:868
std::string getPlanetName()
Definition: Planet.cpp:47
int highGreen
Definition: Planet.h:109
std::shared_ptr< ge::Texture2Drgba > earthTexture
Definition: Planet.h:117
void setSunEnvironment(std::vector< at::Sun * > _sunVec)
Definition: Planet.cpp:64
std::shared_ptr< ge::Texture2Drgba > earthNightTexture
Definition: Planet.h:118
float atmosphereRadius
Definition: Planet.h:69
GLint uniformPlanetRadius
Definition: Planet.h:100
void setPlanetSunDist(double dist_)
Definition: Planet.cpp:860
std::shared_ptr< at::AtmosphereComposition > constructChemicalCompounds(int earthAtmosphereLayer_)
Definition: Planet.cpp:929
GLint uniformPlanetLocation
Definition: Planet.h:87
GLfloat * sunPositions
Definition: Planet.h:83
std::vector< std::shared_ptr< at::AtmosphereShell > > atmosphereEnvironment
Definition: Planet.h:76
Planet()
Definition: Planet.cpp:11
Definition: AtmosphereComposition.h:20
int highBlue
Definition: Planet.h:111
int lowGreen
Definition: Planet.h:108
void toggleNightMode(bool b_)
Definition: Planet.cpp:283
void activateNightMode(std::shared_ptr< ge::Shader > _shader, GLuint _texhandle)
Definition: Planet.cpp:264
void setShader(std::shared_ptr< ge::Shader > _shader)
Definition: Planet.cpp:76
float planetRadius
Definition: Planet.h:68
std::shared_ptr< ge::Texture2Drgba > marsTexture
Definition: Planet.h:119
GLint uniformHighGreen
Definition: Planet.h:94
Definition: Planet.h:18
std::shared_ptr< ge::Texture2Drgba > plutoTexture
Definition: Planet.h:124
double getPlanetSunDist()
Definition: Planet.cpp:864
int highRed
Definition: Planet.h:107
std::shared_ptr< ge::Texture2Drgba > mercuryTexture
Definition: Planet.h:115
GLint uniformSunLocation
Definition: Planet.h:86
GLint uniformSunCount
Definition: Planet.h:85
at::PlanetNight * nightSphere
Definition: Planet.h:70
float scalingFactor
Definition: Planet.h:67
GLint uniformHighBlue
Definition: Planet.h:96
std::vector< std::shared_ptr< at::AtmosphereShell > > getAtmosphereEnvironment()
Definition: Planet.cpp:310
int lowRed
Definition: Planet.h:106