aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorTeravus Ovares2008-09-25 11:46:05 +0000
committerTeravus Ovares2008-09-25 11:46:05 +0000
commit4004172106d2f736916bd2b3729edfce43699e1e (patch)
treea785022360ec66b51a05d7319cb3fe85c2ee145a /OpenSim/Region/ClientStack
parentfixes a slight copy and paste bug in OGP module. (diff)
downloadopensim-SC_OLD-4004172106d2f736916bd2b3729edfce43699e1e.zip
opensim-SC_OLD-4004172106d2f736916bd2b3729edfce43699e1e.tar.gz
opensim-SC_OLD-4004172106d2f736916bd2b3729edfce43699e1e.tar.bz2
opensim-SC_OLD-4004172106d2f736916bd2b3729edfce43699e1e.tar.xz
* Adds some Wind
* A little wind wouldn't hurt anyone, right? This is the 'slightly breezy' setting.. hopefully you won't notice 'much' of a difference. * It turns out the terrain patch routine is similar enough to the wind version that it can be used to hack together a breeze generator with a few mods. * Not much configuration.. yet. You only get breeze updates in the general vicinity of your camera now to keep bandwidth usage down.. and we're not talking about 'much' movement at the moment. * initial version... could use improvement I'm sure.
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs93
1 files changed, 92 insertions, 1 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 983e1a9..3a90cff 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -1219,8 +1219,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1219 1219
1220 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(map, patches); 1220 LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(map, patches);
1221 layerpack.Header.Zerocoded = true; 1221 layerpack.Header.Zerocoded = true;
1222 1222
1223 OutPacket(layerpack, ThrottleOutPacketType.Land); 1223 OutPacket(layerpack, ThrottleOutPacketType.Land);
1224
1224 } 1225 }
1225 catch (Exception e) 1226 catch (Exception e)
1226 { 1227 {
@@ -1229,6 +1230,96 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1229 } 1230 }
1230 1231
1231 /// <summary> 1232 /// <summary>
1233 /// Send the region heightmap to the client
1234 /// </summary>
1235 /// <param name="map">heightmap</param>
1236 public virtual void SendWindData(float[] map)
1237 {
1238 ThreadPool.QueueUserWorkItem(new WaitCallback(DoSendWindData), (object)map);
1239 }
1240
1241 /// <summary>
1242 /// Send terrain layer information to the client.
1243 /// </summary>
1244 /// <param name="o"></param>
1245 private void DoSendWindData(object o)
1246 {
1247 float[] map = (float[])o;
1248
1249 try
1250 {
1251 for (int y = 0; y < 16; y++)
1252 {
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
1255 //for (int x = 0; x < 16; x += 4)
1256 //{
1257 // SendLayerPacket(map, y, x);
1258 // Thread.Sleep(150);
1259 //}
1260 for (int x = 0; x < 16; x++)
1261 {
1262 SendWindData(x, y, map);
1263 Thread.Sleep(35);
1264 }
1265 }
1266 }
1267 catch (Exception e)
1268 {
1269 m_log.Warn("[CLIENT]: ClientView.API.cs: SendLayerData() - Failed with exception " + e.ToString());
1270 }
1271 }
1272
1273 /// <summary>
1274 /// Sends a set of four patches (x, x+1, ..., x+3) to the client
1275 /// </summary>
1276 /// <param name="map">heightmap</param>
1277 /// <param name="px">X coordinate for patches 0..12</param>
1278 /// <param name="py">Y coordinate for patches 0..15</param>
1279 // private void SendLayerPacket(float[] map, int y, int x)
1280 // {
1281 // int[] patches = new int[4];
1282 // patches[0] = x + 0 + y * 16;
1283 // patches[1] = x + 1 + y * 16;
1284 // patches[2] = x + 2 + y * 16;
1285 // patches[3] = x + 3 + y * 16;
1286
1287 // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches);
1288 // OutPacket(layerpack, ThrottleOutPacketType.Land);
1289 // }
1290
1291 /// <summary>
1292 /// Sends a specified patch to a client
1293 /// </summary>
1294 /// <param name="px">Patch coordinate (x) 0..15</param>
1295 /// <param name="py">Patch coordinate (y) 0..15</param>
1296 /// <param name="map">heightmap</param>
1297 public void SendWindData(int px, int py, float[] map)
1298 {
1299 try
1300 {
1301 int[] patches = new int[1];
1302 int patchx, patchy;
1303 patchx = px;
1304 patchy = py;
1305
1306 patches[0] = patchx + 0 + patchy * 16;
1307
1308 LayerDataPacket layerpack = TerrainCompressor.CreateWindPacket(map, patches);
1309 layerpack.Header.Zerocoded = true;
1310
1311 OutPacket(layerpack, ThrottleOutPacketType.Wind);
1312
1313 }
1314 catch (Exception e)
1315 {
1316 m_log.Warn("[client]: ClientView.API.cs: SendLayerData() - Failed with exception " + e.ToString());
1317 }
1318 }
1319
1320
1321
1322 /// <summary>
1232 /// Tell the client that the given neighbour region is ready to receive a child agent. 1323 /// Tell the client that the given neighbour region is ready to receive a child agent.
1233 /// </summary> 1324 /// </summary>
1234 /// <param name="neighbourHandle"></param> 1325 /// <param name="neighbourHandle"></param>