Move rendering functions to own module

This commit is contained in:
Camden Dixie O'Brien
2025-09-22 22:12:51 +01:00
parent 1ee0571178
commit 7e273a3e8d
6 changed files with 177 additions and 167 deletions

9
demo.c
View File

@@ -1,7 +1,5 @@
#include "camera.h"
#include "ff.h"
#include "obj.h"
#include "rng.h"
#include "render.h"
#include <unistd.h>
@@ -64,15 +62,14 @@ int main()
rand_obj(objs + i, &rng);
img_t img = { .pix = pixbuf };
camera_t camera
= camera_init(camera_pos, target, FOV, W, H, SAMPLES_PER_PIXEL);
camera_t camera = camera_init(camera_pos, target, FOV, W, H);
const scene_t scene = {
.sky_colour = sky,
.objs = objs,
.obj_count = OBJ_COUNT,
};
camera_render(&camera, &scene, &img);
render(&camera, &scene, &img, SAMPLES_PER_PIXEL);
ff_write(STDOUT_FILENO, img);