[Opentnl-cvs] tnl/zap barrier.cpp,1.2,1.3
Brought to you by:
mark_frohnmayer,
s_alanet
From: Ben G. <s_a...@us...> - 2004-04-21 01:57:15
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15475/zap Modified Files: barrier.cpp Log Message: Fix to barrier calculations to get rid of "gaps." Index: barrier.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/barrier.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** barrier.cpp 20 Apr 2004 08:51:29 -0000 1.2 --- barrier.cpp 21 Apr 2004 01:57:06 -0000 1.3 *************** *** 163,167 **** Point rp1 = mRenderLineSegments[i]; Point rp2 = mRenderLineSegments[i + 1]; ! Point cp1 = polyPoints[polyPoints.size() - 1]; for(S32 j = 0; j < polyPoints.size(); j++) --- 163,179 ---- Point rp1 = mRenderLineSegments[i]; Point rp2 = mRenderLineSegments[i + 1]; ! ! /* Point cp1 = polyPoints[polyPoints.size() - 1]; ! for(S32 j = 0; j < polyPoints.size(); j++) ! { ! Point cp2 = polyPoints[j]; ! Point ce = cp2 - cp1; ! ! // If we're collinear, just don't clip ! ! cp1 = cp2; ! } */ ! ! Point cp1 = polyPoints[polyPoints.size() - 1]; for(S32 j = 0; j < polyPoints.size(); j++) *************** *** 180,184 **** bool d2in = d2 > distToZero; ! if(!d1in && !d2in) // both points are outside this edge of the poly, so... { // add them to the render poly --- 192,206 ---- bool d2in = d2 > distToZero; ! // collinearity check ! Point a = ce; ! Point b = rp2-rp1; ! a.normalize(); ! b.normalize(); ! F32 v = a.dot(b); ! ! // And locality check ! F32 lc = getMin( getMin( (cp1 - rp1).len(), (cp1 - rp2).len() ), getMin( (cp2 - rp1).len(), (cp2 - rp2).len() )); ! ! if(!d1in && !d2in || (v >= 1.f && lc < 0.1)) // both points are outside this edge of the poly, so... { // add them to the render poly *************** *** 208,212 **** // if both are in, just go to the next edge. - cp1 = cp2; } --- 230,233 ---- |