From 13c92a77d3646f6574ff34fdd02481679ca874ac Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Wed, 21 May 2014 11:49:31 +0900 Subject: Freestyle: Fix for Z normalization in SilhouetteGeomEngine. The Z component of the projected point in the 2D image space has already been normalized in GeomUtils::fromWorldToImage(). --- .../blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp') diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp index 00814c29776..aa5bc5a4a71 100644 --- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp +++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp @@ -140,12 +140,8 @@ void SilhouetteGeomEngine::ProjectSilhouette(vector& ioVertices) real max = -HUGE; #endif vector::iterator sv, svend; - const real depth = _zfar - _znear; - const real fac = (depth < 1.0e-6) ? 1.0 : 1.0 / depth; - for (sv = ioVertices.begin(), svend = ioVertices.end(); sv != svend; sv++) { GeomUtils::fromWorldToImage((*sv)->point3D(), newPoint, _modelViewMatrix, _projectionMatrix, _viewport); - newPoint[2] = (-newPoint[2] - _znear) * fac; // normalize Z between 0 and 1 (*sv)->setPoint2D(newPoint); #if 0 cerr << (*sv)->point2d().z() << " "; @@ -173,10 +169,7 @@ void SilhouetteGeomEngine::ProjectSilhouette(SVertex *ioVertex) real max = -HUGE; vector::iterator sv, svend; #endif - const real depth = _zfar - _znear; - const real fac = (depth < 1.0e-6) ? 1.0 : 1.0 / depth; GeomUtils::fromWorldToImage(ioVertex->point3D(), newPoint, _modelViewMatrix, _projectionMatrix, _viewport); - newPoint[2] = (-newPoint[2] - _znear) * fac; // normalize Z between 0 and 1 ioVertex->setPoint2D(newPoint); } @@ -311,11 +304,8 @@ iter: Vec3r SilhouetteGeomEngine::WorldToImage(const Vec3r& M) { - const real depth = _zfar - _znear; - const real fac = (depth < 1.0e-6) ? 1.0 : 1.0 / depth; Vec3r newPoint; GeomUtils::fromWorldToImage(M, newPoint, _transform, _viewport); - newPoint[2] = (-newPoint[2] - _znear) * fac; // normalize Z between 0 and 1 return newPoint; } -- cgit v1.2.3