[AD] Patch for the documentation of polygon_z_normal() |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
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().
AE.
--- allegro._tx.old 2005-05-19 16:07:30.908598400 +0200
+++ allegro._tx 2005-06-05 21:30:37.318049600 +0200
@@ -10794,7 +10794,13 @@
to the viewer, therefore they never need to be drawn. This can cull on
average half the polygons from a scene. If the normal is negative the
polygon can safely be culled. If it is zero, the polygon is perpendicular
- to the screen.
+ 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
+ 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.
@@void @apply_matrix(const MATRIX *m, fixed x, y, z, *xout, *yout, *zout);
@@void @apply_matrix_f(const MATRIX_f *m, float x, y, z, *xout, *yout, *zout);