Temporary fix for the seam issue, if user has specified a texture resolution above what the max tile texture size is. Currently that is 128x128.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7723 4a71c877-e1ca-e34f-864e-861f7616d084
master
Buginator 2009-06-12 03:43:21 +00:00 committed by Git SVN Gateway
parent 50fc6a0060
commit ccacb3aade
1 changed files with 1452 additions and 1449 deletions

View File

@ -222,6 +222,9 @@ void setTileColour(int x, int y, PIELIGHT colour)
psTile->colour = colour; psTile->colour = colour;
} }
// HACK NOTE: The current (max) texture size of a tile is 128x128. We allow up to a user defined texture size
// of 2048. This will cause ugly seams for the decals, if user picks a texture size bigger than the tile!
#define TILE_TEXTURE_SIZE 128.0f
/// Set up the texture coordinates for a tile /// Set up the texture coordinates for a tile
static void getTileTexCoords(Vector2f *uv, unsigned int tileNumber) static void getTileTexCoords(Vector2f *uv, unsigned int tileNumber)
{ {
@ -232,7 +235,7 @@ static void getTileTexCoords(Vector2f *uv, unsigned int tileNumber)
/* Used to calculate texture coordinates */ /* Used to calculate texture coordinates */
const float xMult = 1.0f / TILES_IN_PAGE_COLUMN; const float xMult = 1.0f / TILES_IN_PAGE_COLUMN;
const float yMult = 1.0f / TILES_IN_PAGE_ROW; const float yMult = 1.0f / TILES_IN_PAGE_ROW;
const float texsize = (float)getTextureSize(); const float texsize = TILE_TEXTURE_SIZE; // see note above.
const float centertile = 0.5f / texsize; //compute center of tile const float centertile = 0.5f / texsize; //compute center of tile
const float shiftamount = (texsize -1.0) / texsize; // 1 pixel border const float shiftamount = (texsize -1.0) / texsize; // 1 pixel border
float one = 1.0f / (TILES_IN_PAGE_COLUMN * texsize); float one = 1.0f / (TILES_IN_PAGE_COLUMN * texsize);