mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 15:15:37 +00:00
remove unnecessary conditions
This commit is contained in:
parent
6277f5511c
commit
8f45b0d53a
1 changed files with 9 additions and 22 deletions
|
@ -434,19 +434,14 @@ namespace ESMTerrain
|
||||||
const int imageScaleFactor = 2;
|
const int imageScaleFactor = 2;
|
||||||
const int blendmapImageSize = blendmapSize * imageScaleFactor;
|
const int blendmapImageSize = blendmapSize * imageScaleFactor;
|
||||||
|
|
||||||
|
|
||||||
const bool largeImage = true;
|
|
||||||
|
|
||||||
for (int i=0; i<numBlendmaps; ++i)
|
for (int i=0; i<numBlendmaps; ++i)
|
||||||
{
|
{
|
||||||
GLenum format = pack ? GL_RGBA : GL_ALPHA;
|
GLenum format = pack ? GL_RGBA : GL_ALPHA;
|
||||||
|
|
||||||
osg::ref_ptr<osg::Image> image (new osg::Image);
|
osg::ref_ptr<osg::Image> image (new osg::Image);
|
||||||
if(!largeImage)
|
image->allocateImage(blendmapImageSize, blendmapImageSize, 1, format, GL_UNSIGNED_BYTE);
|
||||||
image->allocateImage(blendmapSize, blendmapSize, 1, format, GL_UNSIGNED_BYTE);
|
|
||||||
else
|
|
||||||
image->allocateImage(blendmapImageSize, blendmapImageSize, 1, format, GL_UNSIGNED_BYTE);
|
|
||||||
unsigned char* pData = image->data();
|
unsigned char* pData = image->data();
|
||||||
|
|
||||||
for (int y=0; y<blendmapSize; ++y)
|
for (int y=0; y<blendmapSize; ++y)
|
||||||
{
|
{
|
||||||
for (int x=0; x<blendmapSize; ++x)
|
for (int x=0; x<blendmapSize; ++x)
|
||||||
|
@ -459,21 +454,13 @@ namespace ESMTerrain
|
||||||
|
|
||||||
int alpha = (blendIndex == i) ? 255 : 0;
|
int alpha = (blendIndex == i) ? 255 : 0;
|
||||||
|
|
||||||
if(!largeImage)
|
int realY = (blendmapSize - y - 1)*imageScaleFactor;
|
||||||
pData[((blendmapSize - y - 1)*blendmapSize + x)*channels + channel] = alpha;
|
int realX = x*imageScaleFactor;
|
||||||
else
|
|
||||||
{
|
pData[((realY+0)*blendmapImageSize + realX + 0)*channels + channel] = alpha;
|
||||||
int realY = (blendmapSize - y - 1)*imageScaleFactor;
|
pData[((realY+1)*blendmapImageSize + realX + 0)*channels + channel] = alpha;
|
||||||
int realX = x*imageScaleFactor;
|
pData[((realY+0)*blendmapImageSize + realX + 1)*channels + channel] = alpha;
|
||||||
if(true)
|
pData[((realY+1)*blendmapImageSize + realX + 1)*channels + channel] = alpha;
|
||||||
pData[((realY+0)*blendmapImageSize + realX + 0)*channels + channel] = alpha;
|
|
||||||
if(realY+1 < blendmapImageSize)
|
|
||||||
pData[((realY+1)*blendmapImageSize + realX + 0)*channels + channel] = alpha;
|
|
||||||
if(realX+1 < blendmapImageSize)
|
|
||||||
pData[((realY+0)*blendmapImageSize + realX + 1)*channels + channel] = alpha;
|
|
||||||
if(realY+1 < blendmapImageSize && realX+1 < blendmapImageSize)
|
|
||||||
pData[((realY+1)*blendmapImageSize + realX + 1)*channels + channel] = alpha;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
blendmaps.push_back(image);
|
blendmaps.push_back(image);
|
||||||
|
|
Loading…
Reference in a new issue