X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fpolytest.c;h=800dd465ba2aeb732df84bf4623caca36116684e;hb=0b870b76705b3e597da3f6a11e0499deedbeee30;hp=b9ad891f99256d19f336727c5044cae2926d8929;hpb=0945eeeef21fe85f9a592bfc2e41069a7894b08b;p=dosdemo diff --git a/src/polytest.c b/src/polytest.c index b9ad891..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,7 +37,9 @@ static struct screen scr = { static float theta, phi = 25; static struct mesh cube, torus; -#define LOWRES_SCALE 16 +static struct pimage tex; + +#define LOWRES_SCALE 10 static uint16_t *lowres_pixels; static int lowres_width, lowres_height; @@ -46,12 +50,24 @@ 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; +}