summaryrefslogtreecommitdiff
path: root/indra/llmath
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmath')
-rwxr-xr-xindra/llmath/llcamera.cpp16
-rwxr-xr-xindra/llmath/llcamera.h2
-rwxr-xr-xindra/llmath/llplane.h8
3 files changed, 25 insertions, 1 deletions
diff --git a/indra/llmath/llcamera.cpp b/indra/llmath/llcamera.cpp
index 054afd3e95..6a1e3804be 100755
--- a/indra/llmath/llcamera.cpp
+++ b/indra/llmath/llcamera.cpp
@@ -161,6 +161,22 @@ size_t LLCamera::readFrustumFromBuffer(const char *buffer)
// ---------------- test methods ----------------
+bool LLCamera::isChanged()
+{
+ bool changed = false;
+ for (U32 i = 0; i < mPlaneCount; i++)
+ {
+ U8 mask = mPlaneMask[i];
+ if (mask != 0xff && !changed)
+ {
+ changed = !mAgentPlanes[i].equal(mLastAgentPlanes[i]);
+ }
+ mLastAgentPlanes[i].set(mAgentPlanes[i]);
+ }
+
+ return changed;
+}
+
S32 LLCamera::AABBInFrustum(const LLVector4a &center, const LLVector4a& radius, const LLPlane* planes)
{
static const LLVector4a scaler[] = {
diff --git a/indra/llmath/llcamera.h b/indra/llmath/llcamera.h
index 898d73ed7e..a7cdcff4ac 100755
--- a/indra/llmath/llcamera.h
+++ b/indra/llmath/llcamera.h
@@ -110,6 +110,7 @@ public:
private:
LL_ALIGN_16(LLPlane mAgentPlanes[7]); //frustum planes in agent space a la gluUnproject (I'm a bastard, I know) - DaveP
LL_ALIGN_16(LLPlane mRegionPlanes[7]); //frustum planes in a local region space, derived from mAgentPlanes
+ LL_ALIGN_16(LLPlane mLastAgentPlanes[7]);
U8 mPlaneMask[8]; // 8 for alignment
F32 mView; // angle between top and bottom frustum planes in radians.
@@ -138,6 +139,7 @@ public:
LLCamera(F32 vertical_fov_rads, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane);
virtual ~LLCamera();
+ bool isChanged(); //check if mAgentPlanes changed since last frame.
void setUserClipPlane(LLPlane& plane);
void disableUserClipPlane();
diff --git a/indra/llmath/llplane.h b/indra/llmath/llplane.h
index 3c32441b11..64a3eed0e5 100755
--- a/indra/llmath/llplane.h
+++ b/indra/llmath/llplane.h
@@ -93,7 +93,13 @@ public:
{
return mV.greaterEqual(LLVector4a::getZero()).getGatheredBits() & LLVector4Logical::MASK_XYZ;
}
-
+
+ //check if two planes are nearly same
+ bool equal(const LLPlane& p) const
+ {
+ return mV.equals4(p.mV);
+ }
+
private:
LLVector4a mV;
} LL_ALIGN_POSTFIX(16);