Pioneer
Loading...
Searching...
No Matches
Background.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 _BACKGROUND_H
5#define _BACKGROUND_H
6
7#include "galaxy/SystemPath.h"
9
10class Random;
11class Galaxy;
12class Space;
13
14namespace Graphics {
15 class Renderer;
16 class Material;
17 class RenderState;
18 class Texture;
19
20} // namespace Graphics
21
22/*
23 * Classes to draw background stars and the milky way
24 */
25
26namespace Background {
28 public:
29 void SetIntensity(float intensity);
30
31 protected:
35
36 float m_rMin;
37 float m_rMax;
38 float m_gMin;
39 float m_gMax;
40 float m_bMin;
41 float m_bMax;
42 };
43
45 public:
48
49 void Draw();
50 void LoadCubeMap(Random &rand);
51
52 private:
53 void Init();
54
55 std::unique_ptr<Graphics::MeshObject> m_universeBox;
57
58 Uint32 m_numCubemaps;
59 };
60
62 public:
63 //does not Fill the starfield
64 Starfield(Graphics::Renderer *r, Random &rand, const SystemPath *const systemPath, RefCountedPtr<Galaxy> galaxy);
65 void Draw();
66 //create or recreate the starfield
67 void Fill(Random &rand, const SystemPath *const systemPath, RefCountedPtr<Galaxy> galaxy);
68
69 private:
70 void Init();
71
72 std::unique_ptr<Graphics::Drawables::PointSprites> m_pointSprites;
73
74 //hyperspace animation vertex data
75 std::unique_ptr<vector3f[]> m_hyperVtx; // BG_STAR_MAX * 3
76 std::unique_ptr<Color[]> m_hyperCol; // BG_STAR_MAX * 3
77 std::unique_ptr<Graphics::MeshObject> m_animMesh;
78 };
79
80 class MilkyWay : public BackgroundElement {
81 public:
83 void Draw();
84
85 private:
86 std::unique_ptr<Graphics::MeshObject> m_meshObject;
87 };
88
89 // contains starfield, milkyway, possibly other Background elements
90 class Container {
91 public:
93 DRAW_STARS = 1 << 0,
94 DRAW_MILKY = 1 << 1,
95 DRAW_SKYBOX = 1 << 2
96 };
97
98 Container(Graphics::Renderer *, Random &rand, const Space *space, RefCountedPtr<Galaxy> galaxy, const SystemPath *const systemPath = nullptr);
99 void Draw(const matrix4x4d &transform);
100
101 void SetIntensity(float intensity);
102 void SetDrawFlags(const Uint32 flags);
103 Uint32 GetDrawFlags() const { return m_drawFlags; }
104
105 private:
106 Graphics::Renderer *m_renderer;
107 MilkyWay m_milkyWay;
108 Starfield m_starField;
109 UniverseBox m_universeBox;
110 Uint32 m_drawFlags;
111 };
112
113} //namespace Background
114
115#endif
Definition Background.h:27
float m_rMax
Definition Background.h:37
RefCountedPtr< Graphics::Material > m_materialStreaks
Definition Background.h:34
Graphics::Renderer * m_renderer
Definition Background.h:32
RefCountedPtr< Graphics::Material > m_material
Definition Background.h:33
void SetIntensity(float intensity)
Definition Background.cpp:80
float m_gMin
Definition Background.h:38
float m_bMax
Definition Background.h:41
float m_bMin
Definition Background.h:40
float m_rMin
Definition Background.h:36
float m_gMax
Definition Background.h:39
Definition Background.h:90
Uint32 GetDrawFlags() const
Definition Background.h:103
void Draw(const matrix4x4d &transform)
Definition Background.cpp:672
BackgroundDrawFlags
Definition Background.h:92
@ DRAW_SKYBOX
Definition Background.h:95
@ DRAW_STARS
Definition Background.h:93
@ DRAW_MILKY
Definition Background.h:94
void SetDrawFlags(const Uint32 flags)
Definition Background.cpp:697
void SetIntensity(float intensity)
Definition Background.cpp:688
Definition Background.h:80
void Draw()
Definition Background.cpp:655
Definition Background.h:61
void Draw()
Definition Background.cpp:542
void Fill(Random &rand, const SystemPath *const systemPath, RefCountedPtr< Galaxy > galaxy)
Definition Background.cpp:415
Definition Background.h:44
~UniverseBox()
Definition Background.cpp:91
void Draw()
Definition Background.cpp:178
void LoadCubeMap(Random &rand)
Definition Background.cpp:184
Definition Galaxy.h:18
Definition Material.h:148
Definition Renderer.h:44
Definition Texture.h:106
Definition Random.h:27
Definition RefCounted.h:36
Definition Space.h:19
Definition SystemPath.h:13
Definition Background.cpp:61
Definition Background.h:14