From f5189b2cdd672734137a76f46379d225ed7c79e3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 23 Sep 2016 16:04:43 +0100 Subject: do the same for legacy clouds (still visible on older viewer ie singu 1.8.7). Fix clouds update. Send clouds and wind also to child agents. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 52 ++++++++++++++++------ 1 file changed, 38 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5f8d8f1..90f0336 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1390,11 +1390,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Send the cloud matrix to the client /// /// 16x16 array of cloud densities +/* public virtual void SendCloudData(int version, float[] cloudDensity) { Util.FireAndForget(DoSendCloudData, cloudDensity, "LLClientView.SendCloudData"); } - +*/ // wind caching private static int lastWindVersion = 0; private static List lastWindPackets = new List(); @@ -1445,30 +1446,53 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(pkt, ThrottleOutPacketType.Wind); } + // cloud caching + private static int lastCloudVersion = 0; + private static List lastCloudPackets = new List(); + /// /// Send cloud layer information to the client. /// /// - private void DoSendCloudData(object o) +// private void DoSendCloudData(object o) + public virtual void SendCloudData(int version, float[] cloudDensity) { - float[] cloudCover = (float[])o; - TerrainPatch[] patches = new TerrainPatch[1]; - patches[0] = new TerrainPatch(); - patches[0].Data = new float[16 * 16]; +// float[] cloudDensity = (float[])o; + bool isNewData; + lock(lastCloudPackets) + isNewData = lastCloudVersion != version; - for (int y = 0; y < 16; y++) + if(isNewData) { - for (int x = 0; x < 16; x++) + TerrainPatch[] patches = new TerrainPatch[1]; + patches[0] = new TerrainPatch(); + patches[0].Data = new float[16 * 16]; + + for (int y = 0; y < 16; y++) + { + for (int x = 0; x < 16; x++) + { + patches[0].Data[y * 16 + x] = cloudDensity[y * 16 + x]; + } + } + // neither we or viewers have extended clouds + byte layerType = (byte)TerrainPatch.LayerType.Cloud; + + LayerDataPacket layerpack = + OpenSimTerrainCompressor.CreateLayerDataPacketStandardSize( + patches, layerType); + layerpack.Header.Zerocoded = true; + lock(lastCloudPackets) { - patches[0].Data[y * 16 + x] = cloudCover[y * 16 + x]; + lastCloudPackets.Clear(); + lastCloudPackets.Add(layerpack); + lastCloudVersion = version; } } - // neither we or viewers have extended clouds - byte layerType = (byte)TerrainPatch.LayerType.Cloud; - LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLayerDataPacketStandardSize(patches, layerType); - layerpack.Header.Zerocoded = true; - OutPacket(layerpack, ThrottleOutPacketType.Cloud); + lock(lastCloudPackets) + foreach(LayerDataPacket pkt in lastCloudPackets) + OutPacket(pkt, ThrottleOutPacketType.Cloud); } /// -- cgit v1.1