From e1247d631f24065a31d9668915cb8bc84f3abc7f Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 18 Dec 2012 14:36:46 -0700 Subject: fix for SH-3619: some objects are missing --- indra/llmath/llcamera.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/llmath/llcamera.h') diff --git a/indra/llmath/llcamera.h b/indra/llmath/llcamera.h index 0b591be622..898d73ed7e 100644 --- a/indra/llmath/llcamera.h +++ b/indra/llmath/llcamera.h @@ -109,6 +109,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 U8 mPlaneMask[8]; // 8 for alignment F32 mView; // angle between top and bottom frustum planes in radians. @@ -178,6 +179,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 ignoreAgentFrustumPlane(S32 idx); // Returns 1 if partly in, 2 if fully in. @@ -186,8 +188,10 @@ public: S32 sphereInFrustum(const LLVector3 ¢er, const F32 radius) const; S32 pointInFrustum(const LLVector3 &point) const { return sphereInFrustum(point, 0.0f); } S32 sphereInFrustumFull(const LLVector3 ¢er, const F32 radius) const { return sphereInFrustum(center, radius); } - S32 AABBInFrustum(const LLVector4a& center, const LLVector4a& radius); - S32 AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius); + S32 AABBInFrustum(const LLVector4a& center, const LLVector4a& radius, const LLPlane* planes = NULL); + S32 AABBInRegionFrustum(const LLVector4a& center, const LLVector4a& radius); + S32 AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius, const LLPlane* planes = NULL); + S32 AABBInRegionFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius); //does a quick 'n dirty sphere-sphere check S32 sphereInFrustumQuick(const LLVector3 &sphere_center, const F32 radius); -- cgit v1.3 From 4cca9ba279f908f206fa5e32adccf1038f05cc7f Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 29 Jul 2013 10:15:10 -0600 Subject: fix for SH-4293: texture console takes a while to settle down on Interesting viewer. --- indra/llmath/llcamera.cpp | 16 ++++++++++++++++ indra/llmath/llcamera.h | 2 ++ indra/llmath/llplane.h | 8 +++++++- indra/newview/llviewerregion.cpp | 4 +++- indra/newview/llviewerregion.h | 1 + indra/newview/llvocache.cpp | 10 +++------- indra/newview/llvocache.h | 1 + indra/newview/llworld.cpp | 5 +++++ 8 files changed, 38 insertions(+), 9 deletions(-) (limited to 'indra/llmath/llcamera.h') 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 ¢er, 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); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index b80d87ef07..cd8466d948 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -87,6 +87,7 @@ const F32 CAP_REQUEST_TIMEOUT = 18; const S32 MAX_CAP_REQUEST_ATTEMPTS = 30; BOOL LLViewerRegion::sVOCacheCullingEnabled = FALSE; +S32 LLViewerRegion::sLastCameraUpdated = 0; typedef std::map CapabilityMap; @@ -992,6 +993,7 @@ void LLViewerRegion::removeFromVOCacheTree(LLVOCacheEntry* entry) } mImpl->mVOCachePartition->removeEntry(entry->getEntry()); + entry->mLastCameraUpdated = sLastCameraUpdated; } //add the visible entries @@ -1219,7 +1221,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) iter = mImpl->mActiveSet.begin(); } - if(!(*iter)->isRecentlyVisible()) + if(!(*iter)->isRecentlyVisible() && (*iter)->mLastCameraUpdated != sLastCameraUpdated) { killObject((*iter), delete_list); } diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 29483662e8..2ac934d19c 100755 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -411,6 +411,7 @@ public: LLDynamicArray mMapAvatarIDs; static BOOL sVOCacheCullingEnabled; //vo cache culling enabled or not. + static S32 sLastCameraUpdated; private: LLViewerRegionImpl * mImpl; LLFrameTimer mRegionTimer; diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 69c32db13e..6e0243e985 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -219,18 +219,14 @@ void LLVOCacheEntry::setState(U32 state) if(getState() == ACTIVE) { - const S32 MIN_REAVTIVE_INTERVAL = 32; + const S32 MIN_REAVTIVE_INTERVAL = 128; U32 last_visible = getVisible(); setVisible(); - if(getVisible() - last_visible < MIN_REAVTIVE_INTERVAL + mMinFrameRange) + if(getVisible() - last_visible > MIN_REAVTIVE_INTERVAL + mMinFrameRange) { - mMinFrameRange = llmin(mMinFrameRange * 2, getInvisibleObjectsLiveTime() * 32); - } - else - { - mMinFrameRange = getInvisibleObjectsLiveTime(); //reset + mLastCameraUpdated = 0; //reset } } } diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 0248298eb5..816ef88dc4 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -130,6 +130,7 @@ public: typedef std::set vocache_entry_set_t; typedef std::set vocache_entry_priority_list_t; + S32 mLastCameraUpdated; protected: U32 mLocalID; U32 mParentID; diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 3dfe4c5e5f..ea0e38824b 100755 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -666,6 +666,11 @@ void LLWorld::updateRegions(F32 max_update_time) LLTimer update_timer; BOOL did_one = FALSE; + if(LLViewerCamera::getInstance()->isChanged()) + { + LLViewerRegion::sLastCameraUpdated = LLViewerOctreeEntryData::getCurrentFrame(); + } + // Perform idle time updates for the regions (and associated surfaces) for (region_list_t::iterator iter = mRegionList.begin(); iter != mRegionList.end(); ++iter) -- cgit v1.3 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/llmath/llcamera.h') 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.3