diff options
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 49 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 10 | ||||
-rw-r--r-- | prebuild.xml | 2 |
8 files changed, 63 insertions, 21 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index 9c2ee4a..4a16a70 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -412,8 +412,8 @@ namespace OpenSim.Data.MySQL | |||
412 | public List<SceneObjectGroup> LoadObjects(UUID regionUUID) | 412 | public List<SceneObjectGroup> LoadObjects(UUID regionUUID) |
413 | { | 413 | { |
414 | UUID lastGroupID = UUID.Zero; | 414 | UUID lastGroupID = UUID.Zero; |
415 | List<SceneObjectGroup> objects = new List<SceneObjectGroup>(); | 415 | Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>(); |
416 | List<SceneObjectPart> prims = new List<SceneObjectPart>(); | 416 | Dictionary<UUID, SceneObjectPart> prims = new Dictionary<UUID, SceneObjectPart>(); |
417 | SceneObjectGroup grp = null; | 417 | SceneObjectGroup grp = null; |
418 | 418 | ||
419 | lock (m_Connection) | 419 | lock (m_Connection) |
@@ -441,14 +441,14 @@ namespace OpenSim.Data.MySQL | |||
441 | else | 441 | else |
442 | prim.Shape = BuildShape(reader); | 442 | prim.Shape = BuildShape(reader); |
443 | 443 | ||
444 | prims.Add(prim); | 444 | prims[prim.UUID] = prim; |
445 | 445 | ||
446 | UUID groupID = new UUID(reader["SceneGroupID"].ToString()); | 446 | UUID groupID = new UUID(reader["SceneGroupID"].ToString()); |
447 | 447 | ||
448 | if (groupID != lastGroupID) // New SOG | 448 | if (groupID != lastGroupID) // New SOG |
449 | { | 449 | { |
450 | if (grp != null) | 450 | if (grp != null) |
451 | objects.Add(grp); | 451 | objects[grp.UUID] = grp; |
452 | 452 | ||
453 | lastGroupID = groupID; | 453 | lastGroupID = groupID; |
454 | 454 | ||
@@ -487,16 +487,47 @@ namespace OpenSim.Data.MySQL | |||
487 | } | 487 | } |
488 | 488 | ||
489 | if (grp != null) | 489 | if (grp != null) |
490 | objects.Add(grp); | 490 | objects[grp.UUID] = grp; |
491 | cmd.Dispose(); | 491 | cmd.Dispose(); |
492 | } | 492 | } |
493 | 493 | ||
494 | foreach (SceneObjectPart part in prims) | 494 | // Instead of attempting to LoadItems on every prim, |
495 | LoadItems(part); | 495 | // most of which probably have no items... get a |
496 | // list from DB of all prims which have items and | ||
497 | // LoadItems only on those | ||
498 | List<SceneObjectPart> primsWithInventory = new List<SceneObjectPart>(); | ||
499 | lock (m_Connection) | ||
500 | { | ||
501 | MySqlCommand itemCmd = m_Connection.CreateCommand(); | ||
502 | itemCmd.CommandText = "select distinct primID from primitems"; | ||
503 | IDataReader itemReader = ExecuteReader(itemCmd); | ||
504 | try | ||
505 | { | ||
506 | while (itemReader.Read()) | ||
507 | { | ||
508 | if (!(itemReader["primID"] is DBNull)) | ||
509 | { | ||
510 | UUID primID = new UUID(itemReader["primID"].ToString()); | ||
511 | if (prims.ContainsKey(primID)) | ||
512 | { | ||
513 | primsWithInventory.Add(prims[primID]); | ||
514 | } | ||
515 | } | ||
516 | } | ||
517 | } | ||
518 | finally | ||
519 | { | ||
520 | itemReader.Close(); | ||
521 | } | ||
522 | itemCmd.Dispose(); | ||
523 | } | ||
496 | 524 | ||
525 | foreach (SceneObjectPart prim in primsWithInventory) | ||
526 | { | ||
527 | LoadItems(prim); | ||
528 | } | ||
497 | m_log.DebugFormat("[REGION DB]: Loaded {0} objects using {1} prims", objects.Count, prims.Count); | 529 | m_log.DebugFormat("[REGION DB]: Loaded {0} objects using {1} prims", objects.Count, prims.Count); |
498 | 530 | return new List<SceneObjectGroup>(objects.Values); | |
499 | return objects; | ||
500 | } | 531 | } |
501 | 532 | ||
502 | /// <summary> | 533 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 33afc40..ec209ed 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -998,7 +998,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
998 | physicsMS2 = Environment.TickCount - physicsMS2; | 998 | physicsMS2 = Environment.TickCount - physicsMS2; |
999 | 999 | ||
1000 | if (m_frame % m_update_entitymovement == 0) | 1000 | if (m_frame % m_update_entitymovement == 0) |
1001 | m_sceneGraph.UpdateEntityMovement(); | 1001 | m_sceneGraph.UpdateScenePresenceMovement(); |
1002 | 1002 | ||
1003 | physicsMS = Environment.TickCount; | 1003 | physicsMS = Environment.TickCount; |
1004 | if ((m_frame % m_update_physics == 0) && m_physics_enabled) | 1004 | if ((m_frame % m_update_physics == 0) && m_physics_enabled) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 3007598..48dea07 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -198,9 +198,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
198 | } | 198 | } |
199 | } | 199 | } |
200 | 200 | ||
201 | protected internal void UpdateEntityMovement() | 201 | protected internal void UpdateScenePresenceMovement() |
202 | { | 202 | { |
203 | List<EntityBase> moveEntities = GetEntities(); | 203 | List<ScenePresence> moveEntities = GetScenePresences(); |
204 | 204 | ||
205 | foreach (EntityBase entity in moveEntities) | 205 | foreach (EntityBase entity in moveEntities) |
206 | { | 206 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index d72ed7d..5be074e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1904,7 +1904,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1904 | //return; | 1904 | //return; |
1905 | //} | 1905 | //} |
1906 | 1906 | ||
1907 | if (Util.DistanceLessThan(lastPhysGroupPos, AbsolutePosition, 0.02) && UsePhysics) | 1907 | if (UsePhysics && Util.DistanceLessThan(lastPhysGroupPos, AbsolutePosition, 0.02)) |
1908 | { | 1908 | { |
1909 | m_rootPart.UpdateFlag = 1; | 1909 | m_rootPart.UpdateFlag = 1; |
1910 | lastPhysGroupPos = AbsolutePosition; | 1910 | lastPhysGroupPos = AbsolutePosition; |
@@ -1916,11 +1916,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1916 | 1916 | ||
1917 | checkAtTargets(); | 1917 | checkAtTargets(); |
1918 | 1918 | ||
1919 | if (((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1) | 1919 | if (UsePhysics && ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1) |
1920 | || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1) | 1920 | || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1) |
1921 | || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1) | 1921 | || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1) |
1922 | || (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1)) | 1922 | || (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1))) |
1923 | && UsePhysics) | ||
1924 | { | 1923 | { |
1925 | m_rootPart.UpdateFlag = 1; | 1924 | m_rootPart.UpdateFlag = 1; |
1926 | 1925 | ||
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 38df751..dd58a4e 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -223,6 +223,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
223 | set { m_localID = value; } | 223 | set { m_localID = value; } |
224 | } | 224 | } |
225 | 225 | ||
226 | public override int GetHashCode() | ||
227 | { | ||
228 | return (int)m_localID; | ||
229 | } | ||
230 | |||
226 | public override bool Grabbed | 231 | public override bool Grabbed |
227 | { | 232 | { |
228 | set { return; } | 233 | set { return; } |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index d0f77e6..673ae39 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -260,6 +260,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
260 | m_localID = value; } | 260 | m_localID = value; } |
261 | } | 261 | } |
262 | 262 | ||
263 | public override int GetHashCode() | ||
264 | { | ||
265 | return (int)m_localID; | ||
266 | } | ||
267 | |||
263 | public override bool Grabbed | 268 | public override bool Grabbed |
264 | { | 269 | { |
265 | set { return; } | 270 | set { return; } |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 817cc22..e702d5e 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -235,11 +235,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
235 | private d.NearCallback nearCallback; | 235 | private d.NearCallback nearCallback; |
236 | public d.TriCallback triCallback; | 236 | public d.TriCallback triCallback; |
237 | public d.TriArrayCallback triArrayCallback; | 237 | public d.TriArrayCallback triArrayCallback; |
238 | private readonly List<OdeCharacter> _characters = new List<OdeCharacter>(); | 238 | private readonly HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>(); |
239 | private readonly List<OdePrim> _prims = new List<OdePrim>(); | 239 | private readonly HashSet<OdePrim> _prims = new HashSet<OdePrim>(); |
240 | private readonly List<OdePrim> _activeprims = new List<OdePrim>(); | 240 | private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>(); |
241 | private readonly List<OdePrim> _taintedPrim = new List<OdePrim>(); | 241 | private readonly HashSet<OdePrim> _taintedPrim = new HashSet<OdePrim>(); |
242 | private readonly List<OdeCharacter> _taintedActors = new List<OdeCharacter>(); | 242 | private readonly HashSet<OdeCharacter> _taintedActors = new HashSet<OdeCharacter>(); |
243 | private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>(); | 243 | private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>(); |
244 | private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>(); | 244 | private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>(); |
245 | public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); | 245 | public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); |
diff --git a/prebuild.xml b/prebuild.xml index 343b06a..cdffd8a 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -501,6 +501,7 @@ | |||
501 | 501 | ||
502 | <ReferencePath>../../../../bin/</ReferencePath> | 502 | <ReferencePath>../../../../bin/</ReferencePath> |
503 | <Reference name="System"/> | 503 | <Reference name="System"/> |
504 | <Reference name="System.Core"/> | ||
504 | <Reference name="OpenMetaverseTypes.dll"/> | 505 | <Reference name="OpenMetaverseTypes.dll"/> |
505 | <Reference name="Nini.dll" /> | 506 | <Reference name="Nini.dll" /> |
506 | <Reference name="OpenSim.Framework"/> | 507 | <Reference name="OpenSim.Framework"/> |
@@ -3714,6 +3715,7 @@ | |||
3714 | 3715 | ||
3715 | <ReferencePath>../../../../bin/</ReferencePath> | 3716 | <ReferencePath>../../../../bin/</ReferencePath> |
3716 | <Reference name="System"/> | 3717 | <Reference name="System"/> |
3718 | <Reference name="System.Core"/> | ||
3717 | <Reference name="OpenMetaverseTypes.dll"/> | 3719 | <Reference name="OpenMetaverseTypes.dll"/> |
3718 | <Reference name="Nini.dll" /> | 3720 | <Reference name="Nini.dll" /> |
3719 | <Reference name="OpenSim.Framework"/> | 3721 | <Reference name="OpenSim.Framework"/> |