adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-devel] Re: Collision fixes, rendering getting there ...


From: Kai Sterker
Subject: [Adonthell-devel] Re: Collision fixes, rendering getting there ...
Date: Sun, 12 Oct 2008 21:26:39 +0200

On Fri, Oct 10, 2008 at 11:04 PM, Kai Sterker <address@hidden> wrote:

> The other open issue is the rendering, which also had some regressions
> since alpha 2. I managed to improve it somewhat, but there are still
> some glitches. I believe I know the reason (vertical vs. horizontal
> tiles and their base points). Fortunately, all the information
> required to treat those two differently should be there where it's
> needed. I'll try to have a go at it tomorrow.

Not much luck at fixing it, unfortunately. While obviously there is an
order in which everything needs to be rendered, I haven't yet found a
way to bring the drawing queue into this order.

I think I need to wrap my head around the issue some more, to come up
with a solution, so here we go:

If all tiles were flat, we could sort them by their z-Order first,
then by their y-Order. Likewise, if all tiles were vertical, we could
sort them by their y-Order first, then by their z-Order. But we have
both of them in the same queue, so how do we sort it?

Obviously, if two tiles are of the same kind, figuring out the order
is simple (as it's already written down above). The problem is how to
sort tiles of a different kind. Maybe it's not so bad at all, since
there aren't that many different combinations here:

(a) ----|   (b) ---,---    (c)    |       (d) |----
        |          |           ---'---        |

In case (a) and (c) we draw the flat tile F first, in case (b) and (d)
we draw the vertical tile V first. Now there only had to be a nice
algorithm that doesn't require to enumerate those different cases one
by one.

I'm to tired right now to actually try it out, but if somebody wants
to have a go, all it takes is a modification to
render_info::operator<().

The following lines at the end of the loop in mapview::render() will
allow to watch the result in a fairly nice way:

        // debug rendering by drawing one tile at a time
        base::timer::sleep (100);
        gfx::screen::update ();

Have fun :-). Otherwise, I'll have to give it a shot one of the following days.

Kai




reply via email to

[Prev in Thread] Current Thread [Next in Thread]