Merge branch 'future'
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
#include "llregionhandle.h"
|
||||
#include "llsurface.h"
|
||||
#include "llviewercamera.h"
|
||||
#include "llviewertexture.h"
|
||||
#include "llviewertexturelist.h"
|
||||
#include "llviewernetwork.h"
|
||||
#include "llviewerobjectlist.h"
|
||||
@@ -54,6 +55,7 @@
|
||||
#include "llviewerstats.h"
|
||||
#include "llvlcomposition.h"
|
||||
#include "llvoavatar.h"
|
||||
#include "llvocache.h"
|
||||
#include "llvowater.h"
|
||||
#include "message.h"
|
||||
#include "pipeline.h"
|
||||
@@ -129,6 +131,10 @@ void LLWorld::destroyClass()
|
||||
LLViewerRegion* region_to_delete = *region_it++;
|
||||
removeRegion(region_to_delete->getHost());
|
||||
}
|
||||
if(LLVOCache::hasInstance())
|
||||
{
|
||||
LLVOCache::getInstance()->destroyClass() ;
|
||||
}
|
||||
LLViewerPartSim::getInstance()->destroyClass();
|
||||
}
|
||||
|
||||
@@ -267,6 +273,7 @@ void LLWorld::removeRegion(const LLHost &host)
|
||||
llwarns << "Disabling region " << regionp->getName() << " that agent is in!" << llendl;
|
||||
LLAppViewer::instance()->forceDisconnect("You have been disconnected from the region you were in.");
|
||||
|
||||
regionp->saveObjectCache() ; //force to save objects here in case that the object cache is about to be destroyed.
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -281,6 +288,10 @@ void LLWorld::removeRegion(const LLHost &host)
|
||||
delete regionp;
|
||||
|
||||
updateWaterObjects();
|
||||
|
||||
//double check all objects of this region are removed.
|
||||
gObjectList.clearAllMapObjectsInRegion(regionp) ;
|
||||
//llassert_always(!gObjectList.hasMapObjectInRegion(regionp)) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -431,9 +442,9 @@ BOOL LLWorld::positionRegionValidGlobal(const LLVector3d &pos_global)
|
||||
|
||||
|
||||
// Allow objects to go up to their radius underground.
|
||||
F32 LLWorld::getMinAllowedZ(LLViewerObject* object)
|
||||
F32 LLWorld::getMinAllowedZ(LLViewerObject* object, const LLVector3d &global_pos)
|
||||
{
|
||||
F32 land_height = resolveLandHeightGlobal(object->getPositionGlobal());
|
||||
F32 land_height = resolveLandHeightGlobal(global_pos);
|
||||
F32 radius = 0.5f * object->getScale().length();
|
||||
return land_height - radius;
|
||||
}
|
||||
@@ -596,7 +607,7 @@ void LLWorld::updateVisibilities()
|
||||
region_list_t::iterator curiter = iter++;
|
||||
LLViewerRegion* regionp = *curiter;
|
||||
F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ();
|
||||
F32 radius = 0.5f*fsqrtf(height * height + diagonal_squared);
|
||||
F32 radius = 0.5f*(F32) sqrt(height * height + diagonal_squared);
|
||||
if (!regionp->getLand().hasZData()
|
||||
|| LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius))
|
||||
{
|
||||
@@ -617,7 +628,7 @@ void LLWorld::updateVisibilities()
|
||||
}
|
||||
|
||||
F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ();
|
||||
F32 radius = 0.5f*fsqrtf(height * height + diagonal_squared);
|
||||
F32 radius = 0.5f*(F32) sqrt(height * height + diagonal_squared);
|
||||
if (LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius))
|
||||
{
|
||||
regionp->calculateCameraDistance();
|
||||
@@ -645,8 +656,8 @@ void LLWorld::updateRegions(F32 max_update_time)
|
||||
BOOL did_one = FALSE;
|
||||
|
||||
// Perform idle time updates for the regions (and associated surfaces)
|
||||
for (region_list_t::iterator iter = mRegionList.begin();
|
||||
iter != mRegionList.end(); ++iter)
|
||||
for (region_list_t::iterator iter = mActiveRegionList.begin()/*mRegionList.begin()*/;
|
||||
iter != mActiveRegionList.end()/*mRegionList.end()*/; ++iter)
|
||||
{
|
||||
LLViewerRegion* regionp = *iter;
|
||||
F32 max_time = max_update_time - update_timer.getElapsedTimeF32();
|
||||
@@ -1400,21 +1411,23 @@ void send_agent_resume()
|
||||
LLAppViewer::instance()->resumeMainloopTimeout();
|
||||
}
|
||||
|
||||
static LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3d& region_origin)
|
||||
{
|
||||
LLVector3d pos_global(region_origin);
|
||||
LLVector3d pos_local;
|
||||
|
||||
pos_local.mdV[VZ] = (compact_local & 0xFFU) * 4;
|
||||
pos_local.mdV[VY] = (compact_local >> 8) & 0xFFU;
|
||||
pos_local.mdV[VX] = (compact_local >> 16) & 0xFFU;
|
||||
|
||||
pos_global += pos_local;
|
||||
return pos_global;
|
||||
static LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3d& region_origin)
|
||||
{
|
||||
LLVector3d pos_global(region_origin);
|
||||
LLVector3d pos_local;
|
||||
|
||||
pos_local.mdV[VZ] = (compact_local & 0xFFU) * 4;
|
||||
pos_local.mdV[VY] = (compact_local >> 8) & 0xFFU;
|
||||
pos_local.mdV[VX] = (compact_local >> 16) & 0xFFU;
|
||||
|
||||
pos_global += pos_local;
|
||||
return pos_global;
|
||||
}
|
||||
|
||||
void LLWorld::getAvatars(std::vector<LLUUID>* avatar_ids, std::vector<LLVector3d>* positions, const LLVector3d& relative_to, F32 radius) const
|
||||
{
|
||||
F32 radius_squared = radius * radius;
|
||||
|
||||
if(avatar_ids != NULL)
|
||||
{
|
||||
avatar_ids->clear();
|
||||
@@ -1423,6 +1436,33 @@ void LLWorld::getAvatars(std::vector<LLUUID>* avatar_ids, std::vector<LLVector3d
|
||||
{
|
||||
positions->clear();
|
||||
}
|
||||
// get the list of avatars from the character list first, so distances are correct
|
||||
// when agent is above 1020m and other avatars are nearby
|
||||
for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
|
||||
iter != LLCharacter::sInstances.end(); ++iter)
|
||||
{
|
||||
LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter;
|
||||
if(!pVOAvatar->isDead() && !pVOAvatar->isSelf())
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// region avatars added for situations where radius is greater than RenderFarClip
|
||||
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
|
||||
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
|
||||
{
|
||||
@@ -1432,50 +1472,16 @@ void LLWorld::getAvatars(std::vector<LLUUID>* avatar_ids, std::vector<LLVector3d
|
||||
for (S32 i = 0; i < count; i++)
|
||||
{
|
||||
LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.get(i), origin_global);
|
||||
if(dist_vec(pos_global, relative_to) <= radius)
|
||||
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(regionp->mMapAvatarIDs.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// retrieve the list of close avatars from viewer objects as well
|
||||
// for when we are above 1000m, only do this when we are retrieving
|
||||
// uuid's too as there could be duplicates
|
||||
if(avatar_ids != NULL)
|
||||
{
|
||||
for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
|
||||
iter != LLCharacter::sInstances.end(); ++iter)
|
||||
{
|
||||
LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter;
|
||||
if(pVOAvatar->isDead() || pVOAvatar->isSelf())
|
||||
continue;
|
||||
LLUUID uuid = pVOAvatar->getID();
|
||||
if(uuid.isNull())
|
||||
continue;
|
||||
LLVector3d pos_global = pVOAvatar->getPositionGlobal();
|
||||
if(dist_vec(pos_global, relative_to) <= radius)
|
||||
{
|
||||
bool found = false;
|
||||
uuid_vec_t::iterator sel_iter = avatar_ids->begin();
|
||||
for (; sel_iter != avatar_ids->end(); sel_iter++)
|
||||
{
|
||||
if(*sel_iter == uuid)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found)
|
||||
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(positions != NULL)
|
||||
{
|
||||
positions->push_back(pos_global);
|
||||
}
|
||||
avatar_ids->push_back(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user