Fix problems updating texture size. Also see bug #10456.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2984 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
299d7bfcfb
commit
411b172dac
|
@ -940,7 +940,7 @@ static void flipsAndRots(unsigned int tileNumber, unsigned int i, unsigned int j
|
|||
/* Used to calculate texture coordinates, which are 0-255 in value */
|
||||
const float xMult = 1.0f / TILES_IN_PAGE_COLUMN;
|
||||
const float yMult = 1.0f / TILES_IN_PAGE_ROW;
|
||||
const float one = 1.0f / (TILES_IN_PAGE_COLUMN * getTextureSize());
|
||||
const float one = 1.0f / (TILES_IN_PAGE_COLUMN * (float)getTextureSize());
|
||||
|
||||
/*
|
||||
* Points for flipping the texture around if the tile is flipped or rotated
|
||||
|
@ -4051,7 +4051,7 @@ static void drawTerrainWaterTile(UDWORD i, UDWORD j)
|
|||
/* Used to calculate texture coordinates, which are 0-255 in value */
|
||||
const float xMult = 1.0f / TILES_IN_PAGE_COLUMN;
|
||||
const float yMult = 1.0f / (2.0f * TILES_IN_PAGE_ROW);
|
||||
const float one = 1.0f / (TILES_IN_PAGE_COLUMN * getTextureSize());
|
||||
const float one = 1.0f / (TILES_IN_PAGE_COLUMN * (float)getTextureSize());
|
||||
const unsigned int tileNumber = getWaterTileNum();
|
||||
TERRAIN_VERTEX vertices[3];
|
||||
|
||||
|
|
|
@ -49,8 +49,7 @@ TILE_TEX_INFO tileTexInfo[MAX_TILES];
|
|||
|
||||
static int firstPage; // the last used page before we start adding terrain textures
|
||||
int terrainPage; // texture ID of the terrain page
|
||||
static int mipmap_max = MIPMAP_MAX, mipmap_levels = MIPMAP_LEVELS;
|
||||
static int mipmap_user_requested = MIPMAP_MAX;
|
||||
static int mipmap_max, mipmap_levels, mipmap_user_requested = MIPMAP_MAX;
|
||||
|
||||
void setTextureSize(int texSize)
|
||||
{
|
||||
|
@ -60,6 +59,7 @@ void setTextureSize(int texSize)
|
|||
return;
|
||||
}
|
||||
mipmap_user_requested = texSize;
|
||||
debug(LOG_3D, "texture size set to %d", texSize);
|
||||
}
|
||||
|
||||
int getTextureSize()
|
||||
|
@ -126,6 +126,10 @@ void texLoad(const char *fileName)
|
|||
ASSERT(_TEX_INDEX < iV_TEX_MAX, "Too many texture pages used");
|
||||
ASSERT(MIPMAP_MAX == TILE_WIDTH && MIPMAP_MAX == TILE_HEIGHT, "Bad tile sizes");
|
||||
|
||||
// reset defaults
|
||||
mipmap_max = MIPMAP_MAX;
|
||||
mipmap_levels = MIPMAP_LEVELS;
|
||||
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glval);
|
||||
|
||||
while (glval < mipmap_max * TILES_IN_PAGE_COLUMN)
|
||||
|
@ -145,6 +149,7 @@ void texLoad(const char *fileName)
|
|||
{
|
||||
mipmap_max /= 2;
|
||||
mipmap_levels--;
|
||||
debug(LOG_3D, "Downgrading texture quality to %d due to user setting %d", mipmap_max, mipmap_user_requested);
|
||||
}
|
||||
mipmap_user_requested = mipmap_max; // reduce to lowest possible
|
||||
|
||||
|
|
Loading…
Reference in New Issue