X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2F3dgfx.c;h=a642c1e42da16918510da9dcdf6c1770021a167b;hp=044ab6602897259700f0a3a1208100528831d58d;hb=5029eb9f7a538dd58e1c66c0945784acac8cc58b;hpb=8f7234e08947a80bace3643f37214c5fb076bdfe diff --git a/src/3dgfx.c b/src/3dgfx.c index 044ab66..a642c1e 100644 --- a/src/3dgfx.c +++ b/src/3dgfx.c @@ -82,6 +82,7 @@ int g3d_init(void) fprintf(stderr, "failed to allocate G3D context\n"); return -1; } + st->opt = G3D_CLIP_FRUSTUM; st->fill_mode = POLYFILL_FLAT; for(i=0; ipixels = pixels; + pfill_fb.pixels = pixels; +} + void g3d_viewport(int x, int y, int w, int h) { st->vport[0] = x; @@ -438,17 +446,19 @@ void g3d_draw_indexed(int prim, const struct g3d_vertex *varr, int varr_size, } /* clipping */ - for(i=0; i<6; i++) { - memcpy(tmpv, v, vnum * sizeof *v); - - if(clip_frustum(v, &vnum, tmpv, vnum, i) < 0) { - /* polygon completely outside of view volume. discard */ - vnum = 0; - break; + if(st->opt & G3D_CLIP_FRUSTUM) { + for(i=0; i<6; i++) { + memcpy(tmpv, v, vnum * sizeof *v); + + if(clip_frustum(v, &vnum, tmpv, vnum, i) < 0) { + /* polygon completely outside of view volume. discard */ + vnum = 0; + break; + } } - } - if(!vnum) continue; + if(!vnum) continue; + } for(i=0; i