[Orxonox-commit 3390] r8077 - code/branches/usability/src/modules/designtools
dafrick at orxonox.net
dafrick at orxonox.net
Tue Mar 15 21:00:06 CET 2011
Author: dafrick
Date: 2011-03-15 21:00:05 +0100 (Tue, 15 Mar 2011)
New Revision: 8077
Modified:
code/branches/usability/src/modules/designtools/ScreenshotManager.cc
code/branches/usability/src/modules/designtools/ScreenshotManager.h
code/branches/usability/src/modules/designtools/SkyboxGenerator.cc
Log:
Improving documentation of ScreenshotManager.
Modified: code/branches/usability/src/modules/designtools/ScreenshotManager.cc
===================================================================
--- code/branches/usability/src/modules/designtools/ScreenshotManager.cc 2011-03-14 16:36:36 UTC (rev 8076)
+++ code/branches/usability/src/modules/designtools/ScreenshotManager.cc 2011-03-15 20:00:05 UTC (rev 8077)
@@ -58,10 +58,13 @@
/**
- * @brief Creates a screenshot with the given camera.
- * @param camera Pointer to the camera "looking at" the scene of interest
- * @param fileName the filename of the screenshot file.
- */
+ @brief
+ Creates a screenshot with the given camera.
+ @param camera
+ Pointer to the camera "looking at" the scene of interest
+ @param fileName
+ the filename of the screenshot file.
+ */
void ScreenshotManager::makeScreenshot() const
{
Ogre::Camera* camera = CameraManager::getInstance().getActiveCamera()->getOgreCamera();
@@ -152,6 +155,29 @@
Ogre::Root::getSingletonPtr()->clearEventTimes();
}
+ /**
+ @brief
+ Set the size of the grid.
+ @param size
+ The size of the grid.
+ */
+ void ScreenshotManager::setGridSize(unsigned int size)
+ {
+ if(size == this->mGridSize_)
+ return;
+
+ this->mGridSize_ = size;
+ // New PixelBox for the changed size.
+ uint8_t* data_ = new uint8_t[(this->mWindowWidth_ * this->mGridSize_) * (this->mWindowHeight_ * this->mGridSize_) * 3];
+ this->mFinalPicturePB_ = Ogre::PixelBox(this->mWindowWidth_ * this->mGridSize_, this->mWindowHeight_ * this->mGridSize_, 1, Ogre::PF_B8G8R8, data_);
+ }
+
+ /**
+ @brief
+ Get a timestamp for the curent time instant.
+ @return
+ Returns a string with the timestamp.
+ */
std::string ScreenshotManager::getTimestamp()
{
struct tm *pTime;
Modified: code/branches/usability/src/modules/designtools/ScreenshotManager.h
===================================================================
--- code/branches/usability/src/modules/designtools/ScreenshotManager.h 2011-03-14 16:36:36 UTC (rev 8076)
+++ code/branches/usability/src/modules/designtools/ScreenshotManager.h 2011-03-15 20:00:05 UTC (rev 8077)
@@ -19,60 +19,45 @@
namespace orxonox
{
-
- /* Class encapsulates Screenshot functionality and provides a method for making multi grid screenshots.
- * pRenderWindow: Pointer to the render window. This could be "mWindow" from the ExampleApplication,
- * the window automatically created obtained when calling
- * Ogre::Root::getSingletonPtr()->initialise(false) and retrieved by calling
- * "Ogre::Root::getSingletonPtr()->getAutoCreatedWindow()", or the manually created
- * window from calling "mRoot->createRenderWindow()".
- * 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.
- * fileExtension: The extension of the screenshot file name, hence the type of graphics file to generate.
- * To generate "MyScreenshot.png" this parameter would contain ".png".
+ /**
+ @brief
+ Class encapsulates Screenshot functionality and provides a method for making multi grid screenshots.
*/
class ScreenshotManager : public OrxonoxClass, public Singleton<ScreenshotManager>
{
friend class Singleton<ScreenshotManager>;
- public:
- ScreenshotManager();
- ~ScreenshotManager();
+ public:
+ ScreenshotManager();
+ virtual ~ScreenshotManager();
- /**
- * @briefCreates a screenshot with the given camera.
- * @param camera Pointer to the camera "looking at" the scene of interest
- * @param fileName the filename of the screenshot file.
- */
- void makeScreenshot() const;
+ void makeScreenshot() const; //!< Creates a screenshot with the given camera.
- //static void makeScreenshot_s()
- // { getInstance().makeScreenshot(); }
- static void makeScreenshot_s(unsigned int size)
- { getInstance().setGridSize(size); getInstance().makeScreenshot(); }
+ /**
+ @brief Creates a screenshot with a given size.
+ @param size Size is factor by which the current screen size is scaled.
+ */
+ static void makeScreenshot_s(unsigned int size)
+ { getInstance().setGridSize(size); getInstance().makeScreenshot(); }
- void setGridSize(unsigned int size)
- {
- this->mGridSize_ = size;
- uint8_t* data_ = new uint8_t[(this->mWindowWidth_ * this->mGridSize_) * (this->mWindowHeight_ * this->mGridSize_) * 3];
- this->mFinalPicturePB_ = Ogre::PixelBox(this->mWindowWidth_ * this->mGridSize_, this->mWindowHeight_ * this->mGridSize_, 1, Ogre::PF_B8G8R8, data_);
- }
+ void setGridSize(unsigned int size); //!< Set the size of the grid.
- protected:
- static std::string getTimestamp();
+ protected:
+ static std::string getTimestamp();
- std::string mFileExtension_;
- unsigned int mGridSize_, mWindowWidth_, mWindowHeight_;
- bool mDisableOverlays_;
- //temp texture with current screensize
- Ogre::TexturePtr mTempTex_;
- Ogre::RenderTexture* mRT_;
- Ogre::HardwarePixelBufferSharedPtr mBuffer_;
- //PixelBox for a large Screenshot, if grid size is > 1
- Ogre::PixelBox mFinalPicturePB_;
- uint8_t* data_;
+ std::string mFileExtension_;
+ 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.
+ unsigned int mWindowWidth_, mWindowHeight_;
+ bool mDisableOverlays_;
+ //! temp texture with current screensize
+ Ogre::TexturePtr mTempTex_;
+ Ogre::RenderTexture* mRT_;
+ Ogre::HardwarePixelBufferSharedPtr mBuffer_;
+ //! PixelBox for a large Screenshot, if grid size is > 1
+ Ogre::PixelBox mFinalPicturePB_;
+ uint8_t* data_;
- static ScreenshotManager* singletonPtr_s;
+ static ScreenshotManager* singletonPtr_s;
};
}
Modified: code/branches/usability/src/modules/designtools/SkyboxGenerator.cc
===================================================================
--- code/branches/usability/src/modules/designtools/SkyboxGenerator.cc 2011-03-14 16:36:36 UTC (rev 8076)
+++ code/branches/usability/src/modules/designtools/SkyboxGenerator.cc 2011-03-15 20:00:05 UTC (rev 8077)
@@ -58,7 +58,7 @@
RegisterRootObject(SkyboxGenerator);
this->setConfigValues();
- takeScreenshot_ = false;
+ this->takeScreenshot_ = false;
this->captionsRemoved_ = false;
}
More information about the Orxonox-commit
mailing list