Merge pull request #4886 from shimaowo/fix_gltf2_camera_fov
Fix: fix incorrect math for calculating the horizontal FOV of a perspective camera in gltf2 import #4435pull/4887/head^2
commit
a9ce8a967d
|
@ -853,7 +853,7 @@ void glTF2Importer::ImportCameras(glTF2::Asset &r) {
|
|||
|
||||
if (cam.type == Camera::Perspective) {
|
||||
aicam->mAspect = cam.cameraProperties.perspective.aspectRatio;
|
||||
aicam->mHorizontalFOV = cam.cameraProperties.perspective.yfov * ((aicam->mAspect == 0.f) ? 1.f : aicam->mAspect);
|
||||
aicam->mHorizontalFOV = 2.0f * std::atan(std::tan(cam.cameraProperties.perspective.yfov * 0.5f) * ((aicam->mAspect == 0.f) ? 1.f : aicam->mAspect));
|
||||
aicam->mClipPlaneFar = cam.cameraProperties.perspective.zfar;
|
||||
aicam->mClipPlaneNear = cam.cameraProperties.perspective.znear;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue