Flip terrain textures

coverity_scan
scrawl 9 years ago
parent 71401aafe7
commit fbd4ad9b0c

@ -399,9 +399,9 @@ namespace ESMTerrain
int channel = pack ? std::max(0, (layerIndex-1) % 4) : 0; int channel = pack ? std::max(0, (layerIndex-1) % 4) : 0;
if (blendIndex == i) if (blendIndex == i)
pData[y*blendmapSize*channels + x*channels + channel] = 255; pData[(blendmapSize - y - 1)*blendmapSize*channels + x*channels + channel] = 255;
else else
pData[y*blendmapSize*channels + x*channels + channel] = 0; pData[(blendmapSize - y - 1)*blendmapSize*channels + x*channels + channel] = 0;
} }
} }

@ -193,7 +193,7 @@ namespace Terrain
for (unsigned int row = 0; row < mNumVerts; ++row) for (unsigned int row = 0; row < mNumVerts; ++row)
{ {
uvs->push_back(osg::Vec2f(col / static_cast<float>(mNumVerts-1), uvs->push_back(osg::Vec2f(col / static_cast<float>(mNumVerts-1),
row / static_cast<float>(mNumVerts-1))); ((mNumVerts-1) - row) / static_cast<float>(mNumVerts-1)));
} }
} }

Loading…
Cancel
Save