mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 02:36:00 +08:00
Converted the LSL scripting engine into a IRegionModule, so now all "modules" share a common base interface and are loaded from the single loader. (It seems to work fine, but I have left the old scriptengine loader, incase we have to change back).
Removed the reference to OpenJpeg in the DynamicTextureModule, to see if that was causing the build problem someone is having. Added a Temporary fix for the "existing connection was forcibly closed by the remote host" exception on windows when a user logs out of a multiregion instance. Some early work to prepare for improving the way clients are updated (about prims etc).
This commit is contained in:
@@ -44,6 +44,9 @@ namespace OpenSim.Region.Environment
|
||||
LoadedModules.Add(avatarProfiles);
|
||||
|
||||
this.LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene);
|
||||
|
||||
string lslPath = System.IO.Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll");
|
||||
this.LoadRegionModule(lslPath, "LSLScriptingModule", scene);
|
||||
}
|
||||
|
||||
public void LoadDefaultSharedModules(string exceptModules)
|
||||
|
||||
@@ -5,7 +5,6 @@ using System.Threading;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using libsecondlife;
|
||||
using OpenJPEGNet;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
|
||||
@@ -44,6 +44,7 @@ using OpenSim.Framework.Communications.Caches;
|
||||
using OpenSim.Region.Environment.LandManagement;
|
||||
using OpenSim.Region.Environment;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Types;
|
||||
using OpenSim.Region.Terrain;
|
||||
using OpenSim.Framework.Data;
|
||||
using Caps = OpenSim.Region.Capabilities.Caps;
|
||||
@@ -72,6 +73,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
private int m_timePhase = 24;
|
||||
private int m_timeUpdateCount;
|
||||
|
||||
public BasicQuadTreeNode QuadTree;
|
||||
|
||||
private Mutex updateLock;
|
||||
|
||||
protected ModuleLoader m_moduleLoader;
|
||||
@@ -178,6 +181,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
|
||||
m_eventManager.OnPermissionError += SendPermissionAlert;
|
||||
|
||||
QuadTree = new BasicQuadTreeNode(null, 0, 0, 256, 256);
|
||||
QuadTree.Subdivide();
|
||||
QuadTree.Subdivide();
|
||||
|
||||
MainLog.Instance.Verbose("Creating new entitities instance");
|
||||
Entities = new Dictionary<LLUUID, EntityBase>();
|
||||
Avatars = new Dictionary<LLUUID, ScenePresence>();
|
||||
@@ -596,6 +603,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
{
|
||||
if (!Entities.ContainsKey(sceneObject.UUID))
|
||||
{
|
||||
QuadTree.AddObject(sceneObject);
|
||||
Entities.Add(sceneObject.UUID, sceneObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
|
||||
protected byte[] m_particleSystem = new byte[0];
|
||||
|
||||
public uint TimeStampFull = 0;
|
||||
public uint TimeStampTerse = 0;
|
||||
|
||||
protected SceneObjectGroup m_parentGroup;
|
||||
|
||||
/// <summary>
|
||||
@@ -366,6 +369,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
{
|
||||
m_parentGroup.HasChanged = true;
|
||||
}
|
||||
this.TimeStampFull =(uint) Util.UnixTimeSinceEpoch();
|
||||
m_updateFlag = 2;
|
||||
}
|
||||
|
||||
@@ -380,6 +384,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
{
|
||||
m_parentGroup.HasChanged = true;
|
||||
}
|
||||
this.TimeStampTerse = (uint)Util.UnixTimeSinceEpoch();
|
||||
m_updateFlag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,11 +88,13 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
public delegate void SignificantClientMovement(IClientAPI remote_client);
|
||||
public event SignificantClientMovement OnSignificantClientMovement;
|
||||
|
||||
public List<SceneObjectGroup> InterestList = new List<SceneObjectGroup>();
|
||||
|
||||
// private Queue<SceneObjectGroup> m_fullGroupUpdates = new Queue<SceneObjectGroup>();
|
||||
// private Queue<SceneObjectGroup> m_terseGroupUpdates = new Queue<SceneObjectGroup>();
|
||||
|
||||
private Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>();
|
||||
private Queue<SceneObjectPart> m_teserPartUpdates = new Queue<SceneObjectPart>();
|
||||
private Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>();
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
@@ -201,7 +203,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
|
||||
public void AddTersePart(SceneObjectPart part)
|
||||
{
|
||||
m_teserPartUpdates.Enqueue(part);
|
||||
m_tersePartUpdates.Enqueue(part);
|
||||
}
|
||||
|
||||
public void AddFullPart(SceneObjectPart part)
|
||||
@@ -211,18 +213,18 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
|
||||
public void SendPrimUpdates()
|
||||
{
|
||||
if (m_teserPartUpdates.Count > 0)
|
||||
if (m_tersePartUpdates.Count > 0)
|
||||
{
|
||||
bool terse = true;
|
||||
int terseCount = 0;
|
||||
|
||||
while (terse)
|
||||
{
|
||||
SceneObjectPart part = m_teserPartUpdates.Dequeue();
|
||||
SceneObjectPart part = m_tersePartUpdates.Dequeue();
|
||||
part.SendTerseUpdate(this.ControllingClient);
|
||||
terseCount++;
|
||||
|
||||
if ((m_teserPartUpdates.Count < 1) |(terseCount > 30))
|
||||
if ((m_tersePartUpdates.Count < 1) |(terseCount > 30))
|
||||
{
|
||||
terse = false;
|
||||
}
|
||||
|
||||
167
OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
Normal file
167
OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs
Normal file
@@ -0,0 +1,167 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Environment.Types
|
||||
{
|
||||
public class BasicQuadTreeNode
|
||||
{
|
||||
private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>();
|
||||
private BasicQuadTreeNode[] m_childNodes = null;
|
||||
private BasicQuadTreeNode m_parent = null;
|
||||
|
||||
private short m_leftX;
|
||||
private short m_leftY;
|
||||
private short m_width;
|
||||
private short m_height;
|
||||
|
||||
public BasicQuadTreeNode(BasicQuadTreeNode parent, short leftX, short leftY, short width, short height)
|
||||
{
|
||||
m_parent = parent;
|
||||
m_leftX = leftX;
|
||||
m_leftY = leftY;
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
}
|
||||
|
||||
public void AddObject(SceneObjectGroup obj)
|
||||
{
|
||||
if (m_childNodes == null)
|
||||
{
|
||||
if (!m_objects.Contains(obj))
|
||||
{
|
||||
m_objects.Add(obj);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2)))
|
||||
{
|
||||
if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2)))
|
||||
{
|
||||
m_childNodes[0].AddObject(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_childNodes[2].AddObject(obj);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2)))
|
||||
{
|
||||
m_childNodes[1].AddObject(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_childNodes[3].AddObject(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Subdivide()
|
||||
{
|
||||
if (m_childNodes == null)
|
||||
{
|
||||
m_childNodes = new BasicQuadTreeNode[4];
|
||||
m_childNodes[0] = new BasicQuadTreeNode(this, m_leftX, m_leftY,(short) (m_width / 2), (short)( m_height / 2));
|
||||
m_childNodes[1] = new BasicQuadTreeNode(this,(short)( m_leftX + (m_width / 2)), m_leftY,(short)( m_width / 2),(short) (m_height / 2));
|
||||
m_childNodes[2] = new BasicQuadTreeNode(this, m_leftX, (short)( m_leftY + (m_height / 2)), (short)(m_width / 2),(short)( m_height / 2));
|
||||
m_childNodes[3] = new BasicQuadTreeNode(this, (short)( m_leftX + (m_width / 2)),(short)( m_height + (m_height / 2)),(short)( m_width / 2), (short)(m_height / 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < m_childNodes.Length; i++)
|
||||
{
|
||||
m_childNodes[i].Subdivide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<SceneObjectGroup> GetObjectsFrom(int x, int y)
|
||||
{
|
||||
if (m_childNodes == null)
|
||||
{
|
||||
return m_objects;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x < (m_leftX + (m_width / 2)))
|
||||
{
|
||||
if (y < (m_leftY + (m_height / 2)))
|
||||
{
|
||||
return m_childNodes[0].GetObjectsFrom(x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_childNodes[2].GetObjectsFrom(x, y);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (y < (m_leftY + (m_height / 2)))
|
||||
{
|
||||
return m_childNodes[1].GetObjectsFrom(x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_childNodes[3].GetObjectsFrom(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (m_childNodes != null)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
m_childNodes[i].Update();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>();
|
||||
foreach (SceneObjectGroup group in m_objects)
|
||||
{
|
||||
if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
|
||||
{
|
||||
//still in bounds
|
||||
}
|
||||
else
|
||||
{
|
||||
outBounds.Add(group);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (SceneObjectGroup removee in outBounds)
|
||||
{
|
||||
m_objects.Remove(removee);
|
||||
if (m_parent != null)
|
||||
{
|
||||
m_parent.PassUp(removee);
|
||||
}
|
||||
}
|
||||
outBounds.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void PassUp(SceneObjectGroup group)
|
||||
{
|
||||
if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
|
||||
{
|
||||
this.AddObject(group);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_parent != null)
|
||||
{
|
||||
m_parent.PassUp(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
OpenSim/Region/Environment/Types/UpdateQueue.cs
Normal file
21
OpenSim/Region/Environment/Types/UpdateQueue.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using libsecondlife;
|
||||
|
||||
namespace OpenSim.Region.Environment.Types
|
||||
{
|
||||
public class UpdateQueue
|
||||
{
|
||||
private Queue<SceneObjectPart> m_queue;
|
||||
|
||||
private List<LLUUID> m_ids;
|
||||
|
||||
public UpdateQueue()
|
||||
{
|
||||
m_queue = new Queue<SceneObjectPart>();
|
||||
m_ids = new List<LLUUID>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user