From bd92aea926d66cdb2548fbdd7e8d8b28208fad6d Mon Sep 17 00:00:00 2001 From: Maxime Curioni Date: Tue, 4 Aug 2009 00:40:36 +0000 Subject: SUMMARY: The main contribution of this commit is the possibility to save Freestyle configuration information inside .blend files. It required an extensive refactoring of the previous interface code. The code has been tested and does not crash on my machine. If you encounter issues, please let me know (and if possible, sending me an sample .blend file). DETAILS: - refactored code to notify Freestyle when adding/removing render layers (FRS_freestyle_config.{h,cpp}) - corrected the freeing of style modules when files are read from / written to disk - moved Freestyle configuration information into scene renderlayers, to allow loading / saving .blend files (DNA_scene_types.h DNA_freestyle_types.h FRS_freestyle.cpp) - inserted temporary trick to prevent crashes when orthographic camera is used (SilhouetteGeomEngine.cpp), but outputting incorrect feature line calculations --- source/blender/freestyle/intern/geometry/GeomUtils.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'source/blender/freestyle/intern/geometry') diff --git a/source/blender/freestyle/intern/geometry/GeomUtils.cpp b/source/blender/freestyle/intern/geometry/GeomUtils.cpp index fd36e81ca77..88aafeed598 100755 --- a/source/blender/freestyle/intern/geometry/GeomUtils.cpp +++ b/source/blender/freestyle/intern/geometry/GeomUtils.cpp @@ -619,11 +619,21 @@ namespace GeomUtils { void fromRetinaToCamera(const Vec3r& p, Vec3r& q, - real z, + real focal, const real projection_matrix[4][4]) { - q[0] = (-p[0] * z) / projection_matrix[0][0]; - q[1] = (-p[1] * z) / projection_matrix[1][1]; - q[2] = z; + + if( projection_matrix[3][3] == 0.0 ) // perspective + { + q[0] = (-p[0] * focal) / projection_matrix[0][0]; + q[1] = (-p[1] * focal) / projection_matrix[1][1]; + q[2] = focal; + } + else // orthogonal + { + q[0] = p[0] / projection_matrix[0][0]; + q[1] = p[1] / projection_matrix[1][1]; + q[2] = focal; + } } void fromCameraToWorld(const Vec3r& p, -- cgit v1.2.3