/* camera.h */

#pragma once

#include <stdint.h>
#include "config.h"
#include "object.h"

/* Types */

typedef struct {
	tuple eye_point, look_at;
	num   fov;	/* n.b. vertical: horizontal fov determined by aspect ratio */
	u32   width, height;
} view;

typedef struct {
	view			*v;
	object_entry	*scene;
	u32				scene_count;
	lighting_t		*lights;
	u32				light_count;
	num				light_ambient;
	tuple			background;
} camera;

typedef struct {
	camera *c;
	view   *v;
	u32    *canvas;
	u32    slice;
} paint_thread_data;

/* Methods */

ray 	view_eye_ray(view *view, u32 col, u32 row);

tuple 	colour_interpolate(tuple a, tuple b, tuple c, tuple d);

tuple 	camera_trace(camera *c, ray r, int reflections);
void 	camera_paint_thread_entry(void* vp_data);
void 	camera_paint(camera* c, u32* canvas);