aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2008-09-26 12:56:17 +0000
committerTeravus Ovares2008-09-26 12:56:17 +0000
commit6b13730bc7451a407c6370d289545542c66a74ea (patch)
tree82a649a73dd2aca6bbe5dd783b3ec98ca275b6ea /OpenSim/Region
parentRemove interfaces that are no longer used from DNE (diff)
downloadopensim-SC_OLD-6b13730bc7451a407c6370d289545542c66a74ea.zip
opensim-SC_OLD-6b13730bc7451a407c6370d289545542c66a74ea.tar.gz
opensim-SC_OLD-6b13730bc7451a407c6370d289545542c66a74ea.tar.bz2
opensim-SC_OLD-6b13730bc7451a407c6370d289545542c66a74ea.tar.xz
* Wind updates. Still random.. but in 4 directions instead of two!
* It seems kind of silly to be building a 256x256 array just to use two 16 float blocks.. but for now the layerdata routine requires it so we'll go along with that. * We only fill a 32x16 area of the 256x256 float array with data. * We use patches 0,0 and 0,1 for the first and second patch to determine the direction and magnitude of the wind.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs50
-rw-r--r--OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/World/Wind/WindModule.cs54
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs2
4 files changed, 57 insertions, 51 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index e21bf7c..39bda70 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -1235,7 +1235,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1235 /// <param name="map">heightmap</param> 1235 /// <param name="map">heightmap</param>
1236 public virtual void SendWindData(float[] map) 1236 public virtual void SendWindData(float[] map)
1237 { 1237 {
1238 ThreadPool.QueueUserWorkItem(new WaitCallback(DoSendWindData), (object)map); 1238 //ThreadPool.QueueUserWorkItem(new WaitCallback(DoSendWindData), (object)map);
1239 } 1239 }
1240 1240
1241 /// <summary> 1241 /// <summary>
@@ -1244,12 +1244,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1244 /// <param name="o"></param> 1244 /// <param name="o"></param>
1245 private void DoSendWindData(object o) 1245 private void DoSendWindData(object o)
1246 { 1246 {
1247 float[] map = (float[])o; 1247 //float[] map = (float[])o;
1248 1248
1249 try 1249 //try
1250 { 1250 //{
1251 for (int y = 0; y < 16; y++) 1251 //for (int y = 0; y < 16; y++)
1252 { 1252 //{
1253 // For some terrains, sending more than one terrain patch at once results in a libsecondlife exception 1253 // For some terrains, sending more than one terrain patch at once results in a libsecondlife exception
1254 // see http://opensimulator.org/mantis/view.php?id=1662 1254 // see http://opensimulator.org/mantis/view.php?id=1662
1255 //for (int x = 0; x < 16; x += 4) 1255 //for (int x = 0; x < 16; x += 4)
@@ -1257,17 +1257,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1257 // SendLayerPacket(map, y, x); 1257 // SendLayerPacket(map, y, x);
1258 // Thread.Sleep(150); 1258 // Thread.Sleep(150);
1259 //} 1259 //}
1260 for (int x = 0; x < 16; x++) 1260 // for (int x = 0; x < 16; x++)
1261 { 1261 //{
1262 SendWindData(x, y, map); 1262 //SendWindData(x, y, map);
1263 Thread.Sleep(35); 1263 //Thread.Sleep(35);
1264 } 1264 //}
1265 } 1265 //}
1266 } 1266 //}
1267 catch (Exception e) 1267 //catch (Exception e)
1268 { 1268 //{
1269 m_log.Warn("[CLIENT]: ClientView.API.cs: SendLayerData() - Failed with exception " + e.ToString()); 1269 // m_log.Warn("[CLIENT]: ClientView.API.cs: SendLayerData() - Failed with exception " + e.ToString());
1270 } 1270 // }
1271 } 1271 }
1272 1272
1273 /// <summary> 1273 /// <summary>
@@ -1294,16 +1294,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1294 /// <param name="px">Patch coordinate (x) 0..15</param> 1294 /// <param name="px">Patch coordinate (x) 0..15</param>
1295 /// <param name="py">Patch coordinate (y) 0..15</param> 1295 /// <param name="py">Patch coordinate (y) 0..15</param>
1296 /// <param name="map">heightmap</param> 1296 /// <param name="map">heightmap</param>
1297 public void SendWindData(int px, int py, float[] map) 1297 public void SendWindData(int p1x, int p1y, int p2x, int p2y, float[] map)
1298 { 1298 {
1299 try 1299 try
1300 { 1300 {
1301 int[] patches = new int[1]; 1301 int[] patches = new int[2];
1302 int patchx, patchy; 1302 int patch1x, patch1y, patch2x, patch2y;
1303 patchx = px; 1303 patch1x = p1x;
1304 patchy = py; 1304 patch1y = p1y;
1305 patch2x = p2x;
1306 patch2y = p2y;
1305 1307
1306 patches[0] = patchx + 0 + patchy * 16; 1308
1309 patches[0] = patch1x + 0 + patch1y * 16;
1310 patches[1] = patch2x + 0 + patch2y * 16;
1307 1311
1308 LayerDataPacket layerpack = TerrainCompressor.CreateWindPacket(map, patches); 1312 LayerDataPacket layerpack = TerrainCompressor.CreateWindPacket(map, patches);
1309 layerpack.Header.Zerocoded = true; 1313 layerpack.Header.Zerocoded = true;
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
index 653932c..a8ed498 100644
--- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
@@ -483,7 +483,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
483 } 483 }
484 484
485 public virtual void SendWindData(float[] map) { } 485 public virtual void SendWindData(float[] map) { }
486 public virtual void SendWindData(int px, int py, float[] map) { } 486 public virtual void SendWindData(int p1x, int p1y, int p2x, int p2y, float[] map) { }
487 487
488 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) 488 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
489 { 489 {
diff --git a/OpenSim/Region/Environment/Modules/World/Wind/WindModule.cs b/OpenSim/Region/Environment/Modules/World/Wind/WindModule.cs
index 190cc0b..d7bc42f 100644
--- a/OpenSim/Region/Environment/Modules/World/Wind/WindModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Wind/WindModule.cs
@@ -149,28 +149,11 @@ namespace OpenSim.Region.Environment.Modules
149 { 149 {
150 if (!avatar.IsChildAgent) 150 if (!avatar.IsChildAgent)
151 { 151 {
152 spotxp = (int)avatar.CameraPosition.X + 3; 152
153 spotxm = (int)avatar.CameraPosition.X - 3; 153 avatar.ControllingClient.SendWindData(
154 spotyp = (int)avatar.CameraPosition.Y + 3; 154 0,
155 spotym = (int)avatar.CameraPosition.Y - 3; 155 0,0,1,
156 if (spotxm < 0) 156 windarr);
157 spotxm = 0;
158 if (spotym < 0)
159 spotym = 0;
160 if (spotxp > 255)
161 spotxp = 255;
162 if (spotyp > 255)
163 spotyp = 255;
164 for (int x = spotxm; x<spotxp; x++)
165 {
166 for (int y = spotym; y<spotyp; y++)
167 {
168 avatar.ControllingClient.SendWindData(
169 x / Constants.TerrainPatchSize,
170 y / Constants.TerrainPatchSize,
171 windarr);
172 }
173 }
174 } 157 }
175 } 158 }
176 159
@@ -199,14 +182,33 @@ namespace OpenSim.Region.Environment.Modules
199 182
200 private void GenWindPos() 183 private void GenWindPos()
201 { 184 {
202 windarr = new float[256*256]; 185 //windarr = new float[256*256];
203 for (int x = 0; x < 256; x++) 186
187 Array.Clear(windarr, 0, 256 * 256);
188 //float i = 0f;
189 //float i2 = 2f;
190
191 for (int x = 0; x < 16; x++)
204 { 192 {
205 for (int y = 0; y < 256; y++) 193 for (int y = 0; y < 16; y++)
206 { 194 {
207 windarr[y*256 + x]= (float)(rndnums.NextDouble()* 2d - 1d); 195
196 windarr[x * 256 + y] = (float)(rndnums.NextDouble() * 2d - 1d);
197
208 } 198 }
199
209 } 200 }
201 for (int x = 16; x < 32; x++)
202 {
203 for (int y = 0; y < 16; y++)
204 {
205
206 windarr[x * 256 + y] = (float)(rndnums.NextDouble() * 2d - 1d);
207
208 }
209
210 }
211
210 212
211 // m_log.Debug("[SUN] Velocity("+Velocity.X+","+Velocity.Y+","+Velocity.Z+")"); 213 // m_log.Debug("[SUN] Velocity("+Velocity.X+","+Velocity.Y+","+Velocity.Z+")");
212 } 214 }
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 279abdf..a3f6763 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -397,7 +397,7 @@ namespace OpenSim.Region.Examples.SimpleModule
397 } 397 }
398 398
399 public virtual void SendWindData(float[] map) { } 399 public virtual void SendWindData(float[] map) { }
400 public virtual void SendWindData(int px, int py, float[] map) { } 400 public virtual void SendWindData(int p1x, int p1y, int p2x, int p2y, float[] map) { }
401 401
402 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) 402 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
403 { 403 {