Orxonox  0.0.5 Codename: Arcturus
SkyboxGenerator.h
Go to the documentation of this file.
1 /*
2  * ORXONOX - the hottest 3D action shooter ever to exist
3  * > www.orxonox.net <
4  *
5  *
6  * License notice:
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * Author:
23  * Gion-Andri Cantieni
24  * Co-authors:
25  * Damian 'Mozork' Frick
26  *
27  */
28 
35 #ifndef __SkyboxGenerator_h__
36 #define __SkyboxGenerator_h__
37 
39 #include "util/Singleton.h"
41 
42 #include <OgreMath.h>
43 
44 namespace orxonox
45 {
46 
60  class SkyboxGenerator : public virtual Configurable, public Singleton<SkyboxGenerator>, public Tickable
61  {
62  friend class Singleton<SkyboxGenerator>;
63 
64  public:
66  virtual ~SkyboxGenerator();
67  virtual void tick(float dt) override; // This is where the skybox generation happens.
68  static void createSkybox(void); // Generate the 6 faces of a skybox.
69  void setConfigValues(void); // Sets some config values.
70 
75  inline void setSize(unsigned int size)
76  { this->size_ = size; }
77 
78  protected:
82  inline void startSkyboxGeneration(void)
83  { this->bGenerateSkybox_ = true; }
84 
85  private:
86  void setupCamera(Ogre::Camera* camera); // Set up the input camera to be ready to generate a skybox face.
87  void setupRenderWindow(Ogre::RenderWindow* renderWindow); // Setup the input render window to be ready to generate the skybox.
88  void restoreRenderWindow(Ogre::RenderWindow* renderWindow); // Restore the render window.
89 
90  void saveImage(Ogre::Image* image, const std::string& name) const;
91 
93 
94  unsigned int size_;
97 
98  // FLow control variables
101  bool bSetup_;
102  bool bWait_;
104  unsigned int faceCounter_;
105  bool bCleanup_;
106 
107  std::vector<std::string> names_;
108  std::vector< std::pair<int, int>> rotations_;
109 
110  // Storage variables
111  float aspectRatio_;
112  Ogre::Radian fovy_;
113  unsigned int windowWidth_;
114  unsigned int windowHeight_;
116  unsigned int gridSize_;
117 
118  };
119 }
120 
121 #endif // __SkyboxGenerator_h__
The SkyboxGenerator class is a singleton that allows for the creation of a skybox from a level by tak...
Definition: SkyboxGenerator.h:60
void startSkyboxGeneration(void)
Starts the generation of the skybox.
Definition: SkyboxGenerator.h:82
virtual ~SkyboxGenerator()
Destructor.
Definition: SkyboxGenerator.cc:103
Declaration of the Tickable interface.
std::vector< std::pair< int, int > > rotations_
The rotation in yaw an pitch direction that is applied to the camera after a specific face has been g...
Definition: SkyboxGenerator.h:108
bool bGenerateSkybox_
Whether a skybox is currently being generated.
Definition: SkyboxGenerator.h:99
bool bCaptionsRemoved_
Whether the overlays have been removed.
Definition: SkyboxGenerator.h:100
SkyboxGenerator()
Constructor.
Definition: SkyboxGenerator.cc:70
void setupCamera(Ogre::Camera *camera)
Set up the input camera to be ready to generate a skybox face.
Definition: SkyboxGenerator.cc:240
::std::string string
Definition: gtest-port.h:756
virtual void tick(float dt) override
This is where the skybox generation happens.
Definition: SkyboxGenerator.cc:136
bool bSetup_
Whether the render window is being setup.
Definition: SkyboxGenerator.h:101
float aspectRatio_
The backed up aspect ratio of the camera.
Definition: SkyboxGenerator.h:111
void setSize(unsigned int size)
Set the size of the skybox faces to be generated.
Definition: SkyboxGenerator.h:75
bool bWait_
Whether we have to wait for the setup to take effect.
Definition: SkyboxGenerator.h:102
This is the base class of all objects which may contain config values.
Definition: Configurable.h:47
bool bCreateFace_
Whether the faces are being created,.
Definition: SkyboxGenerator.h:103
unsigned int windowHeight_
The backed up window height.
Definition: SkyboxGenerator.h:114
bool bCleanup_
Whether the generator is being cleaned up.
Definition: SkyboxGenerator.h:105
Base for singleton classes.
Definition: Singleton.h:114
std::vector< std::string > names_
The names of the image files for the skybox faces to be generated.
Definition: SkyboxGenerator.h:107
void setupRenderWindow(Ogre::RenderWindow *renderWindow)
Setup the input render window to be ready to generate the skybox.
Definition: SkyboxGenerator.cc:252
unsigned int gridSize_
The backed up grid size of the ScreenshotManager.
Definition: SkyboxGenerator.h:116
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
static void createSkybox(void)
Generate the 6 faces of a skybox.
Definition: SkyboxGenerator.cc:123
unsigned int size_
The desired size of the skybox faces.
Definition: SkyboxGenerator.h:94
unsigned int windowWidth_
The backed up window width.
Definition: SkyboxGenerator.h:113
std::string skyboxPrefix_
Prefix for the generated image files.
Definition: SkyboxGenerator.h:95
Declaration of Configurable, the base class of all objects which may contain config values...
Ogre::Radian fovy_
The backed up field of view of the camera.
Definition: SkyboxGenerator.h:112
Definition of the Singleton template that is used as base class for classes that allow only one insta...
void saveImage(Ogre::Image *image, const std::string &name) const
Resizes and saves the input image under the input name.
Definition: SkyboxGenerator.cc:308
void restoreRenderWindow(Ogre::RenderWindow *renderWindow)
Restore the render window.
Definition: SkyboxGenerator.cc:292
The Tickable interface provides a tick(dt) function, that gets called every frame.
Definition: Tickable.h:52
std::string imageExtension_
Extension of the generated image files.
Definition: SkyboxGenerator.h:96
unsigned int faceCounter_
Counter to keep track of which skybox face is being created.
Definition: SkyboxGenerator.h:104
bool windowFullScreen_
Whether the window was in fullscreen mode.
Definition: SkyboxGenerator.h:115
static SkyboxGenerator * singletonPtr_s
Singleton pointer.
Definition: SkyboxGenerator.h:92
void setConfigValues(void)
Sets some config values.
Definition: SkyboxGenerator.cc:112