Make samples per pixel a camera parameter

This commit is contained in:
2025-09-23 15:36:08 +01:00
parent 1eb8fd3067
commit 1e31fae5d0
3 changed files with 12 additions and 10 deletions

4
demo.c
View File

@@ -9,6 +9,7 @@
#define H 600
#define FOCAL_LEN 1.0
#define VIEWPORT_H 2.0
#define SAMPLES_PER_PIXEL 100
#define NELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
@@ -30,7 +31,8 @@ static pix_t pixbuf[W * H];
int main()
{
img_t img = { .pix = pixbuf };
camera_t camera = camera_init(camera_pos, FOCAL_LEN, VIEWPORT_H, W, H);
camera_t camera = camera_init(
camera_pos, FOCAL_LEN, VIEWPORT_H, W, H, SAMPLES_PER_PIXEL);
camera_render(&camera, scene, NELEMS(scene), &img);
ff_write(STDOUT_FILENO, img);