Small cleanup + fixes

This commit is contained in:
Carlos Sanchez 2024-08-26 01:28:02 -04:00
parent cf54dd083d
commit 1ed03f97b8
3 changed files with 11 additions and 3 deletions

11
scene.c
View File

@ -20,7 +20,7 @@
// IDK you probably have to change this based on your display.
// Maybe there's a way to fix this?
#define UNIGIBITDEPTH 32
#define UNIGIBITDEPTH 0
#define TARGETFPS 60
#define DITHERSTART 100
@ -82,7 +82,9 @@ int main(int argc, char **argv) {
haloo3d_gen_sloped(models + 2, PLANESIZE, 1.0, 1.25);
haloo3d_fb_init_tex(textures + 3, 8, 8);
memcpy(textures[3].buffer, redflower, sizeof(uint16_t) * 64);
haloo3d_gen_crossquad(models + 3, textures + 3);
haloo3d_gen_crossquad(models + 3, textures + 3,
(struct vec3){.x = 0, .y = 0, .z = 0});
eprintf("Initialized models + textures");
camset cams[MAXCAM];
int numcams = readcam(cams, MAXCAM, argv[3]);
@ -127,6 +129,7 @@ int main(int argc, char **argv) {
#endif
objects[0].pos.y = 1;
vec3(objects[1].scale.v, SKYSCALE, SKYSCALE, SKYSCALE);
eprintf("Initialized object instances\n");
// Now we create a framebuffer to draw the triangle into
haloo3d_fb fb;
@ -202,6 +205,8 @@ int main(int argc, char **argv) {
mat4_inverse(matrixcam, matrixcam);
mat4_multiply(matrixscreen, perspective, matrixcam);
// eprintf("BEGIN ITERATE OBJECTS\n");
// Iterate over objects
for (int i = 0; i < NUMINSTANCES; i++) {
// Setup final model matrix and the precalced vertices
@ -236,10 +241,12 @@ int main(int argc, char **argv) {
totaldrawn++;
// 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]);
}
}
}
// eprintf("OBJECTS COMPLETE\n");
haloo3d_print(&t, "Last frame: %05.2f (%05.2f)\nTris: %d / %d\nVerts: %d\n",
lastframe, sumframe, totaldrawn, totalfaces, totalverts);

View File

@ -80,7 +80,8 @@ int main(int argc, char **argv) {
haloo3d_gen_sloped(models + 2, PLANESIZE, 1.0, 1.25);
haloo3d_fb_init_tex(textures + 3, 8, 8);
memcpy(textures[3].buffer, redflower, sizeof(uint16_t) * 64);
haloo3d_gen_crossquad(models + 3, textures + 3);
haloo3d_gen_crossquad(models + 3, textures + 3,
(struct vec3){.x = 0, .y = 0, .z = 0});
// Create the camera matrix, which DOES change. In this one,
// we move the camera instead of the model