aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/TerrainChannel.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/TerrainChannel.cs30
1 files changed, 20 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
index 3d563a6..506ad24 100644
--- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
+++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
@@ -57,6 +57,7 @@ namespace OpenSim.Region.Framework.Scenes
57 public int Height { get { return m_terrainData.SizeY; } } // Y dimension 57 public int Height { get { return m_terrainData.SizeY; } } // Y dimension
58 public int Altitude { get { return m_terrainData.SizeZ; } } // Y dimension 58 public int Altitude { get { return m_terrainData.SizeZ; } } // Y dimension
59 59
60
60 // Default, not-often-used builder 61 // Default, not-often-used builder
61 public TerrainChannel() 62 public TerrainChannel()
62 { 63 {
@@ -157,7 +158,11 @@ namespace OpenSim.Region.Framework.Scenes
157 { 158 {
158 if (Double.IsNaN(value) || Double.IsInfinity(value)) 159 if (Double.IsNaN(value) || Double.IsInfinity(value))
159 return; 160 return;
160 161 if (value < 0)
162 value = 0;
163 else
164 if (value > 655.35)
165 value = 655.35;
161 m_terrainData[x, y] = (float)value; 166 m_terrainData[x, y] = (float)value;
162 } 167 }
163 } 168 }
@@ -363,8 +368,8 @@ namespace OpenSim.Region.Framework.Scenes
363 public int SizeY; 368 public int SizeY;
364 public int SizeZ; 369 public int SizeZ;
365 public float CompressionFactor; 370 public float CompressionFactor;
366 public int[] Map; 371 public float[] Map;
367 public TerrainChannelXMLPackage(int pX, int pY, int pZ, float pCompressionFactor, int[] pMap) 372 public TerrainChannelXMLPackage(int pX, int pY, int pZ, float pCompressionFactor, float[] pMap)
368 { 373 {
369 Version = 1; 374 Version = 1;
370 SizeX = pX; 375 SizeX = pX;
@@ -395,17 +400,22 @@ namespace OpenSim.Region.Framework.Scenes
395 // Fill the heightmap with the center bump terrain 400 // Fill the heightmap with the center bump terrain
396 private void PinHeadIsland() 401 private void PinHeadIsland()
397 { 402 {
403 float cx = m_terrainData.SizeX * 0.5f;
404 float cy = m_terrainData.SizeY * 0.5f;
405 float h;
398 for (int x = 0; x < Width; x++) 406 for (int x = 0; x < Width; x++)
399 { 407 {
400 for (int y = 0; y < Height; y++) 408 for (int y = 0; y < Height; y++)
401 { 409 {
402 m_terrainData[x, y] = (float)TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10; 410 // h = (float)TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10;
403 float spherFacA = (float)(TerrainUtil.SphericalFactor(x, y, m_terrainData.SizeX / 2.0, m_terrainData.SizeY / 2.0, 50) * 0.01d); 411 h = 1.0f;
404 float spherFacB = (float)(TerrainUtil.SphericalFactor(x, y, m_terrainData.SizeX / 2.0, m_terrainData.SizeY / 2.0, 100) * 0.001d); 412 float spherFacA = (float)(TerrainUtil.SphericalFactor(x, y, cx, cy, 50) * 0.01d);
405 if (m_terrainData[x, y]< spherFacA) 413 float spherFacB = (float)(TerrainUtil.SphericalFactor(x, y, cx, cy, 100) * 0.001d);
406 m_terrainData[x, y]= spherFacA; 414 if (h < spherFacA)
407 if (m_terrainData[x, y]< spherFacB) 415 h = spherFacA;
408 m_terrainData[x, y] = spherFacB; 416 if (h < spherFacB)
417 h = spherFacB;
418 m_terrainData[x, y] = h;
409 } 419 }
410 } 420 }
411 } 421 }