From 42dd02fc321a52179dda89a49d4bee2e9c18be45 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 3 Jul 2016 15:47:20 +0100 Subject: scale down position X and Y acording to region size on sending coarse Updates. Viewers need to scale up by same amount. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index f9f795f..90ee1d1 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -242,6 +242,19 @@ namespace OpenSim.Region.Framework.Scenes coarseLocations = new List(); avatarUUIDs = new List(); + // coarse locations are sent as BYTE, so limited to the 255m max of normal regions + // try to work around that scale down X and Y acording to region size, so reducing the resolution + // + // viewers need to scale up + float scaleX = m_parentScene.RegionInfo.RegionSizeX / Constants.RegionSize; + if (scaleX == 0) + scaleX = 1.0f; + scaleX = 1.0f / scaleX; + float scaleY = m_parentScene.RegionInfo.RegionSizeY / Constants.RegionSize; + if (scaleY == 0) + scaleY = 1.0f; + scaleY = 1.0f / scaleY; + List presences = GetScenePresences(); for (int i = 0; i < Math.Min(presences.Count, maxLocations); ++i) { @@ -250,9 +263,11 @@ namespace OpenSim.Region.Framework.Scenes // If this presence is a child agent, we don't want its coarse locations if (sp.IsChildAgent) continue; + Vector3 pos = sp.AbsolutePosition; + pos.X *= scaleX; + pos.Y *= scaleY; - coarseLocations.Add(sp.AbsolutePosition); - + coarseLocations.Add(pos); avatarUUIDs.Add(sp.UUID); } } -- cgit v1.1