|
| 1 | +#pragma once |
| 2 | + |
| 3 | +#include <stdbool.h> |
| 4 | +#include "cglm/cglm.h" |
| 5 | + |
| 6 | +/** Manages camera properties. */ |
| 7 | +struct te_camera_component; |
| 8 | + |
| 9 | +/** |
| 10 | + * Sets camera's near clip plane distance. |
| 11 | + * |
| 12 | + * @param comp Component. |
| 13 | + * @param z Non-negative value. |
| 14 | + */ |
| 15 | +void camera_set_near_clip(struct te_camera_component* comp, float z); |
| 16 | + |
| 17 | +/** |
| 18 | + * Sets camera's far clip plane distance. |
| 19 | + * |
| 20 | + * @param comp Component. |
| 21 | + * @param z Non-negative value. |
| 22 | + */ |
| 23 | +void camera_set_far_clip(struct te_camera_component* comp, float z); |
| 24 | + |
| 25 | +/** |
| 26 | + * Sets camera's vertical field of view. |
| 27 | + * |
| 28 | + * @param comp Component. |
| 29 | + * @param fov Vertical FOV. |
| 30 | + */ |
| 31 | +void camera_set_vertical_fov(struct te_camera_component* comp, unsigned char fov); |
| 32 | + |
| 33 | +/** |
| 34 | + * Returns camera's near clip plane distance. |
| 35 | + * |
| 36 | + * @param comp Component. |
| 37 | + * |
| 38 | + * @return Near clip. |
| 39 | + */ |
| 40 | +float camera_get_near_clip(struct te_camera_component* comp); |
| 41 | + |
| 42 | +/** |
| 43 | + * Returns camera's far clip plane distance. |
| 44 | + * |
| 45 | + * @param comp Component. |
| 46 | + * |
| 47 | + * @return Far clip. |
| 48 | + */ |
| 49 | +float camera_get_far_clip(struct te_camera_component* comp); |
| 50 | + |
| 51 | +/** |
| 52 | + * Returns camera's vertical field of view. |
| 53 | + * |
| 54 | + * @return Vertical FOV. |
| 55 | + */ |
| 56 | +unsigned char camera_get_vertical_fov(struct te_camera_component* comp); |
| 57 | + |
| 58 | +// ------------------------------------------------------------------------------------------------ |
| 59 | +// PRIVATE API |
| 60 | +// ------------------------------------------------------------------------------------------------ |
| 61 | + |
| 62 | +/** |
| 63 | + * Returns sizeof(te_camera_component). |
| 64 | + * |
| 65 | + * @return Size in bytes. |
| 66 | + */ |
| 67 | +unsigned int prv_camera_component_get_sizeof(void); |
| 68 | + |
| 69 | +/** |
| 70 | + * Initializes allocated memory. |
| 71 | + * |
| 72 | + * @param data Allocated component data. |
| 73 | + */ |
| 74 | +void prv_camera_component_init(void* data); |
| 75 | + |
| 76 | +/** |
| 77 | + * Returns `true` if some properties of the camera changed |
| 78 | + * and view and projection matrices need to be recalculated. |
| 79 | + * |
| 80 | + * @remark This function is used by the camera system. |
| 81 | + * |
| 82 | + * @param comp Component. |
| 83 | + * |
| 84 | + * @return `true` if changed. |
| 85 | + */ |
| 86 | +bool prv_camera_is_properties_changed(struct te_camera_component* comp); |
| 87 | + |
| 88 | +/** |
| 89 | + * Sets `false` to @ref prv_camera_is_properties_changed. |
| 90 | + * |
| 91 | + * @remark This function is used by the camera system. |
| 92 | + * |
| 93 | + * @param comp Component. |
| 94 | + */ |
| 95 | +void prv_camera_reset_properties_changed_flag(struct te_camera_component* comp); |
0 commit comments