diff --git a/haloo3d b/haloo3d index e374afa..750c235 160000 --- a/haloo3d +++ b/haloo3d @@ -1 +1 @@ -Subproject commit e374afaa60a7f5daeaa87104bed3fb2b97a29f7e +Subproject commit 750c2355ccf169fe6b1fd56cc1ca7cfdb2283e83 diff --git a/maze.c b/maze.c index a90b69f..d59da0b 100644 --- a/maze.c +++ b/maze.c @@ -13,10 +13,13 @@ #include -#define WIDTH 640 -#define HEIGHT 400 +// INteresting flags for performance comparisons +#define FASTFILL + +#define WIDTH 320 +#define HEIGHT 200 #define ASPECT ((float)WIDTH / HEIGHT) -#define SCREENSCALE 2 +#define SCREENSCALE 4 #define SWIDTH (WIDTH * SCREENSCALE) #define SHEIGHT (HEIGHT * SCREENSCALE) #define NEARCLIP 0.01 @@ -167,8 +170,6 @@ int main() { // int argc, char **argv) { haloo3d_fb screen; haloo3d_fb_init(&screen, SWIDTH, SHEIGHT); - haloo3d_recti texrect = {.x1 = 0, .y1 = 0, .x2 = WIDTH, .y2 = HEIGHT}; - haloo3d_recti screenrect = {.x1 = 0, .y1 = 0, .x2 = SWIDTH, .y2 = SHEIGHT}; haloo3d_easyrender render; haloo3d_easyrender_init(&render, WIDTH, HEIGHT); @@ -187,9 +188,10 @@ int main() { // int argc, char **argv) { render.tprint.fb = &screen; - haloo3d_easytimer frametimer, sdltimer; + haloo3d_easytimer frametimer, sdltimer, filltimer; haloo3d_easytimer_init(&frametimer, AVGWEIGHT); haloo3d_easytimer_init(&sdltimer, AVGWEIGHT); + haloo3d_easytimer_init(&filltimer, AVGWEIGHT); // Load the junk + generate stuff haloo3d_obj *flooro = haloo3d_easystore_addobj(&storage, "floor"); @@ -319,19 +321,30 @@ int main() { // int argc, char **argv) { } } + haloo3d_easytimer_start(&filltimer); +#ifdef FASTFILL + haloo3d_fb_fill(&screen, &render.window); +#else + haloo3d_recti texrect = {.x1 = 0, .y1 = 0, .x2 = WIDTH, .y2 = HEIGHT}; + haloo3d_recti screenrect = {.x1 = 0, .y1 = 0, .x2 = SWIDTH, .y2 = SHEIGHT}; haloo3d_sprite(&screen, &render.window, texrect, screenrect); +#endif + haloo3d_easytimer_end(&filltimer); haloo3d_print(&render.tprint, - "Last frame: %05.2f (%05.2f)\nLast SDLFl: %05.2f " + // "Last frame: %05.2f (%05.2f)\nLast SDLFl: %05.2f " + // "(%05.2f)\nTris: %d / %d\nVerts: %d\n", + "Last frame: %05.2f (%05.2f)\nLast fill: %05.2f " + "(%05.2f)\nLast SDLFl: %05.2f " "(%05.2f)\nTris: %d / %d\nVerts: %d\n", frametimer.last * 1000, frametimer.sum * 1000, + filltimer.last * 1000, filltimer.sum * 1000, sdltimer.last * 1000, sdltimer.sum * 1000, totaldrawn, render.totalfaces, render.totalverts); + haloo3d_easytimer_start(&sdltimer); unigi_graphics_blit(0, (unigi_type_color *)screen.buffer, res.width * res.height); - - haloo3d_easytimer_start(&sdltimer); unigi_graphics_flush(); haloo3d_easytimer_end(&sdltimer); diff --git a/maze_todo.txt b/maze_todo.txt new file mode 100644 index 0000000..6f8e2f2 --- /dev/null +++ b/maze_todo.txt @@ -0,0 +1,29 @@ +- Need a way to traverse the maze + - Do we just look for empty walls? + - should we generate a maze properly then use it to generate the maze walls? + - Maybe a general quad adder or something? + - How hard is it to check for empty walls? use the same formula to find the face, + then uh... well it sucks for the edges of the map, which are different + - tile based doesn't line up well with the normal maze generator, might need a different one + - well no, if you're always moving two spaces because you must leave walls, then i suppose it's roughly the same + - could generate walls based on maze input? Must assume each "wall" ... mmm + - visit each "normal" cell, generate quads somehow... generic quad generator for a "cell" centered + at some point? points are usually aligned to the whole number grid. + - could do it based on floats. divide the width by two and get the actual width, which in our case + is 15.5. then we know our centers are at 0.5. + if edge is 30, middle is 15, edges are at 0.5. How do we know though? middle is thus + - no who cares, always align to integers. make the player move if they're not centered + - instead of generating the entire thing, could simply have a function that "adds" quads at specified locations. Would require realloc for the arrays if they get too large, totally fine I think... + - wouldn't need thing anymore + - erm since we're representing the maze with thin walls, should PROBABLY represent the maze with + simple array where each cell indicates the walls that exist... probably. + + +So new thing: +- Generate maze with simple array of values which represent the walls that are torn down + between cells. +- Use that to generate individual quads for the walls. You will need to realloc the arrays as + they run out of space +- use the maze array for the player to walk through + +