From 34c01b6b1ff758463dcdff19782e5af668699304 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 20 Oct 2011 18:53:12 -0500 Subject: SH-2564 Fix for bad frustum culling on visible region list --- indra/newview/llworld.cpp | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'indra/newview/llworld.cpp') diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index a7ae456f3c..6f6e0d2334 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -589,22 +589,22 @@ void LLWorld::updateVisibilities() { F32 cur_far_clip = LLViewerCamera::getInstance()->getFar(); - LLViewerCamera::getInstance()->setFar(mLandFarClip); - - F32 diagonal_squared = F_SQRT2 * F_SQRT2 * mWidth * mWidth; - // Go through the culled list and check for visible regions + // Go through the culled list and check for visible regions (region is visible if land is visible) for (region_list_t::iterator iter = mCulledRegionList.begin(); iter != mCulledRegionList.end(); ) { region_list_t::iterator curiter = iter++; LLViewerRegion* regionp = *curiter; - F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ(); - F32 radius = 0.5f*(F32) sqrt(height * height + diagonal_squared); - if (!regionp->getLand().hasZData() - || LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius)) + + LLSpatialPartition* part = regionp->getSpatialPartition(LLViewerRegion::PARTITION_TERRAIN); + if (part) { - mCulledRegionList.erase(curiter); - mVisibleRegionList.push_back(regionp); + LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0); + if (LLViewerCamera::getInstance()->AABBInFrustum(group->mBounds[0], group->mBounds[1])) + { + mCulledRegionList.erase(curiter); + mVisibleRegionList.push_back(regionp); + } } } @@ -619,17 +619,20 @@ void LLWorld::updateVisibilities() continue; } - F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ(); - F32 radius = 0.5f*(F32) sqrt(height * height + diagonal_squared); - if (LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius)) + LLSpatialPartition* part = regionp->getSpatialPartition(LLViewerRegion::PARTITION_TERRAIN); + if (part) { - regionp->calculateCameraDistance(); - regionp->getLand().updatePatchVisibilities(gAgent); - } - else - { - mVisibleRegionList.erase(curiter); - mCulledRegionList.push_back(regionp); + LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0); + if (LLViewerCamera::getInstance()->AABBInFrustum(group->mBounds[0], group->mBounds[1])) + { + regionp->calculateCameraDistance(); + regionp->getLand().updatePatchVisibilities(gAgent); + } + else + { + mVisibleRegionList.erase(curiter); + mCulledRegionList.push_back(regionp); + } } } -- cgit v1.2.3 From e6f5a57395a64b8dcfe85f20b0a63402c77a3c5f Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 30 Nov 2011 11:21:22 -0700 Subject: fix for SH-2668: "ocean" water is always 20m high instead of the Region Water Height --- indra/newview/llworld.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'indra/newview/llworld.cpp') diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 6f6e0d2334..676287c0ad 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -818,14 +818,11 @@ void LLWorld::updateWaterObjects() max_x = (S32)region_x + range; max_y = (S32)region_y + range; - F32 height = 0.f; - for (region_list_t::iterator iter = mRegionList.begin(); iter != mRegionList.end(); ++iter) { LLViewerRegion* regionp = *iter; LLVOWater* waterp = regionp->getLand().getWaterObj(); - height += regionp->getWaterHeight(); if (waterp) { gObjectList.updateActive(waterp); @@ -842,6 +839,7 @@ void LLWorld::updateWaterObjects() // Now, get a list of the holes S32 x, y; + F32 water_height = gAgent.getRegion()->getWaterHeight() + 256.f; for (x = min_x; x <= max_x; x += rwidth) { for (y = min_y; y <= max_y; y += rwidth) @@ -853,7 +851,7 @@ void LLWorld::updateWaterObjects() waterp->setUseTexture(FALSE); waterp->setPositionGlobal(LLVector3d(x + rwidth/2, y + rwidth/2, - 256.f+DEFAULT_WATER_HEIGHT)); + water_height)); waterp->setScale(LLVector3((F32)rwidth, (F32)rwidth, 512.f)); gPipeline.createObject(waterp); mHoleWaterObjects.push_back(waterp); @@ -910,8 +908,7 @@ void LLWorld::updateWaterObjects() } waterp->setRegion(gAgent.getRegion()); - LLVector3d water_pos(water_center_x, water_center_y, - DEFAULT_WATER_HEIGHT+256.f); + LLVector3d water_pos(water_center_x, water_center_y, water_height) ; LLVector3 water_scale((F32) dim[0], (F32) dim[1], 512.f); //stretch out to horizon -- cgit v1.2.3 From 3b2511661e98eb5c0dbaf30ab72783b53341e03f Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 27 Jan 2012 08:33:26 -0500 Subject: STORM-1793 1) Treat all mini-map altitudes above 1020 m as the same height 2) Improve z-level accuracy With help from Aleric Inglewood --- indra/newview/llworld.cpp | 52 ++++++++++++++++------------------------------- 1 file changed, 17 insertions(+), 35 deletions(-) (limited to 'indra/newview/llworld.cpp') diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 676287c0ad..86780d0604 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1161,24 +1161,13 @@ void send_agent_resume() static LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3d& region_origin) { - LLVector3d pos_global; - LLVector3 pos_local; - U8 bits; + LLVector3d pos_local; - bits = compact_local & 0xFF; - pos_local.mV[VZ] = F32(bits) * 4.f; - compact_local >>= 8; + pos_local.mdV[VZ] = (compact_local & 0xFFU) * 4; + pos_local.mdV[VY] = (compact_local >> 8) & 0xFFU; + pos_local.mdV[VX] = (compact_local >> 16) & 0xFFU; - bits = compact_local & 0xFF; - pos_local.mV[VY] = (F32)bits; - compact_local >>= 8; - - bits = compact_local & 0xFF; - pos_local.mV[VX] = (F32)bits; - - pos_global.setVec( pos_local ); - pos_global += region_origin; - return pos_global; + return region_origin + pos_local; } void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector* positions, const LLVector3d& relative_to, F32 radius) const @@ -1199,24 +1188,17 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector* positi iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter; - if(!pVOAvatar->isDead() && !pVOAvatar->isSelf()) + LLVector3d pos_global = pVOAvatar->getPositionGlobal(); + LLUUID uuid = pVOAvatar->getID(); + if( !pVOAvatar->isDead() && + !pVOAvatar->isSelf() && + !uuid.isNull() && + dist_vec_squared(pos_global, relative_to) <= radius_squared && + positions != NULL && + avatar_ids != NULL) { - LLUUID uuid = pVOAvatar->getID(); - if(!uuid.isNull()) - { - LLVector3d pos_global = pVOAvatar->getPositionGlobal(); - if(dist_vec_squared(pos_global, relative_to) <= radius_squared) - { - if(positions != NULL) - { - positions->push_back(pos_global); - } - if(avatar_ids !=NULL) - { - avatar_ids->push_back(uuid); - } - } - } + positions->push_back(pos_global); + avatar_ids->push_back(uuid); } } // region avatars added for situations where radius is greater than RenderFarClip @@ -1233,13 +1215,13 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector* positi { LLUUID uuid = regionp->mMapAvatarIDs.get(i); // if this avatar doesn't already exist in the list, add it - if(uuid.notNull() && avatar_ids!=NULL && std::find(avatar_ids->begin(), avatar_ids->end(), uuid) == avatar_ids->end()) + if(uuid.notNull() && avatar_ids != NULL && std::find(avatar_ids->begin(), avatar_ids->end(), uuid) == avatar_ids->end()) { if(positions != NULL) { positions->push_back(pos_global); + avatar_ids->push_back(uuid); } - avatar_ids->push_back(uuid); } } } -- cgit v1.2.3 From f106ef838397f62261e7ec4e94f96848f37acf19 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 3 Feb 2012 09:02:01 -0500 Subject: STORM-1793 Fix bad assumption in getAvatars --- indra/newview/llworld.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'indra/newview/llworld.cpp') diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 86780d0604..bbe440e14f 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1193,12 +1193,17 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector* positi if( !pVOAvatar->isDead() && !pVOAvatar->isSelf() && !uuid.isNull() && - dist_vec_squared(pos_global, relative_to) <= radius_squared && - positions != NULL && - avatar_ids != NULL) - { - positions->push_back(pos_global); - avatar_ids->push_back(uuid); + dist_vec_squared(pos_global, relative_to) <= radius_squared) + { + if(positions != NULL) + { + positions->push_back(pos_global); + } + if(avatar_ids !=NULL) + { + avatar_ids->push_back(uuid); + } + } } } // region avatars added for situations where radius is greater than RenderFarClip -- cgit v1.2.3 From acb1df8b856f49b970a5756bbed24cafad127df8 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 3 Feb 2012 11:48:00 -0500 Subject: STORM-1793 Fix another logic error in getAvatars --- indra/newview/llworld.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llworld.cpp') diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index bbe440e14f..5b2e78477c 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1222,11 +1222,11 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector* positi // if this avatar doesn't already exist in the list, add it if(uuid.notNull() && avatar_ids != NULL && std::find(avatar_ids->begin(), avatar_ids->end(), uuid) == avatar_ids->end()) { - if(positions != NULL) + if (positions != NULL) { positions->push_back(pos_global); - avatar_ids->push_back(uuid); } + avatar_ids->push_back(uuid); } } } -- cgit v1.2.3 From 21f3634d29fda4ea39537102bfdcc29c37e718ba Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Mon, 6 Feb 2012 18:00:18 -0500 Subject: STORM-1793 Fix dumb syntax error --- indra/newview/llworld.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'indra/newview/llworld.cpp') diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 5b2e78477c..fbd8b3ada3 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1190,19 +1190,18 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector* positi LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter; LLVector3d pos_global = pVOAvatar->getPositionGlobal(); LLUUID uuid = pVOAvatar->getID(); - if( !pVOAvatar->isDead() && - !pVOAvatar->isSelf() && - !uuid.isNull() && + if( !pVOAvatar->isDead() + && !pVOAvatar->isSelf() + && !uuid.isNull() && dist_vec_squared(pos_global, relative_to) <= radius_squared) + { + if(positions != NULL) { - if(positions != NULL) - { - positions->push_back(pos_global); - } - if(avatar_ids !=NULL) - { - avatar_ids->push_back(uuid); - } + positions->push_back(pos_global); + } + if(avatar_ids !=NULL) + { + avatar_ids->push_back(uuid); } } } -- cgit v1.2.3 From 784ec584013eff80ab31d10370c14e2d954cea51 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 26 Apr 2012 00:40:42 +0300 Subject: MAINT-813 FIXED crash when trying to access the region info after viewer disconnect. Added checks for LLViewerRegion pointer in LLViewerObject being invalid. --- indra/newview/llworld.cpp | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'indra/newview/llworld.cpp') diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index fbd8b3ada3..3d971e738e 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1188,20 +1188,23 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector* positi iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter; - LLVector3d pos_global = pVOAvatar->getPositionGlobal(); - LLUUID uuid = pVOAvatar->getID(); - if( !pVOAvatar->isDead() - && !pVOAvatar->isSelf() - && !uuid.isNull() && - dist_vec_squared(pos_global, relative_to) <= radius_squared) + + if (!pVOAvatar->isDead() && !pVOAvatar->isSelf()) { - if(positions != NULL) - { - positions->push_back(pos_global); - } - if(avatar_ids !=NULL) + LLVector3d pos_global = pVOAvatar->getPositionGlobal(); + LLUUID uuid = pVOAvatar->getID(); + + if (!uuid.isNull() + && dist_vec_squared(pos_global, relative_to) <= radius_squared) { - avatar_ids->push_back(uuid); + if(positions != NULL) + { + positions->push_back(pos_global); + } + if(avatar_ids !=NULL) + { + avatar_ids->push_back(uuid); + } } } } @@ -1232,6 +1235,11 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector* positi } } +bool LLWorld::isRegionListed(const LLViewerRegion* region) const +{ + region_list_t::const_iterator it = find(mRegionList.begin(), mRegionList.end(), region); + return it != mRegionList.end(); +} LLHTTPRegistration gHTTPRegistrationEstablishAgentCommunication( -- cgit v1.2.3