Merge branch 'master' into careminster-presence-refactor
commit
2cc07de0ba
|
@ -577,11 +577,13 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
public ISceneEntity Entity;
|
public ISceneEntity Entity;
|
||||||
public PrimUpdateFlags Flags;
|
public PrimUpdateFlags Flags;
|
||||||
|
public float TimeDilation;
|
||||||
|
|
||||||
public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags)
|
public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, float timedilation)
|
||||||
{
|
{
|
||||||
Entity = entity;
|
Entity = entity;
|
||||||
Flags = flags;
|
Flags = flags;
|
||||||
|
TimeDilation = timedilation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3591,7 +3591,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
double priority = m_prioritizer.GetUpdatePriority(this, entity);
|
double priority = m_prioritizer.GetUpdatePriority(this, entity);
|
||||||
|
|
||||||
lock (m_entityUpdates.SyncRoot)
|
lock (m_entityUpdates.SyncRoot)
|
||||||
m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId);
|
m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation), entity.LocalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessEntityUpdates(int maxUpdates)
|
private void ProcessEntityUpdates(int maxUpdates)
|
||||||
|
@ -3604,6 +3604,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
if (maxUpdates <= 0) maxUpdates = Int32.MaxValue;
|
if (maxUpdates <= 0) maxUpdates = Int32.MaxValue;
|
||||||
int updatesThisCall = 0;
|
int updatesThisCall = 0;
|
||||||
|
|
||||||
|
float avgTimeDilation = 0;
|
||||||
|
|
||||||
EntityUpdate update;
|
EntityUpdate update;
|
||||||
while (updatesThisCall < maxUpdates)
|
while (updatesThisCall < maxUpdates)
|
||||||
{
|
{
|
||||||
|
@ -3611,6 +3613,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
if (!m_entityUpdates.TryDequeue(out update))
|
if (!m_entityUpdates.TryDequeue(out update))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
avgTimeDilation += update.TimeDilation;
|
||||||
|
avgTimeDilation *= 0.5f;
|
||||||
|
|
||||||
if (update.Entity is SceneObjectPart)
|
if (update.Entity is SceneObjectPart)
|
||||||
{
|
{
|
||||||
SceneObjectPart part = (SceneObjectPart)update.Entity;
|
SceneObjectPart part = (SceneObjectPart)update.Entity;
|
||||||
|
@ -3790,8 +3795,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
#region Packet Sending
|
#region Packet Sending
|
||||||
|
|
||||||
const float TIME_DILATION = 1.0f;
|
const float TIME_DILATION = 1.0f;
|
||||||
ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f);
|
ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f);
|
||||||
|
|
||||||
if (terseAgentUpdateBlocks.IsValueCreated)
|
if (terseAgentUpdateBlocks.IsValueCreated)
|
||||||
{
|
{
|
||||||
List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value;
|
List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> blocks = terseAgentUpdateBlocks.Value;
|
||||||
|
@ -3830,7 +3835,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
|
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
|
||||||
packet.RegionData.TimeDilation = timeDilation;
|
packet.RegionData.TimeDilation = timeDilation;
|
||||||
packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
|
packet.ObjectData = new ObjectUpdateCompressedPacket.ObjectDataBlock[blocks.Count];
|
||||||
|
|
||||||
for (int i = 0; i < blocks.Count; i++)
|
for (int i = 0; i < blocks.Count; i++)
|
||||||
packet.ObjectData[i] = blocks[i];
|
packet.ObjectData[i] = blocks[i];
|
||||||
|
|
||||||
|
|
|
@ -105,12 +105,11 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This should not be here
|
if (Requests.ContainsKey(fileName))
|
||||||
//if (Requests.ContainsKey(fileName))
|
{
|
||||||
//{
|
RequestXfer(Requests[fileName].remoteClient, Requests[fileName].xferID, fileName);
|
||||||
// RequestXfer(Requests[fileName].remoteClient, Requests[fileName].xferID, fileName);
|
Requests.Remove(fileName);
|
||||||
// Requests.Remove(fileName);
|
}
|
||||||
//}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,6 +287,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
private OdePrim cp1;
|
private OdePrim cp1;
|
||||||
private OdeCharacter cc2;
|
private OdeCharacter cc2;
|
||||||
private OdePrim cp2;
|
private OdePrim cp2;
|
||||||
|
private int tickCountFrameRun;
|
||||||
|
|
||||||
|
private int latertickcount=0;
|
||||||
//private int cStartStop = 0;
|
//private int cStartStop = 0;
|
||||||
//private string cDictKey = "";
|
//private string cDictKey = "";
|
||||||
|
|
||||||
|
@ -3123,6 +3126,22 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
}
|
}
|
||||||
d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix);
|
d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix);
|
||||||
}
|
}
|
||||||
|
latertickcount = Util.EnvironmentTickCount() - tickCountFrameRun;
|
||||||
|
|
||||||
|
// OpenSimulator above does 10 fps. 10 fps = means that the main thread loop and physics
|
||||||
|
// has a max of 100 ms to run theoretically.
|
||||||
|
// If the main loop stalls, it calls Simulate later which makes the tick count ms larger.
|
||||||
|
// If Physics stalls, it takes longer which makes the tick count ms larger.
|
||||||
|
|
||||||
|
if (latertickcount < 100)
|
||||||
|
m_timeDilation = 1.0f;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_timeDilation = 100f / latertickcount;
|
||||||
|
//m_timeDilation = Math.Min((Math.Max(100 - (Util.EnvironmentTickCount() - tickCountFrameRun), 1) / 100f), 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
tickCountFrameRun = Util.EnvironmentTickCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
return fps;
|
return fps;
|
||||||
|
|
Loading…
Reference in New Issue