[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50362] trunk/blender/source/blender/ collada: fix:32348 Collada yfov to xfov conversion fo camera settings
Gaia Clary
gaia.clary at machinimatrix.org
Mon Sep 3 19:54:04 CEST 2012
Revision: 50362
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50362
Author: gaiaclary
Date: 2012-09-03 17:54:04 +0000 (Mon, 03 Sep 2012)
Log Message:
-----------
fix:32348 Collada yfov to xfov conversion fo camera settings
Modified Paths:
--------------
trunk/blender/source/blender/collada/AnimationImporter.cpp
trunk/blender/source/blender/collada/DocumentImporter.cpp
Modified: trunk/blender/source/blender/collada/AnimationImporter.cpp
===================================================================
--- trunk/blender/source/blender/collada/AnimationImporter.cpp 2012-09-03 17:41:49 UTC (rev 50361)
+++ trunk/blender/source/blender/collada/AnimationImporter.cpp 2012-09-03 17:54:04 UTC (rev 50362)
@@ -683,12 +683,11 @@
for (unsigned int i = 0; i < fcu->totvert; i++) {
double input_fov = fcu->bezt[i].vec[1][1];
- double xfov = (fov_type == CAMERA_YFOV) ? aspect * input_fov : input_fov;
- // fov is in degrees, cam->lens is in millimiters
- double fov = fov_to_focallength(DEG2RADF(input_fov), cam->sensor_x);
+ // NOTE: Needs more testing (As we curretnly have no official test data for this)
+ double xfov = (fov_type == CAMERA_YFOV) ? (2.0f * atanf(aspect * tanf(DEG2RADF(input_fov) * 0.5f))) : DEG2RADF(input_fov);
- fcu->bezt[i].vec[1][1] = fov;
+ fcu->bezt[i].vec[1][1] = fov_to_focallength(xfov, cam->sensor_x);
}
BLI_addtail(AnimCurves, fcu);
Modified: trunk/blender/source/blender/collada/DocumentImporter.cpp
===================================================================
--- trunk/blender/source/blender/collada/DocumentImporter.cpp 2012-09-03 17:41:49 UTC (rev 50361)
+++ trunk/blender/source/blender/collada/DocumentImporter.cpp 2012-09-03 17:54:04 UTC (rev 50362)
@@ -867,9 +867,11 @@
{
double yfov = camera->getYFov().getValue();
double aspect = camera->getAspectRatio().getValue();
- double xfov = aspect * yfov;
- // xfov is in degrees, cam->lens is in millimiters
- cam->lens = fov_to_focallength(DEG2RADF(xfov), cam->sensor_x);
+
+ // NOTE: Needs more testing (As we curretnly have no official test data for this)
+
+ double xfov = 2.0f * atanf(aspect * tanf(DEG2RADF(yfov) * 0.5f));
+ cam->lens = fov_to_focallength(xfov, cam->sensor_x);
}
break;
}
More information about the Bf-blender-cvs
mailing list