X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Fpolytest.c;h=dfca5ef2a5978aeb3e52d1e3287ccdd5bc290525;hp=fb8d9afca4b408d500e5d9511732fc8715d7f83e;hb=45f6f46fe758d15aafccdb69ae837fc7d84ee466;hpb=921c229affb2b1da97d7be21d5c86ad045a6fcc3 diff --git a/src/polytest.c b/src/polytest.c index fb8d9af..dfca5ef 100644 --- a/src/polytest.c +++ b/src/polytest.c @@ -1,19 +1,42 @@ #include #include +#include +#include #include "screen.h" +#include "demo.h" +#include "3dgfx.h" +#include "gfxutil.h" +#include "polyfill.h" /* just for struct pimage */ +#include "cfgopt.h" +#include "mesh.h" +#include "bsptree.h" static int init(void); static void destroy(void); +static void start(long trans_time); static void draw(void); +static void draw_lowres_raster(void); +static int gen_texture(struct pimage *img, int xsz, int ysz); static struct screen scr = { "polytest", init, destroy, - 0, 0, + start, 0, draw }; +static float cam_theta, cam_phi = 25; +static float cam_dist = 3; +static struct g3d_mesh cube, torus; +static struct bsptree torus_bsp; + +static struct pimage tex; + +#define LOWRES_SCALE 10 +static uint16_t *lowres_pixels; +static int lowres_width, lowres_height; + struct screen *polytest_screen(void) { return &scr; @@ -21,13 +44,179 @@ struct screen *polytest_screen(void) static int init(void) { + int i; + + gen_cube_mesh(&cube, 1.0, 0); + gen_torus_mesh(&torus, 1.0, 0.25, 24, 12); + /* scale texcoords */ + for(i=0; ipixels = malloc(xsz * ysz * sizeof *pix))) { + return -1; + } + pix = img->pixels; + + for(i=0; iwidth = xsz; + img->height = ysz; + return 0; }