diff options
author | Adam Frisby | 2007-07-15 15:51:09 +0000 |
---|---|---|
committer | Adam Frisby | 2007-07-15 15:51:09 +0000 |
commit | 2dea3dbd6bb4e382dfb1a7dddd5c104dc889e83c (patch) | |
tree | c159f1dde91845a42d7996f8652fe3a57e080022 | |
parent | * Storage Manager now initialises with a DB name equal to that of the region ... (diff) | |
download | opensim-SC-2dea3dbd6bb4e382dfb1a7dddd5c104dc889e83c.zip opensim-SC-2dea3dbd6bb4e382dfb1a7dddd5c104dc889e83c.tar.gz opensim-SC-2dea3dbd6bb4e382dfb1a7dddd5c104dc889e83c.tar.bz2 opensim-SC-2dea3dbd6bb4e382dfb1a7dddd5c104dc889e83c.tar.xz |
* Terrain now uses the new StorageManager.
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs | 26 |
3 files changed, 32 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index de39261..839a75a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -352,7 +352,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
352 | { | 352 | { |
353 | try | 353 | try |
354 | { | 354 | { |
355 | float[] map = this.localStorage.LoadWorld(); | 355 | double[,] map = this.storageManager.DataStore.LoadTerrain(); |
356 | if (map == null) | 356 | if (map == null) |
357 | { | 357 | { |
358 | if (string.IsNullOrEmpty(this.m_regInfo.estateSettings.terrainFile)) | 358 | if (string.IsNullOrEmpty(this.m_regInfo.estateSettings.terrainFile)) |
@@ -360,7 +360,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
360 | Console.WriteLine("No default terrain, procedurally generating..."); | 360 | Console.WriteLine("No default terrain, procedurally generating..."); |
361 | this.Terrain.hills(); | 361 | this.Terrain.hills(); |
362 | 362 | ||
363 | this.localStorage.SaveMap(this.Terrain.getHeights1D()); | 363 | this.storageManager.DataStore.StoreTerrain(this.Terrain.getHeights2DD()); |
364 | } | 364 | } |
365 | else | 365 | else |
366 | { | 366 | { |
@@ -374,12 +374,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
374 | Console.WriteLine("Unable to load default terrain, procedurally generating instead..."); | 374 | Console.WriteLine("Unable to load default terrain, procedurally generating instead..."); |
375 | Terrain.hills(); | 375 | Terrain.hills(); |
376 | } | 376 | } |
377 | this.localStorage.SaveMap(this.Terrain.getHeights1D()); | 377 | this.storageManager.DataStore.StoreTerrain(this.Terrain.getHeights2DD()); |
378 | } | 378 | } |
379 | } | 379 | } |
380 | else | 380 | else |
381 | { | 381 | { |
382 | this.Terrain.setHeights1D(map); | 382 | this.Terrain.setHeights2D(map); |
383 | } | 383 | } |
384 | 384 | ||
385 | CreateTerrainTexture(); | 385 | CreateTerrainTexture(); |
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs index b67ba93..8542ef3 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs | |||
@@ -29,7 +29,7 @@ namespace OpenSim.DataStore.NullStorage | |||
29 | 29 | ||
30 | public List<SceneObject> LoadObjects() | 30 | public List<SceneObject> LoadObjects() |
31 | { | 31 | { |
32 | return null; | 32 | return new List<SceneObject>(); |
33 | } | 33 | } |
34 | 34 | ||
35 | public void StoreTerrain(double[,] ter) | 35 | public void StoreTerrain(double[,] ter) |
@@ -54,7 +54,7 @@ namespace OpenSim.DataStore.NullStorage | |||
54 | 54 | ||
55 | public List<OpenSim.Region.Environment.Parcel> LoadParcels() | 55 | public List<OpenSim.Region.Environment.Parcel> LoadParcels() |
56 | { | 56 | { |
57 | return null; | 57 | return new List<OpenSim.Region.Environment.Parcel>(); |
58 | } | 58 | } |
59 | 59 | ||
60 | public void Shutdown() | 60 | public void Shutdown() |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs index d177ed5..f017e44 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs | |||
@@ -124,6 +124,15 @@ namespace OpenSim.Region.Terrain | |||
124 | } | 124 | } |
125 | 125 | ||
126 | /// <summary> | 126 | /// <summary> |
127 | /// Converts the heightmap to a 256x256 value 2D floating point array. Double precision version. | ||
128 | /// </summary> | ||
129 | /// <returns>An array of 256,256 values containing the heightmap</returns> | ||
130 | public double[,] getHeights2DD() | ||
131 | { | ||
132 | return heightmap.map; | ||
133 | } | ||
134 | |||
135 | /// <summary> | ||
127 | /// Imports a 1D floating point array into the 2D heightmap array | 136 | /// Imports a 1D floating point array into the 2D heightmap array |
128 | /// </summary> | 137 | /// </summary> |
129 | /// <param name="heights">The array to import (must have 65536 members)</param> | 138 | /// <param name="heights">The array to import (must have 65536 members)</param> |
@@ -156,6 +165,23 @@ namespace OpenSim.Region.Terrain | |||
156 | } | 165 | } |
157 | 166 | ||
158 | /// <summary> | 167 | /// <summary> |
168 | /// Loads a 2D array of values into the heightmap (Double Precision Version) | ||
169 | /// </summary> | ||
170 | /// <param name="heights">An array of 256,256 float values</param> | ||
171 | public void setHeights2D(double[,] heights) | ||
172 | { | ||
173 | int x, y; | ||
174 | for (x = 0; x < w; x++) | ||
175 | { | ||
176 | for (y = 0; y < h; y++) | ||
177 | { | ||
178 | heightmap.set(x, y, heights[x, y]); | ||
179 | } | ||
180 | } | ||
181 | tainted++; | ||
182 | } | ||
183 | |||
184 | /// <summary> | ||
159 | /// Swaps the two heightmap buffers (the 'revert map' and the heightmap) | 185 | /// Swaps the two heightmap buffers (the 'revert map' and the heightmap) |
160 | /// </summary> | 186 | /// </summary> |
161 | public void swapRevertMaps() | 187 | public void swapRevertMaps() |