From 6a0a5c18e33be6889f12a9954861c446acb9113b Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 13 Nov 2013 22:38:19 -0700 Subject: more fix for SH-4607: Create new object cache tuning parameters fix remote objects not showing up. --- indra/llmath/llcamera.cpp | 28 ++++++++++++++++++++++++++-- indra/llmath/llcamera.h | 2 +- indra/newview/llvocache.cpp | 2 +- 3 files changed, 28 insertions(+), 4 deletions(-) (limited to 'indra') 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, -- cgit v1.2.3