Near 60fps

This commit is contained in:
Carlos Sanchez 2024-08-13 00:40:03 -04:00
parent 9d3063914d
commit 962cec230a
4 changed files with 26 additions and 3 deletions

15
scene.c
View File

@ -17,6 +17,11 @@
#define DOLIGHTING
#define FASTTRIS
// IDK you probably have to change this based on your display.
// Maybe there's a way to fix this?
#define UNIGIBITDEPTH 32
#define TARGETFPS 60
#define WIDTH 640
#define HEIGHT 480
#define ASPECT ((float)WIDTH / HEIGHT)
@ -125,7 +130,7 @@ int main(int argc, char **argv) {
unigi_type_resolution res;
res.width = WIDTH;
res.height = HEIGHT;
res.depth = 32; // Not actually 32 bit
res.depth = UNIGIBITDEPTH;
// Printing to screen needs tracking
haloo3d_print_tracker t;
@ -143,7 +148,9 @@ int main(int argc, char **argv) {
struct vec4 *vert_precalc;
mallocordie(vert_precalc, sizeof(struct vec4) * H3D_OBJ_MAXVERTICES);
clock_t begin, end;
// Measured in milliseconds
float sumframe = 0, lastframe = 0;
float msperframe = 1000.0 / TARGETFPS;
int totaldrawn = 0;
eprintf("Scene has %d tris, %d verts\n", totalfaces, totalverts);
@ -229,8 +236,14 @@ int main(int argc, char **argv) {
end = clock();
CALCTIME(lastframe, begin, end, sumframe);
float waittime = msperframe - lastframe;
if (waittime > 0) {
unigi_time_sleep(waittime * unigi_time_clocks_per_s / 1000);
}
}
// Free after loop
for (int i = 0; i < NUMOBJECTS; i++) {
haloo3d_obj_free(models + i);
haloo3d_fb_free(textures + i);

10
unigi/pullall.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
set -e
cd unigi
git pull
cd ../unigi.headers
git pull
cd ../unigi.ext
git pull
cd ../unigi.platform.sdl1
git pull

@ -1 +1 @@
Subproject commit 41e4f122d1910927760a08b6bbc9b645bb11f8f6
Subproject commit 196b30670bca3829fc29aa37666cedc1a973958c

@ -1 +1 @@
Subproject commit ab5f142e3413c5e9850049e49ae60bc3ed3d1b71
Subproject commit e407020c2118d7ad2f4d43eca5214b6360a0b7cc