adonthell-devel
[Top][All Lists]
Advanced

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

Re: [Adonthell-devel] Drawing order


From: Kai Sterker
Subject: Re: [Adonthell-devel] Drawing order
Date: Sun, 26 Oct 2008 20:49:53 +0100

On Sun, Oct 26, 2008 at 7:54 PM, Enrico Kochon
<address@hidden> wrote:
> Hi,
>
> why dont you just adjust the drawing order according to the viewpoint?
> Beginning from the last to the first: this is the world-famous
> "z-buffer" algo.

Which I only know by name ... might have to do some reading on it to
see if it could be applied.

> However, I don't know much about the adonthell-rendering pipeline. So
> maybe this is not appropriate.

Basically, there are simple 3D objects represented by a sprite. Since
the objects are not supposed to intersect (in a properly constructed
world), it ought to be possible to bring them into an order where
their sprites can be drawn.

I have implemented yesterdays suggestion and it works up to a point.
The major problem is that sometimes objects seem to have circular
dependencies, so that each one overlaps at least one other object.
That's where the algorithm fails and goes into an infinite loop. Maybe
my checking routine is still a little off ... but it might also happen
with a world where things intersect. Not the kind of code you'd want
to have around.

If you are familiar with the z-buffer thing, maybe you'd want to have
a look. The code in question is basically the mapview class, which
collects the objects that should be visible at any given point,
render_info which stores data about the objects for rendering and
takes care of the sorting and finally renderer which does the actual
drawing.

My latest changes (which I'm not sure if they are worth keeping)
delegated the sorting into the renderer itself, but that is about the
biggest difference.

Kai




reply via email to

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