[AD] Bug in clip3d_f() / polygon3d_f() |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
In my game, polygons are clipped by clip3d_f() and then passed to
polygon3d_f() to be drawn. Most of the time it works. However, if one vertex
coincides exactly with a clipping plane, clip3d_f() may create two
coincident vertices. When this is passed to polygon3d_f(), the polygon
doesn't appear. This happens a lot in my game, because of how it's designed.
I don't know whether this happens in all cases or just some. I don't know
whether it would also be true for clip3d() and polygon3d() (fixed-point
versions). However, I can say for sure that this problem was introduced
since the last WIP, and exists in the CVS version. I suspect it was
introduced when the polygon3d functions were given proper sub-pixel accuracy
(or did I imagine that? :-)
At the same time, I'd like to point out that the polygons often miss the
left and top edges of the screen by 1 pixel. This never used to happen.
It is my opinion that clip3d_f() should not be changed. It cannot know,
without extra calculation, whether two vertices will coincide when
perspective projection is applied. Therefore we need to change polygon3d_f()
and possibly polygon3d(). I could spend ages puzzling over the inner
workings of these functions, but I thought it would be better if the problem
was fixed by someone who already knows what's going on.
Ben Davis