X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Fpolyclip.h;h=adee29ddb74e2cd145a24b59fc9b1c9d0778ca31;hp=c6745e374d784de938bb79e467663ba48d8dea1d;hb=d956a9d9273eebfacfda58cb3bafff017269d5dc;hpb=dac99aab001a4589f2947e03a917e45b94033c98 diff --git a/src/polyclip.h b/src/polyclip.h index c6745e3..adee29d 100644 --- a/src/polyclip.h +++ b/src/polyclip.h @@ -8,7 +8,13 @@ struct cplane { float nx, ny, nz; }; -/* Polygon clipper +enum { + CLIP_LEFT, CLIP_RIGHT, + CLIP_BOTTOM, CLIP_TOP, + CLIP_NEAR, CLIP_FAR +}; + +/* Generic polygon clipper * returns: * 1 -> fully inside, not clipped * 0 -> straddling the plane and clipped @@ -19,4 +25,14 @@ struct cplane { int clip_poly(struct g3d_vertex *vout, int *voutnum, const struct g3d_vertex *vin, int vnum, struct cplane *plane); +/* only checks if the polygon would be clipped by the plane, and classifies it + * as inside/outside/straddling, without actually producing a clipped polygon. + * return values are the same as clip_poly. + */ +int check_clip_poly(const struct g3d_vertex *v, int vnum, struct cplane *plane); + +/* Special-case frustum clipper (might be slightly faster) */ +int clip_frustum(struct g3d_vertex *vout, int *voutnum, + const struct g3d_vertex *vin, int vnum, int fplane); + #endif /* POLYCLIP_H_ */