Specify camera FOV instead of viewport height
This commit is contained in:
6
demo.c
6
demo.c
@@ -8,7 +8,7 @@
|
||||
#define W 800
|
||||
#define H 600
|
||||
#define FOCAL_LEN 1.0
|
||||
#define VIEWPORT_H 2.0
|
||||
#define FOV 120
|
||||
#define SAMPLES_PER_PIXEL 100
|
||||
|
||||
#define NELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
@@ -31,8 +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, SAMPLES_PER_PIXEL);
|
||||
camera_t camera
|
||||
= camera_init(camera_pos, FOCAL_LEN, FOV, W, H, SAMPLES_PER_PIXEL);
|
||||
camera_render(&camera, scene, NELEMS(scene), &img);
|
||||
|
||||
ff_write(STDOUT_FILENO, img);
|
||||
|
||||
Reference in New Issue
Block a user