* Made a quickupdate method to run through only entities that have scheduled themselves for updates looking for changes. This runs 10 times a second.
* Set the massively slow UpdateEntities method to run every 2 seconds instead of 10 times a second. This method runs through *all* of the entities can calls the virtual update(). * Documented some of the code in the scene.Update method.ThreadPoolClientBranch
parent
ca78c3ef0d
commit
932a132116
|
@ -62,6 +62,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
protected RegionInfo m_regInfo;
|
||||
protected Scene m_parentScene;
|
||||
protected PermissionManager PermissionsMngr;
|
||||
protected List<EntityBase> m_updateList = new List<EntityBase>();
|
||||
protected int m_numRootAgents = 0;
|
||||
protected int m_numPrim = 0;
|
||||
protected int m_numChildAgents = 0;
|
||||
|
@ -146,6 +147,15 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
internal void UpdatePresences()
|
||||
{
|
||||
List<ScenePresence> updateScenePresences = GetScenePresences();
|
||||
foreach (ScenePresence pres in updateScenePresences)
|
||||
{
|
||||
pres.Update();
|
||||
}
|
||||
}
|
||||
|
||||
internal float UpdatePhysics(double elapsed)
|
||||
{
|
||||
lock (m_syncRoot)
|
||||
|
@ -194,6 +204,29 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
internal void AddToUpdateList(EntityBase obj)
|
||||
{
|
||||
lock (m_updateList)
|
||||
{
|
||||
if (!m_updateList.Contains(obj))
|
||||
{
|
||||
m_updateList.Add(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void ProcessUpdates()
|
||||
{
|
||||
lock (m_updateList)
|
||||
{
|
||||
for (int i = 0; i < m_updateList.Count; i++)
|
||||
{
|
||||
m_updateList[i].Update();
|
||||
}
|
||||
m_updateList.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddPhysicalPrim(int number)
|
||||
{
|
||||
m_physicalPrim++;
|
||||
|
|
|
@ -120,7 +120,9 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
private int m_update_physics = 1;
|
||||
private int m_update_entitymovement = 1;
|
||||
private int m_update_entities = 1;
|
||||
private int m_update_entities = 20; // Run through all objects checking for updates
|
||||
private int m_update_entitiesquick = 1; // Run through objects that have scheduled updates checking for updates
|
||||
private int m_update_presences = 1; // Update scene presence movements
|
||||
private int m_update_events = 1;
|
||||
private int m_update_backup = 200;
|
||||
private int m_update_terrain = 50;
|
||||
|
@ -706,9 +708,19 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
physicsMS += physicsMS2;
|
||||
|
||||
otherMS = System.Environment.TickCount;
|
||||
// run through all entities looking for updates (slow)
|
||||
if (m_frame % m_update_entities == 0)
|
||||
m_innerScene.UpdateEntities();
|
||||
|
||||
// run through entities that have scheduled themselves for
|
||||
// updates looking for updates(faster)
|
||||
if (m_frame % m_update_entitiesquick == 0)
|
||||
m_innerScene.ProcessUpdates();
|
||||
|
||||
// Run through scenepresences looking for updates
|
||||
if (m_frame % m_update_presences == 0)
|
||||
m_innerScene.UpdatePresences();
|
||||
|
||||
if (m_frame % m_update_events == 0)
|
||||
UpdateEvents();
|
||||
|
||||
|
@ -1167,6 +1179,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
// if not phantom, add to physics
|
||||
sceneOb.ApplyPhysics(m_physicalPrim);
|
||||
m_innerScene.AddToUpdateList(sceneOb);
|
||||
|
||||
return sceneOb;
|
||||
}
|
||||
|
|
|
@ -765,6 +765,11 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void QueueForUpdateCheck()
|
||||
{
|
||||
m_scene.m_innerScene.AddToUpdateList(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
|
@ -1079,6 +1079,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
if (m_parentGroup != null)
|
||||
{
|
||||
m_parentGroup.HasGroupChanged = true;
|
||||
m_parentGroup.QueueForUpdateCheck();
|
||||
}
|
||||
TimeStampFull = (uint) Util.UnixTimeSinceEpoch();
|
||||
m_updateFlag = 2;
|
||||
|
@ -1120,9 +1121,11 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
if (m_parentGroup != null)
|
||||
{
|
||||
m_parentGroup.HasGroupChanged = true;
|
||||
m_parentGroup.QueueForUpdateCheck();
|
||||
}
|
||||
TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
|
||||
m_updateFlag = 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue