aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World
diff options
context:
space:
mode:
authorUbitUmarov2016-09-23 16:04:43 +0100
committerUbitUmarov2016-09-23 16:04:43 +0100
commitf5189b2cdd672734137a76f46379d225ed7c79e3 (patch)
treed2ee9f0e6626ffde96305234b28f47c1e97e8f87 /OpenSim/Region/CoreModules/World
parentcache wind compressed data so cpu burning compression is only done after a ch... (diff)
downloadopensim-SC_OLD-f5189b2cdd672734137a76f46379d225ed7c79e3.zip
opensim-SC_OLD-f5189b2cdd672734137a76f46379d225ed7c79e3.tar.gz
opensim-SC_OLD-f5189b2cdd672734137a76f46379d225ed7c79e3.tar.bz2
opensim-SC_OLD-f5189b2cdd672734137a76f46379d225ed7c79e3.tar.xz
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.
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r--OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs57
-rw-r--r--OpenSim/Region/CoreModules/World/Wind/WindModule.cs2
2 files changed, 46 insertions, 13 deletions
diff --git a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs
index f304307..3c2884b 100644
--- a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs
+++ b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Threading;
30using Mono.Addins; 31using Mono.Addins;
31using Nini.Config; 32using Nini.Config;
32using OpenMetaverse; 33using OpenMetaverse;
@@ -49,6 +50,10 @@ namespace OpenSim.Region.CoreModules.World
49 private bool m_enabled = false; 50 private bool m_enabled = false;
50 private float m_cloudDensity = 1.0F; 51 private float m_cloudDensity = 1.0F;
51 private float[] cloudCover = new float[16 * 16]; 52 private float[] cloudCover = new float[16 * 16];
53 private int m_dataVersion;
54 private bool m_busy;
55 private object cloudlock = new object();
56
52 57
53 public void Initialise(IConfigSource config) 58 public void Initialise(IConfigSource config)
54 { 59 {
@@ -70,11 +75,13 @@ namespace OpenSim.Region.CoreModules.World
70 75
71 m_scene = scene; 76 m_scene = scene;
72 77
73 scene.EventManager.OnNewClient += CloudsToClient;
74 scene.RegisterModuleInterface<ICloudModule>(this); 78 scene.RegisterModuleInterface<ICloudModule>(this);
75 scene.EventManager.OnFrame += CloudUpdate;
76 79
77 GenerateCloudCover(); 80 GenerateCloudCover();
81 m_dataVersion = (int)m_scene.AllocateLocalId();
82
83 scene.EventManager.OnNewClient += CloudsToClient;
84 scene.EventManager.OnFrame += CloudUpdate;
78 85
79 m_ready = true; 86 m_ready = true;
80 } 87 }
@@ -89,7 +96,6 @@ namespace OpenSim.Region.CoreModules.World
89 m_scene.EventManager.OnNewClient -= CloudsToClient; 96 m_scene.EventManager.OnNewClient -= CloudsToClient;
90 m_scene.EventManager.OnFrame -= CloudUpdate; 97 m_scene.EventManager.OnFrame -= CloudUpdate;
91 m_scene.UnregisterModuleInterface<ICloudModule>(this); 98 m_scene.UnregisterModuleInterface<ICloudModule>(this);
92
93 m_scene = null; 99 m_scene = null;
94 } 100 }
95 101
@@ -127,7 +133,8 @@ namespace OpenSim.Region.CoreModules.World
127 133
128 if (cloudCover != null) 134 if (cloudCover != null)
129 { 135 {
130 cover = cloudCover[y * 16 + x]; 136 lock(cloudlock)
137 cover = cloudCover[y * 16 + x];
131 } 138 }
132 139
133 return cover; 140 return cover;
@@ -188,22 +195,48 @@ namespace OpenSim.Region.CoreModules.World
188 } 195 }
189 } 196 }
190 Array.Copy(newCover, cloudCover, 16 * 16); 197 Array.Copy(newCover, cloudCover, 16 * 16);
198 m_dataVersion++;
191 } 199 }
192 200
193 private void CloudUpdate() 201 private void CloudUpdate()
194 { 202 {
195 if (((m_frame++ % m_frameUpdateRate) != 0) || !m_ready || (m_cloudDensity == 0)) 203 if ((!m_ready || m_cloudDensity == 0 || (m_frame++ % m_frameUpdateRate) != 0))
196 { 204 {
197 return; 205 return;
198 } 206 }
199 UpdateCloudCover(); 207
208 if(Monitor.TryEnter(cloudlock))
209 {
210 m_busy = true;
211 Util.FireAndForget(delegate
212 {
213 try
214 {
215 lock(cloudlock)
216 {
217 UpdateCloudCover();
218 m_scene.ForEachClient(delegate(IClientAPI client)
219 {
220 client.SendCloudData(m_dataVersion, cloudCover);
221 });
222 }
223 }
224 finally
225 {
226 m_busy = false;
227 }
228 },
229 null, "CloudModuleUpdate");
230 Monitor.Exit(cloudlock);
231 }
200 } 232 }
201 233
202 public void CloudsToClient(IClientAPI client) 234 public void CloudsToClient(IClientAPI client)
203 { 235 {
204 if (m_ready) 236 if (m_ready)
205 { 237 {
206 client.SendCloudData(0, cloudCover); 238 lock(cloudlock)
239 client.SendCloudData(m_dataVersion, cloudCover);
207 } 240 }
208 } 241 }
209 242
diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
index bc92582..95cf57d 100644
--- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
@@ -425,7 +425,7 @@ namespace OpenSim.Region.CoreModules
425 try 425 try
426 { 426 {
427 GenWind(); 427 GenWind();
428 m_scene.ForEachRootClient(delegate(IClientAPI client) 428 m_scene.ForEachClient(delegate(IClientAPI client)
429 { 429 {
430 client.SendWindData(m_dataVersion, windSpeeds); 430 client.SendWindData(m_dataVersion, windSpeeds);
431 }); 431 });