Re: [AD] Patch for the documentation of polygon_z_normal() |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Sun, 2005-06-05 at 21:44 +0200, Andrei Ellman wrote:
> Attatched is a patch for the documentation of polygon_z_normal() in
> allegro._tx. What this does is to tell the user that if using the
> function for culling back-facing polygons, they must convert the
> co-ordinates into screen-space. I've also mentioned an alternative
> method for culling back-facing polygons, but I'm not sure if the docs
> for polygon_z_normal() are the right place to mention this, as this
> alternative method does not use polygon_z_normal().
>
I think it's a good place. Else you could move it to the beginning of
the chapter..
And while you're add it, maybe add a note that the function will fail if
the three vectors lie on one line.
+ to the screen. However, this method of culling back-faces should only be
+ used once the X and Y coordinates have been projected into screen-space
+ using persp_project() (or if an isometric-projection is being used). In
I'd replace "should" by "can" and "isometric" by "orthographic".
+ order to cull back-faces before projection into screen-space, find the
+ dot-product of a vector from the camera to a point on the polygon with
+ the polygon's normal, and if the sign of the result is positive, the
+ polygon can be culled.
Maybe also add a short example code how to get the normal of a triangle.
I mean, if someone doesn't know the above information already, then that
person certainly also doesn't know how to get the normal in the first
place.
--
Elias Pschernig <elias@xxxxxxxxxx>