summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2013-11-13 22:38:19 -0700
committerXiaohong Bao <bao@lindenlab.com>2013-11-13 22:38:19 -0700
commit6a0a5c18e33be6889f12a9954861c446acb9113b (patch)
tree9733dddb830eeae2981213ca3c1d5fadb77d9ab7
parent754a671c93f55c3e1cde6cd2ee0771156f7abaf5 (diff)
more fix for SH-4607: Create new object cache tuning parameters
fix remote objects not showing up.
-rwxr-xr-xindra/llmath/llcamera.cpp28
-rwxr-xr-xindra/llmath/llcamera.h2
-rwxr-xr-xindra/newview/llvocache.cpp2
3 files changed, 28 insertions, 4 deletions
diff --git a/indra/llmath/llcamera.cpp b/indra/llmath/llcamera.cpp
index 4d1ee15661..ff90532f75 100755
--- a/indra/llmath/llcamera.cpp
+++ b/indra/llmath/llcamera.cpp
@@ -629,8 +629,24 @@ void LLCamera::calcAgentFrustumPlanes(LLVector3* frust)
//calculate regional planes from mAgentPlanes.
//vector "shift" is the vector of the region origin in the agent space.
-void LLCamera::calcRegionFrustumPlanes(const LLVector3& shift)
+void LLCamera::calcRegionFrustumPlanes(const LLVector3& shift, F32 far_clip_distance)
{
+ F32 far_w;
+ {
+ LLVector3 p = getOrigin();
+ LLVector3 n(mAgentPlanes[5][0], mAgentPlanes[5][1], mAgentPlanes[5][2]);
+ F32 dd = n * p;
+ if(dd + mAgentPlanes[5][3] < 0) //signed distance
+ {
+ far_w = -far_clip_distance - dd;
+ }
+ else
+ {
+ far_w = far_clip_distance - dd;
+ }
+ far_w += n * shift;
+ }
+
F32 d;
LLVector3 n;
for(S32 i = 0 ; i < 7; i++)
@@ -638,7 +654,15 @@ void LLCamera::calcRegionFrustumPlanes(const LLVector3& shift)
if (mPlaneMask[i] != 0xff)
{
n.setVec(mAgentPlanes[i][0], mAgentPlanes[i][1], mAgentPlanes[i][2]);
- d = mAgentPlanes[i][3] + n * shift;
+
+ if(i != 5)
+ {
+ d = mAgentPlanes[i][3] + n * shift;
+ }
+ else
+ {
+ d = far_w;
+ }
mRegionPlanes[i].setVec(n, d);
}
}
diff --git a/indra/llmath/llcamera.h b/indra/llmath/llcamera.h
index 946f9f8d84..321b8ddcc4 100755
--- a/indra/llmath/llcamera.h
+++ b/indra/llmath/llcamera.h
@@ -194,7 +194,7 @@ public:
// Return number of bytes copied.
size_t readFrustumFromBuffer(const char *buffer);
void calcAgentFrustumPlanes(LLVector3* frust);
- void calcRegionFrustumPlanes(const LLVector3& shift); //calculate regional planes from mAgentPlanes.
+ void calcRegionFrustumPlanes(const LLVector3& shift, F32 far_clip_distance); //calculate regional planes from mAgentPlanes.
void ignoreAgentFrustumPlane(S32 idx);
// Returns 1 if partly in, 2 if fully in.
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index 92a8f7b18e..8c28d9e440 100755
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -865,7 +865,7 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion)
//localize the camera
LLVector3 region_agent = mRegionp->getOriginAgent();
- camera.calcRegionFrustumPlanes(region_agent);
+ camera.calcRegionFrustumPlanes(region_agent, gAgentCamera.mDrawDistance);
mFrontCull = TRUE;
LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, do_occlusion && use_object_cache_occlusion,