X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Fpolytest.c;h=800dd465ba2aeb732df84bf4623caca36116684e;hp=e7c3cdf74d3117ac97ceb47324c377cb22b7d0f3;hb=07ce18b114e1e01b2a85a04079128f3eb754de1d;hpb=f7789d3011a5ac2620a2f7732a389963f790fd85 diff --git a/src/polytest.c b/src/polytest.c index e7c3cdf..800dd46 100644 --- a/src/polytest.c +++ b/src/polytest.c @@ -6,6 +6,7 @@ #include "demo.h" #include "3dgfx.h" #include "gfxutil.h" +#include "polyfill.h" /* just for struct pimage */ struct mesh { int prim; @@ -23,6 +24,7 @@ static int gen_cube(struct mesh *mesh, float sz); static int gen_torus(struct mesh *mesh, float rad, float ringrad, int usub, int vsub); static void zsort(struct mesh *m); static void draw_lowres_raster(void); +static int gen_texture(struct pimage *img, int xsz, int ysz); static struct screen scr = { "polytest", @@ -35,6 +37,8 @@ static struct screen scr = { static float theta, phi = 25; static struct mesh cube, torus; +static struct pimage tex; + #define LOWRES_SCALE 10 static uint16_t *lowres_pixels; static int lowres_width, lowres_height; @@ -46,8 +50,17 @@ struct screen *polytest_screen(void) static int init(void) { + int i; + gen_cube(&cube, 1.0); gen_torus(&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; +}