Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8077


Ignore:
Timestamp:
Mar 15, 2011, 9:00:05 PM (14 years ago)
Author:
dafrick
Message:

Improving documentation of ScreenshotManager.

Location:
code/branches/usability/src/modules/designtools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/usability/src/modules/designtools/ScreenshotManager.cc

    r8076 r8077  
    5959
    6060    /**
    61      * @brief Creates a screenshot with the given camera.
    62      * @param camera Pointer to the camera "looking at" the scene of interest
    63      * @param fileName the filename of the screenshot file.
    64      */
     61    @brief
     62        Creates a screenshot with the given camera.
     63    @param camera
     64        Pointer to the camera "looking at" the scene of interest
     65    @param fileName
     66        the filename of the screenshot file.
     67    */
    6568    void ScreenshotManager::makeScreenshot() const
    6669    {
     
    153156    }
    154157
     158    /**
     159    @brief
     160        Set the size of the grid.
     161    @param size
     162        The size of the grid.
     163    */
     164    void ScreenshotManager::setGridSize(unsigned int size)
     165    {
     166        if(size == this->mGridSize_)
     167            return;
     168
     169        this->mGridSize_ = size;
     170        // New PixelBox for the changed size.
     171        uint8_t* data_ = new uint8_t[(this->mWindowWidth_ * this->mGridSize_) * (this->mWindowHeight_ * this->mGridSize_) * 3];
     172        this->mFinalPicturePB_ = Ogre::PixelBox(this->mWindowWidth_ * this->mGridSize_, this->mWindowHeight_ * this->mGridSize_, 1, Ogre::PF_B8G8R8, data_);
     173    }
     174
     175    /**
     176    @brief
     177        Get a timestamp for the curent time instant.
     178    @return
     179        Returns a string with the timestamp.
     180    */
    155181    std::string ScreenshotManager::getTimestamp()
    156182    {
  • code/branches/usability/src/modules/designtools/ScreenshotManager.h

    r8076 r8077  
    2020{
    2121
    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".
     22    /**
     23    @brief
     24        Class encapsulates Screenshot functionality and provides a method for making multi grid screenshots.
    3325    */
    3426    class ScreenshotManager : public OrxonoxClass, public Singleton<ScreenshotManager>
     
    3628        friend class Singleton<ScreenshotManager>;
    3729
    38     public:
    39         ScreenshotManager();
    40         ~ScreenshotManager();
     30        public:
     31            ScreenshotManager();
     32            virtual ~ScreenshotManager();
    4133
    42         /**
    43          * @briefCreates a screenshot with the given camera.
    44          * @param camera Pointer to the camera "looking at" the scene of interest
    45          * @param fileName the filename of the screenshot file.
    46          */
    47         void makeScreenshot() const;
     34            void makeScreenshot() const; //!< Creates a screenshot with the given camera.
    4835
    49         //static void makeScreenshot_s()
    50         //    { getInstance().makeScreenshot(); }
    51         static void makeScreenshot_s(unsigned int size)
    52             { getInstance().setGridSize(size); getInstance().makeScreenshot(); }
     36            /**
     37            @brief Creates a screenshot with a given size.
     38            @param size Size is factor by which the current screen size is scaled.
     39            */
     40            static void makeScreenshot_s(unsigned int size)
     41                { getInstance().setGridSize(size); getInstance().makeScreenshot(); }
    5342
    54         void setGridSize(unsigned int size)
    55         {
    56             this->mGridSize_ = size;
    57             uint8_t* data_ = new uint8_t[(this->mWindowWidth_ * this->mGridSize_) * (this->mWindowHeight_ * this->mGridSize_) * 3];
    58             this->mFinalPicturePB_ = Ogre::PixelBox(this->mWindowWidth_ * this->mGridSize_, this->mWindowHeight_ * this->mGridSize_, 1, Ogre::PF_B8G8R8, data_);
    59         }
     43            void setGridSize(unsigned int size); //!< Set the size of the grid.
    6044
    61     protected:
    62         static std::string getTimestamp();
     45        protected:
     46            static std::string getTimestamp();
    6347
    64         std::string    mFileExtension_;
    65         unsigned int   mGridSize_, mWindowWidth_, mWindowHeight_;
    66         bool           mDisableOverlays_;
    67         //temp texture with current screensize
    68         Ogre::TexturePtr mTempTex_;
    69         Ogre::RenderTexture* mRT_;
    70         Ogre::HardwarePixelBufferSharedPtr mBuffer_;
    71         //PixelBox for a large Screenshot, if grid size is > 1
    72         Ogre::PixelBox  mFinalPicturePB_;
    73         uint8_t* data_;
     48            std::string mFileExtension_;
     49            unsigned int mGridSize_; //!< 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.
     50            unsigned int mWindowWidth_, mWindowHeight_;
     51            bool mDisableOverlays_;
     52            //! temp texture with current screensize
     53            Ogre::TexturePtr mTempTex_;
     54            Ogre::RenderTexture* mRT_;
     55            Ogre::HardwarePixelBufferSharedPtr mBuffer_;
     56            //! PixelBox for a large Screenshot, if grid size is > 1
     57            Ogre::PixelBox  mFinalPicturePB_;
     58            uint8_t* data_;
    7459
    75         static ScreenshotManager* singletonPtr_s;
     60            static ScreenshotManager* singletonPtr_s;
    7661    };
    7762
  • code/branches/usability/src/modules/designtools/SkyboxGenerator.cc

    r7284 r8077  
    5959
    6060        this->setConfigValues();
    61         takeScreenshot_ = false;
     61        this->takeScreenshot_ = false;
    6262        this->captionsRemoved_ = false;
    6363    }
Note: See TracChangeset for help on using the changeset viewer.