diff options
Diffstat (limited to 'OpenSim/Region/Terrain.BasicTerrain')
-rw-r--r-- | OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs | 136 |
1 files changed, 86 insertions, 50 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs index 686b35d..f965c41 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs | |||
@@ -69,6 +69,17 @@ namespace OpenSim.Region.Terrain | |||
69 | public Channel watermap; | 69 | public Channel watermap; |
70 | 70 | ||
71 | /// <summary> | 71 | /// <summary> |
72 | /// Max amount the terrain can be raised from the revert parameters | ||
73 | /// </summary> | ||
74 | public double maxRaise = 500.0; | ||
75 | |||
76 | /// <summary> | ||
77 | /// Min amount the terrain can be lowered from the revert parameters | ||
78 | /// </summary> | ||
79 | public double minLower = 500.0; | ||
80 | |||
81 | |||
82 | /// <summary> | ||
72 | /// Whether or not the terrain has been modified since it was last saved and sent to the Physics engine. | 83 | /// Whether or not the terrain has been modified since it was last saved and sent to the Physics engine. |
73 | /// Counts the number of modifications since the last save. (0 = Untainted) | 84 | /// Counts the number of modifications since the last save. (0 = Untainted) |
74 | /// </summary> | 85 | /// </summary> |
@@ -89,10 +100,33 @@ namespace OpenSim.Region.Terrain | |||
89 | } | 100 | } |
90 | 101 | ||
91 | /// <summary> | 102 | /// <summary> |
103 | /// Checks to make sure the terrain is within baked values +/- maxRaise/minLower | ||
104 | /// </summary> | ||
105 | public void CheckHeightValues() | ||
106 | { | ||
107 | int x, y; | ||
108 | for (x = 0; x < w; x++) | ||
109 | { | ||
110 | for (y = 0; y < h; y++) | ||
111 | { | ||
112 | if ((heightmap.get(x, y) > revertmap.get(x, y) + maxRaise)) | ||
113 | { | ||
114 | heightmap.map[x, y] = revertmap(x, y) + maxRaise; | ||
115 | } | ||
116 | if ((heightmap.get(x, y) > revertmap.get(x, y) - minLower)) | ||
117 | { | ||
118 | heightmap.map[x, y] = revertmap(x, y) - minLower; | ||
119 | } | ||
120 | } | ||
121 | } | ||
122 | } | ||
123 | |||
124 | |||
125 | /// <summary> | ||
92 | /// Converts the heightmap to a 65536 value 1D floating point array | 126 | /// Converts the heightmap to a 65536 value 1D floating point array |
93 | /// </summary> | 127 | /// </summary> |
94 | /// <returns>A float[65536] array containing the heightmap</returns> | 128 | /// <returns>A float[65536] array containing the heightmap</returns> |
95 | public float[] getHeights1D() | 129 | public float[] GetHeights1D() |
96 | { | 130 | { |
97 | float[] heights = new float[w * h]; | 131 | float[] heights = new float[w * h]; |
98 | int i; | 132 | int i; |
@@ -109,7 +143,7 @@ namespace OpenSim.Region.Terrain | |||
109 | /// Converts the heightmap to a 256x256 value 2D floating point array. | 143 | /// Converts the heightmap to a 256x256 value 2D floating point array. |
110 | /// </summary> | 144 | /// </summary> |
111 | /// <returns>An array of 256,256 values containing the heightmap</returns> | 145 | /// <returns>An array of 256,256 values containing the heightmap</returns> |
112 | public float[,] getHeights2D() | 146 | public float[,] GetHeights2D() |
113 | { | 147 | { |
114 | float[,] heights = new float[w, h]; | 148 | float[,] heights = new float[w, h]; |
115 | int x, y; | 149 | int x, y; |
@@ -127,7 +161,7 @@ namespace OpenSim.Region.Terrain | |||
127 | /// Converts the heightmap to a 256x256 value 2D floating point array. Double precision version. | 161 | /// Converts the heightmap to a 256x256 value 2D floating point array. Double precision version. |
128 | /// </summary> | 162 | /// </summary> |
129 | /// <returns>An array of 256,256 values containing the heightmap</returns> | 163 | /// <returns>An array of 256,256 values containing the heightmap</returns> |
130 | public double[,] getHeights2DD() | 164 | public double[,] GetHeights2DD() |
131 | { | 165 | { |
132 | return heightmap.map; | 166 | return heightmap.map; |
133 | } | 167 | } |
@@ -136,7 +170,7 @@ namespace OpenSim.Region.Terrain | |||
136 | /// Imports a 1D floating point array into the 2D heightmap array | 170 | /// Imports a 1D floating point array into the 2D heightmap array |
137 | /// </summary> | 171 | /// </summary> |
138 | /// <param name="heights">The array to import (must have 65536 members)</param> | 172 | /// <param name="heights">The array to import (must have 65536 members)</param> |
139 | public void setHeights1D(float[] heights) | 173 | public void GetHeights1D(float[] heights) |
140 | { | 174 | { |
141 | int i; | 175 | int i; |
142 | for (i = 0; i < w * h; i++) | 176 | for (i = 0; i < w * h; i++) |
@@ -151,7 +185,7 @@ namespace OpenSim.Region.Terrain | |||
151 | /// Loads a 2D array of values into the heightmap | 185 | /// Loads a 2D array of values into the heightmap |
152 | /// </summary> | 186 | /// </summary> |
153 | /// <param name="heights">An array of 256,256 float values</param> | 187 | /// <param name="heights">An array of 256,256 float values</param> |
154 | public void setHeights2D(float[,] heights) | 188 | public void SetHeights2D(float[,] heights) |
155 | { | 189 | { |
156 | int x, y; | 190 | int x, y; |
157 | for (x = 0; x < w; x++) | 191 | for (x = 0; x < w; x++) |
@@ -161,6 +195,7 @@ namespace OpenSim.Region.Terrain | |||
161 | heightmap.set(x, y, (double)heights[x, y]); | 195 | heightmap.set(x, y, (double)heights[x, y]); |
162 | } | 196 | } |
163 | } | 197 | } |
198 | SaveRevertMap(); | ||
164 | tainted++; | 199 | tainted++; |
165 | } | 200 | } |
166 | 201 | ||
@@ -168,7 +203,7 @@ namespace OpenSim.Region.Terrain | |||
168 | /// Loads a 2D array of values into the heightmap (Double Precision Version) | 203 | /// Loads a 2D array of values into the heightmap (Double Precision Version) |
169 | /// </summary> | 204 | /// </summary> |
170 | /// <param name="heights">An array of 256,256 float values</param> | 205 | /// <param name="heights">An array of 256,256 float values</param> |
171 | public void setHeights2D(double[,] heights) | 206 | public void SetHeights2D(double[,] heights) |
172 | { | 207 | { |
173 | int x, y; | 208 | int x, y; |
174 | for (x = 0; x < w; x++) | 209 | for (x = 0; x < w; x++) |
@@ -178,13 +213,14 @@ namespace OpenSim.Region.Terrain | |||
178 | heightmap.set(x, y, heights[x, y]); | 213 | heightmap.set(x, y, heights[x, y]); |
179 | } | 214 | } |
180 | } | 215 | } |
216 | SaveRevertMap(); | ||
181 | tainted++; | 217 | tainted++; |
182 | } | 218 | } |
183 | 219 | ||
184 | /// <summary> | 220 | /// <summary> |
185 | /// Swaps the two heightmap buffers (the 'revert map' and the heightmap) | 221 | /// Swaps the two heightmap buffers (the 'revert map' and the heightmap) |
186 | /// </summary> | 222 | /// </summary> |
187 | public void swapRevertMaps() | 223 | public void SwapRevertMaps() |
188 | { | 224 | { |
189 | Channel backup = heightmap.copy(); | 225 | Channel backup = heightmap.copy(); |
190 | heightmap = revertmap; | 226 | heightmap = revertmap; |
@@ -194,7 +230,7 @@ namespace OpenSim.Region.Terrain | |||
194 | /// <summary> | 230 | /// <summary> |
195 | /// Saves the current heightmap into the revertmap | 231 | /// Saves the current heightmap into the revertmap |
196 | /// </summary> | 232 | /// </summary> |
197 | public void saveRevertMap() | 233 | public void SaveRevertMap() |
198 | { | 234 | { |
199 | revertmap = heightmap.copy(); | 235 | revertmap = heightmap.copy(); |
200 | } | 236 | } |
@@ -239,20 +275,20 @@ namespace OpenSim.Region.Terrain | |||
239 | return false; | 275 | return false; |
240 | 276 | ||
241 | case "revert": | 277 | case "revert": |
242 | swapRevertMaps(); | 278 | SwapRevertMaps(); |
243 | saveRevertMap(); | 279 | SaveRevertMap(); |
244 | break; | 280 | break; |
245 | 281 | ||
246 | case "bake": | 282 | case "bake": |
247 | saveRevertMap(); | 283 | SaveRevertMap(); |
248 | break; | 284 | break; |
249 | 285 | ||
250 | case "seed": | 286 | case "seed": |
251 | setSeed(Convert.ToInt32(args[1])); | 287 | SetSeed(Convert.ToInt32(args[1])); |
252 | break; | 288 | break; |
253 | 289 | ||
254 | case "erode": | 290 | case "erode": |
255 | return consoleErosion(args, ref resultText); | 291 | return ConsoleErosion(args, ref resultText); |
256 | 292 | ||
257 | case "voronoi": | 293 | case "voronoi": |
258 | double[] c = new double[2]; | 294 | double[] c = new double[2]; |
@@ -262,14 +298,14 @@ namespace OpenSim.Region.Terrain | |||
262 | break; | 298 | break; |
263 | 299 | ||
264 | case "hills": | 300 | case "hills": |
265 | return consoleHills(args, ref resultText); | 301 | return ConsoleHills(args, ref resultText); |
266 | 302 | ||
267 | case "regenerate": | 303 | case "regenerate": |
268 | hills(); | 304 | HillsGenerator(); |
269 | break; | 305 | break; |
270 | 306 | ||
271 | case "rescale": | 307 | case "rescale": |
272 | setRange(Convert.ToSingle(args[1]), Convert.ToSingle(args[2])); | 308 | SetRange(Convert.ToSingle(args[1]), Convert.ToSingle(args[2])); |
273 | break; | 309 | break; |
274 | 310 | ||
275 | case "multiply": | 311 | case "multiply": |
@@ -282,15 +318,15 @@ namespace OpenSim.Region.Terrain | |||
282 | switch (args[1].ToLower()) | 318 | switch (args[1].ToLower()) |
283 | { | 319 | { |
284 | case "f32": | 320 | case "f32": |
285 | loadFromFileF32(args[2]); | 321 | LoadFromFileF32(args[2]); |
286 | break; | 322 | break; |
287 | 323 | ||
288 | case "f64": | 324 | case "f64": |
289 | loadFromFileF64(args[2]); | 325 | LoadFromFileF64(args[2]); |
290 | break; | 326 | break; |
291 | 327 | ||
292 | case "raw": | 328 | case "raw": |
293 | loadFromFileSLRAW(args[2]); | 329 | LoadFromFileSLRAW(args[2]); |
294 | break; | 330 | break; |
295 | 331 | ||
296 | case "img": | 332 | case "img": |
@@ -308,15 +344,15 @@ namespace OpenSim.Region.Terrain | |||
308 | switch (args[1].ToLower()) | 344 | switch (args[1].ToLower()) |
309 | { | 345 | { |
310 | case "f32": | 346 | case "f32": |
311 | writeToFileF32(args[2]); | 347 | WriteToFileF32(args[2]); |
312 | break; | 348 | break; |
313 | 349 | ||
314 | case "f64": | 350 | case "f64": |
315 | writeToFileF64(args[2]); | 351 | WriteToFileF64(args[2]); |
316 | break; | 352 | break; |
317 | 353 | ||
318 | case "grdmap": | 354 | case "grdmap": |
319 | exportImage(args[2], args[3]); | 355 | ExportImage(args[2], args[3]); |
320 | break; | 356 | break; |
321 | 357 | ||
322 | case "png": | 358 | case "png": |
@@ -324,11 +360,11 @@ namespace OpenSim.Region.Terrain | |||
324 | break; | 360 | break; |
325 | 361 | ||
326 | case "raw": | 362 | case "raw": |
327 | writeToFileRAW(args[2]); | 363 | WriteToFileRAW(args[2]); |
328 | break; | 364 | break; |
329 | 365 | ||
330 | case "hiraw": | 366 | case "hiraw": |
331 | writeToFileHiRAW(args[2]); | 367 | WriteToFileHiRAW(args[2]); |
332 | break; | 368 | break; |
333 | 369 | ||
334 | default: | 370 | default: |
@@ -366,7 +402,7 @@ namespace OpenSim.Region.Terrain | |||
366 | } | 402 | } |
367 | } | 403 | } |
368 | 404 | ||
369 | private bool consoleErosion(string[] args, ref string resultText) | 405 | private bool ConsoleErosion(string[] args, ref string resultText) |
370 | { | 406 | { |
371 | switch (args[1].ToLower()) | 407 | switch (args[1].ToLower()) |
372 | { | 408 | { |
@@ -384,10 +420,10 @@ namespace OpenSim.Region.Terrain | |||
384 | return true; | 420 | return true; |
385 | } | 421 | } |
386 | 422 | ||
387 | private bool consoleHills(string[] args, ref string resultText) | 423 | private bool ConsoleHills(string[] args, ref string resultText) |
388 | { | 424 | { |
389 | Random RandomClass = new Random(); | 425 | Random RandomClass = new Random(); |
390 | setSeed(RandomClass.Next()); | 426 | SetSeed(RandomClass.Next()); |
391 | int count; | 427 | int count; |
392 | double sizeMin; | 428 | double sizeMin; |
393 | double sizeRange; | 429 | double sizeRange; |
@@ -441,7 +477,7 @@ namespace OpenSim.Region.Terrain | |||
441 | /// </summary> | 477 | /// </summary> |
442 | /// <param name="min">Minimum value of the new array</param> | 478 | /// <param name="min">Minimum value of the new array</param> |
443 | /// <param name="max">Maximum value of the new array</param> | 479 | /// <param name="max">Maximum value of the new array</param> |
444 | public void setRange(float min, float max) | 480 | public void SetRange(float min, float max) |
445 | { | 481 | { |
446 | heightmap.normalise((double)min, (double)max); | 482 | heightmap.normalise((double)min, (double)max); |
447 | tainted++; | 483 | tainted++; |
@@ -452,7 +488,7 @@ namespace OpenSim.Region.Terrain | |||
452 | /// </summary> | 488 | /// </summary> |
453 | /// <remarks>TODO: Move this to libTerrain itself</remarks> | 489 | /// <remarks>TODO: Move this to libTerrain itself</remarks> |
454 | /// <param name="filename">The filename of the double array to import</param> | 490 | /// <param name="filename">The filename of the double array to import</param> |
455 | public void loadFromFileF64(string filename) | 491 | public void LoadFromFileF64(string filename) |
456 | { | 492 | { |
457 | FileInfo file = new FileInfo(filename); | 493 | FileInfo file = new FileInfo(filename); |
458 | FileStream s = file.Open(FileMode.Open, FileAccess.Read); | 494 | FileStream s = file.Open(FileMode.Open, FileAccess.Read); |
@@ -477,7 +513,7 @@ namespace OpenSim.Region.Terrain | |||
477 | /// </summary> | 513 | /// </summary> |
478 | /// <remarks>TODO: Move this to libTerrain itself</remarks> | 514 | /// <remarks>TODO: Move this to libTerrain itself</remarks> |
479 | /// <param name="filename">The filename of the float array to import</param> | 515 | /// <param name="filename">The filename of the float array to import</param> |
480 | public void loadFromFileF32(string filename) | 516 | public void LoadFromFileF32(string filename) |
481 | { | 517 | { |
482 | FileInfo file = new FileInfo(filename); | 518 | FileInfo file = new FileInfo(filename); |
483 | FileStream s = file.Open(FileMode.Open, FileAccess.Read); | 519 | FileStream s = file.Open(FileMode.Open, FileAccess.Read); |
@@ -502,7 +538,7 @@ namespace OpenSim.Region.Terrain | |||
502 | /// </summary> | 538 | /// </summary> |
503 | /// <remarks>This file format stinks and is best avoided.</remarks> | 539 | /// <remarks>This file format stinks and is best avoided.</remarks> |
504 | /// <param name="filename">A path to the .RAW format</param> | 540 | /// <param name="filename">A path to the .RAW format</param> |
505 | public void loadFromFileSLRAW(string filename) | 541 | public void LoadFromFileSLRAW(string filename) |
506 | { | 542 | { |
507 | FileInfo file = new FileInfo(filename); | 543 | FileInfo file = new FileInfo(filename); |
508 | FileStream s = file.Open(FileMode.Open, FileAccess.Read); | 544 | FileStream s = file.Open(FileMode.Open, FileAccess.Read); |
@@ -527,7 +563,7 @@ namespace OpenSim.Region.Terrain | |||
527 | /// Writes the current terrain heightmap to disk, in the format of a 65536 entry double[] array. | 563 | /// Writes the current terrain heightmap to disk, in the format of a 65536 entry double[] array. |
528 | /// </summary> | 564 | /// </summary> |
529 | /// <param name="filename">The desired output filename</param> | 565 | /// <param name="filename">The desired output filename</param> |
530 | public void writeToFileF64(string filename) | 566 | public void WriteToFileF64(string filename) |
531 | { | 567 | { |
532 | FileInfo file = new FileInfo(filename); | 568 | FileInfo file = new FileInfo(filename); |
533 | FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); | 569 | FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); |
@@ -550,7 +586,7 @@ namespace OpenSim.Region.Terrain | |||
550 | /// Writes the current terrain heightmap to disk, in the format of a 65536 entry float[] array | 586 | /// Writes the current terrain heightmap to disk, in the format of a 65536 entry float[] array |
551 | /// </summary> | 587 | /// </summary> |
552 | /// <param name="filename">The desired output filename</param> | 588 | /// <param name="filename">The desired output filename</param> |
553 | public void writeToFileF32(string filename) | 589 | public void WriteToFileF32(string filename) |
554 | { | 590 | { |
555 | FileInfo file = new FileInfo(filename); | 591 | FileInfo file = new FileInfo(filename); |
556 | FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); | 592 | FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); |
@@ -574,7 +610,7 @@ namespace OpenSim.Region.Terrain | |||
574 | /// (is also editable in an image application) | 610 | /// (is also editable in an image application) |
575 | /// </summary> | 611 | /// </summary> |
576 | /// <param name="filename">Filename to write to</param> | 612 | /// <param name="filename">Filename to write to</param> |
577 | public void writeToFileRAW(string filename) | 613 | public void WriteToFileRAW(string filename) |
578 | { | 614 | { |
579 | FileInfo file = new FileInfo(filename); | 615 | FileInfo file = new FileInfo(filename); |
580 | FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); | 616 | FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); |
@@ -639,7 +675,7 @@ namespace OpenSim.Region.Terrain | |||
639 | /// </summary> | 675 | /// </summary> |
640 | /// <remarks>Does not calculate the revert map</remarks> | 676 | /// <remarks>Does not calculate the revert map</remarks> |
641 | /// <param name="filename">The filename to output to</param> | 677 | /// <param name="filename">The filename to output to</param> |
642 | public void writeToFileHiRAW(string filename) | 678 | public void WriteToFileHiRAW(string filename) |
643 | { | 679 | { |
644 | FileInfo file = new FileInfo(filename); | 680 | FileInfo file = new FileInfo(filename); |
645 | FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); | 681 | FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); |
@@ -712,7 +748,7 @@ namespace OpenSim.Region.Terrain | |||
712 | /// Sets the random seed to be used by procedural functions which involve random numbers. | 748 | /// Sets the random seed to be used by procedural functions which involve random numbers. |
713 | /// </summary> | 749 | /// </summary> |
714 | /// <param name="val">The desired seed</param> | 750 | /// <param name="val">The desired seed</param> |
715 | public void setSeed(int val) | 751 | public void SetSeed(int val) |
716 | { | 752 | { |
717 | heightmap.seed = val; | 753 | heightmap.seed = val; |
718 | } | 754 | } |
@@ -724,7 +760,7 @@ namespace OpenSim.Region.Terrain | |||
724 | /// <param name="ry">Center of the sphere on the Y axis</param> | 760 | /// <param name="ry">Center of the sphere on the Y axis</param> |
725 | /// <param name="size">The radius of the sphere</param> | 761 | /// <param name="size">The radius of the sphere</param> |
726 | /// <param name="amount">Scale the height of the sphere by this amount (recommended 0..2)</param> | 762 | /// <param name="amount">Scale the height of the sphere by this amount (recommended 0..2)</param> |
727 | public void raise(double rx, double ry, double size, double amount) | 763 | public void RaiseTerrain(double rx, double ry, double size, double amount) |
728 | { | 764 | { |
729 | lock (heightmap) | 765 | lock (heightmap) |
730 | { | 766 | { |
@@ -741,7 +777,7 @@ namespace OpenSim.Region.Terrain | |||
741 | /// <param name="ry">The center of the sphere at the Y axis</param> | 777 | /// <param name="ry">The center of the sphere at the Y axis</param> |
742 | /// <param name="size">The radius of the sphere in meters</param> | 778 | /// <param name="size">The radius of the sphere in meters</param> |
743 | /// <param name="amount">Scale the height of the sphere by this amount (recommended 0..2)</param> | 779 | /// <param name="amount">Scale the height of the sphere by this amount (recommended 0..2)</param> |
744 | public void lower(double rx, double ry, double size, double amount) | 780 | public void LowerTerrain(double rx, double ry, double size, double amount) |
745 | { | 781 | { |
746 | lock (heightmap) | 782 | lock (heightmap) |
747 | { | 783 | { |
@@ -758,7 +794,7 @@ namespace OpenSim.Region.Terrain | |||
758 | /// <param name="ry">Center of sphere</param> | 794 | /// <param name="ry">Center of sphere</param> |
759 | /// <param name="size">Radius of the sphere</param> | 795 | /// <param name="size">Radius of the sphere</param> |
760 | /// <param name="amount">Thickness of the mask (0..2 recommended)</param> | 796 | /// <param name="amount">Thickness of the mask (0..2 recommended)</param> |
761 | public void flatten(double rx, double ry, double size, double amount) | 797 | public void FlattenTerrain(double rx, double ry, double size, double amount) |
762 | { | 798 | { |
763 | lock (heightmap) | 799 | lock (heightmap) |
764 | { | 800 | { |
@@ -775,7 +811,7 @@ namespace OpenSim.Region.Terrain | |||
775 | /// <param name="ry">Center of the bounding sphere</param> | 811 | /// <param name="ry">Center of the bounding sphere</param> |
776 | /// <param name="size">The radius of the sphere</param> | 812 | /// <param name="size">The radius of the sphere</param> |
777 | /// <param name="amount">Strength of the mask (0..2) recommended</param> | 813 | /// <param name="amount">Strength of the mask (0..2) recommended</param> |
778 | public void noise(double rx, double ry, double size, double amount) | 814 | public void NoiseTerrain(double rx, double ry, double size, double amount) |
779 | { | 815 | { |
780 | lock (heightmap) | 816 | lock (heightmap) |
781 | { | 817 | { |
@@ -798,7 +834,7 @@ namespace OpenSim.Region.Terrain | |||
798 | /// <param name="ry">Center of the bounding sphere</param> | 834 | /// <param name="ry">Center of the bounding sphere</param> |
799 | /// <param name="size">The radius of the sphere</param> | 835 | /// <param name="size">The radius of the sphere</param> |
800 | /// <param name="amount">Strength of the mask (0..2) recommended</param> | 836 | /// <param name="amount">Strength of the mask (0..2) recommended</param> |
801 | public void revert(double rx, double ry, double size, double amount) | 837 | public void RevertTerrain(double rx, double ry, double size, double amount) |
802 | { | 838 | { |
803 | lock (heightmap) | 839 | lock (heightmap) |
804 | { | 840 | { |
@@ -818,7 +854,7 @@ namespace OpenSim.Region.Terrain | |||
818 | /// <param name="ry">Center of the sphere</param> | 854 | /// <param name="ry">Center of the sphere</param> |
819 | /// <param name="size">Radius of the sphere</param> | 855 | /// <param name="size">Radius of the sphere</param> |
820 | /// <param name="amount">Thickness of the mask (0..2 recommended)</param> | 856 | /// <param name="amount">Thickness of the mask (0..2 recommended)</param> |
821 | public void smooth(double rx, double ry, double size, double amount) | 857 | public void SmoothTerrain(double rx, double ry, double size, double amount) |
822 | { | 858 | { |
823 | lock (heightmap) | 859 | lock (heightmap) |
824 | { | 860 | { |
@@ -837,7 +873,7 @@ namespace OpenSim.Region.Terrain | |||
837 | /// <summary> | 873 | /// <summary> |
838 | /// Generates a simple set of hills in the shape of an island | 874 | /// Generates a simple set of hills in the shape of an island |
839 | /// </summary> | 875 | /// </summary> |
840 | public void hills() | 876 | public void HillsGenerator() |
841 | { | 877 | { |
842 | lock (heightmap) | 878 | lock (heightmap) |
843 | { | 879 | { |
@@ -855,7 +891,7 @@ namespace OpenSim.Region.Terrain | |||
855 | /// <param name="x">X coord</param> | 891 | /// <param name="x">X coord</param> |
856 | /// <param name="y">Y coord</param> | 892 | /// <param name="y">Y coord</param> |
857 | /// <returns>Height at specified coordinates</returns> | 893 | /// <returns>Height at specified coordinates</returns> |
858 | public double get(int x, int y) | 894 | public double GetHeight(int x, int y) |
859 | { | 895 | { |
860 | return heightmap.get(x, y); | 896 | return heightmap.get(x, y); |
861 | } | 897 | } |
@@ -866,11 +902,11 @@ namespace OpenSim.Region.Terrain | |||
866 | /// <param name="meep">The heightfield</param> | 902 | /// <param name="meep">The heightfield</param> |
867 | /// <param name="val">The multiplier</param> | 903 | /// <param name="val">The multiplier</param> |
868 | /// <returns></returns> | 904 | /// <returns></returns> |
869 | public static TerrainEngine operator *(TerrainEngine meep, Double val) | 905 | public static TerrainEngine operator *(TerrainEngine terrain, Double val) |
870 | { | 906 | { |
871 | meep.heightmap *= val; | 907 | terrain.heightmap *= val; |
872 | meep.tainted++; | 908 | terrain.tainted++; |
873 | return meep; | 909 | return terrain; |
874 | } | 910 | } |
875 | 911 | ||
876 | /// <summary> | 912 | /// <summary> |
@@ -878,7 +914,7 @@ namespace OpenSim.Region.Terrain | |||
878 | /// </summary> | 914 | /// </summary> |
879 | /// <param name="filename">The destination filename for the image</param> | 915 | /// <param name="filename">The destination filename for the image</param> |
880 | /// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param> | 916 | /// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param> |
881 | public void exportImage(string filename, string gradientmap) | 917 | public void ExportImage(string filename, string gradientmap) |
882 | { | 918 | { |
883 | try | 919 | try |
884 | { | 920 | { |
@@ -917,7 +953,7 @@ namespace OpenSim.Region.Terrain | |||
917 | /// Exports the current heightmap in Jpeg2000 format to a byte[] | 953 | /// Exports the current heightmap in Jpeg2000 format to a byte[] |
918 | /// </summary> | 954 | /// </summary> |
919 | /// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param> | 955 | /// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param> |
920 | public byte[] exportJpegImage(string gradientmap) | 956 | public byte[] ExportJpegImage(string gradientmap) |
921 | { | 957 | { |
922 | byte[] imageData = null; | 958 | byte[] imageData = null; |
923 | try | 959 | try |