diff options
author | Maxime Curioni <maxime.curioni@gmail.com> | 2009-08-04 04:40:36 +0400 |
---|---|---|
committer | Maxime Curioni <maxime.curioni@gmail.com> | 2009-08-04 04:40:36 +0400 |
commit | bd92aea926d66cdb2548fbdd7e8d8b28208fad6d (patch) | |
tree | a146154c1310427608a393d6325dcc3c1929765f /source/blender/freestyle/intern/geometry/GeomUtils.cpp | |
parent | ff110c17f705976435ee14f2cde9c85f7334a56c (diff) |
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
Diffstat (limited to 'source/blender/freestyle/intern/geometry/GeomUtils.cpp')
-rwxr-xr-x | source/blender/freestyle/intern/geometry/GeomUtils.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
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, |