Pioneer
BaseSphere.h
Go to the documentation of this file.
1 // Copyright © 2008-2021 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"
8 #include "vector3.h"
10 #include "graphics/Material.h"
11 #include "terrain/Terrain.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 
45  std::vector<Camera::Shadow> shadows;
46  Sint32 patchDepth;
47  Sint32 maxPatchDepth;
48  };
49 
50  virtual void Reset() = 0;
51 
52  const SystemBody *GetSystemBody() const { return m_sbody; }
53  Terrain *GetTerrain() const { return m_terrain.Get(); }
54 
58 
59 protected:
61 
62  // all variables for GetHeight(), GetColor()
64 
65  virtual void SetUpMaterials() = 0;
66 
71 
72  // atmosphere geometry
73  std::unique_ptr<Graphics::Drawables::Sphere3D> m_atmos;
74 
75  //special parameters for shaders
77 };
78 
79 #endif /* _GEOSPHERE_H */
Definition: BaseSphere.h:21
virtual ~BaseSphere()
Definition: BaseSphere.cpp:16
void DrawAtmosphereSurface(Graphics::Renderer *renderer, const matrix4x4d &modelView, const vector3d &campos, float rad, Graphics::RenderState *rs, RefCountedPtr< Graphics::Material > mat)
Definition: BaseSphere.cpp:46
BaseSphere(const SystemBody *body)
Definition: BaseSphere.cpp:12
MaterialParameters m_materialParameters
Definition: BaseSphere.h:76
Terrain * GetTerrain() const
Definition: BaseSphere.h:53
virtual double GetMaxFeatureHeight() const =0
Graphics::RenderState * m_atmosRenderState
Definition: BaseSphere.h:68
static void Init()
Definition: BaseSphere.cpp:19
const SystemBody * GetSystemBody() const
Definition: BaseSphere.h:52
std::unique_ptr< Graphics::Drawables::Sphere3D > m_atmos
Definition: BaseSphere.h:73
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:70
virtual void Update()=0
virtual void SetUpMaterials()=0
MaterialParameters & GetMaterialParameters()
Definition: BaseSphere.h:57
RefCountedPtr< Graphics::Material > m_surfaceMaterial
Definition: BaseSphere.h:69
const SystemBody * m_sbody
Definition: BaseSphere.h:60
RefCountedPtr< Terrain > m_terrain
Definition: BaseSphere.h:63
static void Uninit()
Definition: BaseSphere.cpp:27
RefCountedPtr< Graphics::Material > GetSurfaceMaterial() const
Definition: BaseSphere.h:56
static void UpdateAllBaseSphereDerivatives()
Definition: BaseSphere.cpp:34
Graphics::RenderState * GetSurfRenderState() const
Definition: BaseSphere.h:55
virtual void Reset()=0
Graphics::RenderState * m_surfRenderState
Definition: BaseSphere.h:67
virtual double GetHeight(const vector3d &p) const
Definition: BaseSphere.h:29
static void OnChangeDetailLevel()
Definition: BaseSphere.cpp:41
Definition: Drawables.h:133
Definition: RenderState.h:25
Definition: Renderer.h:39
T * Get() const
Definition: SmartPtr.h:37
Definition: SystemBody.h:19
Definition: Terrain.h:25
Definition: Background.h:13
Definition: AtmosphereParameters.h:4
Definition: BaseSphere.h:43
std::vector< Camera::Shadow > shadows
Definition: BaseSphere.h:45
AtmosphereParameters atmosphere
Definition: BaseSphere.h:44
Sint32 patchDepth
Definition: BaseSphere.h:46
Sint32 maxPatchDepth
Definition: BaseSphere.h:47