Changeset 8232 for code/trunk/src/modules/designtools/SkyboxGenerator.h
- Timestamp:
- Apr 11, 2011, 7:37:00 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/designtools/SkyboxGenerator.h
r7163 r8232 23 23 * Gion-Andri Cantieni 24 24 * Co-authors: 25 * ...25 * Damian 'Mozork' Frick 26 26 * 27 27 */ 28 28 29 /** 30 @file SkyboxGenerator.h 31 @brief Definition of the SkyboxGenerator class. 32 @ingroup Designtools 33 */ 34 35 #ifndef __SkyboxGenerator_h__ 36 #define __SkyboxGenerator_h__ 29 37 30 38 #include "core/OrxonoxClass.h" 31 39 #include "util/Singleton.h" 32 40 #include "tools/interfaces/Tickable.h" 41 33 42 #include <OgreMath.h> 34 35 43 36 44 namespace orxonox 37 45 { 46 47 /** 48 @brief 49 The SkyboxGenerator class is a singleton that allows for the creation of a skybox from a level by taking pictures to all 6 sides. 50 The 6 images created by the createSkybox() method are placed in the log folder in your build directory. 51 52 The image filename prefix and the file extension can both be adjusted as config values, so can the desired size of the skybox faces. 53 54 @author 55 Gion-Andri Cantieni 56 @author 57 Damian 'Mozork' Frick 58 @ingroup Designtools 59 */ 38 60 class SkyboxGenerator : public virtual OrxonoxClass, public Singleton<SkyboxGenerator>, public Tickable 39 61 { … … 43 65 SkyboxGenerator(); 44 66 virtual ~SkyboxGenerator(); 45 static void createSkybox( ); 46 void setConfigValues( ); 47 void tick(float dt); 67 void tick(float dt); // 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 71 /** 72 @brief Set the size of the skybox faces to be generated. 73 @param size The size in pixels. 74 */ 75 inline void setSize(unsigned int size) 76 { this->size_ = size; } 77 78 protected: 79 /** 80 @brief Starts the generation of the skybox. 81 */ 82 inline void startSkyboxGeneration(void) 83 { this->bGenerateSkybox_ = true; } 48 84 49 85 private: 50 static SkyboxGenerator* singletonPtr_s; 51 std::string skyboxPrefix_; 52 bool takeScreenshot_; 53 int iterateOverDirections_; 54 float aspectRatio_; 55 Ogre::Radian fovy_; 56 bool captionsRemoved_; 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 92 static SkyboxGenerator* singletonPtr_s; //!< Singleton pointer. 93 94 unsigned int size_; //!< The desired size of the skybox faces. 95 std::string skyboxPrefix_; //!< Prefix for the generated image files. 96 std::string imageExtension_; //!< Extension of the generated image files. 97 98 // FLow control variables 99 bool bGenerateSkybox_; //!< Whether a skybox is currently being generated. 100 bool bCaptionsRemoved_; //!< Whether the overlays have been removed. 101 bool bSetup_; //!< Whether the render window is being setup. 102 bool bWait_; //!< Whether we have to wait for the setup to take effect. 103 bool bCreateFace_; //!< Whether the faces are being created, 104 unsigned int faceCounter_; //!< Counter to keep track of which skybox face is being created. 105 bool bCleanup_; //!< Whether the generator is being cleaned up. 106 107 std::vector<std::string> names_; //!< The names of the image files for the skybox faces to be generated. 108 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 generated. 109 110 // Storage variables 111 float aspectRatio_; //!< The backed up aspect ratio of the camera. 112 Ogre::Radian fovy_; //!< The backed up field of view of the camera. 113 unsigned int windowWidth_; //!< The backed up window width. 114 unsigned int windowHeight_; //!< The backed up window height. 115 bool windowFullScreen_; //!< Whether the window was in fullscreen mode. 116 unsigned int gridSize_; //!< The backed up grid size of the ScreenshotManager. 117 57 118 }; 58 119 } 120 121 #endif // __SkyboxGenerator_h__
Note: See TracChangeset
for help on using the changeset viewer.