take taints check terrain out of Onframe event and add a new event for it. Slow it down to 1/4 heartbeat rate (once every 363ms aprox)
parent
c7f148ee64
commit
b82b16c954
|
@ -229,11 +229,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
}
|
||||
|
||||
m_scene.RegisterModuleInterface<ITerrainModule>(this);
|
||||
m_scene.EventManager.OnFrame += EventManager_OnFrame;
|
||||
m_scene.EventManager.OnNewClient += EventManager_OnNewClient;
|
||||
m_scene.EventManager.OnClientClosed += EventManager_OnClientClosed;
|
||||
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
|
||||
m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick;
|
||||
m_scene.EventManager.OnTerrainCheckUpdates += EventManager_TerrainCheckUpdates;
|
||||
}
|
||||
|
||||
InstallDefaultEffects();
|
||||
|
@ -272,7 +272,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
// remove the commands
|
||||
m_scene.UnregisterModuleCommander(m_commander.Name);
|
||||
// remove the event-handlers
|
||||
m_scene.EventManager.OnFrame -= EventManager_OnFrame;
|
||||
m_scene.EventManager.OnTerrainCheckUpdates -= EventManager_TerrainCheckUpdates;
|
||||
m_scene.EventManager.OnTerrainTick -= EventManager_OnTerrainTick;
|
||||
m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole;
|
||||
m_scene.EventManager.OnClientClosed -= EventManager_OnClientClosed;
|
||||
|
@ -759,13 +759,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called before processing of every simulation frame.
|
||||
/// This is used to check to see of any of the terrain is tainted and, if so, schedule
|
||||
/// updates for all the presences.
|
||||
/// This also checks to see if there are updates that need to be sent for each presence.
|
||||
/// This is where the logic is to send terrain updates to clients.
|
||||
/// </summary>
|
||||
private void EventManager_OnFrame()
|
||||
private void EventManager_TerrainCheckUpdates()
|
||||
{
|
||||
// this needs fixing
|
||||
TerrainData terrData = m_channel.GetTerrainData();
|
||||
|
@ -775,7 +774,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
{
|
||||
for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize)
|
||||
{
|
||||
if (terrData.IsTaintedAt(x, y))
|
||||
if (terrData.IsTaintedAt(x, y,true))
|
||||
{
|
||||
// Found a patch that was modified. Push this flag into the clients.
|
||||
SendToClients(terrData, x, y);
|
||||
|
|
|
@ -80,6 +80,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public event OnTerrainTaintedDelegate OnTerrainTainted;
|
||||
|
||||
public delegate void OnTerrainTickDelegate();
|
||||
public delegate void OnTerrainCheckUpdatesDelegate();
|
||||
|
||||
/// <summary>
|
||||
/// Triggered if the terrain has been edited
|
||||
|
@ -89,6 +90,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// but is used by core solely to update the physics engine.
|
||||
/// </remarks>
|
||||
public event OnTerrainTickDelegate OnTerrainTick;
|
||||
public event OnTerrainCheckUpdatesDelegate OnTerrainCheckUpdates;
|
||||
|
||||
public delegate void OnTerrainUpdateDelegate();
|
||||
|
||||
|
@ -1484,6 +1486,27 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void TriggerTerrainCheckUpdates()
|
||||
{
|
||||
OnTerrainCheckUpdatesDelegate TerrainCheckUpdates = OnTerrainCheckUpdates;
|
||||
if (TerrainCheckUpdates != null)
|
||||
{
|
||||
foreach (OnTerrainCheckUpdatesDelegate d in TerrainCheckUpdates.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
d();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[EVENT MANAGER]: Delegate for TerrainCheckUpdates failed - continuing. {0} {1}",
|
||||
e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerTerrainTainted()
|
||||
{
|
||||
OnTerrainTaintedDelegate handlerTerrainTainted = OnTerrainTainted;
|
||||
|
|
|
@ -245,8 +245,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
get { return m_defaultDrawDistance; }
|
||||
}
|
||||
|
||||
// protected float m_maxDrawDistance = 512.0f;
|
||||
protected float m_maxDrawDistance = 256.0f;
|
||||
protected float m_maxDrawDistance = 512.0f;
|
||||
// protected float m_maxDrawDistance = 256.0f;
|
||||
public float MaxDrawDistance
|
||||
{
|
||||
get { return m_maxDrawDistance; }
|
||||
|
@ -1581,13 +1581,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
EventManager.TriggerRegionHeartbeatStart(this);
|
||||
|
||||
// Apply taints in terrain module to terrain in physics scene
|
||||
|
||||
tmpMS = Util.EnvironmentTickCount();
|
||||
if (Frame % 4 == 0)
|
||||
{
|
||||
CheckTerrainUpdates();
|
||||
}
|
||||
|
||||
if (Frame % m_update_terrain == 0)
|
||||
{
|
||||
tmpMS = Util.EnvironmentTickCount();
|
||||
UpdateTerrain();
|
||||
terrainMS = Util.EnvironmentTickCountSubtract(tmpMS);
|
||||
}
|
||||
|
||||
terrainMS = Util.EnvironmentTickCountSubtract(tmpMS);
|
||||
|
||||
tmpMS = Util.EnvironmentTickCount();
|
||||
if (PhysicsEnabled && Frame % m_update_physics == 0)
|
||||
m_sceneGraph.UpdatePreparePhysics();
|
||||
|
@ -1809,6 +1816,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
EventManager.TriggerTerrainTick();
|
||||
}
|
||||
|
||||
private void CheckTerrainUpdates()
|
||||
{
|
||||
EventManager.TriggerTerrainCheckUpdates();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Back up queued up changes
|
||||
/// </summary>
|
||||
|
@ -5880,11 +5892,12 @@ Environment.Exit(1);
|
|||
/// or corssing the broder walking, but will NOT prevent
|
||||
/// child agent creation, thereby emulating the SL behavior.
|
||||
/// </remarks>
|
||||
/// <param name='agentID'></param>
|
||||
/// <param name='agentID'>The visitor's User ID</param>
|
||||
/// <param name="agentHomeURI">The visitor's Home URI (may be null)</param>
|
||||
/// <param name='position'></param>
|
||||
/// <param name='reason'></param>
|
||||
/// <returns></returns>
|
||||
public bool QueryAccess(UUID agentID, Vector3 position, out string reason)
|
||||
public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string reason)
|
||||
{
|
||||
reason = "You are banned from the region";
|
||||
|
||||
|
@ -5894,6 +5907,10 @@ Environment.Exit(1);
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
// if (!AllowAvatarCrossing && !viaTeleport)
|
||||
// return false;
|
||||
|
||||
// FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check.
|
||||
// However, the long term fix is to make sure root agent count is always accurate.
|
||||
m_sceneGraph.RecalculateStats();
|
||||
|
|
Loading…
Reference in New Issue