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 | |
parent | on entities updates throttles vectors needed to be compared as vectors, not j... (diff) | |
download | opensim-SC-f8cdccc16729212e374cc001ab4f0be8e5960259.zip opensim-SC-f8cdccc16729212e374cc001ab4f0be8e5960259.tar.gz opensim-SC-f8cdccc16729212e374cc001ab4f0be8e5960259.tar.bz2 opensim-SC-f8cdccc16729212e374cc001ab4f0be8e5960259.tar.xz |
a few more changes on entities updates
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 30 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 43 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 36 |
3 files changed, 52 insertions, 57 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 53c185b..954f21f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -6256,20 +6256,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6256 | /// <param name='x'></param> | 6256 | /// <param name='x'></param> |
6257 | private bool CheckAgentCameraUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) | 6257 | private bool CheckAgentCameraUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) |
6258 | { | 6258 | { |
6259 | float vdelta = Vector3.Distance(x.CameraAtAxis, m_thisAgentUpdateArgs.CameraAtAxis); | 6259 | if(Math.Abs(x.CameraCenter.X - m_thisAgentUpdateArgs.CameraCenter.X) > VDELTA || |
6260 | if((vdelta > VDELTA)) | 6260 | Math.Abs(x.CameraCenter.Y - m_thisAgentUpdateArgs.CameraCenter.Y) > VDELTA || |
6261 | return true; | 6261 | Math.Abs(x.CameraCenter.Z - m_thisAgentUpdateArgs.CameraCenter.Z) > VDELTA || |
6262 | 6262 | ||
6263 | vdelta = Vector3.Distance(x.CameraCenter, m_thisAgentUpdateArgs.CameraCenter); | 6263 | Math.Abs(x.CameraAtAxis.X - m_thisAgentUpdateArgs.CameraAtAxis.X) > VDELTA || |
6264 | if((vdelta > VDELTA)) | 6264 | Math.Abs(x.CameraAtAxis.Y - m_thisAgentUpdateArgs.CameraAtAxis.Y) > VDELTA || |
6265 | return true; | 6265 | // Math.Abs(x.CameraAtAxis.Z - m_thisAgentUpdateArgs.CameraAtAxis.Z) > VDELTA || |
6266 | 6266 | ||
6267 | vdelta = Vector3.Distance(x.CameraLeftAxis, m_thisAgentUpdateArgs.CameraLeftAxis); | 6267 | Math.Abs(x.CameraLeftAxis.X - m_thisAgentUpdateArgs.CameraLeftAxis.X) > VDELTA || |
6268 | if((vdelta > VDELTA)) | 6268 | Math.Abs(x.CameraLeftAxis.Y - m_thisAgentUpdateArgs.CameraLeftAxis.Y) > VDELTA || |
6269 | return true; | 6269 | // Math.Abs(x.CameraLeftAxis.Z - m_thisAgentUpdateArgs.CameraLeftAxis.Z) > VDELTA || |
6270 | 6270 | ||
6271 | vdelta = Vector3.Distance(x.CameraUpAxis, m_thisAgentUpdateArgs.CameraUpAxis); | 6271 | Math.Abs(x.CameraUpAxis.X - m_thisAgentUpdateArgs.CameraUpAxis.X) > VDELTA || |
6272 | if((vdelta > VDELTA)) | 6272 | Math.Abs(x.CameraUpAxis.Y - m_thisAgentUpdateArgs.CameraUpAxis.Y) > VDELTA |
6273 | // Math.Abs(x.CameraLeftAxis.Z - m_thisAgentUpdateArgs.CameraLeftAxis.Z) > VDELTA || | ||
6274 | ) | ||
6273 | return true; | 6275 | return true; |
6274 | 6276 | ||
6275 | return false; | 6277 | return false; |
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 | ||