diff options
author | Julian T <julian@jtle.dk> | 2020-02-19 22:35:48 +0100 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2020-02-19 22:35:48 +0100 |
commit | 63a84080f9f0e3d719d5470e370584a5eff18a47 (patch) | |
tree | 58264ab5ee632218ab898f70a8a0170b29e595bf /viewpoint.h |
Viewpoint system and share/ray intersection working
Diffstat (limited to 'viewpoint.h')
-rw-r--r-- | viewpoint.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/viewpoint.h b/viewpoint.h new file mode 100644 index 0000000..0aae5db --- /dev/null +++ b/viewpoint.h @@ -0,0 +1,28 @@ +#ifndef VIEWPOINT_H +#define VIEWPOINT_H + +#include "vector.h" + +// 90 degrees +#define FOV 3.1415/2 + +typedef struct { + // Viewpoint dimensions + unsigned int width; + unsigned int height; + + // Position and orientation + vector_t position, target; + + // Viewpoint shift vectors + // Calculated at initialisation + vector_t qx, qy; + // Left button center pixel location + vector_t blc; +} viewpoint_t; + +// Todo handle initial setup +void viewpoint_init(viewpoint_t *view); + +void viewpoint_ray(viewpoint_t *view, vector_t *r, unsigned x, unsigned y); +#endif |