FIRE-19563: Add support for OpenSim VarRegion width scaling in CoarseLocationUpdate message

This should have no effect on default 256m x 256m sized regions. Regions that
are not using the standard size are currently broken anyway, so the result
will just be a different form of broken if the region is running on a simulator
not supporting this feature yet.
meow-7.2.2
Ansariel 2016-07-07 13:46:00 +02:00
parent 98d74e0a91
commit 4ef3081fca
4 changed files with 26 additions and 10 deletions

View File

@ -1634,7 +1634,7 @@ void LLAvatarActions::getScriptInfo(const LLUUID& idAgent)
// Defined in llworld.cpp
LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3d& region_origin);
LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3d& region_origin, F32 width_scale_factorscale_factor);
// static - Checked: 2010-12-03 (Catznip-2.4.0g) | Added: Catznip-2.4.0g
bool getRegionAndPosGlobalFromAgentID(const LLUUID& idAgent, const LLViewerRegion** ppRegion, LLVector3d* pPosGlobal)
@ -1663,7 +1663,7 @@ bool getRegionAndPosGlobalFromAgentID(const LLUUID& idAgent, const LLViewerRegio
if (ppRegion)
*ppRegion = pRegion;
if (pPosGlobal)
*pPosGlobal = unpackLocalToGlobalPosition(pRegion->mMapAvatars.at(idxRegionAgent), pRegion->getOriginGlobal());
*pPosGlobal = unpackLocalToGlobalPosition(pRegion->mMapAvatars.at(idxRegionAgent), pRegion->getOriginGlobal(), pRegion->getWidthScaleFactor());
return (NULL != pRegion);
}
}

View File

@ -551,7 +551,8 @@ LLViewerRegion::LLViewerRegion(const U64 &handle,
mInvisibilityCheckHistory(-1),
mPaused(FALSE),
// <FS:CR> Aurora Sim
mWidth(region_width_meters)
mWidth(region_width_meters),
mWidthScaleFactor(region_width_meters / REGION_WIDTH_METERS) // <FS:Ansariel> FIRE-19563: Scaling for OpenSim VarRegions
{
// Moved this up... -> mWidth = region_width_meters;
// </FS:CR>
@ -2176,8 +2177,12 @@ public:
if(i == target_index)
{
LLVector3d global_pos(region->getOriginGlobal());
global_pos.mdV[VX] += (F64)x;
global_pos.mdV[VY] += (F64)y;
// <FS:Ansariel> FIRE-19563: Scaling for OpenSim VarRegions
//global_pos.mdV[VX] += (F64)x;
//global_pos.mdV[VY] += (F64)y;
global_pos.mdV[VX] += (F64)x * region->getWidthScaleFactor();
global_pos.mdV[VY] += (F64)y * region->getWidthScaleFactor();
// </FS:Ansariel>
global_pos.mdV[VZ] += (F64)z * 4.0;
LLAvatarTracker::instance().setTrackedCoarseLocation(global_pos);
}
@ -2251,8 +2256,12 @@ void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg)
if(i == target_index)
{
LLVector3d global_pos(mImpl->mOriginGlobal);
global_pos.mdV[VX] += (F64)(x_pos);
global_pos.mdV[VY] += (F64)(y_pos);
// <FS:Ansariel> FIRE-19563: Scaling for OpenSim VarRegions
//global_pos.mdV[VX] += (F64)(x_pos);
//global_pos.mdV[VY] += (F64)(y_pos);
global_pos.mdV[VX] += (F64)(x_pos) * mWidthScaleFactor;
global_pos.mdV[VY] += (F64)(y_pos) * mWidthScaleFactor;
// </FS:Ansariel>
global_pos.mdV[VZ] += (F64)(z_pos) * 4.0;
LLAvatarTracker::instance().setTrackedCoarseLocation(global_pos);
}

View File

@ -240,6 +240,7 @@ public:
void setCacheID(const LLUUID& id);
F32 getWidth() const { return mWidth; }
F32 getWidthScaleFactor() const { return mWidthScaleFactor; } // <FS:Ansariel> FIRE-19563: Scaling for OpenSim VarRegions
void idleUpdate(F32 max_update_time);
void lightIdleUpdate();
@ -495,6 +496,7 @@ private:
U64 mHandle;
F32 mTimeDilation; // time dilation of physics simulation on simulator
S32 mLastUpdate; //last time called idleUpdate()
F32 mWidthScaleFactor; // <FS:Ansariel> FIRE-19563: Scaling for OpenSim VarRegions
// simulator name
std::string mName;

View File

@ -1746,7 +1746,7 @@ void send_agent_resume()
//static LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3d& region_origin)
// [SL:KB] - Patch: UI-SidepanelPeople | Checked: 2010-12-03 (Catznip-2.4.0g) | Added: Catznip-2.4.0g
LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3d& region_origin)
LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3d& region_origin, F32 width_scale_factor)
// [/SL:KB]
{
LLVector3d pos_local;
@ -1755,6 +1755,11 @@ LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3d& regi
pos_local.mdV[VY] = (compact_local >> 8) & 0xFFU;
pos_local.mdV[VX] = (compact_local >> 16) & 0xFFU;
// <FS:Ansariel> FIRE-19563: Scaling for OpenSim VarRegions
pos_local.mdV[VX] *= width_scale_factor;
pos_local.mdV[VY] *= width_scale_factor;
// </FS:Ansariel>
return region_origin + pos_local;
}
@ -1817,7 +1822,7 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi
// <FS:Ansariel>
//LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.at(i), origin_global);
U32 compact_local = regionp->mMapAvatars.at(i);
LLVector3d pos_global = unpackLocalToGlobalPosition(compact_local, origin_global);
LLVector3d pos_global = unpackLocalToGlobalPosition(compact_local, origin_global, regionp->getWidthScaleFactor());
// </FS:Ansariel>
if(dist_vec_squared(pos_global, relative_to) <= radius_squared)
{
@ -1874,7 +1879,7 @@ bool LLWorld::getAvatar(const LLUUID& idAvatar, LLVector3d& posAvatar) const
{
if (idAvatar == pRegion->mMapAvatarIDs[idxAgent])
{
posAvatar = unpackLocalToGlobalPosition(pRegion->mMapAvatars[idxAgent], pRegion->getOriginGlobal());
posAvatar = unpackLocalToGlobalPosition(pRegion->mMapAvatars[idxAgent], pRegion->getOriginGlobal(), pRegion->getWidthScaleFactor());
return true;
}
}