diff options
author | UbitUmarov | 2017-07-10 21:12:34 +0100 |
---|---|---|
committer | UbitUmarov | 2017-07-10 21:12:34 +0100 |
commit | f8cdccc16729212e374cc001ab4f0be8e5960259 (patch) | |
tree | a090bee683a53648d81847f5279a81d5da1ec99a /OpenSim/Region/Framework | |
parent | on entities updates throttles vectors needed to be compared as vectors, not j... (diff) | |
download | opensim-SC_OLD-f8cdccc16729212e374cc001ab4f0be8e5960259.zip opensim-SC_OLD-f8cdccc16729212e374cc001ab4f0be8e5960259.tar.gz opensim-SC_OLD-f8cdccc16729212e374cc001ab4f0be8e5960259.tar.bz2 opensim-SC_OLD-f8cdccc16729212e374cc001ab4f0be8e5960259.tar.xz |
a few more changes on entities updates
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 43 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 36 |
2 files changed, 36 insertions, 43 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 576a013..2e16663 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -3237,7 +3237,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3237 | 3237 | ||
3238 | /// <summary> | 3238 | /// <summary> |
3239 | /// Schedule a terse update for this prim. Terse updates only send position, | 3239 | /// Schedule a terse update for this prim. Terse updates only send position, |
3240 | /// rotation, velocity and rotational velocity information. | 3240 | /// rotation, velocity and rotational velocity information. WRONG!!!! |
3241 | /// </summary> | 3241 | /// </summary> |
3242 | public void ScheduleTerseUpdate() | 3242 | public void ScheduleTerseUpdate() |
3243 | { | 3243 | { |
@@ -3296,21 +3296,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3296 | sp.SendAttachmentUpdate(this, UpdateRequired.FULL); | 3296 | sp.SendAttachmentUpdate(this, UpdateRequired.FULL); |
3297 | } | 3297 | } |
3298 | } | 3298 | } |
3299 | |||
3300 | /* this does nothing | ||
3301 | SendFullUpdateToClient(remoteClient, Position) ignores position parameter | ||
3302 | if (IsRoot) | ||
3303 | { | ||
3304 | if (ParentGroup.IsAttachment) | ||
3305 | { | ||
3306 | SendFullUpdateToClient(remoteClient, AttachedPos); | ||
3307 | } | ||
3308 | else | ||
3309 | { | ||
3310 | SendFullUpdateToClient(remoteClient, AbsolutePosition); | ||
3311 | } | ||
3312 | } | ||
3313 | */ | ||
3314 | else | 3299 | else |
3315 | { | 3300 | { |
3316 | SendFullUpdateToClient(remoteClient); | 3301 | SendFullUpdateToClient(remoteClient); |
@@ -3396,24 +3381,26 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3396 | ParentGroup.Scene.StatsReporter.AddObjectUpdates(1); | 3381 | ParentGroup.Scene.StatsReporter.AddObjectUpdates(1); |
3397 | } | 3382 | } |
3398 | 3383 | ||
3384 | |||
3385 | private const float ROTATION_TOLERANCE = 0.01f; | ||
3386 | private const float VELOCITY_TOLERANCE = 0.1f; // terse update vel has low resolution | ||
3387 | private const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary | ||
3388 | private const double TIME_MS_TOLERANCE = 200f; //llSetPos has a 200ms delay. This should NOT be 3 seconds. | ||
3399 | 3389 | ||
3400 | /// <summary> | 3390 | /// <summary> |
3401 | /// Tell all the prims which have had updates scheduled | 3391 | /// Tell all the prims which have had updates scheduled |
3402 | /// </summary> | 3392 | /// </summary> |
3403 | public void SendScheduledUpdates() | 3393 | public void SendScheduledUpdates() |
3404 | { | 3394 | { |
3405 | const float ROTATION_TOLERANCE = 0.01f; | ||
3406 | const float VELOCITY_TOLERANCE = 0.1f; // terse update vel has low resolution | ||
3407 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary | ||
3408 | const double TIME_MS_TOLERANCE = 200f; //llSetPos has a 200ms delay. This should NOT be 3 seconds. | ||
3409 | |||
3410 | switch (UpdateFlag) | 3395 | switch (UpdateFlag) |
3411 | { | 3396 | { |
3412 | // this is wrong we need to get back to this | 3397 | case UpdateRequired.NONE: |
3413 | case UpdateRequired.TERSE: | ||
3414 | { | ||
3415 | ClearUpdateSchedule(); | 3398 | ClearUpdateSchedule(); |
3399 | break; | ||
3400 | |||
3401 | case UpdateRequired.TERSE: | ||
3416 | 3402 | ||
3403 | ClearUpdateSchedule(); | ||
3417 | bool needupdate = true; | 3404 | bool needupdate = true; |
3418 | double now = Util.GetTimeStampMS(); | 3405 | double now = Util.GetTimeStampMS(); |
3419 | Vector3 curvel = Velocity; | 3406 | Vector3 curvel = Velocity; |
@@ -3423,8 +3410,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3423 | while(true) // just to avoid ugly goto | 3410 | while(true) // just to avoid ugly goto |
3424 | { | 3411 | { |
3425 | double elapsed = now - m_lastUpdateSentTime; | 3412 | double elapsed = now - m_lastUpdateSentTime; |
3426 | |||
3427 | // minimal rate also for the other things on terse updates | ||
3428 | if (elapsed > TIME_MS_TOLERANCE) | 3413 | if (elapsed > TIME_MS_TOLERANCE) |
3429 | break; | 3414 | break; |
3430 | 3415 | ||
@@ -3514,13 +3499,11 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
3514 | }); | 3499 | }); |
3515 | } | 3500 | } |
3516 | break; | 3501 | break; |
3517 | } | 3502 | |
3518 | case UpdateRequired.FULL: | 3503 | case UpdateRequired.FULL: |
3519 | { | ||
3520 | ClearUpdateSchedule(); | 3504 | ClearUpdateSchedule(); |
3521 | SendFullUpdateToAllClientsInternal(); | 3505 | SendFullUpdateToAllClientsInternal(); |
3522 | break; | 3506 | break; |
3523 | } | ||
3524 | } | 3507 | } |
3525 | } | 3508 | } |
3526 | 3509 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c1b62af..ba3aaae 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -279,8 +279,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
279 | private bool MouseDown = false; | 279 | private bool MouseDown = false; |
280 | public Vector3 lastKnownAllowedPosition; | 280 | public Vector3 lastKnownAllowedPosition; |
281 | public bool sentMessageAboutRestrictedParcelFlyingDown; | 281 | public bool sentMessageAboutRestrictedParcelFlyingDown; |
282 | |||
282 | public Vector4 CollisionPlane = Vector4.UnitW; | 283 | public Vector4 CollisionPlane = Vector4.UnitW; |
283 | 284 | ||
285 | public Vector4 m_lastCollisionPlane = Vector4.UnitW; | ||
286 | private byte m_lastState; | ||
284 | private Vector3 m_lastPosition; | 287 | private Vector3 m_lastPosition; |
285 | private Quaternion m_lastRotation; | 288 | private Quaternion m_lastRotation; |
286 | private Vector3 m_lastVelocity; | 289 | private Vector3 m_lastVelocity; |
@@ -2818,16 +2821,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2818 | CameraAtAxis = agentData.CameraAtAxis; | 2821 | CameraAtAxis = agentData.CameraAtAxis; |
2819 | CameraLeftAxis = agentData.CameraLeftAxis; | 2822 | CameraLeftAxis = agentData.CameraLeftAxis; |
2820 | CameraUpAxis = agentData.CameraUpAxis; | 2823 | CameraUpAxis = agentData.CameraUpAxis; |
2821 | Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis); | ||
2822 | CameraRotation = camRot; | ||
2823 | |||
2824 | // The Agent's Draw distance setting | ||
2825 | // When we get to the point of re-computing neighbors everytime this | ||
2826 | // changes, then start using the agent's drawdistance rather than the | ||
2827 | // region's draw distance. | ||
2828 | |||
2829 | DrawDistance = agentData.Far; | 2824 | DrawDistance = agentData.Far; |
2830 | 2825 | ||
2826 | CameraAtAxis.Normalize(); | ||
2827 | CameraLeftAxis.Normalize(); | ||
2828 | CameraUpAxis.Normalize(); | ||
2829 | Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis); | ||
2830 | CameraRotation = camRot; | ||
2831 | 2831 | ||
2832 | // Check if Client has camera in 'follow cam' or 'build' mode. | 2832 | // Check if Client has camera in 'follow cam' or 'build' mode. |
2833 | // Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); | 2833 | // Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); |
@@ -3794,15 +3794,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3794 | // this does need to be more complex later | 3794 | // this does need to be more complex later |
3795 | Vector3 vel = Velocity; | 3795 | Vector3 vel = Velocity; |
3796 | Vector3 dpos = m_pos - m_lastPosition; | 3796 | Vector3 dpos = m_pos - m_lastPosition; |
3797 | if( Math.Abs(vel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE || | 3797 | if( State != m_lastState || |
3798 | Math.Abs(vel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE || | ||
3798 | Math.Abs(vel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE || | 3799 | Math.Abs(vel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE || |
3799 | Math.Abs(vel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE || | 3800 | Math.Abs(vel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE || |
3800 | 3801 | ||
3801 | Math.Abs(m_bodyRot.X - m_lastRotation.X) > ROTATION_TOLERANCE || | 3802 | Math.Abs(m_bodyRot.X - m_lastRotation.X) > ROTATION_TOLERANCE || |
3802 | Math.Abs(m_bodyRot.Y - m_lastRotation.Y) > ROTATION_TOLERANCE || | 3803 | Math.Abs(m_bodyRot.Y - m_lastRotation.Y) > ROTATION_TOLERANCE || |
3803 | Math.Abs(m_bodyRot.Z - m_lastRotation.Z) > ROTATION_TOLERANCE || | 3804 | Math.Abs(m_bodyRot.Z - m_lastRotation.Z) > ROTATION_TOLERANCE || |
3804 | 3805 | ||
3805 | (vel == Vector3.Zero && m_lastVelocity != Vector3.Zero) || | 3806 | (vel == Vector3.Zero && m_lastVelocity != Vector3.Zero) || |
3807 | |||
3806 | Math.Abs(dpos.X) > POSITION_LARGETOLERANCE || | 3808 | Math.Abs(dpos.X) > POSITION_LARGETOLERANCE || |
3807 | Math.Abs(dpos.Y) > POSITION_LARGETOLERANCE || | 3809 | Math.Abs(dpos.Y) > POSITION_LARGETOLERANCE || |
3808 | Math.Abs(dpos.Z) > POSITION_LARGETOLERANCE || | 3810 | Math.Abs(dpos.Z) > POSITION_LARGETOLERANCE || |
@@ -3811,7 +3813,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3811 | Math.Abs(dpos.Y) > POSITION_SMALLTOLERANCE || | 3813 | Math.Abs(dpos.Y) > POSITION_SMALLTOLERANCE || |
3812 | Math.Abs(dpos.Z) > POSITION_SMALLTOLERANCE) | 3814 | Math.Abs(dpos.Z) > POSITION_SMALLTOLERANCE) |
3813 | && vel.LengthSquared() < LOWVELOCITYSQ | 3815 | && vel.LengthSquared() < LOWVELOCITYSQ |
3814 | )) | 3816 | ) || |
3817 | |||
3818 | Math.Abs(CollisionPlane.X - m_lastCollisionPlane.X) > POSITION_SMALLTOLERANCE || | ||
3819 | Math.Abs(CollisionPlane.Y - m_lastCollisionPlane.Y) > POSITION_SMALLTOLERANCE || | ||
3820 | Math.Abs(CollisionPlane.W - m_lastCollisionPlane.W) > POSITION_SMALLTOLERANCE | ||
3821 | ) | ||
3815 | { | 3822 | { |
3816 | SendTerseUpdateToAllClients(); | 3823 | SendTerseUpdateToAllClients(); |
3817 | } | 3824 | } |
@@ -3910,11 +3917,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3910 | /// </summary> | 3917 | /// </summary> |
3911 | public void SendTerseUpdateToAllClients() | 3918 | public void SendTerseUpdateToAllClients() |
3912 | { | 3919 | { |
3913 | m_scene.ForEachScenePresence(SendTerseUpdateToAgent); | 3920 | m_lastState = State; |
3914 | // Update the "last" values | ||
3915 | m_lastPosition = m_pos; | 3921 | m_lastPosition = m_pos; |
3916 | m_lastRotation = m_bodyRot; | 3922 | m_lastRotation = m_bodyRot; |
3917 | m_lastVelocity = Velocity; | 3923 | m_lastVelocity = Velocity; |
3924 | m_lastCollisionPlane = CollisionPlane; | ||
3925 | |||
3926 | m_scene.ForEachScenePresence(SendTerseUpdateToAgent); | ||
3927 | // Update the "last" values | ||
3918 | TriggerScenePresenceUpdated(); | 3928 | TriggerScenePresenceUpdated(); |
3919 | } | 3929 | } |
3920 | 3930 | ||