From a464fed6ae27556f19581986b6a4f428c07ed911 Mon Sep 17 00:00:00 2001 From: ponchio Date: Mon, 22 Nov 2010 16:48:02 +0000 Subject: [PATCH] IsOutside returns distance now. (and 0 if inside :) --- wrap/gui/frustum.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wrap/gui/frustum.h b/wrap/gui/frustum.h index e0627879..6baada09 100644 --- a/wrap/gui/frustum.h +++ b/wrap/gui/frustum.h @@ -71,7 +71,7 @@ public: T Resolution(float dist = 1); bool IsOutside(Point3 &point); T Remoteness(Point3 &point, T radius); - bool IsOutside(Point3 &point, T radius); + T IsOutside(Point3 &point, T radius); T Distance(Point3 &point, int plane); T range(Point3 &point, T radius, T &closest, T &farthest); @@ -125,13 +125,13 @@ template T Frustum::Remoteness(Point3 &point, T radius) { return 1 + (mindist / (View::viewport[0] + View::viewport[2])); } -template bool Frustum::IsOutside(Point3 &point, T radius) { +template T Frustum::IsOutside(Point3 &point, T radius) { + T dist = 0; for(int i = 0; i < 4; i++) { - T dist = Distance(point, i); - if(dist < -radius) - return true; + T d = -Distance(point, i) - radius; + if(d > dist) dist = d; } - return false; + return dist; } template T Frustum::range(Point3 &point, T radius, T &closest, T &farthest) {