Pioneer
BaseSphere.h
Go to the documentation of this file.
1 // Copyright © 2008-2023 Pioneer Developers. See AUTHORS.txt for details
2 // Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
3 
4 #ifndef _BASESPHERE_H
5 #define _BASESPHERE_H
6 
7 #include "Camera.h"
9 #include "graphics/Material.h"
10 #include "terrain/Terrain.h"
11 #include "vector3.h"
12 
13 namespace Graphics {
14  class Renderer;
15  class RenderState;
16  namespace Drawables {
17  class Sphere3D;
18  }
19 } // namespace Graphics
20 
21 class BaseSphere {
22 public:
23  BaseSphere(const SystemBody *body);
24  virtual ~BaseSphere();
25 
26  virtual void Update() = 0;
27  virtual void Render(Graphics::Renderer *renderer, const matrix4x4d &modelView, vector3d campos, const float radius, const std::vector<Camera::Shadow> &shadows) = 0;
28 
29  virtual double GetHeight(const vector3d &p) const { return 0.0; }
30 
31  static void Init();
32  static void Uninit();
33  static void UpdateAllBaseSphereDerivatives();
34  static void OnChangeDetailLevel();
35 
37  const matrix4x4d &modelView, const vector3d &campos, float rad,
39 
40  // in sbody radii
41  virtual double GetMaxFeatureHeight() const = 0;
42 
43  virtual void Reset() = 0;
44 
45  const SystemBody *GetSystemBody() const { return m_sbody; }
46  Terrain *GetTerrain() const { return m_terrain.Get(); }
47 
49 
50 protected:
52 
53  // all variables for GetHeight(), GetColor()
55 
56  virtual void SetUpMaterials() = 0;
57 
60 
61  // set up shader data for this geosphere's atmosphere
62  void SetMaterialParameters(const matrix4x4d &t, const float r, const std::vector<Camera::Shadow> &s, const AtmosphereParameters &ap);
63 
64  // atmosphere geometry
65  std::unique_ptr<Graphics::Drawables::Sphere3D> m_atmos;
66 };
67 
68 #endif /* _GEOSPHERE_H */
Definition: BaseSphere.h:21
virtual ~BaseSphere()
Definition: BaseSphere.cpp:37
void DrawAtmosphereSurface(Graphics::Renderer *renderer, const matrix4x4d &modelView, const vector3d &campos, float rad, RefCountedPtr< Graphics::Material > mat)
Definition: BaseSphere.cpp:67
BaseSphere(const SystemBody *body)
Definition: BaseSphere.cpp:33
Terrain * GetTerrain() const
Definition: BaseSphere.h:46
virtual double GetMaxFeatureHeight() const =0
static void Init()
Definition: BaseSphere.cpp:40
const SystemBody * GetSystemBody() const
Definition: BaseSphere.h:45
std::unique_ptr< Graphics::Drawables::Sphere3D > m_atmos
Definition: BaseSphere.h:65
virtual void Render(Graphics::Renderer *renderer, const matrix4x4d &modelView, vector3d campos, const float radius, const std::vector< Camera::Shadow > &shadows)=0
RefCountedPtr< Graphics::Material > m_atmosphereMaterial
Definition: BaseSphere.h:59
virtual void Update()=0
virtual void SetUpMaterials()=0
RefCountedPtr< Graphics::Material > m_surfaceMaterial
Definition: BaseSphere.h:58
const SystemBody * m_sbody
Definition: BaseSphere.h:51
RefCountedPtr< Terrain > m_terrain
Definition: BaseSphere.h:54
static void Uninit()
Definition: BaseSphere.cpp:48
RefCountedPtr< Graphics::Material > GetSurfaceMaterial() const
Definition: BaseSphere.h:48
static void UpdateAllBaseSphereDerivatives()
Definition: BaseSphere.cpp:55
virtual void Reset()=0
void SetMaterialParameters(const matrix4x4d &t, const float r, const std::vector< Camera::Shadow > &s, const AtmosphereParameters &ap)
Definition: BaseSphere.cpp:89
virtual double GetHeight(const vector3d &p) const
Definition: BaseSphere.h:29
static void OnChangeDetailLevel()
Definition: BaseSphere.cpp:62
Definition: Drawables.h:148
Definition: Renderer.h:44
T * Get() const
Definition: SmartPtr.h:37
Definition: SystemBody.h:19
Definition: Terrain.h:25
Definition: Background.h:14
Definition: AtmosphereParameters.h:7