aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Terrain/TerrainUtil.cs
diff options
context:
space:
mode:
authorAdam Frisby2008-04-21 06:39:16 +0000
committerAdam Frisby2008-04-21 06:39:16 +0000
commit05e24c8f58e5cc41b3e7704b1912dfbe9703d4fe (patch)
tree09f7aa55e82ede0839373e85895a34fb3e797b31 /OpenSim/Region/Environment/Modules/Terrain/TerrainUtil.cs
parent* Written a improved self-contained version of the XML Object Serialiser for ... (diff)
downloadopensim-SC_OLD-05e24c8f58e5cc41b3e7704b1912dfbe9703d4fe.zip
opensim-SC_OLD-05e24c8f58e5cc41b3e7704b1912dfbe9703d4fe.tar.gz
opensim-SC_OLD-05e24c8f58e5cc41b3e7704b1912dfbe9703d4fe.tar.bz2
opensim-SC_OLD-05e24c8f58e5cc41b3e7704b1912dfbe9703d4fe.tar.xz
* Terrain Module code has been reformatted to comply with guidelines.
* Fixed a variety of code quality issues. (Yes, I've found ReSharper.)
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Terrain/TerrainUtil.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/TerrainUtil.cs24
1 files changed, 12 insertions, 12 deletions
diff --git a/OpenSim/Region/Environment/Modules/Terrain/TerrainUtil.cs b/OpenSim/Region/Environment/Modules/Terrain/TerrainUtil.cs
index bae171b..d4d0922 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/TerrainUtil.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/TerrainUtil.cs
@@ -57,10 +57,10 @@ namespace OpenSim.Region.Environment.Modules.Terrain
57 y = 0.0; 57 y = 0.0;
58 58
59 int stepSize = 1; 59 int stepSize = 1;
60 double h00 = map[(int)x, (int)y]; 60 double h00 = map[(int) x, (int) y];
61 double h10 = map[(int)x + stepSize, (int)y]; 61 double h10 = map[(int) x + stepSize, (int) y];
62 double h01 = map[(int)x, (int)y + stepSize]; 62 double h01 = map[(int) x, (int) y + stepSize];
63 double h11 = map[(int)x + stepSize, (int)y + stepSize]; 63 double h11 = map[(int) x + stepSize, (int) y + stepSize];
64 double h1 = h00; 64 double h1 = h00;
65 double h2 = h10; 65 double h2 = h10;
66 double h3 = h01; 66 double h3 = h01;
@@ -69,15 +69,15 @@ namespace OpenSim.Region.Environment.Modules.Terrain
69 double a10 = h2 - h1; 69 double a10 = h2 - h1;
70 double a01 = h3 - h1; 70 double a01 = h3 - h1;
71 double a11 = h1 - h2 - h3 + h4; 71 double a11 = h1 - h2 - h3 + h4;
72 double partialx = x - (int)x; 72 double partialx = x - (int) x;
73 double partialz = y - (int)y; 73 double partialz = y - (int) y;
74 double hi = a00 + (a10 * partialx) + (a01 * partialz) + (a11 * partialx * partialz); 74 double hi = a00 + (a10 * partialx) + (a01 * partialz) + (a11 * partialx * partialz);
75 return hi; 75 return hi;
76 } 76 }
77 77
78 private static double Noise(double x, double y) 78 private static double Noise(double x, double y)
79 { 79 {
80 int n = (int)x + (int)(y * 749); 80 int n = (int) x + (int) (y * 749);
81 n = (n << 13) ^ n; 81 n = (n << 13) ^ n;
82 return (1.0 - ((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); 82 return (1.0 - ((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0);
83 } 83 }
@@ -97,10 +97,10 @@ namespace OpenSim.Region.Environment.Modules.Terrain
97 97
98 private static double InterpolatedNoise(double x, double y) 98 private static double InterpolatedNoise(double x, double y)
99 { 99 {
100 int integer_X = (int)(x); 100 int integer_X = (int) (x);
101 double fractional_X = x - integer_X; 101 double fractional_X = x - integer_X;
102 102
103 int integer_Y = (int)y; 103 int integer_Y = (int) y;
104 double fractional_Y = y - integer_Y; 104 double fractional_Y = y - integer_Y;
105 105
106 double v1 = SmoothedNoise1(integer_X, integer_Y); 106 double v1 = SmoothedNoise1(integer_X, integer_Y);
@@ -122,12 +122,12 @@ namespace OpenSim.Region.Environment.Modules.Terrain
122 122
123 for (int i = 0; i < octaves; i++) 123 for (int i = 0; i < octaves; i++)
124 { 124 {
125 frequency = System.Math.Pow(2, i); 125 frequency = Math.Pow(2, i);
126 amplitude = System.Math.Pow(persistence, i); 126 amplitude = Math.Pow(persistence, i);
127 127
128 total += InterpolatedNoise(x * frequency, y * frequency) * amplitude; 128 total += InterpolatedNoise(x * frequency, y * frequency) * amplitude;
129 } 129 }
130 return total; 130 return total;
131 } 131 }
132 } 132 }
133} 133} \ No newline at end of file