add zoom option to camera to work around the orthographic camera
This commit is contained in:
@ -413,7 +413,7 @@ void render(void) {
|
||||
}
|
||||
|
||||
|
||||
void draw_camera(Vec3 position, Vec3 direction, Vec3 up, float fov) {
|
||||
void draw_camera(Vec3 position, Vec3 direction, Vec3 up, float fov, float zoom) {
|
||||
bool const orthographic = fabsf(0.0f - fov) < 0.00001f;
|
||||
if (!orthographic && fov >= M_PIf)
|
||||
log_warn("Invalid fov given (%f)", (double)fov);
|
||||
@ -423,6 +423,10 @@ void draw_camera(Vec3 position, Vec3 direction, Vec3 up, float fov) {
|
||||
.pos = position,
|
||||
.target = direction,
|
||||
.up = up,
|
||||
.viewbox = {
|
||||
(Vec2){ 1/-zoom, 1/zoom },
|
||||
(Vec2){ 1/zoom, 1/-zoom }
|
||||
},
|
||||
};
|
||||
|
||||
if (!orthographic)
|
||||
@ -439,7 +443,8 @@ DrawCameraFromPrincipalAxesResult draw_camera_from_principal_axes(Vec3 position,
|
||||
float roll,
|
||||
float pitch,
|
||||
float yaw,
|
||||
float fov)
|
||||
float fov,
|
||||
float zoom)
|
||||
{
|
||||
bool const orthographic = fabsf(0.0f - fov) < 0.00001f;
|
||||
if (!orthographic && fov >= M_PIf)
|
||||
@ -460,6 +465,10 @@ DrawCameraFromPrincipalAxesResult draw_camera_from_principal_axes(Vec3 position,
|
||||
yaws * pitchc,
|
||||
})),
|
||||
.up = (Vec3){0, 1, 0},
|
||||
.viewbox = {
|
||||
(Vec2){ 1/-zoom, 1/zoom },
|
||||
(Vec2){ 1/zoom, 1/-zoom }
|
||||
},
|
||||
};
|
||||
|
||||
if (!orthographic)
|
||||
|
Reference in New Issue
Block a user