|
|
@ -636,21 +636,24 @@ namespace MWRender
|
|
|
|
double fovBackup = mFieldOfView;
|
|
|
|
double fovBackup = mFieldOfView;
|
|
|
|
mFieldOfView = 90.0; // each side sees 90 degrees
|
|
|
|
mFieldOfView = 90.0; // each side sees 90 degrees
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mCamera->isFirstPerson())
|
|
|
|
|
|
|
|
mPlayerAnimation->getObjectRoot()->setNodeMask(0);
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 6; i++) // for each cube side
|
|
|
|
for (int i = 0; i < 6; i++) // for each cube side
|
|
|
|
{
|
|
|
|
{
|
|
|
|
osg::ref_ptr<osg::Image> sideImage (new osg::Image);
|
|
|
|
osg::ref_ptr<osg::Image> sideImage (new osg::Image);
|
|
|
|
screenshot(sideImage.get(),w,w,directions[i]);
|
|
|
|
screenshot(sideImage.get(),w,w,directions[i]);
|
|
|
|
|
|
|
|
|
|
|
|
if (i == 0)
|
|
|
|
if (i == 0)
|
|
|
|
{
|
|
|
|
|
|
|
|
image->allocateImage(w * 6,w,sideImage->r(),sideImage->getPixelFormat(),sideImage->getDataType());
|
|
|
|
image->allocateImage(w * 6,w,sideImage->r(),sideImage->getPixelFormat(),sideImage->getDataType());
|
|
|
|
std::cout << image->s() << " " << image->t() << std::endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
osg::copyImage(sideImage.get(),0,0,0,sideImage->s(),sideImage->t(),sideImage->r(),
|
|
|
|
osg::copyImage(sideImage.get(),0,0,0,sideImage->s(),sideImage->t(),sideImage->r(),
|
|
|
|
image,w * i,0,0);
|
|
|
|
image,w * i,0,0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mCamera->isFirstPerson())
|
|
|
|
|
|
|
|
mPlayerAnimation->getObjectRoot()->setNodeMask(1);
|
|
|
|
|
|
|
|
|
|
|
|
mFieldOfView = fovBackup;
|
|
|
|
mFieldOfView = fovBackup;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -667,6 +670,8 @@ namespace MWRender
|
|
|
|
mViewer->getCamera()->getViewMatrix() * osg::Matrixd::rotate(osg::Vec3(0,0,-1),direction)
|
|
|
|
mViewer->getCamera()->getViewMatrix() * osg::Matrixd::rotate(osg::Vec3(0,0,-1),direction)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: water reflections have to be transformed as well!!!!!
|
|
|
|
|
|
|
|
|
|
|
|
rttCamera->setViewport(0, 0, w, h);
|
|
|
|
rttCamera->setViewport(0, 0, w, h);
|
|
|
|
|
|
|
|
|
|
|
|
osg::ref_ptr<osg::Texture2D> texture (new osg::Texture2D);
|
|
|
|
osg::ref_ptr<osg::Texture2D> texture (new osg::Texture2D);
|
|
|
|