twn_draw: draw_camera_unproject()

This commit is contained in:
veclavtalica
2025-03-07 19:31:31 +03:00
parent 733a1786ab
commit 923cd81571
3 changed files with 176 additions and 0 deletions

View File

@ -100,6 +100,20 @@ TWN_API void draw_camera(Vec3 position, /* optional, default: (0, 0, 0)
float zoom, /* optional, default: 1 */
float draw_distance); /* optional, default: 100 */
/* find position and looking direction of a 2d point into 3d space */
/* make sure it's called with matching parameters to last draw_camera(), if you need them to match */
typedef struct DrawCameraUnprojectResult {
Vec3 position;
Vec3 direction;
} DrawCameraUnprojectResult;
TWN_API DrawCameraUnprojectResult draw_camera_unproject(Vec2 point,
Vec3 position,
Vec3 direction,
Vec3 up,
float fov,
float zoom,
float draw_distance);
/* 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) */
/* return value is direction and up vectors, so that you can use them in logic (such as controllers) */