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(pitch, &pitchs, &pitchc);
|
||||
|
||||
Camera const camera = {
|
||||
.fov = fov,
|
||||
.pos = position,
|
||||
.target = vec3_norm(((Vec3){
|
||||
yawc * pitchc,
|
||||
pitchs,
|
||||
yaws * pitchc,
|
||||
})),
|
||||
.up = (Vec3){0, 1, 0},
|
||||
.viewbox = {
|
||||
(Vec2){ 1/-zoom, 1/zoom },
|
||||
(Vec2){ 1/zoom, 1/-zoom }
|
||||
},
|
||||
};
|
||||
Vec3 const direction = vec3_norm(((Vec3){
|
||||
yawc * pitchc,
|
||||
pitchs,
|
||||
yaws * pitchc,
|
||||
}));
|
||||
|
||||
if (!orthographic)
|
||||
camera_projection_matrix = camera_perspective(&camera);
|
||||
else
|
||||
camera_projection_matrix = camera_orthographic(&camera);
|
||||
Vec3 const up = (Vec3){0, 1, 0};
|
||||
|
||||
camera_look_at_matrix = camera_look_at(&camera);
|
||||
draw_camera(position, direction, up, fov, zoom);
|
||||
|
||||
return (DrawCameraFromPrincipalAxesResult) {
|
||||
.direction = camera.target,
|
||||
.up = camera.up,
|
||||
.direction = direction,
|
||||
.up = up,
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user