diff options
author | Adam Frisby | 2007-04-06 18:48:23 +0000 |
---|---|---|
committer | Adam Frisby | 2007-04-06 18:48:23 +0000 |
commit | fb0dffbf13a79aabe9537f16b7bb151af62c75bf (patch) | |
tree | 28a8d468e5499a7af1e33eec7bbdeb9e82ae8732 /OpenSim.RegionServer/world/World.cs | |
parent | And now for some solution files... (diff) | |
download | opensim-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.
Diffstat (limited to 'OpenSim.RegionServer/world/World.cs')
-rw-r--r-- | OpenSim.RegionServer/world/World.cs | 30 |
1 files changed, 16 insertions, 14 deletions
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; | |||
14 | using OpenSim.world.scripting; | 14 | using OpenSim.world.scripting; |
15 | using OpenSim.RegionServer.world.scripting; | 15 | using OpenSim.RegionServer.world.scripting; |
16 | using OpenSim.RegionServer.world.scripting.Scripts; | 16 | using OpenSim.RegionServer.world.scripting.Scripts; |
17 | using OpenSim.Terrain; | ||
17 | 18 | ||
18 | namespace OpenSim.world | 19 | namespace 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 | ||