Pyrogenesis  trunk
SkyManager.h
Go to the documentation of this file.
1 /* Copyright (C) 2012 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 /*
19  * Sky settings and texture management
20  */
21 
22 #ifndef INCLUDED_SKYMANAGER
23 #define INCLUDED_SKYMANAGER
24 
25 #include "graphics/Texture.h"
26 
27 /**
28  * Class SkyManager: Maintain sky settings and textures, and render the sky.
29  */
31 {
32 public:
35 
36 public:
37  SkyManager();
38 
39  /**
40  * RenderSky: Render the sky.
41  */
42  void RenderSky();
43 
44  /**
45  * GetSkySet(): Return the currently selected sky set name.
46  */
47  inline const CStrW& GetSkySet() const {
48  return m_SkySet;
49  }
50 
51  GLuint GetSkyCube() {
52  return m_SkyCubeMap;
53  }
54 
55  /**
56  * GetSkySet(): Set the sky set name, potentially loading the textures.
57  */
58  void SetSkySet(const CStrW& name);
59 
60  /**
61  * Return a sorted list of available sky sets, in a form suitable
62  * for passing to SetSkySet.
63  */
64  std::vector<CStrW> GetSkySets() const;
65 
66 private:
67  void LoadSkyTextures();
68 
69  /// Name of current skyset (a directory within art/textures/skies)
70  CStrW m_SkySet;
71 
72  // Indices into m_SkyTexture
73  enum
74  {
79  TOP,
81  };
82 
83  // Sky textures
85 
86  GLuint m_SkyCubeMap;
87 
88  // Array of image names (defined in SkyManager.cpp), in the order of the IMG_ id's
89  static const wchar_t* s_imageNames[numTextures];
90 };
91 
92 
93 #endif // INCLUDED_SKYMANAGER
void RenderSky()
RenderSky: Render the sky.
Definition: SkyManager.cpp:223
Definition: SkyManager.h:78
GLuint m_SkyCubeMap
Definition: SkyManager.h:86
Definition: SkyManager.h:77
std::vector< CStrW > GetSkySets() const
Return a sorted list of available sky sets, in a form suitable for passing to SetSkySet.
Definition: SkyManager.cpp:200
float m_HorizonHeight
Definition: SkyManager.h:34
CTexturePtr m_SkyTexture[numTextures]
Definition: SkyManager.h:84
CStrW m_SkySet
Name of current skyset (a directory within art/textures/skies)
Definition: SkyManager.h:70
void LoadSkyTextures()
Definition: SkyManager.cpp:79
GLuint GetSkyCube()
Definition: SkyManager.h:51
SkyManager()
Definition: SkyManager.cpp:65
std::shared_ptr< CTexture > CTexturePtr
Definition: Texture.h:22
bool m_RenderSky
Definition: SkyManager.h:33
static const wchar_t * s_imageNames[numTextures]
Definition: SkyManager.h:89
const CStrW & GetSkySet() const
GetSkySet(): Return the currently selected sky set name.
Definition: SkyManager.h:47
Definition: SkyManager.h:76
void SetSkySet(const CStrW &name)
GetSkySet(): Set the sky set name, potentially loading the textures.
Definition: SkyManager.cpp:182
Definition: SkyManager.h:79
Definition: SkyManager.h:75
Definition: SkyManager.h:80
Class SkyManager: Maintain sky settings and textures, and render the sky.
Definition: SkyManager.h:30