diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 90f0336869..8194260ebf 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1375,44 +1375,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } + + // wind caching + private static Dictionary lastWindVersion = new Dictionary(); + private static Dictionary> lastWindPackets = + new Dictionary>(); + + /// /// Send the wind matrix to the client /// /// 16x16 array of wind speeds -/* - public virtual void SendWindData(Vector2[] windSpeeds) - { - Util.FireAndForget(DoSendWindData, windSpeeds, "LLClientView.SendWindData"); - DoSendWindData(windSpeeds); - } -*/ - /// - /// 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(); - - - /// - /// Send wind layer information to the client. - /// - /// -// private void DoSendWindData(object o) public virtual void SendWindData(int version, Vector2[] windSpeeds) { // Vector2[] windSpeeds = (Vector2[])o; + ulong handle = this.Scene.RegionInfo.RegionHandle; bool isNewData; lock(lastWindPackets) - isNewData = lastWindVersion != version; + { + if(!lastWindVersion.ContainsKey(handle) || + !lastWindPackets.ContainsKey(handle)) + { + lastWindVersion[handle] = 0; + lastWindPackets[handle] = new List(); + isNewData = true; + } + else + isNewData = lastWindVersion[handle] != version; + } if(isNewData) { @@ -1435,32 +1426,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP layerpack.Header.Zerocoded = true; lock(lastWindPackets) { - lastWindPackets.Clear(); - lastWindPackets.Add(layerpack); - lastWindVersion = version; + lastWindPackets[handle].Clear(); + lastWindPackets[handle].Add(layerpack); + lastWindVersion[handle] = version; } } lock(lastWindPackets) - foreach(LayerDataPacket pkt in lastWindPackets) + foreach(LayerDataPacket pkt in lastWindPackets[handle]) OutPacket(pkt, ThrottleOutPacketType.Wind); } // cloud caching - private static int lastCloudVersion = 0; - private static List lastCloudPackets = new List(); + private static Dictionary lastCloudVersion = new Dictionary(); + private static Dictionary> lastCloudPackets = + new Dictionary>(); /// - /// Send cloud layer information to the client. + /// Send the cloud matrix to the client /// - /// -// private void DoSendCloudData(object o) + /// 16x16 array of cloud densities public virtual void SendCloudData(int version, float[] cloudDensity) { -// float[] cloudDensity = (float[])o; + ulong handle = this.Scene.RegionInfo.RegionHandle; bool isNewData; - lock(lastCloudPackets) - isNewData = lastCloudVersion != version; + lock(lastWindPackets) + { + if(!lastCloudVersion.ContainsKey(handle) || + !lastCloudPackets.ContainsKey(handle)) + { + lastCloudVersion[handle] = 0; + lastCloudPackets[handle] = new List(); + isNewData = true; + } + else + isNewData = lastCloudVersion[handle] != version; + } if(isNewData) { @@ -1484,14 +1485,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP layerpack.Header.Zerocoded = true; lock(lastCloudPackets) { - lastCloudPackets.Clear(); - lastCloudPackets.Add(layerpack); - lastCloudVersion = version; + lastCloudPackets[handle].Clear(); + lastCloudPackets[handle].Add(layerpack); + lastCloudVersion[handle] = version; } } lock(lastCloudPackets) - foreach(LayerDataPacket pkt in lastCloudPackets) + foreach(LayerDataPacket pkt in lastCloudPackets[handle]) OutPacket(pkt, ThrottleOutPacketType.Cloud); } diff --git a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs index a18225b9a0..617c348141 100644 --- a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs +++ b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs @@ -204,10 +204,9 @@ namespace OpenSim.Region.CoreModules.World private void CloudUpdate() { - if ((!m_ready || m_cloudDensity == 0 || (m_frame++ % m_frameUpdateRate) != 0)) - { + if ((!m_ready || m_busy || m_cloudDensity == 0 || + (m_frame++ % m_frameUpdateRate) != 0)) return; - } if(Monitor.TryEnter(cloudlock)) {