Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/mac_osx2/src/modules/designtools/ScreenshotManager.h @ 11476

Last change on this file since 11476 was 8232, checked in by dafrick, 14 years ago

Extending and reorganizing ScreenshotManager and SkyboxGenerator.
The SkyboxGenerator now takes HD screenshots, thus the size of the faces generated by the SkyboxGenerator can now be specified freely (through a config value).

  • Property svn:eol-style set to native
File size: 4.0 KB
Line 
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 *      This code comes from http://www.ogre3d.org/tikiwiki/High+resolution+screenshots which is Public Domain.
24 *   Co-authors:
25 *      Oli Scheuss
26 *      Damian 'Mozork' Frick
27 *
28 */
29
30/**
31   @file ScreenshotManager.h
32   @brief Definition of the ScreenshotManager class.
33   @ingroup Designtools
34*/
35
36#ifndef __ScreenshotManager_h__
37#define __ScreenshotManager_h__
38
39#include "DesignToolsPrereqs.h"
40
41#include <OgrePrerequisites.h>
42#include <OgreTexture.h>
43#include <OgreHardwarePixelBuffer.h>
44
45#include "util/Singleton.h"
46#include "core/OrxonoxClass.h"
47
48namespace orxonox
49{
50
51    /**
52    @brief
53        Class encapsulates screenshot functionality and provides a method for making multi grid (i.e. HD) screenshots.
54       
55       
56    @author
57        This code comes from http://www.ogre3d.org/tikiwiki/High+resolution+screenshots which is Public Domain.
58    @author
59        Oli Scheuss
60    @author
61        Damian 'Mozork' Frick
62    @ingroup Designtools
63    */
64    class ScreenshotManager : public OrxonoxClass, public Singleton<ScreenshotManager>
65    {
66        friend class Singleton<ScreenshotManager>;
67
68        public:
69            ScreenshotManager();
70            virtual ~ScreenshotManager();
71            void setConfigValues(void); // Sets some config values.
72
73            void makeScreenshot(); // Make a screenshot.
74            Ogre::Image* getScreenshot(); // Creates a screenshot and returns it.
75            Ogre::Image* getScreenshot(Ogre::Camera* camera); // Creates a screenshot with the given camera and returns it.
76
77            /**
78            @brief Creates a screenshot.
79            */
80            static void makeScreenshot_s()
81                { ScreenshotManager::getInstance().makeScreenshot(); }
82
83            void setGridSize(unsigned int size); // Set the size of the grid.
84            /**
85            @brief Get the current grid size.
86            @return Returns the size of the grid.
87            */
88            inline unsigned int getGridSize(void)
89                { return this->gridSize_; }
90           
91        protected:
92            void update(void); // Update internal parameters.
93           
94            static ScreenshotManager* singletonPtr_s;
95
96            std::string fileExtension_; //!< The image extension used to save the screenshot.
97            unsigned int gridSize_; //!< The magnification factor.  A 2 will create a 2x2 grid, doubling the size of the screenshot.  A 3 will create a 3x3 grid, tripling the size of the screenshot.
98            unsigned int windowWidth_, windowHeight_; //!< The width and height of the window.
99            bool disableOverlays_; //!< Whether overlays should be disabled.
100
101            Ogre::TexturePtr tempTexture_; //!< Temporary texture with current screen size.
102            Ogre::RenderTexture* renderTarget_; //!< Render target for the temporary texture.
103            Ogre::HardwarePixelBufferSharedPtr buffer_; //!< Buffer for the temporary texture.
104           
105            Ogre::PixelBox finalPicturePB_; //!< PixelBox for large screenshots, contains the screenshot for gridSize_ > 1.
106            uint8_t* data_; //!< Data pointer for the PixelBox.
107
108    };
109
110}
111
112#endif  // __ScreenshotManager_h__
Note: See TracBrowser for help on using the repository browser.