aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMW2007-06-17 18:04:35 +0000
committerMW2007-06-17 18:04:35 +0000
commitef494fdf9c24387c2d98ffde5400f93fa276aa9e (patch)
tree9a0a30ef5903b527e3e265d5175ee07c8c57781b /OpenSim
parent* SimpleApp: (diff)
downloadopensim-SC_OLD-ef494fdf9c24387c2d98ffde5400f93fa276aa9e.zip
opensim-SC_OLD-ef494fdf9c24387c2d98ffde5400f93fa276aa9e.tar.gz
opensim-SC_OLD-ef494fdf9c24387c2d98ffde5400f93fa276aa9e.tar.bz2
opensim-SC_OLD-ef494fdf9c24387c2d98ffde5400f93fa276aa9e.tar.xz
Each Region will now generate a texture image of their terrain and this will be used by the map. Note: Currently each region generates a new image every time they start; even if the terrain is read from the database. And also they don't update it when the terrain changes.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs2
-rw-r--r--OpenSim/OpenSim.LocalCommunications/OpenSim.LocalCommunications.csproj.user2
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs4
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Avatar.cs18
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Scene.cs11
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.API.cs34
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs4
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs27
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.cs2
-rw-r--r--OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.csproj4
-rw-r--r--OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.dll.build1
-rw-r--r--OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs44
12 files changed, 83 insertions, 70 deletions
diff --git a/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs b/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs
index 46ace9c..6e963d2 100644
--- a/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs
+++ b/OpenSim/OpenSim.LocalCommunications/LocalBackEndServices.cs
@@ -129,7 +129,7 @@ namespace OpenSim.LocalCommunications
129 map.X = (ushort)regInfo.RegionLocX; 129 map.X = (ushort)regInfo.RegionLocX;
130 map.Y = (ushort)regInfo.RegionLocY; 130 map.Y = (ushort)regInfo.RegionLocY;
131 map.WaterHeight =(byte) regInfo.estateSettings.waterHeight; 131 map.WaterHeight =(byte) regInfo.estateSettings.waterHeight;
132 map.MapImageId = new LLUUID("00000000-0000-0000-9999-000000000007"); 132 map.MapImageId = regInfo.estateSettings.terrainImageID; //new LLUUID("00000000-0000-0000-9999-000000000007");
133 map.Agents = 1; 133 map.Agents = 1;
134 map.RegionFlags = 72458694; 134 map.RegionFlags = 72458694;
135 map.Access = 13; 135 map.Access = 13;
diff --git a/OpenSim/OpenSim.LocalCommunications/OpenSim.LocalCommunications.csproj.user b/OpenSim/OpenSim.LocalCommunications/OpenSim.LocalCommunications.csproj.user
index 518ce40..5941547 100644
--- a/OpenSim/OpenSim.LocalCommunications/OpenSim.LocalCommunications.csproj.user
+++ b/OpenSim/OpenSim.LocalCommunications/OpenSim.LocalCommunications.csproj.user
@@ -2,7 +2,7 @@
2 <PropertyGroup> 2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\Documents and Settings\Stefan\My Documents\source\opensim\branches\Sugilite\bin\</ReferencePath> 5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-06\Sugilite\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion> 6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView> 7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust> 8 <ProjectTrust>0</ProjectTrust>
diff --git a/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs b/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
index 5d70bc1..50d5a14 100644
--- a/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Avatar.Update.cs
@@ -60,7 +60,7 @@ namespace OpenSim.Region.Scenes
60 } 60 }
61 } 61 }
62 62
63 this.CheckBorderCrossing(); 63 this.CheckForBorderCrossing();
64 } 64 }
65 } 65 }
66 66
@@ -156,7 +156,7 @@ namespace OpenSim.Region.Scenes
156 /// <summary> 156 /// <summary>
157 /// 157 ///
158 /// </summary> 158 /// </summary>
159 protected void CheckBorderCrossing() 159 protected void CheckForBorderCrossing()
160 { 160 {
161 LLVector3 pos2 = this.Pos; 161 LLVector3 pos2 = this.Pos;
162 LLVector3 vel = this.Velocity; 162 LLVector3 vel = this.Velocity;
diff --git a/OpenSim/OpenSim.Region/Scenes/Avatar.cs b/OpenSim/OpenSim.Region/Scenes/Avatar.cs
index d40e213..6b393a8 100644
--- a/OpenSim/OpenSim.Region/Scenes/Avatar.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Avatar.cs
@@ -232,24 +232,6 @@ namespace OpenSim.Region.Scenes
232 /// 232 ///
233 /// </summary> 233 /// </summary>
234 /// <param name="pack"></param> 234 /// <param name="pack"></param>
235 public void HandleAgentUpdate(Packet pack)
236 {
237 this.HandleUpdate((AgentUpdatePacket)pack);
238 }
239
240 /// <summary>
241 ///
242 /// </summary>
243 /// <param name="pack"></param>
244 public void HandleUpdate(AgentUpdatePacket pack)
245 {
246
247 }
248
249 /// <summary>
250 ///
251 /// </summary>
252 /// <param name="pack"></param>
253 public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) 235 public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation)
254 { 236 {
255 237
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/OpenSim.Region/Scenes/Scene.cs
index eb942c2..ca9a112 100644
--- a/OpenSim/OpenSim.Region/Scenes/Scene.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Scene.cs
@@ -424,6 +424,17 @@ namespace OpenSim.Region.Scenes
424 { 424 {
425 this.Terrain.setHeights1D(map); 425 this.Terrain.setHeights1D(map);
426 } 426 }
427
428 //create a texture asset of the terrain
429 byte[] data =this.Terrain.exportJpegImage("defaultstripe.png");
430 this.m_regInfo.estateSettings.terrainImageID= LLUUID.Random();
431 AssetBase asset = new AssetBase();
432 asset.FullID = this.m_regInfo.estateSettings.terrainImageID;
433 asset.Data = data;
434 asset.Name = "terrainImage";
435 asset.Type = 0;
436 this.assetCache.AddAsset(asset);
437
427 } 438 }
428 catch (Exception e) 439 catch (Exception e)
429 { 440 {
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
index 80719d6..bb4dccd 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.API.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
@@ -365,22 +365,22 @@ namespace OpenSim
365 365
366 public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) 366 public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags)
367 { 367 {
368 TeleportLocalPacket tpLocal2 = new TeleportLocalPacket(); 368 TeleportLocalPacket tpLocal = new TeleportLocalPacket();
369 tpLocal2.Info.AgentID = this.AgentID; 369 tpLocal.Info.AgentID = this.AgentID;
370 tpLocal2.Info.TeleportFlags = flags; 370 tpLocal.Info.TeleportFlags = flags;
371 tpLocal2.Info.LocationID = 2; 371 tpLocal.Info.LocationID = 2;
372 tpLocal2.Info.LookAt = lookAt; 372 tpLocal.Info.LookAt = lookAt;
373 tpLocal2.Info.Position = position; 373 tpLocal.Info.Position = position;
374 OutPacket(tpLocal2); 374 OutPacket(tpLocal);
375 } 375 }
376 376
377 public void SendRegionTeleport(ulong regionHandle, byte simAccess, string ipAddress, ushort ipPort, uint locationID, uint flags) 377 public void SendRegionTeleport(ulong regionHandle, byte simAccess, string ipAddress, ushort ipPort, uint locationID, uint flags)
378 { 378 {
379 TeleportFinishPacket Teleport = new TeleportFinishPacket(); 379 TeleportFinishPacket teleport = new TeleportFinishPacket();
380 Teleport.Info.AgentID = this.AgentID; 380 teleport.Info.AgentID = this.AgentID;
381 Teleport.Info.RegionHandle = regionHandle; 381 teleport.Info.RegionHandle = regionHandle;
382 Teleport.Info.SimAccess = simAccess; 382 teleport.Info.SimAccess = simAccess;
383 Teleport.Info.SeedCapability = new byte[0]; 383 teleport.Info.SeedCapability = new byte[0];
384 384
385 System.Net.IPAddress oIP = System.Net.IPAddress.Parse(ipAddress); 385 System.Net.IPAddress oIP = System.Net.IPAddress.Parse(ipAddress);
386 byte[] byteIP = oIP.GetAddressBytes(); 386 byte[] byteIP = oIP.GetAddressBytes();
@@ -389,11 +389,11 @@ namespace OpenSim
389 ip += (uint)byteIP[1] << 8; 389 ip += (uint)byteIP[1] << 8;
390 ip += (uint)byteIP[0]; 390 ip += (uint)byteIP[0];
391 391
392 Teleport.Info.SimIP = ip; 392 teleport.Info.SimIP = ip;
393 Teleport.Info.SimPort = ipPort; 393 teleport.Info.SimPort = ipPort;
394 Teleport.Info.LocationID = 4; 394 teleport.Info.LocationID = 4;
395 Teleport.Info.TeleportFlags = 1 << 4; 395 teleport.Info.TeleportFlags = 1 << 4;
396 OutPacket(Teleport); 396 OutPacket(teleport);
397 } 397 }
398 398
399 /// <summary> 399 /// <summary>
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs b/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs
index a173c47..219cdae 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.PacketHandlers.cs
@@ -190,9 +190,7 @@ namespace OpenSim
190 mbReply.Data[iii].Y = System.Convert.ToUInt16(mp["y"]); 190 mbReply.Data[iii].Y = System.Convert.ToUInt16(mp["y"]);
191 } 191 }
192 this.OutPacket(mbReply); 192 this.OutPacket(mbReply);
193 * */ 193 */
194
195
196 } 194 }
197 195
198 196
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
index f8425da..601fd97 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
@@ -399,7 +399,6 @@ namespace OpenSim
399 { 399 {
400 OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); 400 OnRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
401 } 401 }
402 //this.RequestMapBlocks(MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
403 break; 402 break;
404 case PacketType.TeleportLandmarkRequest: 403 case PacketType.TeleportLandmarkRequest:
405 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack; 404 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket)Pack;
@@ -451,7 +450,7 @@ namespace OpenSim
451 break; 450 break;
452 case PacketType.TeleportLocationRequest: 451 case PacketType.TeleportLocationRequest:
453 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; 452 TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;
454 // Console.WriteLine(tpLocReq.ToString()); 453 // Console.WriteLine(tpLocReq.ToString());
455 454
456 if (OnTeleportLocationRequest != null) 455 if (OnTeleportLocationRequest != null)
457 { 456 {
@@ -463,32 +462,8 @@ namespace OpenSim
463 TeleportCancelPacket tpCancel = new TeleportCancelPacket(); 462 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
464 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID; 463 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
465 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID; 464 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
466
467 OutPacket(tpCancel); 465 OutPacket(tpCancel);
468 } 466 }
469
470 /* if (m_regionData.RegionHandle != tpLocReq.Info.RegionHandle)
471 {
472 // m_gridServer.getRegion(tpLocReq.Info.RegionHandle);
473 Console.WriteLine("Inter-sim teleport not yet implemented");
474 TeleportCancelPacket tpCancel = new TeleportCancelPacket();
475 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
476 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
477
478 OutPacket(tpCancel);
479 }
480 else
481 {
482 Console.WriteLine("Local teleport");
483 TeleportLocalPacket tpLocal2 = new TeleportLocalPacket();
484 tpLocal2.Info.AgentID = tpLocReq.AgentData.AgentID;
485 tpLocal2.Info.TeleportFlags = tpStart.Info.TeleportFlags;
486 tpLocal2.Info.LocationID = 2;
487 tpLocal2.Info.LookAt = tpLocReq.Info.LookAt;
488 tpLocal2.Info.Position = tpLocReq.Info.Position;
489 OutPacket(tpLocal2);
490
491 }*/
492 break; 467 break;
493 #endregion 468 #endregion
494 469
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.cs b/OpenSim/OpenSim.RegionServer/ClientView.cs
index 74dbc1a..c5f0a1d 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.cs
@@ -75,7 +75,6 @@ namespace OpenSim
75 protected IWorld m_world; 75 protected IWorld m_world;
76 private Dictionary<uint, ClientView> m_clientThreads; 76 private Dictionary<uint, ClientView> m_clientThreads;
77 private AssetCache m_assetCache; 77 private AssetCache m_assetCache;
78 //private IGridServer m_gridServer;
79 private InventoryCache m_inventoryCache; 78 private InventoryCache m_inventoryCache;
80 private int cachedtextureserial = 0; 79 private int cachedtextureserial = 0;
81 private RegionInfo m_regionData; 80 private RegionInfo m_regionData;
@@ -95,7 +94,6 @@ namespace OpenSim
95 cirpack = initialcirpack; 94 cirpack = initialcirpack;
96 userEP = remoteEP; 95 userEP = remoteEP;
97 96
98 //this.m_child = m_authenticateSessionsHandler.GetAgentChildStatus(initialcirpack.CircuitCode.Code);
99 this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code); 97 this.startpos = m_authenticateSessionsHandler.GetPosition(initialcirpack.CircuitCode.Code);
100 98
101 PacketQueue = new BlockingQueue<QueItem>(); 99 PacketQueue = new BlockingQueue<QueItem>();
diff --git a/OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.csproj b/OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.csproj
index e38c879..10bc0fd 100644
--- a/OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.csproj
+++ b/OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.csproj
@@ -62,6 +62,10 @@
62 <HintPath>..\..\bin\libTerrain-BSD.dll</HintPath> 62 <HintPath>..\..\bin\libTerrain-BSD.dll</HintPath>
63 <Private>False</Private> 63 <Private>False</Private>
64 </Reference> 64 </Reference>
65 <Reference Include="openjpegnet.dll" >
66 <HintPath>..\..\bin\openjpegnet.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
65 <Reference Include="System" > 69 <Reference Include="System" >
66 <HintPath>System.dll</HintPath> 70 <HintPath>System.dll</HintPath>
67 <Private>False</Private> 71 <Private>False</Private>
diff --git a/OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.dll.build b/OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.dll.build
index 6526648..51cecb9 100644
--- a/OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.dll.build
+++ b/OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.dll.build
@@ -20,6 +20,7 @@
20 <include name="${project::get-base-directory()}/${build.dir}" /> 20 <include name="${project::get-base-directory()}/${build.dir}" />
21 </lib> 21 </lib>
22 <include name="../../bin/libTerrain-BSD.dll" /> 22 <include name="../../bin/libTerrain-BSD.dll" />
23 <include name="../../bin/openjpegnet.dll" />
23 <include name="System.dll" /> 24 <include name="System.dll" />
24 <include name="System.Data.dll" /> 25 <include name="System.Data.dll" />
25 <include name="System.Drawing.dll" /> 26 <include name="System.Drawing.dll" />
diff --git a/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
index ecbd078..e5831a0 100644
--- a/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
+++ b/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using System.Drawing; 31using System.Drawing;
32using libTerrain; 32using libTerrain;
33using OpenJPEGNet;
33 34
34namespace OpenSim.Terrain 35namespace OpenSim.Terrain
35{ 36{
@@ -507,5 +508,48 @@ namespace OpenSim.Terrain
507 Console.WriteLine("Failed generating terrain map: " + e.ToString()); 508 Console.WriteLine("Failed generating terrain map: " + e.ToString());
508 } 509 }
509 } 510 }
511
512 /// <summary>
513 /// Exports the current heightmap in Jpeg2000 format to a byte[]
514 /// </summary>
515 /// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param>
516 public byte[] exportJpegImage(string gradientmap)
517 {
518 byte[] imageData = null;
519 try
520 {
521 Bitmap gradientmapLd = new Bitmap(gradientmap);
522
523 int pallete = gradientmapLd.Height;
524
525 Bitmap bmp = new Bitmap(heightmap.w, heightmap.h);
526 Color[] colours = new Color[pallete];
527
528 for (int i = 0; i < pallete; i++)
529 {
530 colours[i] = gradientmapLd.GetPixel(0, i);
531 }
532
533 Channel copy = heightmap.copy();
534 for (int x = 0; x < copy.w; x++)
535 {
536 for (int y = 0; y < copy.h; y++)
537 {
538 // 512 is the largest possible height before colours clamp
539 int colorindex = (int)(Math.Max(Math.Min(1.0, copy.get(copy.w -x, copy.h - y) / 512.0), 0.0) * pallete);
540 bmp.SetPixel(x, y, colours[colorindex]);
541 }
542 }
543
544 //bmp.Save(filename, System.Drawing.Imaging.ImageFormat.Png);
545 imageData = OpenJPEGNet.OpenJPEG.EncodeFromImage(bmp, "map");
546
547 }
548 catch (Exception e)
549 {
550 Console.WriteLine("Failed generating terrain map: " + e.ToString());
551 }
552 return imageData;
553 }
510 } 554 }
511} \ No newline at end of file 555} \ No newline at end of file