aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorUbitUmarov2016-09-23 13:55:23 +0100
committerUbitUmarov2016-09-23 13:55:23 +0100
commit8d7f10e36bbb4de101b900f6b455de09c47d079c (patch)
tree464cf396422aaea042943bef78a0e0b9dc442284 /OpenSim/Region/ClientStack
parentadd a version tag to wind and cloud data updates to iclient (diff)
downloadopensim-SC_OLD-8d7f10e36bbb4de101b900f6b455de09c47d079c.zip
opensim-SC_OLD-8d7f10e36bbb4de101b900f6b455de09c47d079c.tar.gz
opensim-SC_OLD-8d7f10e36bbb4de101b900f6b455de09c47d079c.tar.bz2
opensim-SC_OLD-8d7f10e36bbb4de101b900f6b455de09c47d079c.tar.xz
cache wind compressed data so cpu burning compression is only done after a change. Not happy with version scheme for several regions on same instance, but should be ok for now
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs48
1 files changed, 36 insertions, 12 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 15f1004..5f8d8f1 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -1395,6 +1395,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1395 Util.FireAndForget(DoSendCloudData, cloudDensity, "LLClientView.SendCloudData"); 1395 Util.FireAndForget(DoSendCloudData, cloudDensity, "LLClientView.SendCloudData");
1396 } 1396 }
1397 1397
1398 // wind caching
1399 private static int lastWindVersion = 0;
1400 private static List<LayerDataPacket> lastWindPackets = new List<LayerDataPacket>();
1401
1402
1398 /// <summary> 1403 /// <summary>
1399 /// Send wind layer information to the client. 1404 /// Send wind layer information to the client.
1400 /// </summary> 1405 /// </summary>
@@ -1403,22 +1408,41 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1403 public virtual void SendWindData(int version, Vector2[] windSpeeds) 1408 public virtual void SendWindData(int version, Vector2[] windSpeeds)
1404 { 1409 {
1405// Vector2[] windSpeeds = (Vector2[])o; 1410// Vector2[] windSpeeds = (Vector2[])o;
1406 TerrainPatch[] patches = new TerrainPatch[2]; 1411
1407 patches[0] = new TerrainPatch { Data = new float[16 * 16] }; 1412 bool isNewData;
1408 patches[1] = new TerrainPatch { Data = new float[16 * 16] }; 1413 lock(lastWindPackets)
1414 isNewData = lastWindVersion != version;
1409 1415
1410 for (int x = 0; x < 16 * 16; x++) 1416 if(isNewData)
1411 { 1417 {
1412 patches[0].Data[x] = windSpeeds[x].X; 1418 TerrainPatch[] patches = new TerrainPatch[2];
1413 patches[1].Data[x] = windSpeeds[x].Y; 1419 patches[0] = new TerrainPatch { Data = new float[16 * 16] };
1414 } 1420 patches[1] = new TerrainPatch { Data = new float[16 * 16] };
1415 1421
1416 // neither we or viewers have extended wind 1422 for (int x = 0; x < 16 * 16; x++)
1417 byte layerType = (byte)TerrainPatch.LayerType.Wind; 1423 {
1424 patches[0].Data[x] = windSpeeds[x].X;
1425 patches[1].Data[x] = windSpeeds[x].Y;
1426 }
1418 1427
1419 LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLayerDataPacketStandardSize(patches, layerType); 1428 // neither we or viewers have extended wind
1420 layerpack.Header.Zerocoded = true; 1429 byte layerType = (byte)TerrainPatch.LayerType.Wind;
1421 OutPacket(layerpack, ThrottleOutPacketType.Wind); 1430
1431 LayerDataPacket layerpack =
1432 OpenSimTerrainCompressor.CreateLayerDataPacketStandardSize(
1433 patches, layerType);
1434 layerpack.Header.Zerocoded = true;
1435 lock(lastWindPackets)
1436 {
1437 lastWindPackets.Clear();
1438 lastWindPackets.Add(layerpack);
1439 lastWindVersion = version;
1440 }
1441 }
1442
1443 lock(lastWindPackets)
1444 foreach(LayerDataPacket pkt in lastWindPackets)
1445 OutPacket(pkt, ThrottleOutPacketType.Wind);
1422 } 1446 }
1423 1447
1424 /// <summary> 1448 /// <summary>