X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Finfcubes.c;h=cfa665b84989cee7877bd40bdc4f5148b85b285f;hp=5fe7df9d8a4016402e1e9c5356281e0ee4c3df63;hb=8cee0ffb00cce3d81487f1161286ac299db7d044;hpb=9ed338a5e703fc819cede5cb797e82e08046ac17 diff --git a/src/infcubes.c b/src/infcubes.c index 5fe7df9..cfa665b 100644 --- a/src/infcubes.c +++ b/src/infcubes.c @@ -1,15 +1,19 @@ #include +#include #include #include "demo.h" #include "3dgfx.h" #include "screen.h" #include "cfgopt.h" +#include "polyfill.h" +#include "imago2.h" +#include "gfxutil.h" static int init(void); static void destroy(void); static void start(long trans_time); static void draw(void); -static void draw_cube(void); +static void draw_cube(float sz); static struct screen scr = { "infcubes", @@ -19,8 +23,9 @@ static struct screen scr = { draw }; -static float cam_theta, cam_phi; +static float cam_theta = -29, cam_phi = 35; static float cam_dist = 5; +static struct pimage tex_crate; struct screen *infcubes_screen(void) { @@ -30,11 +35,31 @@ struct screen *infcubes_screen(void) static int init(void) { + int i, npixels; + unsigned char *src; + uint16_t *dst; + + if(!(tex_crate.pixels = img_load_pixels("data/crate.jpg", &tex_crate.width, + &tex_crate.height, IMG_FMT_RGB24))) { + fprintf(stderr, "infcubes: failed to load crate texture\n"); + return -1; + } + + npixels = tex_crate.width * tex_crate.height; + src = (unsigned char*)tex_crate.pixels; + dst = tex_crate.pixels; + for(i=0; i