diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 89 |
1 files changed, 40 insertions, 49 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 13b3ffb..abda29a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -410,8 +410,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
410 | m_particleSystem = Utils.EmptyBytes; | 410 | m_particleSystem = Utils.EmptyBytes; |
411 | Rezzed = DateTime.UtcNow; | 411 | Rezzed = DateTime.UtcNow; |
412 | Description = String.Empty; | 412 | Description = String.Empty; |
413 | DynAttrs = new DAMap(); | 413 | |
414 | |||
415 | // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, | 414 | // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, |
416 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from | 415 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from |
417 | // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log | 416 | // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log |
@@ -3475,7 +3474,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
3475 | private const float ANGVELOCITY_TOLERANCE = 0.005f; | 3474 | private const float ANGVELOCITY_TOLERANCE = 0.005f; |
3476 | private const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary | 3475 | private const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
3477 | private const double TIME_MS_TOLERANCE = 200.0; //llSetPos has a 200ms delay. This should NOT be 3 seconds. | 3476 | private const double TIME_MS_TOLERANCE = 200.0; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
3478 | 3477 | ||
3478 | private Vector3 ClampVectorForTerseUpdate(Vector3 v, float max) | ||
3479 | { | ||
3480 | float a, b; | ||
3481 | |||
3482 | a = Math.Abs(v.X); | ||
3483 | b = Math.Abs(v.Y); | ||
3484 | if (b > a) | ||
3485 | a = b; | ||
3486 | b = Math.Abs(v.Z); | ||
3487 | if (b > a) | ||
3488 | a = b; | ||
3489 | |||
3490 | if (a > max) | ||
3491 | { | ||
3492 | a = max / a; | ||
3493 | v.X *= a; | ||
3494 | v.Y *= a; | ||
3495 | v.Z *= a; | ||
3496 | } | ||
3497 | return v; | ||
3498 | } | ||
3499 | |||
3479 | /// <summary> | 3500 | /// <summary> |
3480 | /// Tell all the prims which have had updates scheduled | 3501 | /// Tell all the prims which have had updates scheduled |
3481 | /// </summary> | 3502 | /// </summary> |
@@ -3491,73 +3512,43 @@ namespace OpenSim.Region.Framework.Scenes | |||
3491 | 3512 | ||
3492 | if(current == PrimUpdateFlags.TerseUpdate) | 3513 | if(current == PrimUpdateFlags.TerseUpdate) |
3493 | { | 3514 | { |
3494 | Vector3 curvel = Velocity; | ||
3495 | Vector3 curacc = Acceleration; | ||
3496 | Vector3 angvel = AngularVelocity; | ||
3497 | |||
3498 | while(true) // just to avoid ugly goto | 3515 | while(true) // just to avoid ugly goto |
3499 | { | 3516 | { |
3500 | double elapsed = now - m_lastUpdateSentTime; | 3517 | double elapsed = now - m_lastUpdateSentTime; |
3501 | if (elapsed > TIME_MS_TOLERANCE) | 3518 | if (elapsed > TIME_MS_TOLERANCE) |
3502 | break; | 3519 | break; |
3503 | 3520 | ||
3504 | if( Math.Abs(curacc.X - m_lastAcceleration.X) > VELOCITY_TOLERANCE || | 3521 | if ( !Acceleration.ApproxEquals(m_lastAcceleration, VELOCITY_TOLERANCE)) |
3505 | Math.Abs(curacc.Y - m_lastAcceleration.Y) > VELOCITY_TOLERANCE || | ||
3506 | Math.Abs(curacc.Z - m_lastAcceleration.Z) > VELOCITY_TOLERANCE) | ||
3507 | break; | 3522 | break; |
3508 | 3523 | ||
3509 | if( Math.Abs(curvel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE || | 3524 | Vector3 curvel = ClampVectorForTerseUpdate(Velocity, 128f); |
3510 | Math.Abs(curvel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE || | 3525 | Vector3 tmp = ClampVectorForTerseUpdate(m_lastVelocity, 128f); |
3511 | Math.Abs(curvel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE) | 3526 | if (!curvel.ApproxEquals(tmp, VELOCITY_TOLERANCE)) |
3512 | break; | 3527 | break; |
3513 | 3528 | ||
3514 | float vx = Math.Abs(curvel.X); | 3529 | if (Math.Abs(curvel.X) < 1e-4 && Math.Abs(curvel.Y) < 1e-4 && Math.Abs(curvel.Z) < 1e-4) |
3515 | if(vx > 128.0) | ||
3516 | break; | ||
3517 | float vy = Math.Abs(curvel.Y); | ||
3518 | if(vy > 128.0) | ||
3519 | break; | ||
3520 | float vz = Math.Abs(curvel.Z); | ||
3521 | if(vz > 128.0) | ||
3522 | break; | ||
3523 | |||
3524 | if(vx < VELOCITY_TOLERANCE && vy < VELOCITY_TOLERANCE && vz < VELOCITY_TOLERANCE | ||
3525 | ) | ||
3526 | { | 3530 | { |
3527 | if(!AbsolutePosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) | 3531 | if (!AbsolutePosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) |
3528 | break; | 3532 | break; |
3529 | if(vx < 1e-4 && vy < 1e-4 && vz < 1e-4 && | 3533 | if ( Math.Abs(m_lastVelocity.X) > 1e-4 || |
3530 | ( | ||
3531 | Math.Abs(m_lastVelocity.X) > 1e-4 || | ||
3532 | Math.Abs(m_lastVelocity.Y) > 1e-4 || | 3534 | Math.Abs(m_lastVelocity.Y) > 1e-4 || |
3533 | Math.Abs(m_lastVelocity.Z) > 1e-4 | 3535 | Math.Abs(m_lastVelocity.Z) > 1e-4 |
3534 | )) | 3536 | ) |
3535 | break; | ||
3536 | } | ||
3537 | |||
3538 | if( Math.Abs(angvel.X - m_lastAngularVelocity.X) > ANGVELOCITY_TOLERANCE || | ||
3539 | Math.Abs(angvel.Y - m_lastAngularVelocity.Y) > ANGVELOCITY_TOLERANCE || | ||
3540 | Math.Abs(angvel.Z - m_lastAngularVelocity.Z) > ANGVELOCITY_TOLERANCE) | ||
3541 | break; | 3537 | break; |
3538 | } | ||
3542 | 3539 | ||
3543 | // viewer interpolators have a limit of 64rad/s | 3540 | Vector3 angvel = ClampVectorForTerseUpdate(AngularVelocity, 64f); |
3544 | float ax = Math.Abs(angvel.X); | 3541 | tmp = ClampVectorForTerseUpdate(m_lastAngularVelocity, 64f); |
3545 | if(ax > 64.0) | 3542 | if (!angvel.ApproxEquals(tmp, ANGVELOCITY_TOLERANCE)) |
3546 | break; | ||
3547 | float ay = Math.Abs(angvel.Y); | ||
3548 | if(ay > 64.0) | ||
3549 | break; | ||
3550 | float az = Math.Abs(angvel.Z); | ||
3551 | if(az > 64.0) | ||
3552 | break; | 3543 | break; |
3553 | 3544 | ||
3554 | if ( | 3545 | if ( Math.Abs(AngularVelocity.X) < 1e-4 && |
3555 | ax < ANGVELOCITY_TOLERANCE && | 3546 | Math.Abs(AngularVelocity.Y) < 1e-4 && |
3556 | ay < ANGVELOCITY_TOLERANCE && | 3547 | Math.Abs(AngularVelocity.Z) < 1e-4 && |
3557 | az < ANGVELOCITY_TOLERANCE && | ||
3558 | !RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) | 3548 | !RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) |
3559 | ) | 3549 | ) |
3560 | break; | 3550 | break; |
3551 | |||
3561 | return; | 3552 | return; |
3562 | } | 3553 | } |
3563 | } | 3554 | } |