aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs126
2 files changed, 74 insertions, 58 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 53b7ced..3380191 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3042,11 +3042,14 @@ namespace OpenSim.Region.Framework.Scenes
3042 if (!IsSelected) 3042 if (!IsSelected)
3043 RootPart.UpdateLookAt(); 3043 RootPart.UpdateLookAt();
3044 3044
3045 double now = Util.GetTimeStampMS();
3046 RootPart.SendScheduledUpdates(now);
3045 SceneObjectPart[] parts = m_parts.GetArray(); 3047 SceneObjectPart[] parts = m_parts.GetArray();
3046 for (int i = 0; i < parts.Length; i++) 3048 for (int i = 0; i < parts.Length; i++)
3047 { 3049 {
3048 SceneObjectPart part = parts[i]; 3050 SceneObjectPart part = parts[i];
3049 part.SendScheduledUpdates(); 3051 if(part != RootPart)
3052 part.SendScheduledUpdates(now);
3050 } 3053 }
3051 } 3054 }
3052 3055
@@ -3113,7 +3116,6 @@ namespace OpenSim.Region.Framework.Scenes
3113 } 3116 }
3114 3117
3115 RootPart.SendFullUpdateToAllClientsInternal(); 3118 RootPart.SendFullUpdateToAllClientsInternal();
3116
3117 SceneObjectPart[] parts = m_parts.GetArray(); 3119 SceneObjectPart[] parts = m_parts.GetArray();
3118 for (int i = 0; i < parts.Length; i++) 3120 for (int i = 0; i < parts.Length; i++)
3119 { 3121 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 0370c41..7bde7c0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3256,10 +3256,16 @@ namespace OpenSim.Region.Framework.Scenes
3256 3256
3257 if (ParentGroup == null) 3257 if (ParentGroup == null)
3258 return; 3258 return;
3259 if (ParentGroup.Scene == null)
3260 return;
3261
3262 if(ParentGroup.Scene.GetNumberOfClients() == 0)
3263 return;
3264
3265 ParentGroup.QueueForUpdateCheck(); // just in case
3259 3266
3260 lock(UpdateFlagLock) 3267 lock(UpdateFlagLock)
3261 { 3268 {
3262 ParentGroup.QueueForUpdateCheck(); // just in case
3263 if(UpdateFlag != UpdateRequired.FULL) 3269 if(UpdateFlag != UpdateRequired.FULL)
3264 { 3270 {
3265 UpdateFlag = UpdateRequired.FULL; 3271 UpdateFlag = UpdateRequired.FULL;
@@ -3268,10 +3274,9 @@ namespace OpenSim.Region.Framework.Scenes
3268 // "[SCENE OBJECT PART]: Scheduling full update for {0}, {1} at {2}", 3274 // "[SCENE OBJECT PART]: Scheduling full update for {0}, {1} at {2}",
3269 // UUID, Name, TimeStampFull); 3275 // UUID, Name, TimeStampFull);
3270 3276
3271 if (ParentGroup.Scene != null)
3272 ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, true);
3273 } 3277 }
3274 } 3278 }
3279 ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, true);
3275 } 3280 }
3276 3281
3277 /// <summary> 3282 /// <summary>
@@ -3282,6 +3287,13 @@ namespace OpenSim.Region.Framework.Scenes
3282 { 3287 {
3283 if (ParentGroup == null) 3288 if (ParentGroup == null)
3284 return; 3289 return;
3290 if (ParentGroup.Scene == null)
3291 return;
3292
3293 ParentGroup.HasGroupChanged = true;
3294
3295 if(ParentGroup.Scene.GetNumberOfClients() == 0)
3296 return;
3285 3297
3286 // This was pulled from SceneViewer. Attachments always receive full updates. 3298 // This was pulled from SceneViewer. Attachments always receive full updates.
3287 // This is needed because otherwise if only the root prim changes position, then 3299 // This is needed because otherwise if only the root prim changes position, then
@@ -3292,23 +3304,19 @@ namespace OpenSim.Region.Framework.Scenes
3292 return; 3304 return;
3293 } 3305 }
3294 3306
3307 ParentGroup.QueueForUpdateCheck();
3295 lock(UpdateFlagLock) 3308 lock(UpdateFlagLock)
3296 { 3309 {
3297 if (UpdateFlag == UpdateRequired.NONE) 3310 if (UpdateFlag == UpdateRequired.NONE)
3298 { 3311 {
3299 ParentGroup.HasGroupChanged = true;
3300 ParentGroup.QueueForUpdateCheck();
3301
3302 UpdateFlag = UpdateRequired.TERSE; 3312 UpdateFlag = UpdateRequired.TERSE;
3303 3313
3304 // m_log.DebugFormat( 3314 // m_log.DebugFormat(
3305 // "[SCENE OBJECT PART]: Scheduling terse update for {0}, {1} at {2}", 3315 // "[SCENE OBJECT PART]: Scheduling terse update for {0}, {1}",
3306 // UUID, Name, TimeStampTerse); 3316 // UUID, Name);
3307 } 3317 }
3308
3309 if (ParentGroup.Scene != null)
3310 ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, false);
3311 } 3318 }
3319 ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this, false);
3312 } 3320 }
3313 3321
3314 public void ScriptSetPhysicsStatus(bool UsePhysics) 3322 public void ScriptSetPhysicsStatus(bool UsePhysics)
@@ -3428,34 +3436,30 @@ namespace OpenSim.Region.Framework.Scenes
3428 ParentGroup.Scene.StatsReporter.AddObjectUpdates(1); 3436 ParentGroup.Scene.StatsReporter.AddObjectUpdates(1);
3429 } 3437 }
3430 3438
3431
3432 private const float ROTATION_TOLERANCE = 0.01f; 3439 private const float ROTATION_TOLERANCE = 0.01f;
3433 private const float VELOCITY_TOLERANCE = 0.1f; // terse update vel has low resolution 3440 private const float VELOCITY_TOLERANCE = 0.1f;
3441 private const float ANGVELOCITY_TOLERANCE = 0.005f;
3434 private const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary 3442 private const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
3435 private const double TIME_MS_TOLERANCE = 200f; //llSetPos has a 200ms delay. This should NOT be 3 seconds. 3443 private const double TIME_MS_TOLERANCE = 200.0; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
3436 3444
3437 /// <summary> 3445 /// <summary>
3438 /// Tell all the prims which have had updates scheduled 3446 /// Tell all the prims which have had updates scheduled
3439 /// </summary> 3447 /// </summary>
3440 public void SendScheduledUpdates() 3448 public void SendScheduledUpdates(double now)
3441 { 3449 {
3442 UpdateRequired currentUpdate; 3450 bool sendterse = false;
3451 bool sendfull = false;
3452
3443 lock(UpdateFlagLock) 3453 lock(UpdateFlagLock)
3444 { 3454 {
3445 currentUpdate = UpdateFlag; 3455 switch (UpdateFlag)
3446 ClearUpdateSchedule(); 3456 {
3447 } 3457 case UpdateRequired.NONE:
3458 break;
3448 3459
3449 switch (currentUpdate) 3460 case UpdateRequired.TERSE:
3450 { 3461 sendterse = true;
3451 case UpdateRequired.NONE:
3452 break;
3453 3462
3454 case UpdateRequired.TERSE:
3455 bool needupdate = true;
3456 lock(UpdateFlagLock)
3457 {
3458 double now = Util.GetTimeStampMS();
3459 Vector3 curvel = Velocity; 3463 Vector3 curvel = Velocity;
3460 Vector3 curacc = Acceleration; 3464 Vector3 curacc = Acceleration;
3461 Vector3 angvel = AngularVelocity; 3465 Vector3 angvel = AngularVelocity;
@@ -3470,8 +3474,7 @@ namespace OpenSim.Region.Framework.Scenes
3470 Math.Abs(curacc.Y - m_lastAcceleration.Y) > VELOCITY_TOLERANCE || 3474 Math.Abs(curacc.Y - m_lastAcceleration.Y) > VELOCITY_TOLERANCE ||
3471 Math.Abs(curacc.Z - m_lastAcceleration.Z) > VELOCITY_TOLERANCE) 3475 Math.Abs(curacc.Z - m_lastAcceleration.Z) > VELOCITY_TOLERANCE)
3472 break; 3476 break;
3473 3477
3474 // velocity change is also direction not only norm)
3475 if( Math.Abs(curvel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE || 3478 if( Math.Abs(curvel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE ||
3476 Math.Abs(curvel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE || 3479 Math.Abs(curvel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE ||
3477 Math.Abs(curvel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE) 3480 Math.Abs(curvel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE)
@@ -3507,12 +3510,12 @@ namespace OpenSim.Region.Framework.Scenes
3507 break; 3510 break;
3508 } 3511 }
3509 3512
3510 if( Math.Abs(angvel.X - m_lastAngularVelocity.X) > VELOCITY_TOLERANCE || 3513 if( Math.Abs(angvel.X - m_lastAngularVelocity.X) > ANGVELOCITY_TOLERANCE ||
3511 Math.Abs(angvel.Y - m_lastAngularVelocity.Y) > VELOCITY_TOLERANCE || 3514 Math.Abs(angvel.Y - m_lastAngularVelocity.Y) > ANGVELOCITY_TOLERANCE ||
3512 Math.Abs(angvel.Z - m_lastAngularVelocity.Z) > VELOCITY_TOLERANCE) 3515 Math.Abs(angvel.Z - m_lastAngularVelocity.Z) > ANGVELOCITY_TOLERANCE)
3513 break; 3516 break;
3514 3517
3515 // viewer interpolators have a limit of 128m/s 3518 // viewer interpolators have a limit of 64rad/s
3516 float ax = Math.Abs(angvel.X); 3519 float ax = Math.Abs(angvel.X);
3517 if(ax > 64.0) 3520 if(ax > 64.0)
3518 break; 3521 break;
@@ -3524,20 +3527,19 @@ namespace OpenSim.Region.Framework.Scenes
3524 break; 3527 break;
3525 3528
3526 if ( 3529 if (
3527 ax < VELOCITY_TOLERANCE && 3530 ax < ANGVELOCITY_TOLERANCE &&
3528 ay < VELOCITY_TOLERANCE && 3531 ay < ANGVELOCITY_TOLERANCE &&
3529 az < VELOCITY_TOLERANCE && 3532 az < ANGVELOCITY_TOLERANCE &&
3530 !RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) 3533 !RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE)
3531 ) 3534 )
3532 break; 3535 break;
3533 3536
3534 needupdate = false; 3537 sendterse = false;
3535 break; 3538 break;
3536 } 3539 }
3537 3540
3538 if(needupdate) 3541 if(sendterse)
3539 { 3542 {
3540
3541 // Update the "last" values 3543 // Update the "last" values
3542 m_lastPosition = AbsolutePosition; 3544 m_lastPosition = AbsolutePosition;
3543 m_lastRotation = RotationOffset; 3545 m_lastRotation = RotationOffset;
@@ -3545,25 +3547,38 @@ namespace OpenSim.Region.Framework.Scenes
3545 m_lastAcceleration = curacc; 3547 m_lastAcceleration = curacc;
3546 m_lastAngularVelocity = angvel; 3548 m_lastAngularVelocity = angvel;
3547 m_lastUpdateSentTime = now; 3549 m_lastUpdateSentTime = now;
3550 ClearUpdateSchedule();
3548 } 3551 }
3549 } 3552 break;
3550
3551 if(needupdate)
3552 {
3553 ParentGroup.Scene.ForEachClient(delegate(IClientAPI client)
3554 {
3555 SendTerseUpdateToClient(client);
3556 });
3557 }
3558 break;
3559 3553
3560 case UpdateRequired.FULL: 3554 case UpdateRequired.FULL:
3561 SendFullUpdateToAllClientsInternal(); 3555 m_lastPosition = AbsolutePosition;
3562 break; 3556 m_lastRotation = RotationOffset;
3557 m_lastVelocity = Velocity;
3558 m_lastAcceleration = Acceleration;
3559 m_lastAngularVelocity = AngularVelocity;
3560 m_lastUpdateSentTime = now;
3561 ClearUpdateSchedule();
3562 sendfull = true;
3563 break;
3564 }
3565 }
3566 if(sendterse)
3567 {
3568 ParentGroup.Scene.ForEachClient(delegate(IClientAPI client)
3569 {
3570 SendTerseUpdateToClient(client);
3571 });
3572 }
3573 else if(sendfull)
3574 {
3575 ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
3576 {
3577 SendFullUpdate(avatar.ControllingClient);
3578 });
3563 } 3579 }
3564 } 3580 }
3565 3581
3566
3567 /// <summary> 3582 /// <summary>
3568 /// Send a terse update to all clients 3583 /// Send a terse update to all clients
3569 /// </summary> 3584 /// </summary>
@@ -3571,7 +3586,6 @@ namespace OpenSim.Region.Framework.Scenes
3571 { 3586 {
3572 if (ParentGroup == null || ParentGroup.Scene == null) 3587 if (ParentGroup == null || ParentGroup.Scene == null)
3573 return; 3588 return;
3574
3575 lock(UpdateFlagLock) 3589 lock(UpdateFlagLock)
3576 { 3590 {
3577 if(UpdateFlag != UpdateRequired.NONE) 3591 if(UpdateFlag != UpdateRequired.NONE)