Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ipv6/src/modules/designtools/ScreenshotManager.h @ 7389

Last change on this file since 7389 was 7163, checked in by dafrick, 14 years ago

Merged presentation3 branch into trunk.

  • Property svn:eol-style set to native
File size: 2.5 KB
Line 
1/* COPYRIGHT: this code comes from http://www.ogre3d.org/wiki/index.php/High_resolution_screenshots */
2
3#ifndef __ScreenshotManager_h__
4#define __ScreenshotManager_h__
5
6#include "DesignToolsPrereqs.h"
7
8#include <string>
9#include <cstring>
10#include <cstdlib>
11
12#include <OgrePrerequisites.h>
13#include <OgreTexture.h>
14#include <OgreHardwarePixelBuffer.h>
15
16#include "util/Singleton.h"
17#include "core/OrxonoxClass.h"
18
19namespace orxonox
20{
21
22
23    /* Class encapsulates Screenshot functionality and provides a method for making multi grid screenshots.
24    *  pRenderWindow:    Pointer to the render window.  This could be "mWindow" from the ExampleApplication,
25    *              the window automatically created obtained when calling
26    *              Ogre::Root::getSingletonPtr()->initialise(false) and retrieved by calling
27    *              "Ogre::Root::getSingletonPtr()->getAutoCreatedWindow()", or the manually created
28    *              window from calling "mRoot->createRenderWindow()".
29    *  gridSize:      The magnification factor.  A 2 will create a 2x2 grid, doubling the size of the
30                screenshot.  A 3 will create a 3x3 grid, tripling the size of the screenshot.
31    *  fileExtension:    The extension of the screenshot file name, hence the type of graphics file to generate.
32    *              To generate "MyScreenshot.png" this parameter would contain ".png".
33    */
34    class ScreenshotManager : public OrxonoxClass, public Singleton<ScreenshotManager>
35    {
36        friend class Singleton<ScreenshotManager>;
37
38    public:
39        ScreenshotManager();
40        ~ScreenshotManager();
41
42      /* Creates a screenshot with the given camera.
43        * @param camera Pointer to the camera "looking at" the scene of interest
44        * @param fileName the filename of the screenshot file.
45      */
46        void makeScreenshot() const;
47
48        static void makeScreenshot_s()
49            { getInstance().makeScreenshot(); }
50
51    protected:
52        static std::string getTimestamp();
53
54        std::string    mFileExtension;
55        unsigned int   mGridSize, mWindowWidth, mWindowHeight;
56        bool           mDisableOverlays;
57        //temp texture with current screensize
58        Ogre::TexturePtr mTempTex;
59        Ogre::RenderTexture* mRT;
60        Ogre::HardwarePixelBufferSharedPtr mBuffer;
61        //PixelBox for a large Screenshot, if grid size is > 1
62        Ogre::PixelBox  mFinalPicturePB;
63        uint8_t* data_;
64
65        static ScreenshotManager* singletonPtr_s;
66    };
67
68}
69
70#endif  // __ScreenshotManager_h__
Note: See TracBrowser for help on using the repository browser.