orthographic projection for fov=0, rework of order and defaults for 3d camera api

This commit is contained in:
veclavtalica
2025-01-27 02:42:36 +03:00
parent 20394eed6c
commit 791ab628ca
5 changed files with 63 additions and 22 deletions

View File

@ -79,7 +79,11 @@ TWN_API void draw_billboard(const char *texture,
bool cylindrical); /* optional, default: false */
/* sets a perspective 3d camera to be used for all 3d commands */
TWN_API void draw_camera(Vec3 position, float fov, Vec3 up, Vec3 direction);
/* fov = 0 corresponds to orthographic projection */
TWN_API void draw_camera(Vec3 position,
Vec3 direction, /* optional, default: (0, 0, -1) */
Vec3 up, /* optional, default: (0, 1, 0) */
float fov); /* optional, default: PI / 6 * 3 (90 degrees) */
/* same as draw_camera(), but with first person controller in mind */
/* direction and up vectors are inferred from roll, pitch and yaw parameters (in radians) */
@ -88,11 +92,12 @@ typedef struct DrawCameraFromPrincipalAxesResult {
Vec3 direction;
Vec3 up;
} DrawCameraFromPrincipalAxesResult;
TWN_API DrawCameraFromPrincipalAxesResult draw_camera_from_principal_axes(Vec3 position,
float fov,
float roll,
float pitch,
float yaw);
TWN_API DrawCameraFromPrincipalAxesResult
draw_camera_from_principal_axes(Vec3 position,
float roll, /* optional, default: 0 */
float pitch, /* optional, default: 0 */
float yaw, /* optional, default: 0 */
float fov); /* optional, default: PI / 6 * 3 (90 degrees) */
/* expects '*' masks that will be expanded to 6 names: 'up', 'down', 'east', 'west', 'north' and 'south' */
TWN_API void draw_skybox(const char *textures);