Add camera aperture / depth-of-field

This commit is contained in:
Camden Dixie O'Brien
2025-09-23 00:09:47 +01:00
parent 4f6cbb008f
commit 209ec3430f
4 changed files with 26 additions and 9 deletions

5
demo.c
View File

@@ -13,6 +13,8 @@
#define MIN_RAD 1.0
#define FOV 90
#define APERTURE 0.5
#define FOCAL_LEN 100.0
#define SAMPLES_PER_PIXEL 100
static const vec3_t camera_pos = { -100.0, 25.0, -100.0 };
@@ -62,7 +64,8 @@ int main()
rand_obj(objs + i, &rng);
img_t img = { .pix = pixbuf };
camera_t camera = camera_init(camera_pos, target, FOV, W, H, APERTURE);
camera_t camera
= camera_init(camera_pos, target, FOV, W, H, APERTURE, FOCAL_LEN);
const scene_t scene = {
.sky_colour = sky,