[Bf-blender-cvs] [01ac74e] master: Freestyle: Added utility function SilhouetteGeomEngine::CameraToImage().

Tamito Kajiyama noreply at git.blender.org
Wed May 21 17:47:15 CEST 2014


Commit: 01ac74e4ad223b0b9a000fa9158355bf02615c7c
Author: Tamito Kajiyama
Date:   Wed May 21 11:38:14 2014 +0900
https://developer.blender.org/rB01ac74e4ad223b0b9a000fa9158355bf02615c7c

Freestyle: Added utility function SilhouetteGeomEngine::CameraToImage().

TODO: Fix for Z normalization in SilhouetteGeomEngine methods.

===================================================================

M	source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp
M	source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h

===================================================================

diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp
index ee885f2..00814c2 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 1234c02..e4bf151 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




More information about the Bf-blender-cvs mailing list