aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAdam Frisby2007-04-06 18:48:23 +0000
committerAdam Frisby2007-04-06 18:48:23 +0000
commitfb0dffbf13a79aabe9537f16b7bb151af62c75bf (patch)
tree28a8d468e5499a7af1e33eec7bbdeb9e82ae8732
parentAnd now for some solution files... (diff)
downloadopensim-SC-fb0dffbf13a79aabe9537f16b7bb151af62c75bf.zip
opensim-SC-fb0dffbf13a79aabe9537f16b7bb151af62c75bf.tar.gz
opensim-SC-fb0dffbf13a79aabe9537f16b7bb151af62c75bf.tar.bz2
opensim-SC-fb0dffbf13a79aabe9537f16b7bb151af62c75bf.tar.xz
**BREAKING CHANGE** Changing the way terrain is stored and used internally.
-rw-r--r--OpenSim.Config/SimConfigDb4o/obj/Debug/OpenSim.Config.SimConfigDb4o.dllbin0 -> 20480 bytes
-rw-r--r--OpenSim.Config/SimConfigDb4o/obj/Debug/OpenSim.Config.SimConfigDb4o.pdbbin0 -> 13824 bytes
-rw-r--r--OpenSim.Config/SimConfigDb4o/obj/OpenSim.Config.SimConfigDb4o.csproj.FileList.txt5
-rw-r--r--OpenSim.Framework/ILocalStorage.cs4
-rw-r--r--OpenSim.Physics/Manager/PhysicsScene.cs4
-rw-r--r--OpenSim.Physics/OdePlugin/OdePlugin.cs2
-rw-r--r--OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs2
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.csproj49
-rw-r--r--OpenSim.RegionServer/OpenSimMain.cs2
-rw-r--r--OpenSim.RegionServer/world/Avatar.cs4
-rw-r--r--OpenSim.RegionServer/world/World.cs30
-rw-r--r--OpenSim.RegionServer/world/WorldPacketHandlers.cs26
-rw-r--r--OpenSim.Terrain.BasicTerrain/Hills.cs72
-rw-r--r--OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.csproj4
-rw-r--r--OpenSim.Terrain.BasicTerrain/RaiseLower.cs91
-rw-r--r--OpenSim.Terrain.BasicTerrain/TerrainEngine.cs64
-rw-r--r--OpenSim.Terrain.BasicTerrain/TerrainManager.cs11
-rw-r--r--OpenSim.Terrain.BasicTerrain/bin/Debug/OpenSim.Terrain.BasicTerrain.dllbin0 -> 16384 bytes
-rw-r--r--OpenSim.Terrain.BasicTerrain/bin/Debug/OpenSim.Terrain.BasicTerrain.pdbbin0 -> 19968 bytes
-rw-r--r--OpenSim.Terrain.BasicTerrain/obj/Debug/OpenSim.Terrain.BasicTerrain.dllbin0 -> 16384 bytes
-rw-r--r--OpenSim.Terrain.BasicTerrain/obj/Debug/OpenSim.Terrain.BasicTerrain.pdbbin0 -> 19968 bytes
-rw-r--r--OpenSim.Terrain.BasicTerrain/obj/OpenSim.Terrain.BasicTerrain.csproj.FileList.txt5
-rw-r--r--bin/OpenSim.Terrain.BasicTerrain.dllbin0 -> 16384 bytes
23 files changed, 299 insertions, 76 deletions
diff --git a/OpenSim.Config/SimConfigDb4o/obj/Debug/OpenSim.Config.SimConfigDb4o.dll b/OpenSim.Config/SimConfigDb4o/obj/Debug/OpenSim.Config.SimConfigDb4o.dll
new file mode 100644
index 0000000..ab27ace
--- /dev/null
+++ b/OpenSim.Config/SimConfigDb4o/obj/Debug/OpenSim.Config.SimConfigDb4o.dll
Binary files differ
diff --git a/OpenSim.Config/SimConfigDb4o/obj/Debug/OpenSim.Config.SimConfigDb4o.pdb b/OpenSim.Config/SimConfigDb4o/obj/Debug/OpenSim.Config.SimConfigDb4o.pdb
new file mode 100644
index 0000000..d724d19
--- /dev/null
+++ b/OpenSim.Config/SimConfigDb4o/obj/Debug/OpenSim.Config.SimConfigDb4o.pdb
Binary files differ
diff --git a/OpenSim.Config/SimConfigDb4o/obj/OpenSim.Config.SimConfigDb4o.csproj.FileList.txt b/OpenSim.Config/SimConfigDb4o/obj/OpenSim.Config.SimConfigDb4o.csproj.FileList.txt
new file mode 100644
index 0000000..2212b41
--- /dev/null
+++ b/OpenSim.Config/SimConfigDb4o/obj/OpenSim.Config.SimConfigDb4o.csproj.FileList.txt
@@ -0,0 +1,5 @@
1..\..\bin\OpenSim.Config.SimConfigDb4o.dll
2..\..\bin\OpenSim.Config.SimConfigDb4o.pdb
3obj\Debug\ResolveAssemblyReference.cache
4obj\Debug\OpenSim.Config.SimConfigDb4o.dll
5obj\Debug\OpenSim.Config.SimConfigDb4o.pdb
diff --git a/OpenSim.Framework/ILocalStorage.cs b/OpenSim.Framework/ILocalStorage.cs
index 2c45baa..bc11d8f 100644
--- a/OpenSim.Framework/ILocalStorage.cs
+++ b/OpenSim.Framework/ILocalStorage.cs
@@ -39,8 +39,8 @@ namespace OpenSim.Framework.Interfaces
39 void StorePrim(PrimData prim); 39 void StorePrim(PrimData prim);
40 void RemovePrim(LLUUID primID); 40 void RemovePrim(LLUUID primID);
41 void LoadPrimitives(ILocalStorageReceiver receiver); 41 void LoadPrimitives(ILocalStorageReceiver receiver);
42 float[] LoadWorld(); 42 float[,] LoadWorld();
43 void SaveMap(float[] heightmap); 43 void SaveMap(float[,] heightmap);
44 void ShutDown(); 44 void ShutDown();
45 } 45 }
46 46
diff --git a/OpenSim.Physics/Manager/PhysicsScene.cs b/OpenSim.Physics/Manager/PhysicsScene.cs
index 0b3dfd2..25e2104 100644
--- a/OpenSim.Physics/Manager/PhysicsScene.cs
+++ b/OpenSim.Physics/Manager/PhysicsScene.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Physics.Manager
49 49
50 public abstract void GetResults(); 50 public abstract void GetResults();
51 51
52 public abstract void SetTerrain(float[] heightMap); 52 public abstract void SetTerrain(float[,] heightMap);
53 53
54 public abstract void DeleteTerrain(); 54 public abstract void DeleteTerrain();
55 55
@@ -87,7 +87,7 @@ namespace OpenSim.Physics.Manager
87 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : GetResults()"); 87 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : GetResults()");
88 } 88 }
89 89
90 public override void SetTerrain(float[] heightMap) 90 public override void SetTerrain(float[,] heightMap)
91 { 91 {
92 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length); 92 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length);
93 } 93 }
diff --git a/OpenSim.Physics/OdePlugin/OdePlugin.cs b/OpenSim.Physics/OdePlugin/OdePlugin.cs
index 325e2fd..7c9c684 100644
--- a/OpenSim.Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim.Physics/OdePlugin/OdePlugin.cs
@@ -173,7 +173,7 @@ namespace OpenSim.Physics.OdePlugin
173 } 173 }
174 } 174 }
175 175
176 public override void SetTerrain(float[] heightMap) 176 public override void SetTerrain(float[,] heightMap)
177 { 177 {
178 for (int i = 0; i < 65536; i++) 178 for (int i = 0; i < 65536; i++)
179 { 179 {
diff --git a/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs
index 10e92fe..74e7cb8 100644
--- a/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs
@@ -173,7 +173,7 @@ namespace OpenSim.Physics.PhysXPlugin
173 } 173 }
174 } 174 }
175 175
176 public override void SetTerrain(float[] heightMap) 176 public override void SetTerrain(float[,] heightMap)
177 { 177 {
178 if (this._heightMap != null) 178 if (this._heightMap != null)
179 { 179 {
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
index 73f523a..44d2635 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.csproj
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
@@ -1,4 +1,4 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup> 2 <PropertyGroup>
3 <ProjectType>Local</ProjectType> 3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion> 4 <ProductVersion>8.0.50727</ProductVersion>
@@ -6,7 +6,8 @@
6 <ProjectGuid>{632E1BFD-0000-0000-0000-000000000000}</ProjectGuid> 6 <ProjectGuid>{632E1BFD-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon> 9 <ApplicationIcon>
10 </ApplicationIcon>
10 <AssemblyKeyContainerName> 11 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName> 12 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.RegionServer</AssemblyName> 13 <AssemblyName>OpenSim.RegionServer</AssemblyName>
@@ -15,9 +16,11 @@
15 <DefaultTargetSchema>IE50</DefaultTargetSchema> 16 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign> 17 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType> 18 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder> 19 <AppDesignerFolder>
20 </AppDesignerFolder>
19 <RootNamespace>OpenSim.RegionServer</RootNamespace> 21 <RootNamespace>OpenSim.RegionServer</RootNamespace>
20 <StartupObject></StartupObject> 22 <StartupObject>
23 </StartupObject>
21 <FileUpgradeFlags> 24 <FileUpgradeFlags>
22 </FileUpgradeFlags> 25 </FileUpgradeFlags>
23 </PropertyGroup> 26 </PropertyGroup>
@@ -28,7 +31,8 @@
28 <ConfigurationOverrideFile> 31 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile> 32 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants> 33 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile> 34 <DocumentationFile>
35 </DocumentationFile>
32 <DebugSymbols>True</DebugSymbols> 36 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment> 37 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize> 38 <Optimize>False</Optimize>
@@ -37,7 +41,8 @@
37 <RemoveIntegerChecks>False</RemoveIntegerChecks> 41 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel> 43 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn> 44 <NoWarn>
45 </NoWarn>
41 </PropertyGroup> 46 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@@ -46,7 +51,8 @@
46 <ConfigurationOverrideFile> 51 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile> 52 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants> 53 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile> 54 <DocumentationFile>
55 </DocumentationFile>
50 <DebugSymbols>False</DebugSymbols> 56 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment> 57 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize> 58 <Optimize>True</Optimize>
@@ -55,26 +61,27 @@
55 <RemoveIntegerChecks>False</RemoveIntegerChecks> 61 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel> 63 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn> 64 <NoWarn>
65 </NoWarn>
59 </PropertyGroup> 66 </PropertyGroup>
60 <ItemGroup> 67 <ItemGroup>
61 <Reference Include="System" > 68 <Reference Include="System">
62 <HintPath>System.dll</HintPath> 69 <HintPath>System.dll</HintPath>
63 <Private>False</Private> 70 <Private>False</Private>
64 </Reference> 71 </Reference>
65 <Reference Include="System.Xml" > 72 <Reference Include="System.Xml">
66 <HintPath>System.Xml.dll</HintPath> 73 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private> 74 <Private>False</Private>
68 </Reference> 75 </Reference>
69 <Reference Include="libsecondlife.dll" > 76 <Reference Include="libsecondlife.dll">
70 <HintPath>..\bin\libsecondlife.dll</HintPath> 77 <HintPath>..\bin\libsecondlife.dll</HintPath>
71 <Private>False</Private> 78 <Private>False</Private>
72 </Reference> 79 </Reference>
73 <Reference Include="Axiom.MathLib.dll" > 80 <Reference Include="Axiom.MathLib.dll">
74 <HintPath>..\bin\Axiom.MathLib.dll</HintPath> 81 <HintPath>..\bin\Axiom.MathLib.dll</HintPath>
75 <Private>False</Private> 82 <Private>False</Private>
76 </Reference> 83 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" > 84 <Reference Include="Db4objects.Db4o.dll">
78 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath> 85 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private> 86 <Private>False</Private>
80 </Reference> 87 </Reference>
@@ -84,31 +91,35 @@
84 <Name>OpenSim.Framework</Name> 91 <Name>OpenSim.Framework</Name>
85 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> 92 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 93 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private> 94 <Private>False</Private>
88 </ProjectReference> 95 </ProjectReference>
89 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> 96 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
90 <Name>OpenSim.Framework.Console</Name> 97 <Name>OpenSim.Framework.Console</Name>
91 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> 98 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 99 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private> 100 <Private>False</Private>
94 </ProjectReference> 101 </ProjectReference>
95 <ProjectReference Include="..\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj"> 102 <ProjectReference Include="..\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj">
96 <Name>OpenSim.GenericConfig.Xml</Name> 103 <Name>OpenSim.GenericConfig.Xml</Name>
97 <Project>{E88EF749-0000-0000-0000-000000000000}</Project> 104 <Project>{E88EF749-0000-0000-0000-000000000000}</Project>
98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 105 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
99 <Private>False</Private> 106 <Private>False</Private>
100 </ProjectReference> 107 </ProjectReference>
101 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> 108 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
102 <Name>OpenSim.Physics.Manager</Name> 109 <Name>OpenSim.Physics.Manager</Name>
103 <Project>{8BE16150-0000-0000-0000-000000000000}</Project> 110 <Project>{8BE16150-0000-0000-0000-000000000000}</Project>
104 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 111 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
105 <Private>False</Private> 112 <Private>False</Private>
113 </ProjectReference>
114 <ProjectReference Include="..\OpenSim.Terrain.BasicTerrain\OpenSim.Terrain.BasicTerrain.csproj">
115 <Project>{FFD5951C-4002-4ACA-9ADF-68852357B94A}</Project>
116 <Name>OpenSim.Terrain.BasicTerrain</Name>
106 </ProjectReference> 117 </ProjectReference>
107 <ProjectReference Include="..\Servers\OpenSim.Servers.csproj"> 118 <ProjectReference Include="..\Servers\OpenSim.Servers.csproj">
108 <Name>OpenSim.Servers</Name> 119 <Name>OpenSim.Servers</Name>
109 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project> 120 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
110 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 121 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
111 <Private>False</Private> 122 <Private>False</Private>
112 </ProjectReference> 123 </ProjectReference>
113 </ItemGroup> 124 </ItemGroup>
114 <ItemGroup> 125 <ItemGroup>
@@ -222,4 +233,4 @@
222 <PostBuildEvent> 233 <PostBuildEvent>
223 </PostBuildEvent> 234 </PostBuildEvent>
224 </PropertyGroup> 235 </PropertyGroup>
225</Project> 236</Project> \ No newline at end of file
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs
index 7b0bd4b..b159af0 100644
--- a/OpenSim.RegionServer/OpenSimMain.cs
+++ b/OpenSim.RegionServer/OpenSimMain.cs
@@ -156,7 +156,7 @@ namespace OpenSim
156 156
157 m_console.WriteLine("Main.cs:Startup() - Starting up messaging system"); 157 m_console.WriteLine("Main.cs:Startup() - Starting up messaging system");
158 LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); //should be reading from the config file what physics engine to use 158 LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); //should be reading from the config file what physics engine to use
159 LocalWorld.PhysScene.SetTerrain(LocalWorld.LandMap); 159 LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.map);
160 160
161 //should be passing a IGenericConfig object to these so they can read the config data they want from it 161 //should be passing a IGenericConfig object to these so they can read the config data they want from it
162 GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey); 162 GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey);
diff --git a/OpenSim.RegionServer/world/Avatar.cs b/OpenSim.RegionServer/world/Avatar.cs
index 186fb5c..f507797 100644
--- a/OpenSim.RegionServer/world/Avatar.cs
+++ b/OpenSim.RegionServer/world/Avatar.cs
@@ -44,7 +44,7 @@ namespace OpenSim.world
44 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); 44 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
45 ControllingClient = TheClient; 45 ControllingClient = TheClient;
46 localid = 8880000 + (this.m_world._localNumber++); 46 localid = 8880000 + (this.m_world._localNumber++);
47 Pos = new LLVector3(100.0f, 100.0f, m_world.LandMap[(int)Pos.Y * 256 + (int)Pos.X] + 1); 47 Pos = new LLVector3(100.0f, 100.0f, m_world.Terrain.map[(int)Pos.X, (int)Pos.Y] + 1.0f);
48 visualParams = new byte[218]; 48 visualParams = new byte[218];
49 for (int i = 0; i < 218; i++) 49 for (int i = 0; i < 218; i++)
50 { 50 {
@@ -332,7 +332,7 @@ namespace OpenSim.world
332 332
333 public override void LandRenegerated() 333 public override void LandRenegerated()
334 { 334 {
335 Pos = new LLVector3(100.0f, 100.0f, this.m_world.LandMap[(int)Pos.Y * 256 + (int)Pos.X] + 50); 335 Pos = new LLVector3(100.0f, 100.0f, m_world.Terrain.map[(int)Pos.X, (int)Pos.Y] + 50.0f);
336 } 336 }
337 } 337 }
338 338
diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs
index 5b7b3a1..c23ac2d 100644
--- a/OpenSim.RegionServer/world/World.cs
+++ b/OpenSim.RegionServer/world/World.cs
@@ -14,6 +14,7 @@ using OpenSim.Assets;
14using OpenSim.world.scripting; 14using OpenSim.world.scripting;
15using OpenSim.RegionServer.world.scripting; 15using OpenSim.RegionServer.world.scripting;
16using OpenSim.RegionServer.world.scripting.Scripts; 16using OpenSim.RegionServer.world.scripting.Scripts;
17using OpenSim.Terrain;
17 18
18namespace OpenSim.world 19namespace OpenSim.world
19{ 20{
@@ -23,8 +24,9 @@ namespace OpenSim.world
23 public Dictionary<libsecondlife.LLUUID, Entity> Entities; 24 public Dictionary<libsecondlife.LLUUID, Entity> Entities;
24 public Dictionary<libsecondlife.LLUUID, Avatar> Avatars; 25 public Dictionary<libsecondlife.LLUUID, Avatar> Avatars;
25 public Dictionary<libsecondlife.LLUUID, Primitive> Prims; 26 public Dictionary<libsecondlife.LLUUID, Primitive> Prims;
26 public float[] LandMap; 27// public float[] LandMap;
27 public ScriptEngine Scripts; 28 public ScriptEngine Scripts;
29 public TerrainEngine Terrain; //TODO: Replace TerrainManager with this.
28 public uint _localNumber = 0; 30 public uint _localNumber = 0;
29 private PhysicsScene phyScene; 31 private PhysicsScene phyScene;
30 private float timeStep = 0.1f; 32 private float timeStep = 0.1f;
@@ -189,13 +191,13 @@ namespace OpenSim.world
189 191
190 public void RegenerateTerrain() 192 public void RegenerateTerrain()
191 { 193 {
192 HeightmapGenHills hills = new HeightmapGenHills(); 194 Terrain.hills();
193 this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); 195
194 lock (this.LockPhysicsEngine) 196 lock (this.LockPhysicsEngine)
195 { 197 {
196 this.phyScene.SetTerrain(this.LandMap); 198 this.phyScene.SetTerrain(Terrain.map);
197 } 199 }
198 this.localStorage.SaveMap(this.LandMap); 200 this.localStorage.SaveMap(this.Terrain.map);
199 201
200 foreach (SimClient client in m_clientThreads.Values) 202 foreach (SimClient client in m_clientThreads.Values)
201 { 203 {
@@ -208,14 +210,14 @@ namespace OpenSim.world
208 } 210 }
209 } 211 }
210 212
211 public void RegenerateTerrain(float[] newMap) 213 public void RegenerateTerrain(float[,] newMap)
212 { 214 {
213 this.LandMap = newMap; 215 this.Terrain.map = newMap;
214 lock (this.LockPhysicsEngine) 216 lock (this.LockPhysicsEngine)
215 { 217 {
216 this.phyScene.SetTerrain(this.LandMap); 218 this.phyScene.SetTerrain(this.Terrain.map);
217 } 219 }
218 this.localStorage.SaveMap(this.LandMap); 220 this.localStorage.SaveMap(this.Terrain.map);
219 221
220 foreach (SimClient client in m_clientThreads.Values) 222 foreach (SimClient client in m_clientThreads.Values)
221 { 223 {
@@ -234,9 +236,9 @@ namespace OpenSim.world
234 { 236 {
235 lock (this.LockPhysicsEngine) 237 lock (this.LockPhysicsEngine)
236 { 238 {
237 this.phyScene.SetTerrain(this.LandMap); 239 this.phyScene.SetTerrain(this.Terrain.map);
238 } 240 }
239 this.localStorage.SaveMap(this.LandMap); 241 this.localStorage.SaveMap(this.Terrain.map);
240 242
241 foreach (SimClient client in m_clientThreads.Values) 243 foreach (SimClient client in m_clientThreads.Values)
242 { 244 {
@@ -249,7 +251,7 @@ namespace OpenSim.world
249 251
250 public void LoadWorldMap() 252 public void LoadWorldMap()
251 { 253 {
252 LandMap = this.localStorage.LoadWorld(); 254 Terrain.map = this.localStorage.LoadWorld();
253 } 255 }
254 256
255 public void LoadPrimsFromStorage() 257 public void LoadPrimsFromStorage()
@@ -288,7 +290,7 @@ namespace OpenSim.world
288 patches[2] = x + 2 + y * 16; 290 patches[2] = x + 2 + y * 16;
289 patches[3] = x + 3 + y * 16; 291 patches[3] = x + 3 + y * 16;
290 292
291 Packet layerpack = TerrainManager.CreateLandPacket(LandMap, patches); 293 Packet layerpack = TerrainManager.CreateLandPacket(Terrain.map, patches);
292 RemoteClient.OutPacket(layerpack); 294 RemoteClient.OutPacket(layerpack);
293 } 295 }
294 } 296 }
@@ -310,7 +312,7 @@ namespace OpenSim.world
310 //patches[2] = patchx + 2 + patchy * 16; 312 //patches[2] = patchx + 2 + patchy * 16;
311 //patches[3] = patchx + 3 + patchy * 16; 313 //patches[3] = patchx + 3 + patchy * 16;
312 314
313 Packet layerpack = TerrainManager.CreateLandPacket(LandMap, patches); 315 Packet layerpack = TerrainManager.CreateLandPacket(Terrain.map, patches);
314 RemoteClient.OutPacket(layerpack); 316 RemoteClient.OutPacket(layerpack);
315 } 317 }
316 318
diff --git a/OpenSim.RegionServer/world/WorldPacketHandlers.cs b/OpenSim.RegionServer/world/WorldPacketHandlers.cs
index a155ffe..0643a4e 100644
--- a/OpenSim.RegionServer/world/WorldPacketHandlers.cs
+++ b/OpenSim.RegionServer/world/WorldPacketHandlers.cs
@@ -24,34 +24,16 @@ namespace OpenSim.world
24 // raise terrain 24 // raise terrain
25 if (modify.ParcelData.Length > 0) 25 if (modify.ParcelData.Length > 0)
26 { 26 {
27 int mody = (int)modify.ParcelData[0].North; 27 Terrain.raise(modify.ParcelData[0].North, modify.ParcelData[0].West, 10.0, 0.1);
28 int modx = (int)modify.ParcelData[0].West; 28 RegenerateTerrain(true, (int)modify.ParcelData[0].North, (int)modify.ParcelData[0].West);
29 lock (LandMap)
30 {
31 LandMap[(mody * 256) + modx - 1] += 0.05f;
32 LandMap[(mody * 256) + modx] += 0.1f;
33 LandMap[(mody * 256) + modx + 1] += 0.05f;
34 LandMap[((mody + 1) * 256) + modx] += 0.05f;
35 LandMap[((mody - 1) * 256) + modx] += 0.05f;
36 }
37 RegenerateTerrain(true, modx, mody);
38 } 29 }
39 break; 30 break;
40 case 2: 31 case 2:
41 //lower terrain 32 //lower terrain
42 if (modify.ParcelData.Length > 0) 33 if (modify.ParcelData.Length > 0)
43 { 34 {
44 int mody = (int)modify.ParcelData[0].North; 35 Terrain.lower(modify.ParcelData[0].North, modify.ParcelData[0].West, 10.0, 0.1);
45 int modx = (int)modify.ParcelData[0].West; 36 RegenerateTerrain(true, (int)modify.ParcelData[0].North, (int)modify.ParcelData[0].West);
46 lock (LandMap)
47 {
48 LandMap[(mody * 256) + modx - 1] -= 0.05f;
49 LandMap[(mody * 256) + modx] -= 0.1f;
50 LandMap[(mody * 256) + modx + 1] -= 0.05f;
51 LandMap[((mody + 1) * 256) + modx] -= 0.05f;
52 LandMap[((mody - 1) * 256) + modx] -= 0.05f;
53 }
54 RegenerateTerrain(true, modx, mody);
55 } 37 }
56 break; 38 break;
57 } 39 }
diff --git a/OpenSim.Terrain.BasicTerrain/Hills.cs b/OpenSim.Terrain.BasicTerrain/Hills.cs
new file mode 100644
index 0000000..40543a9
--- /dev/null
+++ b/OpenSim.Terrain.BasicTerrain/Hills.cs
@@ -0,0 +1,72 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Terrain.BasicTerrain
6{
7 static class Hills
8 {
9 /// <summary>
10 /// Generates a series of spheres which are then either max()'d or added together. Inspired by suggestion from jh.
11 /// </summary>
12 /// <remarks>3-Clause BSD Licensed</remarks>
13 /// <param name="number">The number of hills to generate</param>
14 /// <param name="scale_min">The minimum size of each hill</param>
15 /// <param name="scale_range">The maximum size of each hill</param>
16 /// <param name="island">Whether to bias hills towards the center of the map</param>
17 /// <param name="additive">Whether to add hills together or to pick the largest value</param>
18 /// <param name="noisy">Generates hill-shaped noise instead of consistent hills</param>
19 public static void hillsSpheres(float[,] map,int seed, int number, double scale_min, double scale_range, bool island, bool additive, bool noisy)
20 {
21 Random random = new Random(seed);
22 int w = map.GetLength(0);
23 int h = map.GetLength(1);
24 int x, y;
25 int i;
26
27 for (i = 0; i < number; i++)
28 {
29 double rx = Math.Min(255.0, random.NextDouble() * w);
30 double ry = Math.Min(255.0, random.NextDouble() * h);
31 double rand = random.NextDouble();
32
33 if (island)
34 {
35 // Move everything towards the center
36 rx -= w / 2;
37 rx /= 2;
38 rx += w / 2;
39
40 ry -= h / 2;
41 ry /= 2;
42 ry += h / 2;
43 }
44
45 for (x = 0; x < w; x++)
46 {
47 for (y = 0; y < h; y++)
48 {
49 if (noisy)
50 rand = random.NextDouble();
51
52 double z = (scale_min + (scale_range * rand));
53 z *= z;
54 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry));
55
56 if (z < 0)
57 z = 0;
58
59 if (additive)
60 {
61 map[x, y] += (float)z;
62 }
63 else
64 {
65 map[x, y] = (float)Math.Max(map[x, y], z);
66 }
67 }
68 }
69 }
70 }
71 }
72}
diff --git a/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.csproj b/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.csproj
index 4da1ede..2103902 100644
--- a/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.csproj
+++ b/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.csproj
@@ -33,7 +33,9 @@
33 <Reference Include="System.Xml" /> 33 <Reference Include="System.Xml" />
34 </ItemGroup> 34 </ItemGroup>
35 <ItemGroup> 35 <ItemGroup>
36 <Compile Include="TerrainManager.cs" /> 36 <Compile Include="Hills.cs" />
37 <Compile Include="RaiseLower.cs" />
38 <Compile Include="TerrainEngine.cs" />
37 <Compile Include="Properties\AssemblyInfo.cs" /> 39 <Compile Include="Properties\AssemblyInfo.cs" />
38 </ItemGroup> 40 </ItemGroup>
39 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 41 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
diff --git a/OpenSim.Terrain.BasicTerrain/RaiseLower.cs b/OpenSim.Terrain.BasicTerrain/RaiseLower.cs
new file mode 100644
index 0000000..384bcc0
--- /dev/null
+++ b/OpenSim.Terrain.BasicTerrain/RaiseLower.cs
@@ -0,0 +1,91 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Terrain.BasicTerrain
6{
7 static class RaiseLower
8 {
9 /// <summary>
10 /// Raises land around the selection
11 /// </summary>
12 /// <param name="rx">The center the X coordinate of where you wish to raise the land</param>
13 /// <param name="ry">The center the Y coordinate of where you wish to raise the land</param>
14 /// <param name="size">The radius of the dimple</param>
15 /// <param name="amount">How much impact to add to the terrain (0..2 usually)</param>
16 public static void raise(float[,] map, double rx, double ry, double size, double amount)
17 {
18 raiseSphere(map, rx, ry, size, amount);
19 }
20
21 /// <summary>
22 /// Raises land in a sphere around the selection
23 /// </summary>
24 /// <param name="rx">The center the X coordinate of where you wish to raise the land</param>
25 /// <param name="ry">The center the Y coordinate of where you wish to raise the land</param>
26 /// <param name="size">The radius of the sphere dimple</param>
27 /// <param name="amount">How much impact to add to the terrain (0..2 usually)</param>
28 public static void raiseSphere(float[,] map, double rx, double ry, double size, double amount)
29 {
30 int x, y;
31 int w = map.GetLength(0);
32 int h = map.GetLength(1);
33
34 for (x = 0; x < w; x++)
35 {
36 for (y = 0; y < h; y++)
37 {
38 double z = size;
39 z *= z;
40 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry));
41
42 if (z < 0)
43 z = 0;
44
45 map[x, y] += (float)(z * amount);
46 }
47 }
48 }
49
50 /// <summary>
51 /// Lowers land in a sphere around the selection
52 /// </summary>
53 /// <param name="rx">The center the X coordinate of where you wish to lower the land</param>
54 /// <param name="ry">The center the Y coordinate of where you wish to lower the land</param>
55 /// <param name="size">The radius of the sphere dimple</param>
56 /// <param name="amount">How much impact to remove from the terrain (0..2 usually)</param>
57 public static void lower(float[,] map, double rx, double ry, double size, double amount)
58 {
59 lowerSphere(map, rx, ry, size, amount);
60 }
61
62 /// <summary>
63 /// Lowers land in a sphere around the selection
64 /// </summary>
65 /// <param name="rx">The center the X coordinate of where you wish to lower the land</param>
66 /// <param name="ry">The center the Y coordinate of where you wish to lower the land</param>
67 /// <param name="size">The radius of the sphere dimple</param>
68 /// <param name="amount">How much impact to remove from the terrain (0..2 usually)</param>
69 public static void lowerSphere(float[,] map, double rx, double ry, double size, double amount)
70 {
71 int x, y;
72 int w = map.GetLength(0);
73 int h = map.GetLength(1);
74
75 for (x = 0; x < w; x++)
76 {
77 for (y = 0; y < h; y++)
78 {
79 double z = size;
80 z *= z;
81 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry));
82
83 if (z < 0)
84 z = 0;
85
86 map[x, y] -= (float)(z * amount);
87 }
88 }
89 }
90 }
91}
diff --git a/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
new file mode 100644
index 0000000..f805d18
--- /dev/null
+++ b/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
@@ -0,0 +1,64 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Terrain.BasicTerrain;
5
6namespace OpenSim.Terrain
7{
8 public class TerrainEngine
9 {
10 public float[,] map;
11 public float[,] water;
12 int w, h;
13
14 public TerrainEngine()
15 {
16 w = 256;
17 h = 256;
18 map = new float[w, h];
19 water = new float[w, h];
20
21 }
22
23 /// <summary>
24 /// Swaps the references between the height and water buffers to allow you to edit the water heightmap. Remember to swap back when you are done.
25 /// </summary>
26 public void swapWaterBuffer()
27 {
28 float[,] temp = map;
29 map = water;
30 water = temp;
31 }
32
33 /// <summary>
34 /// Raises land in a sphere around the specified coordinates
35 /// </summary>
36 /// <param name="rx">Center of the sphere on the X axis</param>
37 /// <param name="ry">Center of the sphere on the Y axis</param>
38 /// <param name="size">The radius of the sphere</param>
39 /// <param name="amount">Scale the height of the sphere by this amount (recommended 0..2)</param>
40 public void raise(double rx, double ry, double size, double amount)
41 {
42 lock (map)
43 {
44 RaiseLower.raiseSphere(this.map, rx, ry, size, amount);
45 }
46 }
47 public void lower(double rx, double ry, double size, double amount)
48 {
49 lock (map)
50 {
51 RaiseLower.lowerSphere(this.map, rx, ry, size, amount);
52 }
53 }
54
55 public void hills()
56 {
57 lock (map)
58 {
59 Hills.hillsSpheres(this.map, 1337, 200, 20, 40, true, true, false);
60 }
61 }
62
63 }
64}
diff --git a/OpenSim.Terrain.BasicTerrain/TerrainManager.cs b/OpenSim.Terrain.BasicTerrain/TerrainManager.cs
deleted file mode 100644
index 65880eb..0000000
--- a/OpenSim.Terrain.BasicTerrain/TerrainManager.cs
+++ /dev/null
@@ -1,11 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Terrain
6{
7 public class TerrainManager
8 {
9
10 }
11}
diff --git a/OpenSim.Terrain.BasicTerrain/bin/Debug/OpenSim.Terrain.BasicTerrain.dll b/OpenSim.Terrain.BasicTerrain/bin/Debug/OpenSim.Terrain.BasicTerrain.dll
new file mode 100644
index 0000000..0cfa595
--- /dev/null
+++ b/OpenSim.Terrain.BasicTerrain/bin/Debug/OpenSim.Terrain.BasicTerrain.dll
Binary files differ
diff --git a/OpenSim.Terrain.BasicTerrain/bin/Debug/OpenSim.Terrain.BasicTerrain.pdb b/OpenSim.Terrain.BasicTerrain/bin/Debug/OpenSim.Terrain.BasicTerrain.pdb
new file mode 100644
index 0000000..ce440c6
--- /dev/null
+++ b/OpenSim.Terrain.BasicTerrain/bin/Debug/OpenSim.Terrain.BasicTerrain.pdb
Binary files differ
diff --git a/OpenSim.Terrain.BasicTerrain/obj/Debug/OpenSim.Terrain.BasicTerrain.dll b/OpenSim.Terrain.BasicTerrain/obj/Debug/OpenSim.Terrain.BasicTerrain.dll
new file mode 100644
index 0000000..0cfa595
--- /dev/null
+++ b/OpenSim.Terrain.BasicTerrain/obj/Debug/OpenSim.Terrain.BasicTerrain.dll
Binary files differ
diff --git a/OpenSim.Terrain.BasicTerrain/obj/Debug/OpenSim.Terrain.BasicTerrain.pdb b/OpenSim.Terrain.BasicTerrain/obj/Debug/OpenSim.Terrain.BasicTerrain.pdb
new file mode 100644
index 0000000..ce440c6
--- /dev/null
+++ b/OpenSim.Terrain.BasicTerrain/obj/Debug/OpenSim.Terrain.BasicTerrain.pdb
Binary files differ
diff --git a/OpenSim.Terrain.BasicTerrain/obj/OpenSim.Terrain.BasicTerrain.csproj.FileList.txt b/OpenSim.Terrain.BasicTerrain/obj/OpenSim.Terrain.BasicTerrain.csproj.FileList.txt
new file mode 100644
index 0000000..4728b51
--- /dev/null
+++ b/OpenSim.Terrain.BasicTerrain/obj/OpenSim.Terrain.BasicTerrain.csproj.FileList.txt
@@ -0,0 +1,5 @@
1bin\Debug\OpenSim.Terrain.BasicTerrain.dll
2bin\Debug\OpenSim.Terrain.BasicTerrain.pdb
3obj\Debug\ResolveAssemblyReference.cache
4obj\Debug\OpenSim.Terrain.BasicTerrain.dll
5obj\Debug\OpenSim.Terrain.BasicTerrain.pdb
diff --git a/bin/OpenSim.Terrain.BasicTerrain.dll b/bin/OpenSim.Terrain.BasicTerrain.dll
new file mode 100644
index 0000000..10061e0
--- /dev/null
+++ b/bin/OpenSim.Terrain.BasicTerrain.dll
Binary files differ