X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Fpolyclip.c;h=28e8505a7132bd35c039e352abe936213025d247;hp=67e1c8344554da17d75ab66c5e9c8eb5c5f98606;hb=77e0a84543a31aecceabc0e4b18a0d37ad92c89b;hpb=5d599e487cdc3b172c8c7cd8fc2f91d6af8bd049 diff --git a/src/polyclip.c b/src/polyclip.c index 67e1c83..28e8505 100644 --- a/src/polyclip.c +++ b/src/polyclip.c @@ -23,23 +23,23 @@ int clip_poly(struct g3d_vertex *vout, int *voutnum, { int i, nextidx, res; int edges_clipped = 0; - int out_vnum = 0; + + *voutnum = 0; for(i=0; i= vnum) nextidx = 0; - res = clip_edge(vout, &out_vnum, vin + i, vin + nextidx, plane); + res = clip_edge(vout, voutnum, vin + i, vin + nextidx, plane); if(res == 0) { ++edges_clipped; } } - if(out_vnum <= 0) { + if(*voutnum <= 0) { assert(edges_clipped == 0); return -1; } - *voutnum = out_vnum; return edges_clipped > 0 ? 0 : 1; } @@ -49,28 +49,28 @@ int clip_frustum(struct g3d_vertex *vout, int *voutnum, { int i, nextidx, res; int edges_clipped = 0; - int out_vnum = 0; if(vnum == 1) { /* special case: point clipping */ return inside_frustum_plane(vin, fplane) ? 1 : -1; } + *voutnum = 0; + for(i=0; i= vnum) nextidx = 0; - res = clip_edge_frustum(vout, &out_vnum, vin + i, vin + nextidx, fplane); + res = clip_edge_frustum(vout, voutnum, vin + i, vin + nextidx, fplane); if(res == 0) { ++edges_clipped; } } - if(out_vnum <= 0) { + if(*voutnum <= 0) { assert(edges_clipped == 0); return -1; } - *voutnum = out_vnum; return edges_clipped > 0 ? 0 : 1; }