* Attempts to resolve the megaregion terrain edit rebound.
* It does this by tweaking the throttles on child agent connection to a megaregion and multiplying the land throttle by 50. (various bit and byte magic ensue) * While, I doubt this will cause terrain crater sized potholes.. since it actually increases the bandwidth available for land in child regions when MegaRegions area active, more testing would be good. * This, in theory, also shouldn't cause missing objects in child regions.. because all objects are in the root region anyway. As I said, more testing would be good.mysql-performance
parent
bca2afdb3c
commit
25544ac04a
|
@ -88,7 +88,89 @@ namespace OpenSim.Region.RegionCombinerModule
|
||||||
public void RegionLoaded(Scene scene)
|
public void RegionLoaded(Scene scene)
|
||||||
{
|
{
|
||||||
if (enabledYN)
|
if (enabledYN)
|
||||||
|
{
|
||||||
RegionLoadedDoWork(scene);
|
RegionLoadedDoWork(scene);
|
||||||
|
|
||||||
|
scene.EventManager.OnNewPresence += NewPresence;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NewPresence(ScenePresence presence)
|
||||||
|
{
|
||||||
|
if (presence.IsChildAgent)
|
||||||
|
{
|
||||||
|
byte[] throttleData;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
throttleData = presence.ControllingClient.GetThrottlesPacked(1);
|
||||||
|
}
|
||||||
|
catch (NotImplementedException)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (throttleData == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (throttleData.Length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (throttleData.Length != 28)
|
||||||
|
return;
|
||||||
|
|
||||||
|
byte[] adjData;
|
||||||
|
int pos = 0;
|
||||||
|
|
||||||
|
if (!BitConverter.IsLittleEndian)
|
||||||
|
{
|
||||||
|
byte[] newData = new byte[7 * 4];
|
||||||
|
Buffer.BlockCopy(throttleData, 0, newData, 0, 7 * 4);
|
||||||
|
|
||||||
|
for (int i = 0; i < 7; i++)
|
||||||
|
Array.Reverse(newData, i * 4, 4);
|
||||||
|
|
||||||
|
adjData = newData;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
adjData = throttleData;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 0.125f converts from bits to bytes
|
||||||
|
int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
||||||
|
int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
||||||
|
int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
||||||
|
int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
||||||
|
int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
||||||
|
int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4;
|
||||||
|
int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f);
|
||||||
|
// State is a subcategory of task that we allocate a percentage to
|
||||||
|
|
||||||
|
|
||||||
|
//int total = resend + land + wind + cloud + task + texture + asset;
|
||||||
|
|
||||||
|
byte[] data = new byte[7 * 4];
|
||||||
|
int ii = 0;
|
||||||
|
|
||||||
|
Buffer.BlockCopy(Utils.FloatToBytes(resend), 0, data, ii, 4); ii += 4;
|
||||||
|
Buffer.BlockCopy(Utils.FloatToBytes(land * 50), 0, data, ii, 4); ii += 4;
|
||||||
|
Buffer.BlockCopy(Utils.FloatToBytes(wind), 0, data, ii, 4); ii += 4;
|
||||||
|
Buffer.BlockCopy(Utils.FloatToBytes(cloud), 0, data, ii, 4); ii += 4;
|
||||||
|
Buffer.BlockCopy(Utils.FloatToBytes(task), 0, data, ii, 4); ii += 4;
|
||||||
|
Buffer.BlockCopy(Utils.FloatToBytes(texture), 0, data, ii, 4); ii += 4;
|
||||||
|
Buffer.BlockCopy(Utils.FloatToBytes(asset), 0, data, ii, 4);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
presence.ControllingClient.SetChildAgentThrottle(data);
|
||||||
|
}
|
||||||
|
catch (NotImplementedException)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RegionLoadedDoWork(Scene scene)
|
private void RegionLoadedDoWork(Scene scene)
|
||||||
|
|
Loading…
Reference in New Issue