|
|
@ -807,7 +807,7 @@ namespace MWRender
|
|
|
|
for (int i = 0; i < 6; i++) // for each cube side
|
|
|
|
for (int i = 0; i < 6; i++) // for each cube side
|
|
|
|
{
|
|
|
|
{
|
|
|
|
osg::Image *sideImage = s.getImage(i);
|
|
|
|
osg::Image *sideImage = s.getImage(i);
|
|
|
|
screenshot(sideImage,cubeWidth,cubeWidth,directions[i],true);
|
|
|
|
screenshot(sideImage,cubeWidth,cubeWidth,directions[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
s.create(image,screenshotWidth,mapping != SphericalScreenshot::MAPPING_SMALL_PLANET ? screenshotHeight : screenshotWidth,mapping);
|
|
|
|
s.create(image,screenshotWidth,mapping != SphericalScreenshot::MAPPING_SMALL_PLANET ? screenshotHeight : screenshotWidth,mapping);
|
|
|
@ -818,7 +818,7 @@ namespace MWRender
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void RenderingManager::screenshot(osg::Image *image, int w, int h, osg::Vec3 direction, bool disableWaterEffects)
|
|
|
|
void RenderingManager::screenshot(osg::Image *image, int w, int h, osg::Vec3 direction)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
osg::ref_ptr<osg::Camera> rttCamera (new osg::Camera);
|
|
|
|
osg::ref_ptr<osg::Camera> rttCamera (new osg::Camera);
|
|
|
|
rttCamera->setNodeMask(Mask_RenderToTexture);
|
|
|
|
rttCamera->setNodeMask(Mask_RenderToTexture);
|
|
|
@ -844,6 +844,10 @@ namespace MWRender
|
|
|
|
|
|
|
|
|
|
|
|
rttCamera->setUpdateCallback(new NoTraverseCallback);
|
|
|
|
rttCamera->setUpdateCallback(new NoTraverseCallback);
|
|
|
|
rttCamera->addChild(mSceneRoot);
|
|
|
|
rttCamera->addChild(mSceneRoot);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rttCamera->addChild(mWater->getReflectionCamera());
|
|
|
|
|
|
|
|
rttCamera->addChild(mWater->getRefractionCamera());
|
|
|
|
|
|
|
|
|
|
|
|
rttCamera->setCullMask(mViewer->getCamera()->getCullMask() & (~Mask_GUI));
|
|
|
|
rttCamera->setCullMask(mViewer->getCamera()->getCullMask() & (~Mask_GUI));
|
|
|
|
|
|
|
|
|
|
|
|
mRootNode->addChild(rttCamera);
|
|
|
|
mRootNode->addChild(rttCamera);
|
|
|
@ -856,16 +860,10 @@ namespace MWRender
|
|
|
|
// so out of order calls are necessary to get a correct frameNumber for the next frame.
|
|
|
|
// so out of order calls are necessary to get a correct frameNumber for the next frame.
|
|
|
|
// refer to the advance() and frame() order in Engine::go()
|
|
|
|
// refer to the advance() and frame() order in Engine::go()
|
|
|
|
|
|
|
|
|
|
|
|
if (disableWaterEffects)
|
|
|
|
|
|
|
|
mWater->setEffectsEnabled(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mViewer->eventTraversal();
|
|
|
|
mViewer->eventTraversal();
|
|
|
|
mViewer->updateTraversal();
|
|
|
|
mViewer->updateTraversal();
|
|
|
|
mViewer->renderingTraversals();
|
|
|
|
mViewer->renderingTraversals();
|
|
|
|
|
|
|
|
|
|
|
|
if (disableWaterEffects)
|
|
|
|
|
|
|
|
mWater->setEffectsEnabled(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
callback->waitTillDone();
|
|
|
|
callback->waitTillDone();
|
|
|
|
|
|
|
|
|
|
|
|
// now that we've "used up" the current frame, get a fresh framenumber for the next frame() following after the screenshot is completed
|
|
|
|
// now that we've "used up" the current frame, get a fresh framenumber for the next frame() following after the screenshot is completed
|
|
|
|