From 39b64564dca0e5cb57a2a8e1b60979ccaaf11ef6 Mon Sep 17 00:00:00 2001
From: lbsa71
Date: Thu, 26 Jul 2007 14:55:42 +0000
Subject: * Started renaming world to Scene * Update and UpdateMovement now
first stores array to avoid collection update exceptions * Ignored some bins
---
OpenSim/Region/Environment/Scenes/Entity.cs | 26 ++++++------
OpenSim/Region/Environment/Scenes/EntityBase.cs | 47 ++++++----------------
OpenSim/Region/Environment/Scenes/Primitive.cs | 29 +++++--------
OpenSim/Region/Environment/Scenes/Scene.cs | 24 ++++++-----
OpenSim/Region/Environment/Scenes/SceneBase.cs | 2 +-
OpenSim/Region/Environment/Scenes/SceneObject.cs | 10 ++---
OpenSim/Region/Environment/Scenes/ScenePresence.cs | 22 +++++-----
7 files changed, 65 insertions(+), 95 deletions(-)
(limited to 'OpenSim/Region/Environment/Scenes')
diff --git a/OpenSim/Region/Environment/Scenes/Entity.cs b/OpenSim/Region/Environment/Scenes/Entity.cs
index 2456a4e..204b68f 100644
--- a/OpenSim/Region/Environment/Scenes/Entity.cs
+++ b/OpenSim/Region/Environment/Scenes/Entity.cs
@@ -31,8 +31,8 @@ using OpenSim.Physics.Manager;
namespace OpenSim.Region.Environment.Scenes
{
- public abstract class Entity :EntityBase //this class (Entity) will be phased out
- {
+ public abstract class Entity : EntityBase //this class (Entity) will be phased out
+ {
protected PhysicsActor _physActor;
///
@@ -42,7 +42,7 @@ namespace OpenSim.Region.Environment.Scenes
{
get
{
- if (this._physActor != null)
+ if (_physActor != null)
{
m_pos.X = _physActor.Position.X;
m_pos.Y = _physActor.Position.Y;
@@ -53,14 +53,13 @@ namespace OpenSim.Region.Environment.Scenes
}
set
{
- if (this._physActor != null)
+ if (_physActor != null)
{
try
{
- lock (this.m_world.SyncRoot)
+ lock (m_scene.SyncRoot)
{
-
- this._physActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
+ _physActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
}
}
catch (Exception e)
@@ -73,7 +72,7 @@ namespace OpenSim.Region.Environment.Scenes
}
}
-
+
///
///
///
@@ -81,7 +80,7 @@ namespace OpenSim.Region.Environment.Scenes
{
get
{
- if (this._physActor != null)
+ if (_physActor != null)
{
m_velocity.X = _physActor.Velocity.X;
m_velocity.Y = _physActor.Velocity.Y;
@@ -92,14 +91,13 @@ namespace OpenSim.Region.Environment.Scenes
}
set
{
- if (this._physActor != null)
+ if (_physActor != null)
{
try
{
- lock (this.m_world.SyncRoot)
+ lock (m_scene.SyncRoot)
{
-
- this._physActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
+ _physActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
}
}
catch (Exception e)
@@ -112,4 +110,4 @@ namespace OpenSim.Region.Environment.Scenes
}
}
}
-}
+}
\ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
index 0d1e3fc..08f13c2 100644
--- a/OpenSim/Region/Environment/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -11,7 +11,7 @@ namespace OpenSim.Region.Environment.Scenes
protected List m_children;
- protected Scene m_world;
+ protected Scene m_scene;
protected string m_name;
///
@@ -24,19 +24,14 @@ namespace OpenSim.Region.Environment.Scenes
}
protected LLVector3 m_pos;
+
///
///
///
public virtual LLVector3 Pos
{
- get
- {
- return m_pos;
- }
- set
- {
- m_pos = value;
- }
+ get { return m_pos; }
+ set { m_pos = value; }
}
public LLVector3 m_velocity;
@@ -46,28 +41,16 @@ namespace OpenSim.Region.Environment.Scenes
///
public virtual LLVector3 Velocity
{
- get
- {
- return m_velocity;
- }
- set
- {
- m_velocity = value;
- }
+ get { return m_velocity; }
+ set { m_velocity = value; }
}
- protected Quaternion m_rotation = new Quaternion(0,0,1,0);
+ protected Quaternion m_rotation = new Quaternion(0, 0, 1, 0);
public virtual Quaternion Rotation
{
- get
- {
- return m_rotation;
- }
- set
- {
- m_rotation = value;
- }
+ get { return m_rotation; }
+ set { m_rotation = value; }
}
protected uint m_localId;
@@ -91,19 +74,17 @@ namespace OpenSim.Region.Environment.Scenes
m_name = "(basic entity)";
m_children = new List();
-
}
///
///
///
- public virtual void updateMovement()
+ public virtual void UpdateMovement()
{
-
foreach (EntityBase child in m_children)
{
- child.updateMovement();
+ child.UpdateMovement();
}
}
@@ -125,7 +106,6 @@ namespace OpenSim.Region.Environment.Scenes
///
public virtual void BackUp()
{
-
}
///
@@ -134,7 +114,7 @@ namespace OpenSim.Region.Environment.Scenes
///
public virtual EntityBase Copy()
{
- return (EntityBase)this.MemberwiseClone();
+ return (EntityBase) MemberwiseClone();
}
///
@@ -142,7 +122,6 @@ namespace OpenSim.Region.Environment.Scenes
///
public virtual void LandRenegerated()
{
-
}
}
-}
+}
\ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index 93e4959..ce5c327 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -138,22 +138,11 @@ namespace OpenSim.Region.Environment.Scenes
#region Constructors
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public Primitive(ulong regionHandle, Scene world, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent,
+ public Primitive(ulong regionHandle, Scene scene, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent,
SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos)
{
m_regionHandle = regionHandle;
- m_world = world;
+ m_scene = scene;
m_inventoryItems = new Dictionary();
m_Parent = parent;
m_isRootPrim = isRoot;
@@ -163,7 +152,7 @@ namespace OpenSim.Region.Environment.Scenes
Rotation = Quaternion.Identity;
- m_world.AcknowledgeNewPrim(this);
+ m_scene.AcknowledgeNewPrim(this);
OnPrimCountTainted();
}
@@ -202,10 +191,10 @@ namespace OpenSim.Region.Environment.Scenes
dupe.m_children = new List();
dupe.m_Shape = m_Shape.Copy();
dupe.m_regionHandle = m_regionHandle;
- dupe.m_world = m_world;
+ dupe.m_scene = m_scene;
- uint newLocalID = m_world.PrimIDAllocate();
+ uint newLocalID = m_scene.PrimIDAllocate();
dupe.m_uuid = LLUUID.Random();
dupe.LocalId = newLocalID;
@@ -225,7 +214,7 @@ namespace OpenSim.Region.Environment.Scenes
dupe.m_pos = new LLVector3(m_pos.X, m_pos.Y, m_pos.Z);
rootParent.AddChildToList(dupe);
- m_world.AcknowledgeNewPrim(dupe);
+ m_scene.AcknowledgeNewPrim(dupe);
dupe.TriggerOnPrimCountTainted();
@@ -327,7 +316,7 @@ namespace OpenSim.Region.Environment.Scenes
m_children.Add(linkObject.rootPrimitive);
linkObject.rootPrimitive.SetNewParent(this, m_RootParent);
- m_world.DeleteEntity(linkObject.rootUUID);
+ m_scene.DeleteEntity(linkObject.rootUUID);
linkObject.DeleteAllChildren();
OnPrimCountTainted();
@@ -676,7 +665,7 @@ namespace OpenSim.Region.Environment.Scenes
///
public void SendFullUpdateToAllClients()
{
- List avatars = m_world.RequestAvatarList();
+ List avatars = m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
SendFullUpdateToClient(avatars[i].ControllingClient);
@@ -721,7 +710,7 @@ namespace OpenSim.Region.Environment.Scenes
///
public void SendTerseUpdateToALLClients()
{
- List avatars = m_world.RequestAvatarList();
+ List avatars = m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
SendTerseUpdateToClient(avatars[i].ControllingClient);
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 0e25e54..39584ad 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -140,23 +140,23 @@ namespace OpenSim.Region.Environment.Scenes
m_eventManager = new EventManager();
m_eventManager.OnParcelPrimCountAdd +=
- new EventManager.OnParcelPrimCountAddDelegate(m_LandManager.addPrimToLandPrimCounts);
+ m_LandManager.addPrimToLandPrimCounts;
- MainLog.Instance.Verbose("World.cs - creating new entitities instance");
+ MainLog.Instance.Verbose("Creating new entitities instance");
Entities = new Dictionary();
Avatars = new Dictionary();
Prims = new Dictionary();
- MainLog.Instance.Verbose("World.cs - loading objects from datastore");
+ MainLog.Instance.Verbose("Loading objects from datastore");
List PrimsFromDB = storageManager.DataStore.LoadObjects();
foreach (SceneObject prim in PrimsFromDB)
{
AddEntity(prim);
}
- MainLog.Instance.Verbose("World.cs - loaded " + PrimsFromDB.Count.ToString() + " object(s)");
+ MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " object(s)");
- MainLog.Instance.Verbose("World.cs - creating LandMap");
+ MainLog.Instance.Verbose("Creating LandMap");
Terrain = new TerrainEngine();
ScenePresence.LoadAnims();
@@ -198,7 +198,7 @@ namespace OpenSim.Region.Environment.Scenes
}
///
- /// Performs per-frame updates on the world, this should be the central world loop
+ /// Performs per-frame updates on the scene, this should be the central world loop
///
public override void Update()
{
@@ -210,9 +210,11 @@ namespace OpenSim.Region.Environment.Scenes
phyScene.GetResults();
}
- foreach (LLUUID UUID in Entities.Keys)
+ List moveEntities = new List( Entities.Values );
+
+ foreach (EntityBase entity in moveEntities)
{
- Entities[UUID].updateMovement();
+ entity.UpdateMovement();
}
lock (m_syncRoot)
@@ -220,9 +222,11 @@ namespace OpenSim.Region.Environment.Scenes
phyScene.Simulate(timeStep);
}
- foreach (LLUUID UUID in Entities.Keys)
+ List updateEntities = new List(Entities.Values);
+
+ foreach (EntityBase entity in updateEntities)
{
- Entities[UUID].Update();
+ entity.Update();
}
// General purpose event manager
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index 76a8439..0038b39 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -38,7 +38,7 @@ using OpenSim.Framework;
namespace OpenSim.Region.Environment.Scenes
{
- public abstract class SceneBase : IWorld
+ public abstract class SceneBase : IScene
{
public Dictionary Entities;
protected ulong m_regionHandle;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index d513634..03a7f55 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Region.Environment.Scenes
public SceneObject(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
{
m_regionHandle = world.RegionInfo.RegionHandle;
- m_world = world;
+ m_scene = world;
m_eventManager = eventManager;
this.Pos = pos;
@@ -102,7 +102,7 @@ namespace OpenSim.Region.Environment.Scenes
/// Need a null constructor for duplication
public SceneObject()
{
-
+
}
public void registerEvents()
@@ -144,7 +144,7 @@ namespace OpenSim.Region.Environment.Scenes
public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos)
{
- this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world, agentID, localID, true, this, this, shape, pos);
+ this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_scene, agentID, localID, true, this, this, shape, pos);
this.m_children.Add(rootPrimitive);
this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
@@ -167,7 +167,7 @@ namespace OpenSim.Region.Environment.Scenes
{
SceneObject dupe = new SceneObject();
- dupe.m_world = this.m_world;
+ dupe.m_scene = this.m_scene;
dupe.m_eventManager = this.m_eventManager;
dupe.m_regionHandle = this.m_regionHandle;
Primitive newRoot = this.rootPrimitive.Copy(dupe, dupe);
@@ -176,7 +176,7 @@ namespace OpenSim.Region.Environment.Scenes
dupe.m_children.Add(dupe.rootPrimitive);
dupe.rootPrimitive.Pos = this.Pos;
dupe.Rotation = this.Rotation;
- dupe.LocalId = m_world.PrimIDAllocate();
+ dupe.LocalId = m_scene.PrimIDAllocate();
dupe.registerEvents();
return dupe;
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index e81ac7b..b3255c4 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -120,7 +120,7 @@ namespace OpenSim.Region.Environment.Scenes
public ScenePresence(IClientAPI theClient, Scene world, RegionInfo reginfo)
{
- m_world = world;
+ m_scene = world;
this.m_uuid = theClient.AgentId;
m_regionInfo = reginfo;
@@ -129,7 +129,7 @@ namespace OpenSim.Region.Environment.Scenes
ControllingClient = theClient;
this.firstname = ControllingClient.FirstName;
this.lastname = ControllingClient.LastName;
- m_localId = m_world.NextLocalId;
+ m_localId = m_scene.NextLocalId;
Pos = ControllingClient.StartPos;
visualParams = new byte[218];
for (int i = 0; i < 218; i++)
@@ -394,7 +394,7 @@ namespace OpenSim.Region.Environment.Scenes
///
public void SendTerseUpdateToALLClients()
{
- List avatars = this.m_world.RequestAvatarList();
+ List avatars = this.m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
this.SendTerseUpdateToClient(avatars[i].ControllingClient);
@@ -412,8 +412,8 @@ namespace OpenSim.Region.Environment.Scenes
public void SendFullUpdateToALLClients()
{
- List avatars = this.m_world.RequestAvatarList();
- foreach (ScenePresence avatar in this.m_world.RequestAvatarList())
+ List avatars = this.m_scene.RequestAvatarList();
+ foreach (ScenePresence avatar in this.m_scene.RequestAvatarList())
{
this.SendFullUpdateToOtherClient(avatar);
avatar.SendFullUpdateToOtherClient(this);
@@ -428,7 +428,7 @@ namespace OpenSim.Region.Environment.Scenes
this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.m_uuid, this.LocalId, this.Pos, DefaultTexture);
if (this.newAvatar)
{
- this.m_world.InformClientOfNeighbours(this.ControllingClient);
+ this.m_scene.InformClientOfNeighbours(this.ControllingClient);
this.newAvatar = false;
}
}
@@ -441,7 +441,7 @@ namespace OpenSim.Region.Environment.Scenes
{
this.ControllingClient.SendWearables(this.Wearables);
this.SendFullUpdateToALLClients();
- this.m_world.SendAllSceneObjectsToClient(this.ControllingClient);
+ this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient);
}
///
@@ -462,7 +462,7 @@ namespace OpenSim.Region.Environment.Scenes
{
this.current_anim = animID;
this.anim_seq = seq;
- List avatars = this.m_world.RequestAvatarList();
+ List avatars = this.m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
avatars[i].ControllingClient.SendAnimation(animID, seq, this.ControllingClient.AgentId);
@@ -550,10 +550,10 @@ namespace OpenSim.Region.Environment.Scenes
LLVector3 vel = this.m_velocity;
ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256));
- RegionInfo neighbourRegion = this.m_world.RequestNeighbouringRegionInfo(neighbourHandle);
+ RegionInfo neighbourRegion = this.m_scene.RequestNeighbouringRegionInfo(neighbourHandle);
if (neighbourRegion != null)
{
- bool res = this.m_world.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos, this._physActor.Flying);
+ bool res = this.m_scene.InformNeighbourOfCrossing(neighbourHandle, this.ControllingClient.AgentId, newpos, this._physActor.Flying);
if (res)
{
this.ControllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint);
@@ -574,7 +574,7 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public override void updateMovement()
+ public override void UpdateMovement()
{
newForce = false;
lock (this.forcesList)
--
cgit v1.1