aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorAdam Frisby2007-06-20 21:57:22 +0000
committerAdam Frisby2007-06-20 21:57:22 +0000
commit8194d822301481c56c2e48857e6609409613dd6d (patch)
treeb2036fe5cc82334623810c67bee7b0da180ba231 /OpenSim
parent* Bonus commit: "terrain save" now supports a 'PNG' method. (diff)
downloadopensim-SC_OLD-8194d822301481c56c2e48857e6609409613dd6d.zip
opensim-SC_OLD-8194d822301481c56c2e48857e6609409613dd6d.tar.gz
opensim-SC_OLD-8194d822301481c56c2e48857e6609409613dd6d.tar.bz2
opensim-SC_OLD-8194d822301481c56c2e48857e6609409613dd6d.tar.xz
* Terrain modification more robust, uses area sizes matching those employed by the client display.
* Terrain tools now account for the duration the cursor was held for. * Terrain tools now support new brushes (completing the common set) ** Smooth brush ** Flatten brush ** Revert brush ** Noise brush
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Examples/SimpleApp/Program.cs14
-rw-r--r--OpenSim/OpenSim.Region/Scenes/Scene.PacketHandlers.cs51
-rw-r--r--OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs3
-rw-r--r--OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs83
4 files changed, 136 insertions, 15 deletions
diff --git a/OpenSim/Examples/SimpleApp/Program.cs b/OpenSim/Examples/SimpleApp/Program.cs
index 6d89cbe..de6e6d3 100644
--- a/OpenSim/Examples/SimpleApp/Program.cs
+++ b/OpenSim/Examples/SimpleApp/Program.cs
@@ -19,13 +19,13 @@ namespace SimpleApp
19{ 19{
20 class Program : IAssetReceiver, conscmd_callback 20 class Program : IAssetReceiver, conscmd_callback
21 { 21 {
22 private LogBase m_console; 22 private LogBase m_log;
23 AuthenticateSessionsBase m_circuitManager; 23 AuthenticateSessionsBase m_circuitManager;
24 24
25 private void Run() 25 private void Run()
26 { 26 {
27 m_console = new LogBase(null, "SimpleApp", this, false); 27 m_log = new LogBase(null, "SimpleApp", this, false);
28 MainLog.Instance = m_console; 28 MainLog.Instance = m_log;
29 29
30 CheckSumServer checksumServer = new CheckSumServer(12036); 30 CheckSumServer checksumServer = new CheckSumServer(12036);
31 checksumServer.ServerListener(); 31 checksumServer.ServerListener();
@@ -47,7 +47,7 @@ namespace SimpleApp
47 47
48 AssetCache assetCache = new AssetCache(assetServer); 48 AssetCache assetCache = new AssetCache(assetServer);
49 49
50 UDPServer udpServer = new UDPServer(simPort, assetCache, inventoryCache, m_console, m_circuitManager ); 50 UDPServer udpServer = new UDPServer(simPort, assetCache, inventoryCache, m_log, m_circuitManager );
51 PacketServer packetServer = new PacketServer( udpServer, (uint) simPort ); 51 PacketServer packetServer = new PacketServer( udpServer, (uint) simPort );
52 udpServer.ServerListener(); 52 udpServer.ServerListener();
53 53
@@ -68,13 +68,13 @@ namespace SimpleApp
68 httpServer.AddXmlRPCHandler( "login_to_simulator", loginServer.XmlRpcLoginMethod ); 68 httpServer.AddXmlRPCHandler( "login_to_simulator", loginServer.XmlRpcLoginMethod );
69 httpServer.Start(); 69 httpServer.Start();
70 70
71 m_console.WriteLine( LogPriority.NORMAL, "Press enter to quit."); 71 m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit.");
72 m_console.ReadLine(); 72 m_log.ReadLine();
73 } 73 }
74 74
75 private bool AddNewSessionHandler(ulong regionHandle, Login loginData) 75 private bool AddNewSessionHandler(ulong regionHandle, Login loginData)
76 { 76 {
77 m_console.WriteLine(LogPriority.NORMAL, "Region [{0}] recieved Login from [{1}] [{2}]", regionHandle, loginData.First, loginData.Last); 77 m_log.WriteLine(LogPriority.NORMAL, "Region [{0}] recieved Login from [{1}] [{2}]", regionHandle, loginData.First, loginData.Last);
78 78
79 AgentCircuitData agent = new AgentCircuitData(); 79 AgentCircuitData agent = new AgentCircuitData();
80 agent.AgentID = loginData.Agent; 80 agent.AgentID = loginData.Agent;
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.PacketHandlers.cs b/OpenSim/OpenSim.Region/Scenes/Scene.PacketHandlers.cs
index 75fe779..01e38d5 100644
--- a/OpenSim/OpenSim.Region/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/OpenSim.Region/Scenes/Scene.PacketHandlers.cs
@@ -41,25 +41,62 @@ namespace OpenSim.Region.Scenes
41 public partial class Scene 41 public partial class Scene
42 { 42 {
43 /// <summary> 43 /// <summary>
44 /// 44 /// Modifies terrain using the specified information
45 /// </summary> 45 /// </summary>
46 /// <param name="action"></param> 46 /// <param name="height">The height at which the user started modifying the terrain</param>
47 /// <param name="north"></param> 47 /// <param name="seconds">The number of seconds the modify button was pressed</param>
48 /// <param name="west"></param> 48 /// <param name="brushsize">The size of the brush used</param>
49 public void ModifyTerrain(byte action, float north, float west) 49 /// <param name="action">The action to be performed</param>
50 /// <param name="north">Distance from the north border where the cursor is located</param>
51 /// <param name="west">Distance from the west border where the cursor is located</param>
52 public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west)
50 { 53 {
54 // Shiny.
55 double size = (double)(1 << brushsize);
56
51 switch (action) 57 switch (action)
52 { 58 {
59 case 0:
60 // flatten terrain
61 Terrain.flatten(north, west, size, (double)seconds / 100.0);
62 RegenerateTerrain(true, (int)north, (int)west);
63 break;
53 case 1: 64 case 1:
54 // raise terrain 65 // raise terrain
55 Terrain.raise(north, west, 10.0, 0.001); 66 Terrain.raise(north, west, size, (double)seconds / 100.0);
56 RegenerateTerrain(true, (int)north, (int)west); 67 RegenerateTerrain(true, (int)north, (int)west);
57 break; 68 break;
58 case 2: 69 case 2:
59 //lower terrain 70 //lower terrain
60 Terrain.lower(north, west, 10.0, 0.001); 71 Terrain.lower(north, west, size, (double)seconds / 100.0);
72 RegenerateTerrain(true, (int)north, (int)west);
73 break;
74 case 3:
75 // smooth terrain
76 Terrain.smooth(north, west, size, (double)seconds / 100.0);
77 RegenerateTerrain(true, (int)north, (int)west);
78 break;
79 case 4:
80 // noise
81 Terrain.noise(north, west, size, (double)seconds / 100.0);
82 RegenerateTerrain(true, (int)north, (int)west);
83 break;
84 case 5:
85 // revert
86 Terrain.revert(north, west, size, (double)seconds / 100.0);
61 RegenerateTerrain(true, (int)north, (int)west); 87 RegenerateTerrain(true, (int)north, (int)west);
62 break; 88 break;
89
90 // CLIENT EXTENSIONS GO HERE
91 case 128:
92 // erode-thermal
93 break;
94 case 129:
95 // erode-aerobic
96 break;
97 case 130:
98 // erode-hydraulic
99 break;
63 } 100 }
64 return; 101 return;
65 } 102 }
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
index d53832f..65066b8 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.ProcessPackets.cs
@@ -130,7 +130,8 @@ namespace OpenSim
130 { 130 {
131 if (OnModifyTerrain != null) 131 if (OnModifyTerrain != null)
132 { 132 {
133 OnModifyTerrain(modify.ModifyBlock.Action, modify.ParcelData[0].North, modify.ParcelData[0].West); 133 OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, modify.ModifyBlock.BrushSize,
134 modify.ModifyBlock.Action, modify.ParcelData[0].North, modify.ParcelData[0].West);
134 } 135 }
135 } 136 }
136 break; 137 break;
diff --git a/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
index 2d0fb30..d1d54ad 100644
--- a/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
+++ b/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
@@ -542,6 +542,89 @@ namespace OpenSim.Terrain
542 } 542 }
543 543
544 /// <summary> 544 /// <summary>
545 /// Flattens the land under the brush of specified coordinates (spherical mask)
546 /// </summary>
547 /// <param name="rx">Center of sphere</param>
548 /// <param name="ry">Center of sphere</param>
549 /// <param name="size">Radius of the sphere</param>
550 /// <param name="amount">Thickness of the mask (0..2 recommended)</param>
551 public void flatten(double rx, double ry, double size, double amount)
552 {
553 lock (heightmap)
554 {
555 heightmap.flatten(rx, ry, size, amount);
556 }
557
558 tainted++;
559 }
560
561 /// <summary>
562 /// Creates noise within the specified bounds
563 /// </summary>
564 /// <param name="rx">Center of the bounding sphere</param>
565 /// <param name="ry">Center of the bounding sphere</param>
566 /// <param name="size">The radius of the sphere</param>
567 /// <param name="amount">Strength of the mask (0..2) recommended</param>
568 public void noise(double rx, double ry, double size, double amount)
569 {
570 lock (heightmap)
571 {
572 Channel smoothed = new Channel();
573 smoothed.noise();
574
575 Channel mask = new Channel();
576 mask.raise(rx, ry, size, amount);
577
578 heightmap.blend(smoothed, mask);
579 }
580
581 tainted++;
582 }
583
584 /// <summary>
585 /// Reverts land within the specified bounds
586 /// </summary>
587 /// <param name="rx">Center of the bounding sphere</param>
588 /// <param name="ry">Center of the bounding sphere</param>
589 /// <param name="size">The radius of the sphere</param>
590 /// <param name="amount">Strength of the mask (0..2) recommended</param>
591 public void revert(double rx, double ry, double size, double amount)
592 {
593 lock (heightmap)
594 {
595 Channel mask = new Channel();
596 mask.raise(rx, ry, size, amount);
597
598 heightmap.blend(revertmap, mask);
599 }
600
601 tainted++;
602 }
603
604 /// <summary>
605 /// Smooths land under the brush of specified coordinates (spherical mask)
606 /// </summary>
607 /// <param name="rx">Center of the sphere</param>
608 /// <param name="ry">Center of the sphere</param>
609 /// <param name="size">Radius of the sphere</param>
610 /// <param name="amount">Thickness of the mask (0..2 recommended)</param>
611 public void smooth(double rx, double ry, double size, double amount)
612 {
613 lock (heightmap)
614 {
615 Channel smoothed = heightmap.copy();
616 smoothed.smooth(amount);
617
618 Channel mask = new Channel();
619 mask.raise(rx,ry,size,amount);
620
621 heightmap.blend(smoothed, mask);
622 }
623
624 tainted++;
625 }
626
627 /// <summary>
545 /// Generates a simple set of hills in the shape of an island 628 /// Generates a simple set of hills in the shape of an island
546 /// </summary> 629 /// </summary>
547 public void hills() 630 public void hills()