Draw water edges in a separate pass. This reduces the number of depth state changes

needed to draw the map view with water.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2917 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2007-12-01 11:45:34 +00:00
parent 131cb1bf6f
commit d36f393179
1 changed files with 16 additions and 10 deletions

View File

@ -798,6 +798,7 @@ static void drawTiles(iView *camera, iView *player)
{ {
//get distance of furthest corner //get distance of furthest corner
int zMax = MAX(tileScreenInfo[i][j].screen.z, tileScreenInfo[i+1][j].screen.z); int zMax = MAX(tileScreenInfo[i][j].screen.z, tileScreenInfo[i+1][j].screen.z);
zMax = MAX(zMax, tileScreenInfo[i + 1][j + 1].screen.z); zMax = MAX(zMax, tileScreenInfo[i + 1][j + 1].screen.z);
zMax = MAX(zMax, tileScreenInfo[i][j + 1].screen.z); zMax = MAX(zMax, tileScreenInfo[i][j + 1].screen.z);
@ -808,16 +809,21 @@ static void drawTiles(iView *camera, iView *player)
} }
drawTerrainTile(i, j, FALSE); drawTerrainTile(i, j, FALSE);
}
}
}
pie_SetDepthOffset(-2.0);
for (i = 0; i < MIN(visibleTiles.y, mapHeight); i++)
{
for (j = 0; j < MIN(visibleTiles.x, mapWidth); j++)
{
// check if we need to draw a water edge // check if we need to draw a water edge
if (tileScreenInfo[i][j].bWater if (tileScreenInfo[i][j].drawInfo == TRUE
&& tileScreenInfo[i][j].bWater
&& TileNumber_tile(mapTile(playerXTile + j, playerZTile + i)->texture) != WATER_TILE) && TileNumber_tile(mapTile(playerXTile + j, playerZTile + i)->texture) != WATER_TILE)
{ {
// the edge is in front of the water (which is drawn at z-index -1) // the edge is in front of the water (which is drawn at z-index -1)
pie_SetDepthOffset(-2.0);
drawTerrainTile(i, j, TRUE); drawTerrainTile(i, j, TRUE);
pie_SetDepthOffset(0.0);
}
} }
} }
} }