defocus-modules/include/defocus/camera.h
2023-05-08 13:28:53 +02:00

50 lines
1.1 KiB
C

#ifndef DEFOCUS_CAMERA_H
#define DEFOCUS_CAMERA_H
#include "base.h"
/** @file camera.h
* @brief basic camera functions
*/
/** @brief Stores information for rays in a SIMD friendly way */
typedef struct
{
/** Packs all SIMD data into a single buffer */
float *simd_mem;
/** Source uvs for rays */
df_v2 *ray_uvs;
/* Points into simd_mem */
float *base_x;
float *base_y;
float *base_z;
float *dir_x;
float *dir_y;
float *dir_z;
size_t ray_count;
} df_ray_packet;
/** @brief Free ray packet memory */
void df_release_ray_packet(df_ray_packet *rays);
/** @brief Interface for cameras. */
typedef struct
{
/** Release the camera object */
void (*release)(void *o);
/** Builds a ray packet of all rays that need to be evaluated to generate the image.
*/
df_ray_packet (*build_ray_packet)(void *o);
/** Opaque pointer to the camera object */
void *o;
} df_camera_i;
df_camera_i
df_create_perspective_camera(float image_width, float image_height, float raster_width, float raster_height);
#endif