Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation3/src/modules/designtools/ScreenshotManager.h @ 7038

Last change on this file since 7038 was 7022, checked in by scheusso, 14 years ago

fixed some includes

File size: 2.3 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 <string>
7#include <OgrePrerequisites.h>
8#include <OgreTexture.h>
9#include <OgreHardwarePixelBuffer.h>
10#include "OrxonoxConfig.h"
11#include <cstring>
12#include <cstdlib>
13
14namespace orxonox
15{
16
17
18    /* Class encapsulates Screenshot functionality and provides a method for making multi grid screenshots.     
19    *  pRenderWindow:    Pointer to the render window.  This could be "mWindow" from the ExampleApplication,
20    *              the window automatically created obtained when calling
21    *              Ogre::Root::getSingletonPtr()->initialise(false) and retrieved by calling
22    *              "Ogre::Root::getSingletonPtr()->getAutoCreatedWindow()", or the manually created
23    *              window from calling "mRoot->createRenderWindow()".
24    *  gridSize:      The magnification factor.  A 2 will create a 2x2 grid, doubling the size of the
25                screenshot.  A 3 will create a 3x3 grid, tripling the size of the screenshot.
26    *  fileExtension:    The extension of the screenshot file name, hence the type of graphics file to generate.
27    *              To generate "MyScreenshot.png" this parameter would contain ".png".
28    */
29    class ScreenshotManager
30    {
31    public:
32        ScreenshotManager(Ogre::RenderWindow* pRenderWindow, int gridSize, std::string fileExtension, bool overlayFlag);
33        ~ScreenshotManager();
34
35      /* Creates a screenshot with the given camera.
36        * @param camera Pointer to the camera "looking at" the scene of interest
37        * @param fileName the filename of the screenshot file.
38      */
39        void makeScreenshot(Ogre::Camera* camera, Ogre::String fileName) const;
40     
41    protected:
42        std::string      mFileExtension;
43        unsigned int   mGridSize, mWindowWidth, mWindowHeight;
44        bool           mDisableOverlays;
45        //temp texture with current screensize
46        Ogre::TexturePtr mTempTex;
47        Ogre::RenderTexture* mRT;
48        Ogre::HardwarePixelBufferSharedPtr mBuffer;
49        //PixelBox for a large Screenshot, if grid size is > 1
50        Ogre::PixelBox  mFinalPicturePB;
51        uint8_t* data_;
52    };
53
54}
55
56#endif  // __ScreenshotManager_h__
Note: See TracBrowser for help on using the repository browser.