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 | 73 | ||||
-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, 174 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 29d2a84..49c1ebf 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 | ||
@@ -269,9 +275,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
269 | private volatile bool shuttingdown = false; | 275 | private volatile bool shuttingdown = false; |
270 | 276 | ||
271 | private int m_lastUpdate = Environment.TickCount; | 277 | private int m_lastUpdate = Environment.TickCount; |
272 | private int m_maxPrimsPerFrame = 200; | ||
273 | private bool m_firstHeartbeat = true; | 278 | private bool m_firstHeartbeat = true; |
274 | 279 | ||
280 | private UpdatePrioritizationSchemes m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time; | ||
281 | |||
275 | private object m_deleting_scene_object = new object(); | 282 | private object m_deleting_scene_object = new object(); |
276 | 283 | ||
277 | // the minimum time that must elapse before a changed object will be considered for persisted | 284 | // the minimum time that must elapse before a changed object will be considered for persisted |
@@ -283,6 +290,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
283 | 290 | ||
284 | #region Properties | 291 | #region Properties |
285 | 292 | ||
293 | public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return this.m_update_prioritization_scheme; } } | ||
294 | |||
286 | public AgentCircuitManager AuthenticateHandler | 295 | public AgentCircuitManager AuthenticateHandler |
287 | { | 296 | { |
288 | get { return m_authenticateHandler; } | 297 | get { return m_authenticateHandler; } |
@@ -327,12 +336,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
327 | get { return m_sceneGraph.m_syncRoot; } | 336 | get { return m_sceneGraph.m_syncRoot; } |
328 | } | 337 | } |
329 | 338 | ||
330 | public int MaxPrimsPerFrame | ||
331 | { | ||
332 | get { return m_maxPrimsPerFrame; } | ||
333 | set { m_maxPrimsPerFrame = value; } | ||
334 | } | ||
335 | |||
336 | /// <summary> | 339 | /// <summary> |
337 | /// This is for llGetRegionFPS | 340 | /// This is for llGetRegionFPS |
338 | /// </summary> | 341 | /// </summary> |
@@ -510,7 +513,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
510 | 513 | ||
511 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine"); | 514 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine"); |
512 | 515 | ||
513 | m_maxPrimsPerFrame = startupConfig.GetInt("MaxPrimsPerFrame", 200); | ||
514 | IConfig packetConfig = m_config.Configs["PacketPool"]; | 516 | IConfig packetConfig = m_config.Configs["PacketPool"]; |
515 | if (packetConfig != null) | 517 | if (packetConfig != null) |
516 | { | 518 | { |
@@ -519,6 +521,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
519 | } | 521 | } |
520 | 522 | ||
521 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 523 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); |
524 | |||
525 | IConfig interest_management_config = m_config.Configs["InterestManagement"]; | ||
526 | if (interest_management_config != null) | ||
527 | { | ||
528 | string update_prioritization_scheme = interest_management_config.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower(); | ||
529 | switch (update_prioritization_scheme) | ||
530 | { | ||
531 | case "time": | ||
532 | m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time; | ||
533 | break; | ||
534 | case "distance": | ||
535 | m_update_prioritization_scheme = UpdatePrioritizationSchemes.Distance; | ||
536 | break; | ||
537 | case "simpleangulardistance": | ||
538 | m_update_prioritization_scheme = UpdatePrioritizationSchemes.SimpleAngularDistance; | ||
539 | break; | ||
540 | default: | ||
541 | m_log.Warn("[SCENE]: UpdatePrioritizationScheme was not recognized, setting to default settomg of Time"); | ||
542 | m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time; | ||
543 | break; | ||
544 | } | ||
545 | } | ||
546 | |||
547 | m_log.Info("[SCENE]: Using the " + m_update_prioritization_scheme + " prioritization scheme"); | ||
522 | } | 548 | } |
523 | catch | 549 | catch |
524 | { | 550 | { |
@@ -1200,15 +1226,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1200 | } | 1226 | } |
1201 | 1227 | ||
1202 | /// <summary> | 1228 | /// <summary> |
1203 | /// Perform delegate action on all clients subscribing to updates from this region. | ||
1204 | /// </summary> | ||
1205 | /// <returns></returns> | ||
1206 | public void Broadcast(Action<IClientAPI> whatToDo) | ||
1207 | { | ||
1208 | ForEachScenePresence(delegate(ScenePresence presence) { whatToDo(presence.ControllingClient); }); | ||
1209 | } | ||
1210 | |||
1211 | /// <summary> | ||
1212 | /// Backup the scene. This acts as the main method of the backup thread. | 1229 | /// Backup the scene. This acts as the main method of the backup thread. |
1213 | /// </summary> | 1230 | /// </summary> |
1214 | /// <returns></returns> | 1231 | /// <returns></returns> |
@@ -3054,17 +3071,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3054 | } | 3071 | } |
3055 | 3072 | ||
3056 | m_eventManager.TriggerOnRemovePresence(agentID); | 3073 | m_eventManager.TriggerOnRemovePresence(agentID); |
3057 | Broadcast(delegate(IClientAPI client) | 3074 | ForEachClient( |
3058 | { | 3075 | delegate(IClientAPI client) |
3059 | try | 3076 | { |
3060 | { | 3077 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway |
3061 | client.SendKillObject(avatar.RegionHandle, avatar.LocalId); | 3078 | try { client.SendKillObject(avatar.RegionHandle, avatar.LocalId); } |
3062 | } | 3079 | catch (NullReferenceException) { } |
3063 | catch (NullReferenceException) | 3080 | }); |
3064 | { | ||
3065 | //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway. | ||
3066 | } | ||
3067 | }); | ||
3068 | 3081 | ||
3069 | ForEachScenePresence( | 3082 | ForEachScenePresence( |
3070 | delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); | 3083 | delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); |
@@ -3149,7 +3162,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3149 | return; | 3162 | return; |
3150 | } | 3163 | } |
3151 | } | 3164 | } |
3152 | Broadcast(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); | 3165 | ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); |
3153 | } | 3166 | } |
3154 | 3167 | ||
3155 | #endregion | 3168 | #endregion |
@@ -4222,7 +4235,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4222 | 4235 | ||
4223 | public void ForEachClient(Action<IClientAPI> action) | 4236 | public void ForEachClient(Action<IClientAPI> action) |
4224 | { | 4237 | { |
4225 | m_sceneGraph.ForEachClient(action); | 4238 | ClientManager.ForEach(action); |
4226 | } | 4239 | } |
4227 | 4240 | ||
4228 | public void ForEachSOG(Action<SceneObjectGroup> action) | 4241 | 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 c25fa55..9d13ad4 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 | ||
@@ -3884,5 +3877,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
3884 | } | 3877 | } |
3885 | } | 3878 | } |
3886 | } | 3879 | } |
3880 | |||
3881 | public double GetUpdatePriority(IClientAPI client) | ||
3882 | { | ||
3883 | switch (Scene.UpdatePrioritizationScheme) | ||
3884 | { | ||
3885 | case Scene.UpdatePrioritizationSchemes.Time: | ||
3886 | return GetPriorityByTime(); | ||
3887 | case Scene.UpdatePrioritizationSchemes.Distance: | ||
3888 | return GetPriorityByDistance(client); | ||
3889 | case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance: | ||
3890 | return GetPriorityByDistance(client); | ||
3891 | default: | ||
3892 | throw new InvalidOperationException("UpdatePrioritizationScheme not defined."); | ||
3893 | } | ||
3894 | } | ||
3895 | |||
3896 | private double GetPriorityByTime() | ||
3897 | { | ||
3898 | return DateTime.Now.ToOADate(); | ||
3899 | } | ||
3900 | |||
3901 | private double GetPriorityByDistance(IClientAPI client) | ||
3902 | { | ||
3903 | ScenePresence presence = Scene.GetScenePresence(client.AgentId); | ||
3904 | if (presence != null) | ||
3905 | { | ||
3906 | return GetPriorityByDistance((presence.IsChildAgent) ? | ||
3907 | presence.AbsolutePosition : presence.CameraPosition); | ||
3908 | } | ||
3909 | return double.NaN; | ||
3910 | } | ||
3911 | |||
3912 | private double GetPriorityByDistance(Vector3 position) | ||
3913 | { | ||
3914 | return Vector3.Distance(AbsolutePosition, position); | ||
3915 | } | ||
3887 | } | 3916 | } |
3888 | } | 3917 | } |
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 | } |