aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-26 18:22:32 -0700
committerJohn Hurliman2009-10-26 18:22:32 -0700
commitb6651ce79017bc7c6d1df66757e26a74bacfc36f (patch)
treed6f9835eff9f7d35da3fcdd3cd063cd72cba41c7 /OpenSim
parentRemoving the ClientManager reference from IScene and hiding it entirely insid... (diff)
downloadopensim-SC-b6651ce79017bc7c6d1df66757e26a74bacfc36f.zip
opensim-SC-b6651ce79017bc7c6d1df66757e26a74bacfc36f.tar.gz
opensim-SC-b6651ce79017bc7c6d1df66757e26a74bacfc36f.tar.bz2
opensim-SC-b6651ce79017bc7c6d1df66757e26a74bacfc36f.tar.xz
* Double the priority on avatar bake texture requests to get avatars rezzing in faster than the surrounding scene
* Adds duplicate tracking for SceneObjectParts and ScenePresences to avoid sending out duplicate ImprovedTerseObjectUpdate packets
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs44
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs69
3 files changed, 69 insertions, 62 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index edfb13c..31028b3 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -6756,11 +6756,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6756 if (OnRequestTexture != null) 6756 if (OnRequestTexture != null)
6757 { 6757 {
6758 TextureRequestArgs args = new TextureRequestArgs(); 6758 TextureRequestArgs args = new TextureRequestArgs();
6759 args.RequestedAssetID = imageRequest.RequestImage[i].Image; 6759
6760 args.DiscardLevel = imageRequest.RequestImage[i].DiscardLevel; 6760 RequestImagePacket.RequestImageBlock block = imageRequest.RequestImage[i];
6761 args.PacketNumber = imageRequest.RequestImage[i].Packet; 6761
6762 args.Priority = imageRequest.RequestImage[i].DownloadPriority; 6762 args.RequestedAssetID = block.Image;
6763 args.DiscardLevel = block.DiscardLevel;
6764 args.PacketNumber = block.Packet;
6765 args.Priority = block.DownloadPriority;
6763 args.requestSequence = imageRequest.Header.Sequence; 6766 args.requestSequence = imageRequest.Header.Sequence;
6767
6768 // NOTE: This is not a built in part of the LLUDP protocol, but we double the
6769 // priority of avatar textures to get avatars rezzing in faster than the
6770 // surrounding scene
6771 if ((ImageType)block.Type == ImageType.Baked)
6772 args.Priority *= 2.0f;
6773
6764 //handlerTextureRequest = OnRequestTexture; 6774 //handlerTextureRequest = OnRequestTexture;
6765 6775
6766 //if (handlerTextureRequest != null) 6776 //if (handlerTextureRequest != null)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index d84c35c..a87bde0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -248,6 +248,12 @@ namespace OpenSim.Region.Framework.Scenes
248 protected UUID m_uuid; 248 protected UUID m_uuid;
249 protected Vector3 m_velocity; 249 protected Vector3 m_velocity;
250 250
251 protected Vector3 m_lastPosition;
252 protected Quaternion m_lastRotation;
253 protected Vector3 m_lastVelocity;
254 protected Vector3 m_lastAcceleration;
255 protected Vector3 m_lastAngularVelocity;
256
251 // TODO: Those have to be changed into persistent properties at some later point, 257 // TODO: Those have to be changed into persistent properties at some later point,
252 // or sit-camera on vehicles will break on sim-crossing. 258 // or sit-camera on vehicles will break on sim-crossing.
253 private Vector3 m_cameraEyeOffset; 259 private Vector3 m_cameraEyeOffset;
@@ -2387,18 +2393,36 @@ if (m_shape != null) {
2387 /// </summary> 2393 /// </summary>
2388 public void SendScheduledUpdates() 2394 public void SendScheduledUpdates()
2389 { 2395 {
2390 if (m_updateFlag == 1) //some change has been made so update the clients 2396 const float VELOCITY_TOLERANCE = 0.01f;
2397 const float POSITION_TOLERANCE = 10.0f;
2398
2399 if (m_updateFlag == 1)
2391 { 2400 {
2392 AddTerseUpdateToAllAvatars(); 2401 // Throw away duplicate or insignificant updates
2393 ClearUpdateSchedule(); 2402 if (RotationOffset != m_lastRotation ||
2403 Acceleration != m_lastAcceleration ||
2404 (Velocity - m_lastVelocity).Length() > VELOCITY_TOLERANCE ||
2405 (RotationalVelocity - m_lastAngularVelocity).Length() > VELOCITY_TOLERANCE ||
2406 (OffsetPosition - m_lastPosition).Length() > POSITION_TOLERANCE)
2407 {
2408 AddTerseUpdateToAllAvatars();
2409 ClearUpdateSchedule();
2394 2410
2395 // This causes the Scene to 'poll' physical objects every couple of frames 2411 // This causes the Scene to 'poll' physical objects every couple of frames
2396 // bad, so it's been replaced by an event driven method. 2412 // bad, so it's been replaced by an event driven method.
2397 //if ((ObjectFlags & (uint)PrimFlags.Physics) != 0) 2413 //if ((ObjectFlags & (uint)PrimFlags.Physics) != 0)
2398 //{ 2414 //{
2399 // Only send the constant terse updates on physical objects! 2415 // Only send the constant terse updates on physical objects!
2400 //ScheduleTerseUpdate(); 2416 //ScheduleTerseUpdate();
2401 //} 2417 //}
2418
2419 // Update the "last" values
2420 m_lastPosition = OffsetPosition;
2421 m_lastRotation = RotationOffset;
2422 m_lastVelocity = Velocity;
2423 m_lastAcceleration = Acceleration;
2424 m_lastAngularVelocity = RotationalVelocity;
2425 }
2402 } 2426 }
2403 else 2427 else
2404 { 2428 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 67384fb..0ac5be0 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -93,12 +93,13 @@ namespace OpenSim.Region.Framework.Scenes
93 public Vector3 lastKnownAllowedPosition; 93 public Vector3 lastKnownAllowedPosition;
94 public bool sentMessageAboutRestrictedParcelFlyingDown; 94 public bool sentMessageAboutRestrictedParcelFlyingDown;
95 95
96 96 private Vector3 m_lastPosition;
97 private Quaternion m_lastRotation;
98 private Vector3 m_lastVelocity;
97 99
98 private bool m_updateflag; 100 private bool m_updateflag;
99 private byte m_movementflag; 101 private byte m_movementflag;
100 private readonly List<NewForce> m_forcesList = new List<NewForce>(); 102 private readonly List<NewForce> m_forcesList = new List<NewForce>();
101 private short m_updateCount;
102 private uint m_requestedSitTargetID; 103 private uint m_requestedSitTargetID;
103 private UUID m_requestedSitTargetUUID = UUID.Zero; 104 private UUID m_requestedSitTargetUUID = UUID.Zero;
104 private SendCourseLocationsMethod m_sendCourseLocationsMethod; 105 private SendCourseLocationsMethod m_sendCourseLocationsMethod;
@@ -145,12 +146,9 @@ namespace OpenSim.Region.Framework.Scenes
145 public string JID = string.Empty; 146 public string JID = string.Empty;
146 147
147 // Agent moves with a PID controller causing a force to be exerted. 148 // Agent moves with a PID controller causing a force to be exerted.
148 private bool m_newForce;
149 private bool m_newCoarseLocations = true; 149 private bool m_newCoarseLocations = true;
150 private float m_health = 100f; 150 private float m_health = 100f;
151 151
152 private Vector3 m_lastVelocity = Vector3.Zero;
153
154 // Default AV Height 152 // Default AV Height
155 private float m_avHeight = 127.0f; 153 private float m_avHeight = 127.0f;
156 154
@@ -158,16 +156,6 @@ namespace OpenSim.Region.Framework.Scenes
158 protected ulong crossingFromRegion; 156 protected ulong crossingFromRegion;
159 157
160 private readonly Vector3[] Dir_Vectors = new Vector3[6]; 158 private readonly Vector3[] Dir_Vectors = new Vector3[6];
161
162 /// <value>
163 /// The avatar position last sent to clients
164 /// </value>
165 private Vector3 lastPhysPos = Vector3.Zero;
166
167 /// <value>
168 /// The avatar body rotation last sent to clients
169 /// </value>
170 private Quaternion lastPhysRot = Quaternion.Identity;
171 159
172 // Position of agent's camera in world (region cordinates) 160 // Position of agent's camera in world (region cordinates)
173 protected Vector3 m_CameraCenter = Vector3.Zero; 161 protected Vector3 m_CameraCenter = Vector3.Zero;
@@ -1123,18 +1111,18 @@ namespace OpenSim.Region.Framework.Scenes
1123 CameraConstraintActive = true; 1111 CameraConstraintActive = true;
1124 //m_log.DebugFormat("[RAYCASTRESULT]: {0}, {1}, {2}, {3}", hitYN, collisionPoint, localid, distance); 1112 //m_log.DebugFormat("[RAYCASTRESULT]: {0}, {1}, {2}, {3}", hitYN, collisionPoint, localid, distance);
1125 1113
1126 Vector3 normal = Vector3.Normalize(new Vector3(0,0,collisionPoint.Z) - collisionPoint); 1114 Vector3 normal = Vector3.Normalize(new Vector3(0f, 0f, collisionPoint.Z) - collisionPoint);
1127 ControllingClient.SendCameraConstraint(new Vector4(normal.X, normal.Y, normal.Z, -1 * Vector3.Distance(new Vector3(0,0,collisionPoint.Z),collisionPoint))); 1115 ControllingClient.SendCameraConstraint(new Vector4(normal.X, normal.Y, normal.Z, -1 * Vector3.Distance(new Vector3(0,0,collisionPoint.Z),collisionPoint)));
1128 } 1116 }
1129 else 1117 else
1130 { 1118 {
1131 if (((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02) 1119 if ((m_pos - m_lastPosition).Length() > 0.02f ||
1132 || (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02) 1120 (m_velocity - m_lastVelocity).Length() > 0.02f ||
1133 || lastPhysRot != m_bodyRot)) 1121 m_bodyRot != m_lastRotation)
1134 { 1122 {
1135 if (CameraConstraintActive) 1123 if (CameraConstraintActive)
1136 { 1124 {
1137 ControllingClient.SendCameraConstraint(new Vector4(0, 0.5f, 0.9f, -3000f)); 1125 ControllingClient.SendCameraConstraint(new Vector4(0f, 0.5f, 0.9f, -3000f));
1138 CameraConstraintActive = false; 1126 CameraConstraintActive = false;
1139 } 1127 }
1140 } 1128 }
@@ -2373,6 +2361,9 @@ namespace OpenSim.Region.Framework.Scenes
2373 2361
2374 public override void Update() 2362 public override void Update()
2375 { 2363 {
2364 const float VELOCITY_TOLERANCE = 0.01f;
2365 const float POSITION_TOLERANCE = 10.0f;
2366
2376 SendPrimUpdates(); 2367 SendPrimUpdates();
2377 2368
2378 if (m_newCoarseLocations) 2369 if (m_newCoarseLocations)
@@ -2383,28 +2374,17 @@ namespace OpenSim.Region.Framework.Scenes
2383 2374
2384 if (m_isChildAgent == false) 2375 if (m_isChildAgent == false)
2385 { 2376 {
2386 if (m_newForce) // user movement 'forces' (ie commands to move) 2377 // Throw away duplicate or insignificant updates
2378 if (m_bodyRot != m_lastRotation ||
2379 (m_velocity - m_lastVelocity).Length() > VELOCITY_TOLERANCE ||
2380 (m_pos - m_lastPosition).Length() > POSITION_TOLERANCE)
2387 { 2381 {
2388 SendTerseUpdateToAllClients(); 2382 SendTerseUpdateToAllClients();
2389 m_updateCount = 0; 2383
2390 } 2384 // Update the "last" values
2391 else if (m_movementflag != 0) // scripted movement (?) 2385 m_lastPosition = m_pos;
2392 { 2386 m_lastRotation = m_bodyRot;
2393 m_updateCount++; 2387 m_lastVelocity = m_velocity;
2394 if (m_updateCount > 3)
2395 {
2396 SendTerseUpdateToAllClients();
2397 m_updateCount = 0;
2398 }
2399 }
2400 else if ((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02)
2401 || (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02)
2402 || lastPhysRot != m_bodyRot)
2403 {
2404 // Send Terse Update to all clients updates lastPhysPos and m_lastVelocity
2405 // doing the above assures us that we know what we sent the clients last
2406 SendTerseUpdateToAllClients();
2407 m_updateCount = 0;
2408 } 2388 }
2409 2389
2410 // followed suggestion from mic bowman. reversed the two lines below. 2390 // followed suggestion from mic bowman. reversed the two lines below.
@@ -2447,15 +2427,10 @@ namespace OpenSim.Region.Framework.Scenes
2447 public void SendTerseUpdateToAllClients() 2427 public void SendTerseUpdateToAllClients()
2448 { 2428 {
2449 m_perfMonMS = Environment.TickCount; 2429 m_perfMonMS = Environment.TickCount;
2450 2430
2451 m_scene.ForEachClient(SendTerseUpdateToClient); 2431 m_scene.ForEachClient(SendTerseUpdateToClient);
2452 2432
2453 m_lastVelocity = m_velocity;
2454 lastPhysPos = AbsolutePosition;
2455 lastPhysRot = m_bodyRot;
2456
2457 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2433 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
2458
2459 } 2434 }
2460 2435
2461 public void SendCoarseLocations() 2436 public void SendCoarseLocations()
@@ -3316,7 +3291,6 @@ namespace OpenSim.Region.Framework.Scenes
3316 /// </summary> 3291 /// </summary>
3317 public override void UpdateMovement() 3292 public override void UpdateMovement()
3318 { 3293 {
3319 m_newForce = false;
3320 lock (m_forcesList) 3294 lock (m_forcesList)
3321 { 3295 {
3322 if (m_forcesList.Count > 0) 3296 if (m_forcesList.Count > 0)
@@ -3338,7 +3312,6 @@ namespace OpenSim.Region.Framework.Scenes
3338 // Ignoring this causes no movement to be sent to the physics engine... 3312 // Ignoring this causes no movement to be sent to the physics engine...
3339 // which when the scene is moving at 1 frame every 10 seconds, it doesn't really matter! 3313 // which when the scene is moving at 1 frame every 10 seconds, it doesn't really matter!
3340 } 3314 }
3341 m_newForce = true;
3342 3315
3343 m_forcesList.Clear(); 3316 m_forcesList.Clear();
3344 } 3317 }