diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/ISceneViewer.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 71 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 74 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 20 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 65 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneViewer.cs | 23 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs | 4 |
9 files changed, 172 insertions, 108 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs b/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs index 8e3f4a0..7251d57 100644 --- a/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs +++ b/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs | |||
@@ -34,7 +34,6 @@ namespace OpenSim.Region.Framework.Interfaces | |||
34 | { | 34 | { |
35 | void Reset(); | 35 | void Reset(); |
36 | void Close(); | 36 | void Close(); |
37 | int MaxPrimsPerFrame { get; set; } | ||
38 | void QueuePartForUpdate(SceneObjectPart part); | 37 | void QueuePartForUpdate(SceneObjectPart part); |
39 | void SendPrimUpdates(); | 38 | void SendPrimUpdates(); |
40 | } | 39 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d3d397d..c7efc19 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -57,6 +57,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
57 | 57 | ||
58 | public partial class Scene : SceneBase | 58 | public partial class Scene : SceneBase |
59 | { | 59 | { |
60 | public enum UpdatePrioritizationSchemes { | ||
61 | Time = 0, | ||
62 | Distance = 1, | ||
63 | SimpleAngularDistance = 2, | ||
64 | } | ||
65 | |||
60 | public delegate void SynchronizeSceneHandler(Scene scene); | 66 | public delegate void SynchronizeSceneHandler(Scene scene); |
61 | public SynchronizeSceneHandler SynchronizeScene = null; | 67 | public SynchronizeSceneHandler SynchronizeScene = null; |
62 | 68 | ||
@@ -268,9 +274,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
268 | private volatile bool shuttingdown = false; | 274 | private volatile bool shuttingdown = false; |
269 | 275 | ||
270 | private int m_lastUpdate = Environment.TickCount; | 276 | private int m_lastUpdate = Environment.TickCount; |
271 | private int m_maxPrimsPerFrame = 200; | ||
272 | private bool m_firstHeartbeat = true; | 277 | private bool m_firstHeartbeat = true; |
273 | 278 | ||
279 | private UpdatePrioritizationSchemes m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time; | ||
280 | |||
274 | private object m_deleting_scene_object = new object(); | 281 | private object m_deleting_scene_object = new object(); |
275 | 282 | ||
276 | // the minimum time that must elapse before a changed object will be considered for persisted | 283 | // the minimum time that must elapse before a changed object will be considered for persisted |
@@ -282,6 +289,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
282 | 289 | ||
283 | #region Properties | 290 | #region Properties |
284 | 291 | ||
292 | public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return this.m_update_prioritization_scheme; } } | ||
293 | |||
285 | public AgentCircuitManager AuthenticateHandler | 294 | public AgentCircuitManager AuthenticateHandler |
286 | { | 295 | { |
287 | get { return m_authenticateHandler; } | 296 | get { return m_authenticateHandler; } |
@@ -326,12 +335,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
326 | get { return m_sceneGraph.m_syncRoot; } | 335 | get { return m_sceneGraph.m_syncRoot; } |
327 | } | 336 | } |
328 | 337 | ||
329 | public int MaxPrimsPerFrame | ||
330 | { | ||
331 | get { return m_maxPrimsPerFrame; } | ||
332 | set { m_maxPrimsPerFrame = value; } | ||
333 | } | ||
334 | |||
335 | /// <summary> | 338 | /// <summary> |
336 | /// This is for llGetRegionFPS | 339 | /// This is for llGetRegionFPS |
337 | /// </summary> | 340 | /// </summary> |
@@ -509,7 +512,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
509 | 512 | ||
510 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine"); | 513 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine"); |
511 | 514 | ||
512 | m_maxPrimsPerFrame = startupConfig.GetInt("MaxPrimsPerFrame", 200); | ||
513 | IConfig packetConfig = m_config.Configs["PacketPool"]; | 515 | IConfig packetConfig = m_config.Configs["PacketPool"]; |
514 | if (packetConfig != null) | 516 | if (packetConfig != null) |
515 | { | 517 | { |
@@ -518,6 +520,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
518 | } | 520 | } |
519 | 521 | ||
520 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 522 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
523 | |||
524 | IConfig interest_management_config = m_config.Configs["InterestManagement"]; | ||
525 | if (interest_management_config != null) | ||
526 | { | ||
527 | string update_prioritization_scheme = interest_management_config.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower(); | ||
528 | switch (update_prioritization_scheme) | ||
529 | { | ||
530 | case "time": | ||
531 | m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time; | ||
532 | break; | ||
533 | case "distance": | ||
534 | m_update_prioritization_scheme = UpdatePrioritizationSchemes.Distance; | ||
535 | break; | ||
536 | case "simpleangulardistance": | ||
537 | m_update_prioritization_scheme = UpdatePrioritizationSchemes.SimpleAngularDistance; | ||
538 | break; | ||
539 | default: | ||
540 | m_log.Warn("[SCENE]: UpdatePrioritizationScheme was not recognized, setting to default settomg of Time"); | ||
541 | m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time; | ||
542 | break; | ||
543 | } | ||
544 | } | ||
521 | } | 545 | } |
522 | catch | 546 | catch |
523 | { | 547 | { |
@@ -1194,15 +1218,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1194 | } | 1218 | } |
1195 | 1219 | ||
1196 | /// <summary> | 1220 | /// <summary> |
1197 | /// Perform delegate action on all clients subscribing to updates from this region. | ||
1198 | /// </summary> | ||
1199 | /// <returns></returns> | ||
1200 | public void Broadcast(Action<IClientAPI> whatToDo) | ||
1201 | { | ||
1202 | ForEachScenePresence(delegate(ScenePresence presence) { whatToDo(presence.ControllingClient); }); | ||
1203 | } | ||
1204 | |||
1205 | /// <summary> | ||
1206 | /// Backup the scene. This acts as the main method of the backup thread. | 1221 | /// Backup the scene. This acts as the main method of the backup thread. |
1207 | /// </summary> | 1222 | /// </summary> |
1208 | /// <returns></returns> | 1223 | /// <returns></returns> |
@@ -3048,17 +3063,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3048 | } | 3063 | } |
3049 | 3064 | ||
3050 | m_eventManager.TriggerOnRemovePresence(agentID); | 3065 | m_eventManager.TriggerOnRemovePresence(agentID); |
3051 | Broadcast(delegate(IClientAPI client) | 3066 | ForEachClient( |
3052 | { | 3067 | delegate(IClientAPI client) |
3053 | try | 3068 | { |
3054 | { | 3069 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway |
3055 | client.SendKillObject(avatar.RegionHandle, avatar.LocalId); | 3070 | try { client.SendKillObject(avatar.RegionHandle, avatar.LocalId); } |
3056 | } | 3071 | catch (NullReferenceException) { } |
3057 | catch (NullReferenceException) | 3072 | }); |
3058 | { | ||
3059 | //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway. | ||
3060 | } | ||
3061 | }); | ||
3062 | 3073 | ||
3063 | ForEachScenePresence( | 3074 | ForEachScenePresence( |
3064 | delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); | 3075 | delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); |
@@ -3143,7 +3154,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3143 | return; | 3154 | return; |
3144 | } | 3155 | } |
3145 | } | 3156 | } |
3146 | Broadcast(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); | 3157 | ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); |
3147 | } | 3158 | } |
3148 | 3159 | ||
3149 | #endregion | 3160 | #endregion |
@@ -4211,7 +4222,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4211 | 4222 | ||
4212 | public void ForEachClient(Action<IClientAPI> action) | 4223 | public void ForEachClient(Action<IClientAPI> action) |
4213 | { | 4224 | { |
4214 | m_sceneGraph.ForEachClient(action); | 4225 | ClientManager.ForEach(action); |
4215 | } | 4226 | } |
4216 | 4227 | ||
4217 | public void ForEachSOG(Action<SceneObjectGroup> action) | 4228 | public void ForEachSOG(Action<SceneObjectGroup> action) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 9cd2247..b9872ca 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -613,7 +613,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
613 | 613 | ||
614 | newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); | 614 | newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); |
615 | newAvatar.IsChildAgent = true; | 615 | newAvatar.IsChildAgent = true; |
616 | newAvatar.MaxPrimsPerFrame = m_parentScene.MaxPrimsPerFrame; | ||
617 | 616 | ||
618 | AddScenePresence(newAvatar); | 617 | AddScenePresence(newAvatar); |
619 | 618 | ||
@@ -1107,23 +1106,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1107 | return UUID.Zero; | 1106 | return UUID.Zero; |
1108 | } | 1107 | } |
1109 | 1108 | ||
1110 | protected internal void ForEachClient(Action<IClientAPI> action) | ||
1111 | { | ||
1112 | List<ScenePresence> splist = GetScenePresences(); | ||
1113 | foreach (ScenePresence presence in splist) | ||
1114 | { | ||
1115 | try | ||
1116 | { | ||
1117 | action(presence.ControllingClient); | ||
1118 | } | ||
1119 | catch (Exception e) | ||
1120 | { | ||
1121 | // Catch it and move on. This includes situations where splist has inconsistent info | ||
1122 | m_log.WarnFormat("[SCENE]: Problem processing action in ForEachClient: ", e.Message); | ||
1123 | } | ||
1124 | } | ||
1125 | } | ||
1126 | |||
1127 | protected internal void ForEachSOG(Action<SceneObjectGroup> action) | 1109 | protected internal void ForEachSOG(Action<SceneObjectGroup> action) |
1128 | { | 1110 | { |
1129 | List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values); | 1111 | List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index d4cef7d..2153b9b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1817,7 +1817,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1817 | public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, UUID AgentID, uint RequestFlags) | 1817 | public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, UUID AgentID, uint RequestFlags) |
1818 | { | 1818 | { |
1819 | 1819 | ||
1820 | remoteClient.SendObjectPropertiesFamilyData(RequestFlags, RootPart.UUID, RootPart.ObjectOwner, RootPart.GroupID, RootPart.BaseMask, | 1820 | remoteClient.SendObjectPropertiesFamilyData(RequestFlags, RootPart.UUID, RootPart.OwnerID, RootPart.GroupID, RootPart.BaseMask, |
1821 | RootPart.OwnerMask, RootPart.GroupMask, RootPart.EveryoneMask, RootPart.NextOwnerMask, | 1821 | RootPart.OwnerMask, RootPart.GroupMask, RootPart.EveryoneMask, RootPart.NextOwnerMask, |
1822 | RootPart.OwnershipCost, RootPart.ObjectSaleType, RootPart.SalePrice, RootPart.Category, | 1822 | RootPart.OwnershipCost, RootPart.ObjectSaleType, RootPart.SalePrice, RootPart.Category, |
1823 | RootPart.CreatorID, RootPart.Name, RootPart.Description); | 1823 | RootPart.CreatorID, RootPart.Name, RootPart.Description); |
@@ -3343,5 +3343,77 @@ namespace OpenSim.Region.Framework.Scenes | |||
3343 | 3343 | ||
3344 | return true; | 3344 | return true; |
3345 | } | 3345 | } |
3346 | |||
3347 | public double GetUpdatePriority(IClientAPI client) | ||
3348 | { | ||
3349 | switch (Scene.UpdatePrioritizationScheme) | ||
3350 | { | ||
3351 | case Scene.UpdatePrioritizationSchemes.Time: | ||
3352 | return GetPriorityByTime(); | ||
3353 | case Scene.UpdatePrioritizationSchemes.Distance: | ||
3354 | return GetPriorityByDistance(client); | ||
3355 | case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance: | ||
3356 | return GetPriorityBySimpleAngularDistance(client); | ||
3357 | default: | ||
3358 | throw new InvalidOperationException("UpdatePrioritizationScheme not defined"); | ||
3359 | } | ||
3360 | } | ||
3361 | |||
3362 | private double GetPriorityByTime() | ||
3363 | { | ||
3364 | return DateTime.Now.ToOADate(); | ||
3365 | } | ||
3366 | |||
3367 | private double GetPriorityByDistance(IClientAPI client) | ||
3368 | { | ||
3369 | ScenePresence presence = Scene.GetScenePresence(client.AgentId); | ||
3370 | if (presence != null) | ||
3371 | { | ||
3372 | return GetPriorityByDistance((presence.IsChildAgent) ? | ||
3373 | presence.AbsolutePosition : presence.CameraPosition); | ||
3374 | } | ||
3375 | return double.NaN; | ||
3376 | } | ||
3377 | |||
3378 | private double GetPriorityBySimpleAngularDistance(IClientAPI client) | ||
3379 | { | ||
3380 | ScenePresence presence = Scene.GetScenePresence(client.AgentId); | ||
3381 | if (presence != null) | ||
3382 | { | ||
3383 | return GetPriorityBySimpleAngularDistance((presence.IsChildAgent) ? | ||
3384 | presence.AbsolutePosition : presence.CameraPosition); | ||
3385 | } | ||
3386 | return double.NaN; | ||
3387 | } | ||
3388 | |||
3389 | public double GetPriorityByDistance(Vector3 position) | ||
3390 | { | ||
3391 | return Vector3.Distance(AbsolutePosition, position); | ||
3392 | } | ||
3393 | |||
3394 | public double GetPriorityBySimpleAngularDistance(Vector3 position) | ||
3395 | { | ||
3396 | double distance = Vector3.Distance(position, AbsolutePosition); | ||
3397 | if (distance >= double.Epsilon) | ||
3398 | { | ||
3399 | float height; | ||
3400 | Vector3 box = GetAxisAlignedBoundingBox(out height); | ||
3401 | |||
3402 | double angle = box.X / distance; | ||
3403 | double max = angle; | ||
3404 | |||
3405 | angle = box.Y / distance; | ||
3406 | if (max < angle) | ||
3407 | max = angle; | ||
3408 | |||
3409 | angle = box.Z / distance; | ||
3410 | if (max < angle) | ||
3411 | max = angle; | ||
3412 | |||
3413 | return -max; | ||
3414 | } | ||
3415 | else | ||
3416 | return double.MinValue; | ||
3417 | } | ||
3346 | } | 3418 | } |
3347 | } | 3419 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 801a7db..79f6366 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -853,16 +853,6 @@ if (m_shape != null) { | |||
853 | return m_offsetPosition + m_groupPosition; } | 853 | return m_offsetPosition + m_groupPosition; } |
854 | } | 854 | } |
855 | 855 | ||
856 | public UUID ObjectCreator | ||
857 | { | ||
858 | get { return _creatorID; } | ||
859 | } | ||
860 | |||
861 | public UUID ObjectOwner | ||
862 | { | ||
863 | get { return _ownerID; } | ||
864 | } | ||
865 | |||
866 | public SceneObjectGroup ParentGroup | 856 | public SceneObjectGroup ParentGroup |
867 | { | 857 | { |
868 | get { return m_parentGroup; } | 858 | get { return m_parentGroup; } |
@@ -1440,7 +1430,7 @@ if (m_shape != null) { | |||
1440 | // Move afterwards ResetIDs as it clears the localID | 1430 | // Move afterwards ResetIDs as it clears the localID |
1441 | dupe.LocalId = localID; | 1431 | dupe.LocalId = localID; |
1442 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. | 1432 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. |
1443 | dupe._lastOwnerID = ObjectOwner; | 1433 | dupe._lastOwnerID = OwnerID; |
1444 | 1434 | ||
1445 | byte[] extraP = new byte[Shape.ExtraParams.Length]; | 1435 | byte[] extraP = new byte[Shape.ExtraParams.Length]; |
1446 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); | 1436 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); |
@@ -2410,10 +2400,10 @@ if (m_shape != null) { | |||
2410 | //isattachment = ParentGroup.RootPart.IsAttachment; | 2400 | //isattachment = ParentGroup.RootPart.IsAttachment; |
2411 | 2401 | ||
2412 | byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A}; | 2402 | byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A}; |
2413 | remoteClient.SendPrimitiveToClient(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, m_shape, | 2403 | remoteClient.SendPrimitiveToClient(new SendPrimitiveData(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, m_shape, |
2414 | lPos, Velocity, Acceleration, RotationOffset, RotationalVelocity, clientFlags, m_uuid, _ownerID, | 2404 | lPos, Velocity, Acceleration, RotationOffset, RotationalVelocity, clientFlags, m_uuid, _ownerID, |
2415 | m_text, color, _parentID, m_particleSystem, m_clickAction, (byte)m_material, m_TextureAnimation, IsAttachment, | 2405 | m_text, color, _parentID, m_particleSystem, m_clickAction, (byte)m_material, m_TextureAnimation, IsAttachment, |
2416 | AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius); | 2406 | AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius, ParentGroup.GetUpdatePriority(remoteClient))); |
2417 | } | 2407 | } |
2418 | 2408 | ||
2419 | /// <summary> | 2409 | /// <summary> |
@@ -3804,12 +3794,12 @@ if (m_shape != null) { | |||
3804 | 3794 | ||
3805 | // Causes this thread to dig into the Client Thread Data. | 3795 | // Causes this thread to dig into the Client Thread Data. |
3806 | // Remember your locking here! | 3796 | // Remember your locking here! |
3807 | remoteClient.SendPrimTerseUpdate(m_regionHandle, | 3797 | remoteClient.SendPrimTerseUpdate(new SendPrimitiveTerseData(m_regionHandle, |
3808 | (ushort)(m_parentGroup.GetTimeDilation() * | 3798 | (ushort)(m_parentGroup.GetTimeDilation() * |
3809 | (float)ushort.MaxValue), LocalId, lPos, | 3799 | (float)ushort.MaxValue), LocalId, lPos, |
3810 | RotationOffset, Velocity, | 3800 | RotationOffset, Velocity, |
3811 | RotationalVelocity, state, FromItemID, | 3801 | RotationalVelocity, state, FromItemID, |
3812 | OwnerID, (int)AttachmentPoint); | 3802 | OwnerID, (int)AttachmentPoint, ParentGroup.GetUpdatePriority(remoteClient))); |
3813 | } | 3803 | } |
3814 | 3804 | ||
3815 | public void AddScriptLPS(int count) | 3805 | public void AddScriptLPS(int count) |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b468dde..973537e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -403,12 +403,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
403 | set { m_parentPosition = value; } | 403 | set { m_parentPosition = value; } |
404 | } | 404 | } |
405 | 405 | ||
406 | public int MaxPrimsPerFrame | ||
407 | { | ||
408 | get { return m_sceneViewer.MaxPrimsPerFrame; } | ||
409 | set { m_sceneViewer.MaxPrimsPerFrame = value; } | ||
410 | } | ||
411 | |||
412 | /// <summary> | 406 | /// <summary> |
413 | /// Absolute position of this avatar in 'region cordinates' | 407 | /// Absolute position of this avatar in 'region cordinates' |
414 | /// </summary> | 408 | /// </summary> |
@@ -2456,11 +2450,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2456 | m_perfMonMS = Environment.TickCount; | 2450 | m_perfMonMS = Environment.TickCount; |
2457 | 2451 | ||
2458 | Vector3 pos = m_pos; | 2452 | Vector3 pos = m_pos; |
2459 | Vector3 vel = Velocity; | ||
2460 | Quaternion rot = m_bodyRot; | ||
2461 | pos.Z -= m_appearance.HipOffset; | 2453 | pos.Z -= m_appearance.HipOffset; |
2462 | remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, new Vector3(pos.X, pos.Y, pos.Z), | 2454 | |
2463 | new Vector3(vel.X, vel.Y, vel.Z), rot, m_uuid); | 2455 | remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, |
2456 | pos, m_velocity, m_rotation, m_uuid, GetUpdatePriority(remoteClient))); | ||
2464 | 2457 | ||
2465 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); | 2458 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); |
2466 | m_scene.StatsReporter.AddAgentUpdates(1); | 2459 | m_scene.StatsReporter.AddAgentUpdates(1); |
@@ -2474,7 +2467,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2474 | { | 2467 | { |
2475 | m_perfMonMS = Environment.TickCount; | 2468 | m_perfMonMS = Environment.TickCount; |
2476 | 2469 | ||
2477 | m_scene.Broadcast(SendTerseUpdateToClient); | 2470 | m_scene.ForEachClient(SendTerseUpdateToClient); |
2478 | 2471 | ||
2479 | m_lastVelocity = m_velocity; | 2472 | m_lastVelocity = m_velocity; |
2480 | lastPhysPos = AbsolutePosition; | 2473 | lastPhysPos = AbsolutePosition; |
@@ -2566,9 +2559,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2566 | Vector3 pos = m_pos; | 2559 | Vector3 pos = m_pos; |
2567 | pos.Z -= m_appearance.HipOffset; | 2560 | pos.Z -= m_appearance.HipOffset; |
2568 | 2561 | ||
2569 | remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, | 2562 | remoteAvatar.m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, |
2570 | LocalId, m_pos, m_appearance.Texture.GetBytes(), | 2563 | LocalId, m_pos, m_appearance.Texture.GetBytes(), |
2571 | m_parentID, rot); | 2564 | m_parentID, rot)); |
2572 | m_scene.StatsReporter.AddAgentUpdates(1); | 2565 | m_scene.StatsReporter.AddAgentUpdates(1); |
2573 | } | 2566 | } |
2574 | 2567 | ||
@@ -2637,8 +2630,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2637 | Vector3 pos = m_pos; | 2630 | Vector3 pos = m_pos; |
2638 | pos.Z -= m_appearance.HipOffset; | 2631 | pos.Z -= m_appearance.HipOffset; |
2639 | 2632 | ||
2640 | m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, | 2633 | m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, |
2641 | m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot); | 2634 | m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot)); |
2642 | 2635 | ||
2643 | if (!m_isChildAgent) | 2636 | if (!m_isChildAgent) |
2644 | { | 2637 | { |
@@ -2744,8 +2737,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2744 | } | 2737 | } |
2745 | 2738 | ||
2746 | Quaternion rot = m_bodyRot; | 2739 | Quaternion rot = m_bodyRot; |
2747 | m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, | 2740 | m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, |
2748 | m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot); | 2741 | m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot)); |
2749 | 2742 | ||
2750 | } | 2743 | } |
2751 | 2744 | ||
@@ -2776,7 +2769,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2776 | if (m_isChildAgent) | 2769 | if (m_isChildAgent) |
2777 | return; | 2770 | return; |
2778 | 2771 | ||
2779 | m_scene.Broadcast( | 2772 | m_scene.ForEachClient( |
2780 | delegate(IClientAPI client) { client.SendAnimations(animations, seqs, m_controllingClient.AgentId, objectIDs); }); | 2773 | delegate(IClientAPI client) { client.SendAnimations(animations, seqs, m_controllingClient.AgentId, objectIDs); }); |
2781 | } | 2774 | } |
2782 | 2775 | ||
@@ -3882,5 +3875,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
3882 | } | 3875 | } |
3883 | } | 3876 | } |
3884 | } | 3877 | } |
3878 | |||
3879 | public double GetUpdatePriority(IClientAPI client) | ||
3880 | { | ||
3881 | switch (Scene.UpdatePrioritizationScheme) | ||
3882 | { | ||
3883 | case Scene.UpdatePrioritizationSchemes.Time: | ||
3884 | return GetPriorityByTime(); | ||
3885 | case Scene.UpdatePrioritizationSchemes.Distance: | ||
3886 | return GetPriorityByDistance(client); | ||
3887 | case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance: | ||
3888 | return GetPriorityByDistance(client); | ||
3889 | default: | ||
3890 | throw new InvalidOperationException("UpdatePrioritizationScheme not defined."); | ||
3891 | } | ||
3892 | } | ||
3893 | |||
3894 | private double GetPriorityByTime() | ||
3895 | { | ||
3896 | return DateTime.Now.ToOADate(); | ||
3897 | } | ||
3898 | |||
3899 | private double GetPriorityByDistance(IClientAPI client) | ||
3900 | { | ||
3901 | ScenePresence presence = Scene.GetScenePresence(client.AgentId); | ||
3902 | if (presence != null) | ||
3903 | { | ||
3904 | return GetPriorityByDistance((presence.IsChildAgent) ? | ||
3905 | presence.AbsolutePosition : presence.CameraPosition); | ||
3906 | } | ||
3907 | return double.NaN; | ||
3908 | } | ||
3909 | |||
3910 | private double GetPriorityByDistance(Vector3 position) | ||
3911 | { | ||
3912 | return Vector3.Distance(AbsolutePosition, position); | ||
3913 | } | ||
3885 | } | 3914 | } |
3886 | } | 3915 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index 8ab0552..e4296ef 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs | |||
@@ -45,14 +45,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
45 | 45 | ||
46 | protected Dictionary<UUID, ScenePartUpdate> m_updateTimes = new Dictionary<UUID, ScenePartUpdate>(); | 46 | protected Dictionary<UUID, ScenePartUpdate> m_updateTimes = new Dictionary<UUID, ScenePartUpdate>(); |
47 | 47 | ||
48 | protected int m_maxPrimsPerFrame = 200; | ||
49 | |||
50 | public int MaxPrimsPerFrame | ||
51 | { | ||
52 | get { return m_maxPrimsPerFrame; } | ||
53 | set { m_maxPrimsPerFrame = value; } | ||
54 | } | ||
55 | |||
56 | public SceneViewer() | 48 | public SceneViewer() |
57 | { | 49 | { |
58 | } | 50 | } |
@@ -82,16 +74,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
82 | { | 74 | { |
83 | m_pendingObjects = new Queue<SceneObjectGroup>(); | 75 | m_pendingObjects = new Queue<SceneObjectGroup>(); |
84 | 76 | ||
85 | List<EntityBase> ents = new List<EntityBase>(m_presence.Scene.Entities); | 77 | foreach (EntityBase e in m_presence.Scene.Entities) |
86 | if (!m_presence.IsChildAgent) // Proximity sort makes no sense for | ||
87 | { // Child agents | ||
88 | ents.Sort(delegate(EntityBase a, EntityBase b) | ||
89 | { | ||
90 | return Vector3.Distance(m_presence.AbsolutePosition, a.AbsolutePosition).CompareTo(Vector3.Distance(m_presence.AbsolutePosition, b.AbsolutePosition)); | ||
91 | }); | ||
92 | } | ||
93 | |||
94 | foreach (EntityBase e in ents) | ||
95 | { | 78 | { |
96 | if (e is SceneObjectGroup) | 79 | if (e is SceneObjectGroup) |
97 | m_pendingObjects.Enqueue((SceneObjectGroup)e); | 80 | m_pendingObjects.Enqueue((SceneObjectGroup)e); |
@@ -99,7 +82,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
99 | } | 82 | } |
100 | } | 83 | } |
101 | 84 | ||
102 | while (m_pendingObjects != null && m_pendingObjects.Count > 0 && m_partsUpdateQueue.Count < m_maxPrimsPerFrame) | 85 | while (m_pendingObjects != null && m_pendingObjects.Count > 0) |
103 | { | 86 | { |
104 | SceneObjectGroup g = m_pendingObjects.Dequeue(); | 87 | SceneObjectGroup g = m_pendingObjects.Dequeue(); |
105 | 88 | ||
@@ -183,8 +166,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
183 | m_presence.GenerateClientFlags(part.UUID)); | 166 | m_presence.GenerateClientFlags(part.UUID)); |
184 | } | 167 | } |
185 | } | 168 | } |
186 | |||
187 | m_presence.ControllingClient.FlushPrimUpdates(); | ||
188 | } | 169 | } |
189 | 170 | ||
190 | public void Reset() | 171 | public void Reset() |
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs b/OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs index 29c4672..f3be028 100644 --- a/OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs +++ b/OpenSim/Region/Framework/Scenes/Scripting/IScriptHost.cs | |||
@@ -35,8 +35,8 @@ namespace OpenSim.Region.Framework.Scenes.Scripting | |||
35 | string Description { get; set; } | 35 | string Description { get; set; } |
36 | 36 | ||
37 | UUID UUID { get; } | 37 | UUID UUID { get; } |
38 | UUID ObjectOwner { get; } | 38 | UUID OwnerID { get; } |
39 | UUID ObjectCreator { get; } | 39 | UUID CreatorID { get; } |
40 | Vector3 AbsolutePosition { get; } | 40 | Vector3 AbsolutePosition { get; } |
41 | 41 | ||
42 | string SitName { get; set; } | 42 | string SitName { get; set; } |
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs index af18a98..d7198f0 100644 --- a/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs +++ b/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs | |||
@@ -68,12 +68,12 @@ namespace OpenSim.Region.Framework.Scenes.Scripting | |||
68 | get { return UUID.Zero; } | 68 | get { return UUID.Zero; } |
69 | } | 69 | } |
70 | 70 | ||
71 | public UUID ObjectOwner | 71 | public UUID OwnerID |
72 | { | 72 | { |
73 | get { return UUID.Zero; } | 73 | get { return UUID.Zero; } |
74 | } | 74 | } |
75 | 75 | ||
76 | public UUID ObjectCreator | 76 | public UUID CreatorID |
77 | { | 77 | { |
78 | get { return UUID.Zero; } | 78 | get { return UUID.Zero; } |
79 | } | 79 | } |