diff --git a/README.md b/README.md index f50c597..c5a75de 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Everything in here is a little sample program or otherwise which uses [haloo3d](https://github.com/randomouscrap98/haloo3d) and [unigi](https://git.lumen.sh/Fierelier/unigi). It's all software -rendered, but you'll need to get sdl1 so it can render to screen. +rendered, but you'll need to get sdl2 so it can render to screen. The libraries required are set as submodules, so you can pull them when cloning with: @@ -33,14 +33,13 @@ make FORCE=1 maze.exe ## Unigi -For the time being, unigi is designed such that it expects you to -compile your entire program as a single unit. This means you must -include all your .c files into the main file, in the right order. - -This may change in the future. +Unigi is a small library and is built manually using the 3dtoys makefile. +You can tinker around with Unigi if you like; it has its own make system, +but I'm not sure what is required. The parts that are required for 3dtoys +are handled with the 3dtoys makefile. Unigi expects some kind of graphics backend to run. In this case, -our samples use SDL1, so you'll need to get that. +our samples use SDL2, so you'll need to get that. ## Haloo3d diff --git a/scene.c b/scene.c index 119d88c..74f1aba 100644 --- a/scene.c +++ b/scene.c @@ -1,12 +1,11 @@ #include "haloo3d/haloo3d.h" -#include "haloo3d/haloo3dex_easy.h" +// #include "haloo3d/haloo3dex_easy.h" #include "haloo3d/haloo3dex_gen.h" #include "haloo3d/haloo3dex_img.h" #include "haloo3d/haloo3dex_obj.h" #include "haloo3d/haloo3dex_print.h" -#include "unigi/unigi.headers/src/main.h" -#include "unigi/unigi.platform.sdl1/src/main.c" +#include "unigi/main.h" // #include "unigi/unigi.ext/src/main.c" #include "camera.h" @@ -16,7 +15,7 @@ #include #define DOLIGHTING -#define FASTTRIS +// #define FASTTRIS // IDK you probably have to change this based on your display. // Maybe there's a way to fix this? @@ -25,6 +24,7 @@ #define DITHERSTART 100 #define DITHEREND 101 +#define PCTSTART 100 #define WIDTH 640 #define HEIGHT 480 @@ -45,13 +45,13 @@ #define NUMINSTANCES (NUMOBJECTS - 1 + NUMFLOWERS) #define MAXCAM 1200 -#ifdef FASTTRIS -#define WBUFCLEAR FARCLIP -#define TRIFUNC haloo3d_texturedtriangle_fast -#else -#define WBUFCLEAR 0 -#define TRIFUNC haloo3d_texturedtriangle -#endif +// #ifdef FASTTRIS +// #define WBUFCLEAR FARCLIP +// #define TRIFUNC haloo3d_texturedtriangle_fast +// #else +// #define WBUFCLEAR 0 +// #define TRIFUNC haloo3d_texturedtriangle +// #endif #define CALCTIME(thistime, start, end, sum) \ thistime = 1000.0 * (float)(end - start) / CLOCKS_PER_SEC; \ @@ -166,6 +166,9 @@ int main(int argc, char **argv) { // present in this haloo3d_trirender rendersettings; haloo3d_trirender_init(&rendersettings); + rendersettings.ditherfar = DITHEREND; + rendersettings.ditherclose = DITHERSTART; + rendersettings.pctminsize = PCTSTART; eprintf("Scene has %d tris, %d verts\n", totalfaces, totalverts); @@ -198,7 +201,7 @@ int main(int argc, char **argv) { camera.pitch = cams[cami].pitch + MPI_2; // REMEMBER TO CLEAR DEPTH BUFFER - haloo3d_fb_cleardepth(&fb, WBUFCLEAR); + haloo3d_fb_cleardepth(&fb); // Screen matrix calc. We multiply the modelview matrix with this later haloo3d_camera_calclook(&camera, matrixcam); @@ -223,8 +226,9 @@ int main(int argc, char **argv) { objects[i].model->vtexture, face); int tris = haloo3d_facef_clip(face, outfaces); if (tris > 0) { - haloo3d_easy_calcdither4x4(&rendersettings, face, DITHERSTART, - DITHEREND); + // haloo3d_getdither4x4(float dither, uint8_t *buf) + // haloo3d_easy_calcdither4x4(&rendersettings, face, DITHERSTART, + // DITHEREND); rendersettings.intensity = 1.0; if (objects[i].lighting) { haloo3d_obj_facef(objects[i].model, objects[i].model->faces[fi], @@ -242,7 +246,7 @@ int main(int argc, char **argv) { // We still have to convert the points into the view haloo3d_facef_viewport_into(outfaces[ti], WIDTH, HEIGHT); // eprintf("RENDER TRI\n"); - TRIFUNC(&fb, &rendersettings, outfaces[ti]); + haloo3d_triangle(&fb, &rendersettings, outfaces[ti]); } } } diff --git a/scene_freecam.c b/scene_freecam.c index 41cc63a..844ea58 100644 --- a/scene_freecam.c +++ b/scene_freecam.c @@ -4,9 +4,7 @@ #include "haloo3d/haloo3dex_obj.h" #include "haloo3d/haloo3dex_print.h" -#include "unigi/unigi.headers/src/main.h" -#include "unigi/unigi.platform.sdl1/src/main.c" -// #include "unigi/unigi.ext/src/main.c" +#include "unigi/main.h" #include "camera.h" #include "keys.h" @@ -227,7 +225,7 @@ int main(int argc, char **argv) { // camera.pitch = cams[cami].pitch + MPI_2; // REMEMBER TO CLEAR DEPTH BUFFER - haloo3d_fb_cleardepth(&fb, WBUFCLEAR); + haloo3d_fb_cleardepth(&fb); // Screen matrix calc. We multiply the modelview matrix with this later haloo3d_camera_calclook(&camera, matrixcam); @@ -264,7 +262,7 @@ int main(int argc, char **argv) { } // We still have to convert the points into the view haloo3d_facef_viewport_into(outfaces[ti], WIDTH, HEIGHT); - TRIFUNC(&fb, &rendersettings, outfaces[ti]); + haloo3d_triangle(&fb, &rendersettings, outfaces[ti]); } } }