mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-17 19:20:49 +00:00
add cubemap mapping
This commit is contained in:
parent
5a07d135ae
commit
5baff05bac
@ -629,7 +629,8 @@ namespace MWRender
|
||||
{
|
||||
MAPPING_SPHERICAL = 0,
|
||||
MAPPING_CYLINDRICAL,
|
||||
MAPPING_SMALL_PLANET
|
||||
MAPPING_SMALL_PLANET,
|
||||
MAPPING_CUBEMAP
|
||||
} SphericalScreenshotMapping;
|
||||
|
||||
SphericalScreenshot(int size)
|
||||
@ -647,6 +648,16 @@ namespace MWRender
|
||||
|
||||
void create(osg::Image *dest, int w, int h, SphericalScreenshotMapping mapping)
|
||||
{
|
||||
if (mapping == MAPPING_CUBEMAP)
|
||||
{
|
||||
dest->allocateImage(mSize * 6,mSize,mImages[0]->r(),mImages[0]->getPixelFormat(),mImages[0]->getDataType());
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
osg::copyImage(mImages[i].get(),0,0,0,mImages[i]->s(),mImages[i]->t(),mImages[i]->r(),dest,i * mSize,0,0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
dest->allocateImage(w,h,mImages[0]->r(),mImages[0]->getPixelFormat(),mImages[0]->getDataType());
|
||||
|
||||
for (int j = 0; j < h; ++j)
|
||||
@ -768,6 +779,9 @@ namespace MWRender
|
||||
Settings::Manager::tryGetInt("s360 mapping","Video",SphericalScreenshot::MAPPING_SPHERICAL));
|
||||
int cubeWidth = Settings::Manager::tryGetInt("s360 cubemap size","Video",screenshotWidth / 2);
|
||||
|
||||
if (mapping == SphericalScreenshot::MAPPING_CUBEMAP)
|
||||
cubeWidth = screenshotWidth / 6; // the image will consist of 6 cube sides in a row
|
||||
|
||||
SphericalScreenshot s(cubeWidth);
|
||||
|
||||
osg::Vec3 directions[6] = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user