diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/TerrainChannel.cs | 27 |
2 files changed, 23 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e2880e3..a19f31f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1894,7 +1894,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1894 | { | 1894 | { |
1895 | try | 1895 | try |
1896 | { | 1896 | { |
1897 | double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID); | 1897 | TerrainData map = SimulationDataService.LoadTerrain(RegionInfo.RegionID, (int)RegionInfo.RegionSizeX, (int)RegionInfo.RegionSizeY, (int)RegionInfo.RegionSizeZ); |
1898 | if (map == null) | 1898 | if (map == null) |
1899 | { | 1899 | { |
1900 | // This should be in the Terrain module, but it isn't because | 1900 | // This should be in the Terrain module, but it isn't because |
@@ -1911,7 +1911,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1911 | } | 1911 | } |
1912 | else | 1912 | else |
1913 | { | 1913 | { |
1914 | Heightmap = new TerrainChannel(map, RegionInfo.RegionSizeZ); | 1914 | Heightmap = new TerrainChannel(map); |
1915 | } | 1915 | } |
1916 | } | 1916 | } |
1917 | catch (IOException e) | 1917 | catch (IOException e) |
diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs index d641c87..03499e8 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs | |||
@@ -80,9 +80,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
80 | PinHeadIsland(); | 80 | PinHeadIsland(); |
81 | } | 81 | } |
82 | 82 | ||
83 | public TerrainChannel(double[,] pM, uint pAltitude) | 83 | // Create channel passed a heightmap and expected dimensions of the region. |
84 | // The heightmap might not fit the passed size so accomodations must be made. | ||
85 | public TerrainChannel(double[,] pM, int pSizeX, int pSizeY, int pAltitude) | ||
84 | { | 86 | { |
85 | m_terrainData = new HeightmapTerrainData(pM); | 87 | int hmSizeX = pM.GetLength(0); |
88 | int hmSizeY = pM.GetLength(1); | ||
89 | |||
90 | m_terrainData = new HeightmapTerrainData(pSizeX, pSizeY, pAltitude); | ||
91 | |||
92 | for (int xx = 0; xx < pSizeX; xx++) | ||
93 | for (int yy = 0; yy < pSizeY; yy++) | ||
94 | if (xx > hmSizeX || yy > hmSizeY) | ||
95 | m_terrainData[xx, yy] = TerrainData.DefaultTerrainHeight; | ||
96 | else | ||
97 | m_terrainData[xx, yy] = (float)pM[xx, yy]; | ||
98 | } | ||
99 | |||
100 | public TerrainChannel(TerrainData pTerrData) | ||
101 | { | ||
102 | m_terrainData = pTerrData; | ||
86 | } | 103 | } |
87 | 104 | ||
88 | #region ITerrainChannel Members | 105 | #region ITerrainChannel Members |
@@ -247,7 +264,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
247 | byte[] dataArray = (byte[])serializer.Deserialize(xmlReader); | 264 | byte[] dataArray = (byte[])serializer.Deserialize(xmlReader); |
248 | int index = 0; | 265 | int index = 0; |
249 | 266 | ||
250 | m_terrainData = new HeightmapTerrainData(Width, Height, Altitude); | 267 | m_terrainData = new HeightmapTerrainData((int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); |
251 | 268 | ||
252 | for (int y = 0; y < Height; y++) | 269 | for (int y = 0; y < Height; y++) |
253 | { | 270 | { |
@@ -317,9 +334,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
317 | 334 | ||
318 | private void FlatLand() | 335 | private void FlatLand() |
319 | { | 336 | { |
320 | for (int xx = 0; xx < Width; xx++) | 337 | m_terrainData.ClearLand(); |
321 | for (int yy = 0; yy < Height; yy++) | ||
322 | m_terrainData[xx, yy] = 21; | ||
323 | } | 338 | } |
324 | } | 339 | } |
325 | } | 340 | } |