Changeset 7076 for code/branches/presentation3/src/modules
- Timestamp:
- Jun 2, 2010, 12:39:46 AM (15 years ago)
- Location:
- code/branches/presentation3/src/modules/designtools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/modules/designtools/ScreenshotManager.cc
r7041 r7076 39 39 mWindowHeight = pRenderWindow->getHeight(); 40 40 //create temporary texture 41 mTempTex = Ogre::TextureManager::getSingleton().createManual("ScreenShotTex", 41 mTempTex = Ogre::TextureManager::getSingleton().createManual("ScreenShotTex", 42 42 Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, 43 mWindowWidth, mWindowHeight,0, Ogre::PF_B8G8R8, Ogre::TU_RENDERTARGET); 44 43 mWindowWidth, mWindowHeight,0, Ogre::PF_B8G8R8, Ogre::TU_RENDERTARGET); 44 45 45 //get The current Render Target of the temp Texture 46 46 mRT = mTempTex->getBuffer()->getRenderTarget(); 47 47 48 //HardwarePixelBufferSharedPtr to the Buffer of the temp Texture 48 //HardwarePixelBufferSharedPtr to the Buffer of the temp Texture 49 49 mBuffer = mTempTex->getBuffer(); 50 50 … … 72 72 std::string fileName = PathConfig::getInstance().getLogPathString() + "screenshot_" + this->getTimestamp(); 73 73 74 //Remove all viewports, so the added Viewport(camera) ist the only 74 //Remove all viewports, so the added Viewport(camera) ist the only 75 75 mRT->removeAllViewports(); 76 76 mRT->addViewport(camera); 77 77 78 78 //set the viewport settings 79 79 Ogre::Viewport *vp = mRT->getViewport(0); 80 vp->setClearEveryFrame(true); 80 vp->setClearEveryFrame(true); 81 81 vp->setOverlaysEnabled(false); 82 82 … … 103 103 // set the original Frustum extents 104 104 camera->getFrustumExtents(originalFrustumLeft, originalFrustumRight, originalFrustumTop, originalFrustumBottom); 105 105 106 106 // compute the Stepsize for the drid 107 107 Ogre::Real frustumGridStepHorizontal = (originalFrustumRight * 2) / mGridSize; … … 110 110 // process each grid 111 111 Ogre::Real frustumLeft, frustumRight, frustumTop, frustumBottom; 112 for (unsigned int nbScreenshots = 0; nbScreenshots < mGridSize * mGridSize; nbScreenshots++) 113 { 114 int y = nbScreenshots / mGridSize; 115 int x = nbScreenshots - y * mGridSize; 116 112 for (unsigned int nbScreenshots = 0; nbScreenshots < mGridSize * mGridSize; nbScreenshots++) 113 { 114 int y = nbScreenshots / mGridSize; 115 int x = nbScreenshots - y * mGridSize; 116 117 117 // Shoggoth frustum extents setting 118 118 // compute the new frustum extents … … 121 121 frustumTop = originalFrustumTop - frustumGridStepVertical * y; 122 122 frustumBottom = frustumTop - frustumGridStepVertical; 123 123 124 124 // set the frustum extents value to the camera 125 125 camera->setFrustumExtents(frustumLeft, frustumRight, frustumTop, frustumBottom); … … 128 128 Ogre::Root::getSingletonPtr()->clearEventTimes(); 129 129 mRT->update(); //render 130 131 //define the current 130 131 //define the current 132 132 Ogre::Box subBox = Ogre::Box(x* mWindowWidth,y * mWindowHeight,x * mWindowWidth + mWindowWidth, y * mWindowHeight + mWindowHeight); 133 //copy the content from the temp buffer into the final picture PixelBox 133 //copy the content from the temp buffer into the final picture PixelBox 134 134 //Place the tempBuffer content at the right position 135 135 mBuffer->blitToMemory(mFinalPicturePB.getSubVolume(subBox)); 136 136 137 137 } 138 138 139 139 // set frustum extents to previous settings 140 140 camera->resetFrustumExtents(); 141 141 142 142 Ogre::Image finalImage; //declare the final Image Object 143 143 //insert the PixelBox data into the Image Object … … 145 145 // Save the Final image to a file 146 146 finalImage.save(fileName + "." + mFileExtension); 147 147 148 148 } 149 149 … … 163 163 pTime = localtime( &ctTime ); 164 164 std::ostringstream oss; 165 oss 165 oss << std::setw(2) << std::setfill('0') << (pTime->tm_mon + 1) 166 166 << std::setw(2) << std::setfill('0') << pTime->tm_mday 167 167 << std::setw(2) << std::setfill('0') << (pTime->tm_year + 1900) -
code/branches/presentation3/src/modules/designtools/ScreenshotManager.h
r7044 r7076 21 21 22 22 23 /* Class encapsulates Screenshot functionality and provides a method for making multi grid screenshots. 23 /* Class encapsulates Screenshot functionality and provides a method for making multi grid screenshots. 24 24 * pRenderWindow: Pointer to the render window. This could be "mWindow" from the ExampleApplication, 25 25 * the window automatically created obtained when calling … … 48 48 static void makeScreenshot_s() 49 49 { getInstance().makeScreenshot(); } 50 50 51 51 protected: 52 52 static std::string getTimestamp();
Note: See TracChangeset
for help on using the changeset viewer.