From 01ac74e4ad223b0b9a000fa9158355bf02615c7c Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Wed, 21 May 2014 11:38:14 +0900 Subject: Freestyle: Added utility function SilhouetteGeomEngine::CameraToImage(). TODO: Fix for Z normalization in SilhouetteGeomEngine methods. --- source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp | 8 ++++++++ source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h | 3 +++ 2 files changed, 11 insertions(+) (limited to 'source') diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp index ee885f29211..00814c29776 100644 --- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp +++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp @@ -319,4 +319,12 @@ Vec3r SilhouetteGeomEngine::WorldToImage(const Vec3r& M) return newPoint; } +Vec3r SilhouetteGeomEngine::CameraToImage(const Vec3r& M) +{ + Vec3r newPoint, p; + GeomUtils::fromCameraToRetina(M, p, _projectionMatrix); + GeomUtils::fromRetinaToImage(p, newPoint, _viewport); + return newPoint; +} + } /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h index 1234c028ca1..e4bf1517512 100644 --- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h +++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h @@ -131,6 +131,9 @@ public: /*! From world to image */ static Vec3r WorldToImage(const Vec3r& M); + /*! From camera to image */ + static Vec3r CameraToImage(const Vec3r& M); + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:SilhouetteGeomEngine") #endif -- cgit v1.2.3