Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] (PR#9550) RFC: design drawing layers & elements
Home

[Freeciv-Dev] (PR#9550) RFC: design drawing layers & elements

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9550) RFC: design drawing layers & elements
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 29 Jul 2004 14:07:36 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9550 >

Perhaps I opened this ticket before, but I don't think so.

The problem is that drawing is divided in two orthogonal ways: by tile 
and and by layer.  When drawing a set of tiles, we have to draw all 
tiles and all layers, in the proper order.  Any order that satisfies the 
painter's algorithm will do.

Further, layers may be grouped together.  Terrain may be all on one 
layer (underneath everything else) but cities are on several different 
layers (with some specials drawn in between).

Currently to draw a set of tiles we iterate over all tiles (according to 
the painter's algorithm) and for each tile draw all layers.  However 
this doesn't satisfy the painter's algorithm exactly because sometimes a 
higher layer of a lower tile will overlap onto a lower layer of a higher 
tile, and will be drawn behind when it should be drawn in front.  As an 
example grassland may cover up parts of the mountain of a tile right 
above it.  Another example is the map grid and selection rectangles, 
which has a hack workaround to avoid the problem.

Perhaps a better algorithm would be to iterate over all layers and for 
each layer draw all tiles.  This would be guaranteed to fit the 
painter's algorithm.  The problem is that now it might be harder to 
filter by tile or by layer given the way the code is currently structured.

Why would we want to filter?  In gui-sdl and gui-ftwl, you can look just 
at one tile to popup info about it.  In gui-ftwl you can additionally 
filter this tile so that you are looking at just the terrain, just the 
units, or just the city.  Raimar solved this by writing new tilespec 
code that duplicates the functionality of filling the sprite array.  In 
my opinion this method is unacceptable.  Instead we need a means of 
filtering.

It is at this point where I have hit a wall.  One problem is that there 
are three separate pieces of code: the sprite loading code (tilespec.c), 
the sprite-array-filling code (tilespec.c), and the tile rendering code 
(mapview_common.c).  Doing it "right" seems like it means merging the 
last two, but this is ugly since the first two are very closely tied.

jason




[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9550) RFC: design drawing layers & elements, Jason Short <=