reuse draw_camera() in axial variant
This commit is contained in:
parent
e9f8dbebbf
commit
1818532ec9
@ -491,31 +491,19 @@ DrawCameraFromPrincipalAxesResult draw_camera_from_principal_axes(Vec3 position,
|
|||||||
sincosf(yaw + (float)M_PI_2, &yaws, &yawc);
|
sincosf(yaw + (float)M_PI_2, &yaws, &yawc);
|
||||||
sincosf(pitch, &pitchs, &pitchc);
|
sincosf(pitch, &pitchs, &pitchc);
|
||||||
|
|
||||||
Camera const camera = {
|
Vec3 const direction = vec3_norm(((Vec3){
|
||||||
.fov = fov,
|
|
||||||
.pos = position,
|
|
||||||
.target = vec3_norm(((Vec3){
|
|
||||||
yawc * pitchc,
|
yawc * pitchc,
|
||||||
pitchs,
|
pitchs,
|
||||||
yaws * pitchc,
|
yaws * pitchc,
|
||||||
})),
|
}));
|
||||||
.up = (Vec3){0, 1, 0},
|
|
||||||
.viewbox = {
|
|
||||||
(Vec2){ 1/-zoom, 1/zoom },
|
|
||||||
(Vec2){ 1/zoom, 1/-zoom }
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!orthographic)
|
Vec3 const up = (Vec3){0, 1, 0};
|
||||||
camera_projection_matrix = camera_perspective(&camera);
|
|
||||||
else
|
|
||||||
camera_projection_matrix = camera_orthographic(&camera);
|
|
||||||
|
|
||||||
camera_look_at_matrix = camera_look_at(&camera);
|
draw_camera(position, direction, up, fov, zoom);
|
||||||
|
|
||||||
return (DrawCameraFromPrincipalAxesResult) {
|
return (DrawCameraFromPrincipalAxesResult) {
|
||||||
.direction = camera.target,
|
.direction = direction,
|
||||||
.up = camera.up,
|
.up = up,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user