diff options
author | Adam Frisby | 2007-07-23 05:29:52 +0000 |
---|---|---|
committer | Adam Frisby | 2007-07-23 05:29:52 +0000 |
commit | b8da9c3a64b84ab14642bad8c79d3b2ed62e62fb (patch) | |
tree | de4466ffdf017e140ec3aca9bb52cbe14e5e5b12 /OpenSim/Region/Terrain.BasicTerrain | |
parent | Couple of small changes (diff) | |
download | opensim-SC-b8da9c3a64b84ab14642bad8c79d3b2ed62e62fb.zip opensim-SC-b8da9c3a64b84ab14642bad8c79d3b2ed62e62fb.tar.gz opensim-SC-b8da9c3a64b84ab14642bad8c79d3b2ed62e62fb.tar.bz2 opensim-SC-b8da9c3a64b84ab14642bad8c79d3b2ed62e62fb.tar.xz |
* Major style changes in libTerrain.Channel - now uses .NET-style naming syntax.
* Issue#218 - Updated mySQL region table.
Diffstat (limited to 'OpenSim/Region/Terrain.BasicTerrain')
18 files changed, 180 insertions, 180 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs index 2e40531..e5cc5ea 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs | |||
@@ -109,13 +109,13 @@ namespace OpenSim.Region.Terrain | |||
109 | { | 109 | { |
110 | for (y = 0; y < h; y++) | 110 | for (y = 0; y < h; y++) |
111 | { | 111 | { |
112 | if ((heightmap.get(x, y) > revertmap.get(x, y) + maxRaise)) | 112 | if ((heightmap.Get(x, y) > revertmap.Get(x, y) + maxRaise)) |
113 | { | 113 | { |
114 | heightmap.map[x, y] = revertmap.get(x, y) + maxRaise; | 114 | heightmap.map[x, y] = revertmap.Get(x, y) + maxRaise; |
115 | } | 115 | } |
116 | if ((heightmap.get(x, y) > revertmap.get(x, y) - minLower)) | 116 | if ((heightmap.Get(x, y) > revertmap.Get(x, y) - minLower)) |
117 | { | 117 | { |
118 | heightmap.map[x, y] = revertmap.get(x, y) - minLower; | 118 | heightmap.map[x, y] = revertmap.Get(x, y) - minLower; |
119 | } | 119 | } |
120 | } | 120 | } |
121 | } | 121 | } |
@@ -192,7 +192,7 @@ namespace OpenSim.Region.Terrain | |||
192 | { | 192 | { |
193 | for (y = 0; y < h; y++) | 193 | for (y = 0; y < h; y++) |
194 | { | 194 | { |
195 | heightmap.set(x, y, (double)heights[x, y]); | 195 | heightmap.Set(x, y, (double)heights[x, y]); |
196 | } | 196 | } |
197 | } | 197 | } |
198 | SaveRevertMap(); | 198 | SaveRevertMap(); |
@@ -210,7 +210,7 @@ namespace OpenSim.Region.Terrain | |||
210 | { | 210 | { |
211 | for (y = 0; y < h; y++) | 211 | for (y = 0; y < h; y++) |
212 | { | 212 | { |
213 | heightmap.set(x, y, heights[x, y]); | 213 | heightmap.Set(x, y, heights[x, y]); |
214 | } | 214 | } |
215 | } | 215 | } |
216 | SaveRevertMap(); | 216 | SaveRevertMap(); |
@@ -222,7 +222,7 @@ namespace OpenSim.Region.Terrain | |||
222 | /// </summary> | 222 | /// </summary> |
223 | public void SwapRevertMaps() | 223 | public void SwapRevertMaps() |
224 | { | 224 | { |
225 | Channel backup = heightmap.copy(); | 225 | Channel backup = heightmap.Copy(); |
226 | heightmap = revertmap; | 226 | heightmap = revertmap; |
227 | revertmap = backup; | 227 | revertmap = backup; |
228 | } | 228 | } |
@@ -232,7 +232,7 @@ namespace OpenSim.Region.Terrain | |||
232 | /// </summary> | 232 | /// </summary> |
233 | public void SaveRevertMap() | 233 | public void SaveRevertMap() |
234 | { | 234 | { |
235 | revertmap = heightmap.copy(); | 235 | revertmap = heightmap.Copy(); |
236 | } | 236 | } |
237 | 237 | ||
238 | /// <summary> | 238 | /// <summary> |
@@ -295,7 +295,7 @@ namespace OpenSim.Region.Terrain | |||
295 | double[] c = new double[2]; | 295 | double[] c = new double[2]; |
296 | c[0] = -1; | 296 | c[0] = -1; |
297 | c[1] = 1; | 297 | c[1] = 1; |
298 | heightmap.voronoiDiagram(Convert.ToInt32(args[1]), Convert.ToInt32(args[2]), c); | 298 | heightmap.VoronoiDiagram(Convert.ToInt32(args[1]), Convert.ToInt32(args[2]), c); |
299 | break; | 299 | break; |
300 | 300 | ||
301 | case "hills": | 301 | case "hills": |
@@ -331,7 +331,7 @@ namespace OpenSim.Region.Terrain | |||
331 | break; | 331 | break; |
332 | 332 | ||
333 | case "img": | 333 | case "img": |
334 | heightmap.loadImage(args[2]); | 334 | heightmap.LoadImage(args[2]); |
335 | return false; | 335 | return false; |
336 | 336 | ||
337 | default: | 337 | default: |
@@ -357,7 +357,7 @@ namespace OpenSim.Region.Terrain | |||
357 | break; | 357 | break; |
358 | 358 | ||
359 | case "png": | 359 | case "png": |
360 | heightmap.saveImage(args[2]); | 360 | heightmap.SaveImage(args[2]); |
361 | break; | 361 | break; |
362 | 362 | ||
363 | case "raw": | 363 | case "raw": |
@@ -412,12 +412,12 @@ namespace OpenSim.Region.Terrain | |||
412 | heightmap.AerobicErosion(Convert.ToDouble(args[2]), Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToDouble(args[5]), Convert.ToInt32(args[6]), Convert.ToBoolean(args[7]), true); | 412 | heightmap.AerobicErosion(Convert.ToDouble(args[2]), Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToDouble(args[5]), Convert.ToInt32(args[6]), Convert.ToBoolean(args[7]), true); |
413 | break; | 413 | break; |
414 | case "thermal": | 414 | case "thermal": |
415 | heightmap.thermalWeathering(Convert.ToDouble(args[2]), Convert.ToInt32(args[3]), Convert.ToDouble(args[4])); | 415 | heightmap.ThermalWeathering(Convert.ToDouble(args[2]), Convert.ToInt32(args[3]), Convert.ToDouble(args[4])); |
416 | break; | 416 | break; |
417 | case "hydraulic": | 417 | case "hydraulic": |
418 | Channel rainMap = new Channel(w, h); | 418 | Channel rainMap = new Channel(w, h); |
419 | rainMap.fill(Convert.ToDouble(args[2])); | 419 | rainMap.Fill(Convert.ToDouble(args[2])); |
420 | heightmap.hydraulicErosion(rainMap, Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToInt32(args[5]), Convert.ToInt32(args[6])); | 420 | heightmap.HydraulicErosion(rainMap, Convert.ToDouble(args[3]), Convert.ToDouble(args[4]), Convert.ToInt32(args[5]), Convert.ToInt32(args[6])); |
421 | break; | 421 | break; |
422 | default: | 422 | default: |
423 | resultText = "Unknown erosion type"; | 423 | resultText = "Unknown erosion type"; |
@@ -459,16 +459,16 @@ namespace OpenSim.Region.Terrain | |||
459 | switch (args[1].ToLower()) | 459 | switch (args[1].ToLower()) |
460 | { | 460 | { |
461 | case "blocks": | 461 | case "blocks": |
462 | heightmap.hillsBlocks(count, sizeMin, sizeRange, island, additive, noisy); | 462 | heightmap.HillsBlocks(count, sizeMin, sizeRange, island, additive, noisy); |
463 | break; | 463 | break; |
464 | case "cones": | 464 | case "cones": |
465 | heightmap.hillsCones(count, sizeMin, sizeRange, island, additive, noisy); | 465 | heightmap.HillsCones(count, sizeMin, sizeRange, island, additive, noisy); |
466 | break; | 466 | break; |
467 | case "spheres": | 467 | case "spheres": |
468 | heightmap.hillsSpheres(count, sizeMin, sizeRange, island, additive, noisy); | 468 | heightmap.HillsSpheres(count, sizeMin, sizeRange, island, additive, noisy); |
469 | break; | 469 | break; |
470 | case "squared": | 470 | case "squared": |
471 | heightmap.hillsSquared(count, sizeMin, sizeRange, island, additive, noisy); | 471 | heightmap.HillsSquared(count, sizeMin, sizeRange, island, additive, noisy); |
472 | break; | 472 | break; |
473 | default: | 473 | default: |
474 | resultText = "Unknown hills type"; | 474 | resultText = "Unknown hills type"; |
@@ -485,7 +485,7 @@ namespace OpenSim.Region.Terrain | |||
485 | /// <param name="max">Maximum value of the new array</param> | 485 | /// <param name="max">Maximum value of the new array</param> |
486 | public void SetRange(float min, float max) | 486 | public void SetRange(float min, float max) |
487 | { | 487 | { |
488 | heightmap.normalise((double)min, (double)max); | 488 | heightmap.Normalise((double)min, (double)max); |
489 | tainted++; | 489 | tainted++; |
490 | } | 490 | } |
491 | 491 | ||
@@ -580,7 +580,7 @@ namespace OpenSim.Region.Terrain | |||
580 | { | 580 | { |
581 | for (y = 0; y < h; y++) | 581 | for (y = 0; y < h; y++) |
582 | { | 582 | { |
583 | bs.Write(heightmap.get(x, y)); | 583 | bs.Write(heightmap.Get(x, y)); |
584 | } | 584 | } |
585 | } | 585 | } |
586 | 586 | ||
@@ -603,7 +603,7 @@ namespace OpenSim.Region.Terrain | |||
603 | { | 603 | { |
604 | for (y = 0; y < h; y++) | 604 | for (y = 0; y < h; y++) |
605 | { | 605 | { |
606 | bs.Write((float)heightmap.get(x, y)); | 606 | bs.Write((float)heightmap.Get(x, y)); |
607 | } | 607 | } |
608 | } | 608 | } |
609 | 609 | ||
@@ -625,8 +625,8 @@ namespace OpenSim.Region.Terrain | |||
625 | int x, y; | 625 | int x, y; |
626 | 626 | ||
627 | // Used for the 'green' channel. | 627 | // Used for the 'green' channel. |
628 | byte avgMultiplier = (byte)heightmap.avg(); | 628 | byte avgMultiplier = (byte)heightmap.Avg(); |
629 | byte backupMultiplier = (byte)revertmap.avg(); | 629 | byte backupMultiplier = (byte)revertmap.Avg(); |
630 | 630 | ||
631 | // Limit the multiplier so it can represent points >64m. | 631 | // Limit the multiplier so it can represent points >64m. |
632 | if (avgMultiplier > 196) | 632 | if (avgMultiplier > 196) |
@@ -643,9 +643,9 @@ namespace OpenSim.Region.Terrain | |||
643 | { | 643 | { |
644 | for (y = 0; y < h; y++) | 644 | for (y = 0; y < h; y++) |
645 | { | 645 | { |
646 | byte red = (byte)(heightmap.get(x, y) / ((double)avgMultiplier / 128.0)); | 646 | byte red = (byte)(heightmap.Get(x, y) / ((double)avgMultiplier / 128.0)); |
647 | byte green = avgMultiplier; | 647 | byte green = avgMultiplier; |
648 | byte blue = (byte)watermap.get(x, y); | 648 | byte blue = (byte)watermap.Get(x, y); |
649 | byte alpha1 = 0; // Land Parcels | 649 | byte alpha1 = 0; // Land Parcels |
650 | byte alpha2 = 0; // For Sale Land | 650 | byte alpha2 = 0; // For Sale Land |
651 | byte alpha3 = 0; // Public Edit Object | 651 | byte alpha3 = 0; // Public Edit Object |
@@ -654,7 +654,7 @@ namespace OpenSim.Region.Terrain | |||
654 | byte alpha6 = 255; // Flying Allowed | 654 | byte alpha6 = 255; // Flying Allowed |
655 | byte alpha7 = 255; // Create Landmark | 655 | byte alpha7 = 255; // Create Landmark |
656 | byte alpha8 = 255; // Outside Scripts | 656 | byte alpha8 = 255; // Outside Scripts |
657 | byte alpha9 = (byte)(revertmap.get(x, y) / ((double)backupMultiplier / 128.0)); | 657 | byte alpha9 = (byte)(revertmap.Get(x, y) / ((double)backupMultiplier / 128.0)); |
658 | byte alpha10 = backupMultiplier; | 658 | byte alpha10 = backupMultiplier; |
659 | 659 | ||
660 | binStream.Write(red); | 660 | binStream.Write(red); |
@@ -703,7 +703,7 @@ namespace OpenSim.Region.Terrain | |||
703 | { | 703 | { |
704 | for (y = 0; y < h; y++) | 704 | for (y = 0; y < h; y++) |
705 | { | 705 | { |
706 | double t = heightmap.get(x, y); | 706 | double t = heightmap.Get(x, y); |
707 | double min = double.MaxValue; | 707 | double min = double.MaxValue; |
708 | int index = 0; | 708 | int index = 0; |
709 | 709 | ||
@@ -718,7 +718,7 @@ namespace OpenSim.Region.Terrain | |||
718 | 718 | ||
719 | byte red = (byte)(index & 0xFF); | 719 | byte red = (byte)(index & 0xFF); |
720 | byte green = (byte)((index >> 8) & 0xFF); | 720 | byte green = (byte)((index >> 8) & 0xFF); |
721 | byte blue = (byte)watermap.get(x, y); | 721 | byte blue = (byte)watermap.Get(x, y); |
722 | byte alpha1 = 0; // Land Parcels | 722 | byte alpha1 = 0; // Land Parcels |
723 | byte alpha2 = 0; // For Sale Land | 723 | byte alpha2 = 0; // For Sale Land |
724 | byte alpha3 = 0; // Public Edit Object | 724 | byte alpha3 = 0; // Public Edit Object |
@@ -770,7 +770,7 @@ namespace OpenSim.Region.Terrain | |||
770 | { | 770 | { |
771 | lock (heightmap) | 771 | lock (heightmap) |
772 | { | 772 | { |
773 | heightmap.raise(rx, ry, size, amount); | 773 | heightmap.Raise(rx, ry, size, amount); |
774 | } | 774 | } |
775 | 775 | ||
776 | tainted++; | 776 | tainted++; |
@@ -787,7 +787,7 @@ namespace OpenSim.Region.Terrain | |||
787 | { | 787 | { |
788 | lock (heightmap) | 788 | lock (heightmap) |
789 | { | 789 | { |
790 | heightmap.lower(rx, ry, size, amount); | 790 | heightmap.Lower(rx, ry, size, amount); |
791 | } | 791 | } |
792 | 792 | ||
793 | tainted++; | 793 | tainted++; |
@@ -804,7 +804,7 @@ namespace OpenSim.Region.Terrain | |||
804 | { | 804 | { |
805 | lock (heightmap) | 805 | lock (heightmap) |
806 | { | 806 | { |
807 | heightmap.flatten(rx, ry, size, amount); | 807 | heightmap.Flatten(rx, ry, size, amount); |
808 | } | 808 | } |
809 | 809 | ||
810 | tainted++; | 810 | tainted++; |
@@ -822,12 +822,12 @@ namespace OpenSim.Region.Terrain | |||
822 | lock (heightmap) | 822 | lock (heightmap) |
823 | { | 823 | { |
824 | Channel smoothed = new Channel(); | 824 | Channel smoothed = new Channel(); |
825 | smoothed.noise(); | 825 | smoothed.Noise(); |
826 | 826 | ||
827 | Channel mask = new Channel(); | 827 | Channel mask = new Channel(); |
828 | mask.raise(rx, ry, size, amount); | 828 | mask.Raise(rx, ry, size, amount); |
829 | 829 | ||
830 | heightmap.blend(smoothed, mask); | 830 | heightmap.Blend(smoothed, mask); |
831 | } | 831 | } |
832 | 832 | ||
833 | tainted++; | 833 | tainted++; |
@@ -845,9 +845,9 @@ namespace OpenSim.Region.Terrain | |||
845 | lock (heightmap) | 845 | lock (heightmap) |
846 | { | 846 | { |
847 | Channel mask = new Channel(); | 847 | Channel mask = new Channel(); |
848 | mask.raise(rx, ry, size, amount); | 848 | mask.Raise(rx, ry, size, amount); |
849 | 849 | ||
850 | heightmap.blend(revertmap, mask); | 850 | heightmap.Blend(revertmap, mask); |
851 | } | 851 | } |
852 | 852 | ||
853 | tainted++; | 853 | tainted++; |
@@ -864,13 +864,13 @@ namespace OpenSim.Region.Terrain | |||
864 | { | 864 | { |
865 | lock (heightmap) | 865 | lock (heightmap) |
866 | { | 866 | { |
867 | Channel smoothed = heightmap.copy(); | 867 | Channel smoothed = heightmap.Copy(); |
868 | smoothed.smooth(amount); | 868 | smoothed.Smooth(amount); |
869 | 869 | ||
870 | Channel mask = new Channel(); | 870 | Channel mask = new Channel(); |
871 | mask.raise(rx,ry,size,amount); | 871 | mask.Raise(rx,ry,size,amount); |
872 | 872 | ||
873 | heightmap.blend(smoothed, mask); | 873 | heightmap.Blend(smoothed, mask); |
874 | } | 874 | } |
875 | 875 | ||
876 | tainted++; | 876 | tainted++; |
@@ -883,8 +883,8 @@ namespace OpenSim.Region.Terrain | |||
883 | { | 883 | { |
884 | lock (heightmap) | 884 | lock (heightmap) |
885 | { | 885 | { |
886 | heightmap.hillsSpheres(200, 20, 40, true, true, false); | 886 | heightmap.HillsSpheres(200, 20, 40, true, true, false); |
887 | heightmap.normalise(); | 887 | heightmap.Normalise(); |
888 | heightmap *= 60.0; // Raise to 60m | 888 | heightmap *= 60.0; // Raise to 60m |
889 | } | 889 | } |
890 | 890 | ||
@@ -899,7 +899,7 @@ namespace OpenSim.Region.Terrain | |||
899 | /// <returns>Height at specified coordinates</returns> | 899 | /// <returns>Height at specified coordinates</returns> |
900 | public double GetHeight(int x, int y) | 900 | public double GetHeight(int x, int y) |
901 | { | 901 | { |
902 | return heightmap.get(x, y); | 902 | return heightmap.Get(x, y); |
903 | } | 903 | } |
904 | 904 | ||
905 | /// <summary> | 905 | /// <summary> |
@@ -936,13 +936,13 @@ namespace OpenSim.Region.Terrain | |||
936 | colours[i] = gradientmapLd.GetPixel(0, i); | 936 | colours[i] = gradientmapLd.GetPixel(0, i); |
937 | } | 937 | } |
938 | 938 | ||
939 | Channel copy = heightmap.copy(); | 939 | Channel copy = heightmap.Copy(); |
940 | for (int x = 0; x < copy.w; x++) | 940 | for (int x = 0; x < copy.w; x++) |
941 | { | 941 | { |
942 | for (int y = 0; y < copy.h; y++) | 942 | for (int y = 0; y < copy.h; y++) |
943 | { | 943 | { |
944 | // 512 is the largest possible height before colours clamp | 944 | // 512 is the largest possible height before colours clamp |
945 | int colorindex = (int)(Math.Max(Math.Min(1.0, copy.get(x, y) / 512.0), 0.0) * (pallete - 1)); | 945 | int colorindex = (int)(Math.Max(Math.Min(1.0, copy.Get(x, y) / 512.0), 0.0) * (pallete - 1)); |
946 | bmp.SetPixel(x, y, colours[colorindex]); | 946 | bmp.SetPixel(x, y, colours[colorindex]); |
947 | } | 947 | } |
948 | } | 948 | } |
@@ -976,13 +976,13 @@ namespace OpenSim.Region.Terrain | |||
976 | colours[i] = gradientmapLd.GetPixel(0, i); | 976 | colours[i] = gradientmapLd.GetPixel(0, i); |
977 | } | 977 | } |
978 | 978 | ||
979 | Channel copy = heightmap.copy(); | 979 | Channel copy = heightmap.Copy(); |
980 | for (int x = 0; x < copy.w; x++) | 980 | for (int x = 0; x < copy.w; x++) |
981 | { | 981 | { |
982 | for (int y = 0; y < copy.h; y++) | 982 | for (int y = 0; y < copy.h; y++) |
983 | { | 983 | { |
984 | // 512 is the largest possible height before colours clamp | 984 | // 512 is the largest possible height before colours clamp |
985 | int colorindex = (int)(Math.Max(Math.Min(1.0, copy.get(copy.h - y, x) / 512.0), 0.0) * pallete); | 985 | int colorindex = (int)(Math.Max(Math.Min(1.0, copy.Get(copy.h - y, x) / 512.0), 0.0) * pallete); |
986 | bmp.SetPixel(x, y, colours[colorindex]); | 986 | bmp.SetPixel(x, y, colours[colorindex]); |
987 | } | 987 | } |
988 | } | 988 | } |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs index 40531e0..1ef09fc 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs | |||
@@ -46,7 +46,7 @@ namespace libTerrain | |||
46 | bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); | 46 | bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); |
47 | } | 47 | } |
48 | 48 | ||
49 | public Channel toChannel() | 49 | public Channel ToChannel() |
50 | { | 50 | { |
51 | Channel chan = new Channel(bmp.Width, bmp.Height); | 51 | Channel chan = new Channel(bmp.Width, bmp.Height); |
52 | 52 | ||
@@ -63,7 +63,7 @@ namespace libTerrain | |||
63 | return chan; | 63 | return chan; |
64 | } | 64 | } |
65 | 65 | ||
66 | public void drawText(string txt, string font, double size) | 66 | public void DrawText(string txt, string font, double size) |
67 | { | 67 | { |
68 | Graphics gd = Graphics.FromImage(bmp); | 68 | Graphics gd = Graphics.FromImage(bmp); |
69 | //gd.DrawString(txt, | 69 | //gd.DrawString(txt, |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs index d56f7a5..0d6d0fc 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs | |||
@@ -35,23 +35,23 @@ namespace libTerrain | |||
35 | { | 35 | { |
36 | public partial class Channel | 36 | public partial class Channel |
37 | { | 37 | { |
38 | public int getWidth() | 38 | public int GetWidth() |
39 | { | 39 | { |
40 | return w; | 40 | return w; |
41 | } | 41 | } |
42 | public int getHeight() | 42 | public int GetHeight() |
43 | { | 43 | { |
44 | return h; | 44 | return h; |
45 | } | 45 | } |
46 | 46 | ||
47 | public Channel copy() | 47 | public Channel Copy() |
48 | { | 48 | { |
49 | Channel x = new Channel(w, h); | 49 | Channel x = new Channel(w, h); |
50 | x.map = (double[,])this.map.Clone(); | 50 | x.map = (double[,])this.map.Clone(); |
51 | return x; | 51 | return x; |
52 | } | 52 | } |
53 | 53 | ||
54 | public void set(int x, int y, double val) | 54 | public void Set(int x, int y, double val) |
55 | { | 55 | { |
56 | if (x >= w) | 56 | if (x >= w) |
57 | throw new Exception("Bounds error while setting pixel (width)"); | 57 | throw new Exception("Bounds error while setting pixel (width)"); |
@@ -65,7 +65,7 @@ namespace libTerrain | |||
65 | map[x, y] = val; | 65 | map[x, y] = val; |
66 | } | 66 | } |
67 | 67 | ||
68 | public void setClip(int x, int y, double val) | 68 | public void SetClip(int x, int y, double val) |
69 | { | 69 | { |
70 | if (x >= w) | 70 | if (x >= w) |
71 | throw new Exception("Bounds error while setting pixel (width)"); | 71 | throw new Exception("Bounds error while setting pixel (width)"); |
@@ -84,7 +84,7 @@ namespace libTerrain | |||
84 | map[x, y] = val; | 84 | map[x, y] = val; |
85 | } | 85 | } |
86 | 86 | ||
87 | private double getBilinearInterpolate(double x, double y) | 87 | private double GetBilinearInterpolate(double x, double y) |
88 | { | 88 | { |
89 | if (x > w - 2.0) | 89 | if (x > w - 2.0) |
90 | x = w - 2.0; | 90 | x = w - 2.0; |
@@ -95,11 +95,11 @@ namespace libTerrain | |||
95 | if (y < 0.0) | 95 | if (y < 0.0) |
96 | y = 0.0; | 96 | y = 0.0; |
97 | 97 | ||
98 | int STEP_SIZE = 1; | 98 | int stepSize = 1; |
99 | double h00 = get((int)x, (int)y); | 99 | double h00 = Get((int)x, (int)y); |
100 | double h10 = get((int)x + STEP_SIZE, (int)y); | 100 | double h10 = Get((int)x + stepSize, (int)y); |
101 | double h01 = get((int)x, (int)y + STEP_SIZE); | 101 | double h01 = Get((int)x, (int)y + stepSize); |
102 | double h11 = get((int)x + STEP_SIZE, (int)y + STEP_SIZE); | 102 | double h11 = Get((int)x + stepSize, (int)y + stepSize); |
103 | double h1 = h00; | 103 | double h1 = h00; |
104 | double h2 = h10; | 104 | double h2 = h10; |
105 | double h3 = h01; | 105 | double h3 = h01; |
@@ -114,7 +114,7 @@ namespace libTerrain | |||
114 | return hi; | 114 | return hi; |
115 | } | 115 | } |
116 | 116 | ||
117 | public double get(int x, int y) | 117 | public double Get(int x, int y) |
118 | { | 118 | { |
119 | if (x >= w) | 119 | if (x >= w) |
120 | x = w - 1; | 120 | x = w - 1; |
@@ -127,12 +127,12 @@ namespace libTerrain | |||
127 | return map[x, y]; | 127 | return map[x, y]; |
128 | } | 128 | } |
129 | 129 | ||
130 | public void setWrap(int x, int y, double val) | 130 | public void SetWrap(int x, int y, double val) |
131 | { | 131 | { |
132 | map[x % w, y % h] = val; | 132 | map[x % w, y % h] = val; |
133 | } | 133 | } |
134 | 134 | ||
135 | public void setWrapClip(int x, int y, double val) | 135 | public void SetWrapClip(int x, int y, double val) |
136 | { | 136 | { |
137 | if (val > 1.0) | 137 | if (val > 1.0) |
138 | val = 1.0; | 138 | val = 1.0; |
@@ -142,7 +142,7 @@ namespace libTerrain | |||
142 | map[x % w, y % h] = val; | 142 | map[x % w, y % h] = val; |
143 | } | 143 | } |
144 | 144 | ||
145 | public void fill(double val) | 145 | public void Fill(double val) |
146 | { | 146 | { |
147 | int x, y; | 147 | int x, y; |
148 | for (x = 0; x < w; x++) | 148 | for (x = 0; x < w; x++) |
@@ -154,7 +154,7 @@ namespace libTerrain | |||
154 | } | 154 | } |
155 | } | 155 | } |
156 | 156 | ||
157 | public void fill(double min, double max, double val) | 157 | public void Fill(double min, double max, double val) |
158 | { | 158 | { |
159 | int x, y; | 159 | int x, y; |
160 | for (x = 0; x < w; x++) | 160 | for (x = 0; x < w; x++) |
@@ -167,7 +167,7 @@ namespace libTerrain | |||
167 | } | 167 | } |
168 | } | 168 | } |
169 | 169 | ||
170 | public double findMax() | 170 | public double FindMax() |
171 | { | 171 | { |
172 | int x, y; | 172 | int x, y; |
173 | double max = double.MinValue; | 173 | double max = double.MinValue; |
@@ -184,7 +184,7 @@ namespace libTerrain | |||
184 | return max; | 184 | return max; |
185 | } | 185 | } |
186 | 186 | ||
187 | public double findMin() | 187 | public double FindMin() |
188 | { | 188 | { |
189 | int x, y; | 189 | int x, y; |
190 | double min = double.MaxValue; | 190 | double min = double.MaxValue; |
@@ -201,7 +201,7 @@ namespace libTerrain | |||
201 | return min; | 201 | return min; |
202 | } | 202 | } |
203 | 203 | ||
204 | public double sum() | 204 | public double Sum() |
205 | { | 205 | { |
206 | int x, y; | 206 | int x, y; |
207 | double sum = 0.0; | 207 | double sum = 0.0; |
@@ -217,9 +217,9 @@ namespace libTerrain | |||
217 | return sum; | 217 | return sum; |
218 | } | 218 | } |
219 | 219 | ||
220 | public double avg() | 220 | public double Avg() |
221 | { | 221 | { |
222 | return sum() / (w * h); | 222 | return Sum() / (w * h); |
223 | } | 223 | } |
224 | } | 224 | } |
225 | } | 225 | } |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs index eaca695..57ba729 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs | |||
@@ -42,14 +42,14 @@ namespace libTerrain | |||
42 | /// <param name="ry">The Y coordinate of the terrain mask</param> | 42 | /// <param name="ry">The Y coordinate of the terrain mask</param> |
43 | /// <param name="size">The size of the terrain mask</param> | 43 | /// <param name="size">The size of the terrain mask</param> |
44 | /// <param name="amount">The scale of the terrain mask</param> | 44 | /// <param name="amount">The scale of the terrain mask</param> |
45 | public void flatten(double rx, double ry, double size, double amount) | 45 | public void Flatten(double rx, double ry, double size, double amount) |
46 | { | 46 | { |
47 | // Generate the mask | 47 | // Generate the mask |
48 | Channel temp = new Channel(w, h); | 48 | Channel temp = new Channel(w, h); |
49 | temp.fill(0); | 49 | temp.Fill(0); |
50 | temp.raise(rx, ry, size, amount); | 50 | temp.Raise(rx, ry, size, amount); |
51 | temp.normalise(); | 51 | temp.Normalise(); |
52 | double total_mod = temp.sum(); | 52 | double total_mod = temp.Sum(); |
53 | 53 | ||
54 | // Establish the average height under the area | 54 | // Establish the average height under the area |
55 | Channel newmap = new Channel(w, h); | 55 | Channel newmap = new Channel(w, h); |
@@ -57,26 +57,26 @@ namespace libTerrain | |||
57 | 57 | ||
58 | newmap *= temp; | 58 | newmap *= temp; |
59 | 59 | ||
60 | double total_terrain = newmap.sum(); | 60 | double total_terrain = newmap.Sum(); |
61 | double avg_height = total_terrain / total_mod; | 61 | double avg_height = total_terrain / total_mod; |
62 | 62 | ||
63 | // Create a flat terrain using the average height | 63 | // Create a flat terrain using the average height |
64 | Channel flat = new Channel(w, h); | 64 | Channel flat = new Channel(w, h); |
65 | flat.fill(avg_height); | 65 | flat.Fill(avg_height); |
66 | 66 | ||
67 | // Blend the current terrain with the average height terrain | 67 | // Blend the current terrain with the average height terrain |
68 | // using the "raised" empty terrain as a mask | 68 | // using the "raised" empty terrain as a mask |
69 | blend(flat, temp); | 69 | Blend(flat, temp); |
70 | 70 | ||
71 | } | 71 | } |
72 | 72 | ||
73 | public void flatten(Channel mask, double amount) | 73 | public void Flatten(Channel mask, double amount) |
74 | { | 74 | { |
75 | // Generate the mask | 75 | // Generate the mask |
76 | Channel temp = mask * amount; | 76 | Channel temp = mask * amount; |
77 | temp.clip(0, 1); // Cut off out-of-bounds values | 77 | temp.Clip(0, 1); // Cut off out-of-bounds values |
78 | 78 | ||
79 | double total_mod = temp.sum(); | 79 | double total_mod = temp.Sum(); |
80 | 80 | ||
81 | // Establish the average height under the area | 81 | // Establish the average height under the area |
82 | Channel map = new Channel(w, h); | 82 | Channel map = new Channel(w, h); |
@@ -84,16 +84,16 @@ namespace libTerrain | |||
84 | 84 | ||
85 | map *= temp; | 85 | map *= temp; |
86 | 86 | ||
87 | double total_terrain = map.sum(); | 87 | double total_terrain = map.Sum(); |
88 | double avg_height = total_terrain / total_mod; | 88 | double avg_height = total_terrain / total_mod; |
89 | 89 | ||
90 | // Create a flat terrain using the average height | 90 | // Create a flat terrain using the average height |
91 | Channel flat = new Channel(w, h); | 91 | Channel flat = new Channel(w, h); |
92 | flat.fill(avg_height); | 92 | flat.Fill(avg_height); |
93 | 93 | ||
94 | // Blend the current terrain with the average height terrain | 94 | // Blend the current terrain with the average height terrain |
95 | // using the "raised" empty terrain as a mask | 95 | // using the "raised" empty terrain as a mask |
96 | blend(flat, temp); | 96 | Blend(flat, temp); |
97 | } | 97 | } |
98 | } | 98 | } |
99 | } \ No newline at end of file | 99 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs index d47f8fb..7bccef3 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs | |||
@@ -42,9 +42,9 @@ namespace libTerrain | |||
42 | /// <param name="ry">The center the Y coordinate of where you wish to raise the land</param> | 42 | /// <param name="ry">The center the Y coordinate of where you wish to raise the land</param> |
43 | /// <param name="size">The radius of the dimple</param> | 43 | /// <param name="size">The radius of the dimple</param> |
44 | /// <param name="amount">How much impact to add to the terrain (0..2 usually)</param> | 44 | /// <param name="amount">How much impact to add to the terrain (0..2 usually)</param> |
45 | public void raise(double rx, double ry, double size, double amount) | 45 | public void Raise(double rx, double ry, double size, double amount) |
46 | { | 46 | { |
47 | raiseSphere(rx, ry, size, amount); | 47 | RaiseSphere(rx, ry, size, amount); |
48 | } | 48 | } |
49 | 49 | ||
50 | /// <summary> | 50 | /// <summary> |
@@ -54,7 +54,7 @@ namespace libTerrain | |||
54 | /// <param name="ry">The center the Y coordinate of where you wish to raise the land</param> | 54 | /// <param name="ry">The center the Y coordinate of where you wish to raise the land</param> |
55 | /// <param name="size">The radius of the sphere dimple</param> | 55 | /// <param name="size">The radius of the sphere dimple</param> |
56 | /// <param name="amount">How much impact to add to the terrain (0..2 usually)</param> | 56 | /// <param name="amount">How much impact to add to the terrain (0..2 usually)</param> |
57 | public void raiseSphere(double rx, double ry, double size, double amount) | 57 | public void RaiseSphere(double rx, double ry, double size, double amount) |
58 | { | 58 | { |
59 | int x, y; | 59 | int x, y; |
60 | for (x = 0; x < w; x++) | 60 | for (x = 0; x < w; x++) |
@@ -80,7 +80,7 @@ namespace libTerrain | |||
80 | /// <param name="ry">The center the Y coordinate of where you wish to raise the land</param> | 80 | /// <param name="ry">The center the Y coordinate of where you wish to raise the land</param> |
81 | /// <param name="size">The radius of the cone</param> | 81 | /// <param name="size">The radius of the cone</param> |
82 | /// <param name="amount">How much impact to add to the terrain (0..2 usually)</param> | 82 | /// <param name="amount">How much impact to add to the terrain (0..2 usually)</param> |
83 | public void raiseCone(double rx, double ry, double size, double amount) | 83 | public void RaiseCone(double rx, double ry, double size, double amount) |
84 | { | 84 | { |
85 | int x, y; | 85 | int x, y; |
86 | for (x = 0; x < w; x++) | 86 | for (x = 0; x < w; x++) |
@@ -105,9 +105,9 @@ namespace libTerrain | |||
105 | /// <param name="ry">The center the Y coordinate of where you wish to lower the land</param> | 105 | /// <param name="ry">The center the Y coordinate of where you wish to lower the land</param> |
106 | /// <param name="size">The radius of the sphere dimple</param> | 106 | /// <param name="size">The radius of the sphere dimple</param> |
107 | /// <param name="amount">How much impact to remove from the terrain (0..2 usually)</param> | 107 | /// <param name="amount">How much impact to remove from the terrain (0..2 usually)</param> |
108 | public void lower(double rx, double ry, double size, double amount) | 108 | public void Lower(double rx, double ry, double size, double amount) |
109 | { | 109 | { |
110 | lowerSphere(rx, ry, size, amount); | 110 | LowerSphere(rx, ry, size, amount); |
111 | } | 111 | } |
112 | 112 | ||
113 | /// <summary> | 113 | /// <summary> |
@@ -117,7 +117,7 @@ namespace libTerrain | |||
117 | /// <param name="ry">The center the Y coordinate of where you wish to lower the land</param> | 117 | /// <param name="ry">The center the Y coordinate of where you wish to lower the land</param> |
118 | /// <param name="size">The radius of the sphere dimple</param> | 118 | /// <param name="size">The radius of the sphere dimple</param> |
119 | /// <param name="amount">How much impact to remove from the terrain (0..2 usually)</param> | 119 | /// <param name="amount">How much impact to remove from the terrain (0..2 usually)</param> |
120 | public void lowerSphere(double rx, double ry, double size, double amount) | 120 | public void LowerSphere(double rx, double ry, double size, double amount) |
121 | { | 121 | { |
122 | int x, y; | 122 | int x, y; |
123 | for (x = 0; x < w; x++) | 123 | for (x = 0; x < w; x++) |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs index a27671d..e09dc5a 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs | |||
@@ -35,7 +35,7 @@ namespace libTerrain | |||
35 | { | 35 | { |
36 | partial class Channel | 36 | partial class Channel |
37 | { | 37 | { |
38 | public Channel loadImage(string filename) | 38 | public Channel LoadImage(string filename) |
39 | { | 39 | { |
40 | Bitmap bit = new Bitmap(filename); | 40 | Bitmap bit = new Bitmap(filename); |
41 | Channel chan = new Channel(bit.Width, bit.Height); | 41 | Channel chan = new Channel(bit.Width, bit.Height); |
@@ -53,7 +53,7 @@ namespace libTerrain | |||
53 | return chan; | 53 | return chan; |
54 | } | 54 | } |
55 | 55 | ||
56 | public void saveImage(string filename) | 56 | public void SaveImage(string filename) |
57 | { | 57 | { |
58 | Bitmap bit = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format24bppRgb); | 58 | Bitmap bit = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format24bppRgb); |
59 | int x, y; | 59 | int x, y; |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs index 24a8fc4..b585caa 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs | |||
@@ -42,7 +42,7 @@ namespace libTerrain | |||
42 | /// <param name="w"></param> | 42 | /// <param name="w"></param> |
43 | /// <param name="h"></param> | 43 | /// <param name="h"></param> |
44 | /// <returns></returns> | 44 | /// <returns></returns> |
45 | private int[] radialEdge256(int val) | 45 | private int[] RadialEdge256(int val) |
46 | { | 46 | { |
47 | // Four cases: | 47 | // Four cases: |
48 | // 1. 000..255 return 0,val | 48 | // 1. 000..255 return 0,val |
@@ -79,7 +79,7 @@ namespace libTerrain | |||
79 | 79 | ||
80 | throw new Exception("Out of bounds parameter (val)"); | 80 | throw new Exception("Out of bounds parameter (val)"); |
81 | } | 81 | } |
82 | public void fracture(int number, double scalemin, double scalemax) | 82 | public void Fracture(int number, double scalemin, double scalemax) |
83 | { | 83 | { |
84 | Random rand = new Random(seed); | 84 | Random rand = new Random(seed); |
85 | 85 | ||
@@ -87,8 +87,8 @@ namespace libTerrain | |||
87 | { | 87 | { |
88 | int[] a, b; | 88 | int[] a, b; |
89 | 89 | ||
90 | a = radialEdge256(rand.Next(1023)); // TODO: Broken | 90 | a = RadialEdge256(rand.Next(1023)); // TODO: Broken |
91 | b = radialEdge256(rand.Next(1023)); // TODO: Broken | 91 | b = RadialEdge256(rand.Next(1023)); // TODO: Broken |
92 | double z = rand.NextDouble(); | 92 | double z = rand.NextDouble(); |
93 | 93 | ||
94 | for (int x = 0; x < w; x++) | 94 | for (int x = 0; x < w; x++) |
@@ -104,7 +104,7 @@ namespace libTerrain | |||
104 | } | 104 | } |
105 | } | 105 | } |
106 | } | 106 | } |
107 | normalise(); | 107 | Normalise(); |
108 | } | 108 | } |
109 | } | 109 | } |
110 | } \ No newline at end of file | 110 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs index c2ad882..0c9b3c3 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs | |||
@@ -35,7 +35,7 @@ namespace libTerrain | |||
35 | partial class Channel | 35 | partial class Channel |
36 | { | 36 | { |
37 | 37 | ||
38 | public void gradientCube() | 38 | public void GradientCube() |
39 | { | 39 | { |
40 | int x, y; | 40 | int x, y; |
41 | for (x = 0; x < w; x++) | 41 | for (x = 0; x < w; x++) |
@@ -45,10 +45,10 @@ namespace libTerrain | |||
45 | map[x, y] = x*y; | 45 | map[x, y] = x*y; |
46 | } | 46 | } |
47 | } | 47 | } |
48 | normalise(); | 48 | Normalise(); |
49 | } | 49 | } |
50 | 50 | ||
51 | public void gradientStripe() | 51 | public void GradientStripe() |
52 | { | 52 | { |
53 | int x, y; | 53 | int x, y; |
54 | for (x = 0; x < w; x++) | 54 | for (x = 0; x < w; x++) |
@@ -58,7 +58,7 @@ namespace libTerrain | |||
58 | map[x, y] = x; | 58 | map[x, y] = x; |
59 | } | 59 | } |
60 | } | 60 | } |
61 | normalise(); | 61 | Normalise(); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | } \ No newline at end of file | 64 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs index e8a660f..3b8e963 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs | |||
@@ -44,7 +44,7 @@ namespace libTerrain | |||
44 | /// <param name="island">Whether to bias hills towards the center of the map</param> | 44 | /// <param name="island">Whether to bias hills towards the center of the map</param> |
45 | /// <param name="additive">Whether to add hills together or to pick the largest value</param> | 45 | /// <param name="additive">Whether to add hills together or to pick the largest value</param> |
46 | /// <param name="noisy">Generates hill-shaped noise instead of consistent hills</param> | 46 | /// <param name="noisy">Generates hill-shaped noise instead of consistent hills</param> |
47 | public void hillsSpheres(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) | 47 | public void HillsSpheres(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) |
48 | { | 48 | { |
49 | Random random = new Random(seed); | 49 | Random random = new Random(seed); |
50 | 50 | ||
@@ -95,7 +95,7 @@ namespace libTerrain | |||
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
98 | normalise(); | 98 | Normalise(); |
99 | } | 99 | } |
100 | 100 | ||
101 | /// <summary> | 101 | /// <summary> |
@@ -108,7 +108,7 @@ namespace libTerrain | |||
108 | /// <param name="island">Whether to bias hills towards the center of the map</param> | 108 | /// <param name="island">Whether to bias hills towards the center of the map</param> |
109 | /// <param name="additive">Whether to add hills together or to pick the largest value</param> | 109 | /// <param name="additive">Whether to add hills together or to pick the largest value</param> |
110 | /// <param name="noisy">Generates hill-shaped noise instead of consistent hills</param> | 110 | /// <param name="noisy">Generates hill-shaped noise instead of consistent hills</param> |
111 | public void hillsCones(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) | 111 | public void HillsCones(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) |
112 | { | 112 | { |
113 | Random random = new Random(seed); | 113 | Random random = new Random(seed); |
114 | 114 | ||
@@ -158,10 +158,10 @@ namespace libTerrain | |||
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | normalise(); | 161 | Normalise(); |
162 | } | 162 | } |
163 | 163 | ||
164 | public void hillsBlocks(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) | 164 | public void HillsBlocks(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) |
165 | { | 165 | { |
166 | Random random = new Random(seed); | 166 | Random random = new Random(seed); |
167 | 167 | ||
@@ -212,10 +212,10 @@ namespace libTerrain | |||
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | normalise(); | 215 | Normalise(); |
216 | } | 216 | } |
217 | 217 | ||
218 | public void hillsSquared(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) | 218 | public void HillsSquared(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) |
219 | { | 219 | { |
220 | Random random = new Random(seed); | 220 | Random random = new Random(seed); |
221 | 221 | ||
@@ -268,7 +268,7 @@ namespace libTerrain | |||
268 | } | 268 | } |
269 | } | 269 | } |
270 | 270 | ||
271 | normalise(); | 271 | Normalise(); |
272 | } | 272 | } |
273 | 273 | ||
274 | } | 274 | } |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs index e95fb2e..ebb1771 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs | |||
@@ -38,7 +38,7 @@ namespace libTerrain | |||
38 | /// Fills a channel with 0..1 noise | 38 | /// Fills a channel with 0..1 noise |
39 | /// </summary> | 39 | /// </summary> |
40 | /// <remarks>3-Clause BSD Licensed</remarks> | 40 | /// <remarks>3-Clause BSD Licensed</remarks> |
41 | public void noise() | 41 | public void Noise() |
42 | { | 42 | { |
43 | Random rand = new Random(seed); | 43 | Random rand = new Random(seed); |
44 | int x, y; | 44 | int x, y; |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs index 04ac283..aeff730 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs | |||
@@ -34,7 +34,7 @@ namespace libTerrain | |||
34 | { | 34 | { |
35 | partial class Channel | 35 | partial class Channel |
36 | { | 36 | { |
37 | private double[] coordinatesToPolar(int x, int y) | 37 | private double[] CoordinatesToPolar(int x, int y) |
38 | { | 38 | { |
39 | 39 | ||
40 | double theta = Math.Atan2(x - (w / 2), y - (h / 2)); | 40 | double theta = Math.Atan2(x - (w / 2), y - (h / 2)); |
@@ -48,7 +48,7 @@ namespace libTerrain | |||
48 | return coords; | 48 | return coords; |
49 | } | 49 | } |
50 | 50 | ||
51 | public int[] polarToCoordinates(double r, double theta) { | 51 | public int[] PolarToCoordinates(double r, double theta) { |
52 | double nx; | 52 | double nx; |
53 | double ny; | 53 | double ny; |
54 | 54 | ||
@@ -78,14 +78,14 @@ namespace libTerrain | |||
78 | 78 | ||
79 | public void Polar() | 79 | public void Polar() |
80 | { | 80 | { |
81 | Channel n = this.copy(); | 81 | Channel n = this.Copy(); |
82 | 82 | ||
83 | int x, y; | 83 | int x, y; |
84 | for (x = 0; x < w; x++) | 84 | for (x = 0; x < w; x++) |
85 | { | 85 | { |
86 | for (y = 0; y < h; y++) | 86 | for (y = 0; y < h; y++) |
87 | { | 87 | { |
88 | double[] coords = coordinatesToPolar(x,y); | 88 | double[] coords = CoordinatesToPolar(x,y); |
89 | 89 | ||
90 | coords[0] += w / 2.0; | 90 | coords[0] += w / 2.0; |
91 | coords[1] += h / 2.0; | 91 | coords[1] += h / 2.0; |
@@ -105,8 +105,8 @@ namespace libTerrain | |||
105 | r += incRadius; | 105 | r += incRadius; |
106 | theta += incAngle; | 106 | theta += incAngle; |
107 | 107 | ||
108 | int[] coords = polarToCoordinates(r,theta); | 108 | int[] coords = PolarToCoordinates(r,theta); |
109 | raise(coords[0], coords[1], 20, 1); | 109 | Raise(coords[0], coords[1], 20, 1); |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
@@ -122,11 +122,11 @@ namespace libTerrain | |||
122 | r += incRadius; | 122 | r += incRadius; |
123 | theta += incAngle; | 123 | theta += incAngle; |
124 | 124 | ||
125 | int[] coords = polarToCoordinates(r, theta); | 125 | int[] coords = PolarToCoordinates(r, theta); |
126 | points.Add(new Point2D(coords[0],coords[1])); | 126 | points.Add(new Point2D(coords[0],coords[1])); |
127 | } | 127 | } |
128 | 128 | ||
129 | voronoiDiagram(points, c); | 129 | VoronoiDiagram(points, c); |
130 | } | 130 | } |
131 | 131 | ||
132 | public void Spiral(double wid, double hig, double offset) | 132 | public void Spiral(double wid, double hig, double offset) |
@@ -143,7 +143,7 @@ namespace libTerrain | |||
143 | map[x, y] += Math.Sin(dx / wid) + Math.Cos(dy / hig); | 143 | map[x, y] += Math.Sin(dx / wid) + Math.Cos(dy / hig); |
144 | } | 144 | } |
145 | } | 145 | } |
146 | normalise(); | 146 | Normalise(); |
147 | } | 147 | } |
148 | } | 148 | } |
149 | } \ No newline at end of file | 149 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs index fdd369b..e973d14 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs | |||
@@ -42,7 +42,7 @@ namespace libTerrain | |||
42 | /// <param name="blockSize">A multiple of the channel width and height which will have voronoi points generated in it. | 42 | /// <param name="blockSize">A multiple of the channel width and height which will have voronoi points generated in it. |
43 | /// <para>This is to ensure a more even distribution of the points than pure random allocation.</para></param> | 43 | /// <para>This is to ensure a more even distribution of the points than pure random allocation.</para></param> |
44 | /// <param name="c">The Voronoi diagram type. Usually an array with values consisting of [-1,1]. Experiment with the chain, you can have as many values as you like.</param> | 44 | /// <param name="c">The Voronoi diagram type. Usually an array with values consisting of [-1,1]. Experiment with the chain, you can have as many values as you like.</param> |
45 | public void voronoiDiagram(int pointsPerBlock, int blockSize, double[] c) | 45 | public void VoronoiDiagram(int pointsPerBlock, int blockSize, double[] c) |
46 | { | 46 | { |
47 | List<Point2D> points = new List<Point2D>(); | 47 | List<Point2D> points = new List<Point2D>(); |
48 | Random generator = new Random(seed); | 48 | Random generator = new Random(seed); |
@@ -98,10 +98,10 @@ namespace libTerrain | |||
98 | } | 98 | } |
99 | 99 | ||
100 | // Normalise the result | 100 | // Normalise the result |
101 | normalise(); | 101 | Normalise(); |
102 | } | 102 | } |
103 | 103 | ||
104 | public void voronoiDiagram(List<Point2D> points, double[] c) | 104 | public void VoronoiDiagram(List<Point2D> points, double[] c) |
105 | { | 105 | { |
106 | 106 | ||
107 | Random generator = new Random(seed); | 107 | Random generator = new Random(seed); |
@@ -141,10 +141,10 @@ namespace libTerrain | |||
141 | } | 141 | } |
142 | 142 | ||
143 | // Normalise the result | 143 | // Normalise the result |
144 | normalise(); | 144 | Normalise(); |
145 | } | 145 | } |
146 | 146 | ||
147 | public void voroflatDiagram(int pointsPerBlock, int blockSize) | 147 | public void VoroflatDiagram(int pointsPerBlock, int blockSize) |
148 | { | 148 | { |
149 | List<Point2D> points = new List<Point2D>(); | 149 | List<Point2D> points = new List<Point2D>(); |
150 | Random generator = new Random(seed); | 150 | Random generator = new Random(seed); |
@@ -203,7 +203,7 @@ namespace libTerrain | |||
203 | } | 203 | } |
204 | 204 | ||
205 | // Normalise the result | 205 | // Normalise the result |
206 | normalise(); | 206 | Normalise(); |
207 | } | 207 | } |
208 | } | 208 | } |
209 | } | 209 | } |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs index 38c8001..38a8023 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs | |||
@@ -42,7 +42,7 @@ namespace libTerrain | |||
42 | /// <param name="movement">The maximum distance each worm will move each step</param> | 42 | /// <param name="movement">The maximum distance each worm will move each step</param> |
43 | /// <param name="size">The size of the area around the worm modified</param> | 43 | /// <param name="size">The size of the area around the worm modified</param> |
44 | /// <param name="centerspawn">Do worms start in the middle, or randomly?</param> | 44 | /// <param name="centerspawn">Do worms start in the middle, or randomly?</param> |
45 | public void worms(int number, int rounds, double movement, double size, bool centerspawn) | 45 | public void Worms(int number, int rounds, double movement, double size, bool centerspawn) |
46 | { | 46 | { |
47 | Random random = new Random(seed); | 47 | Random random = new Random(seed); |
48 | int i, j; | 48 | int i, j; |
@@ -64,7 +64,7 @@ namespace libTerrain | |||
64 | { | 64 | { |
65 | rx += (random.NextDouble() * movement) - (movement / 2.0); | 65 | rx += (random.NextDouble() * movement) - (movement / 2.0); |
66 | ry += (random.NextDouble() * movement) - (movement / 2.0); | 66 | ry += (random.NextDouble() * movement) - (movement / 2.0); |
67 | raise(rx, ry, size, 1.0); | 67 | Raise(rx, ry, size, 1.0); |
68 | } | 68 | } |
69 | } | 69 | } |
70 | } | 70 | } |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs index 5ba4ca6..a9106b4 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs | |||
@@ -34,10 +34,10 @@ namespace libTerrain | |||
34 | { | 34 | { |
35 | partial class Channel | 35 | partial class Channel |
36 | { | 36 | { |
37 | public Channel normalise() | 37 | public Channel Normalise() |
38 | { | 38 | { |
39 | double max = findMax(); | 39 | double max = FindMax(); |
40 | double min = findMin(); | 40 | double min = FindMin(); |
41 | 41 | ||
42 | int x, y; | 42 | int x, y; |
43 | 43 | ||
@@ -52,10 +52,10 @@ namespace libTerrain | |||
52 | return this; | 52 | return this; |
53 | } | 53 | } |
54 | 54 | ||
55 | public Channel normalise(double minv, double maxv) | 55 | public Channel Normalise(double minv, double maxv) |
56 | { | 56 | { |
57 | double max = findMax(); | 57 | double max = FindMax(); |
58 | double min = findMin(); | 58 | double min = FindMin(); |
59 | 59 | ||
60 | int x, y; | 60 | int x, y; |
61 | 61 | ||
@@ -74,7 +74,7 @@ namespace libTerrain | |||
74 | return this; | 74 | return this; |
75 | } | 75 | } |
76 | 76 | ||
77 | public Channel clip() | 77 | public Channel Clip() |
78 | { | 78 | { |
79 | int x, y; | 79 | int x, y; |
80 | 80 | ||
@@ -82,14 +82,14 @@ namespace libTerrain | |||
82 | { | 82 | { |
83 | for (y = 0; y < h; y++) | 83 | for (y = 0; y < h; y++) |
84 | { | 84 | { |
85 | setClip(x, y, map[x, y]); | 85 | SetClip(x, y, map[x, y]); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | return this; | 89 | return this; |
90 | } | 90 | } |
91 | 91 | ||
92 | public Channel clip(double min, double max) | 92 | public Channel Clip(double min, double max) |
93 | { | 93 | { |
94 | int x, y; | 94 | int x, y; |
95 | for (x = 0; x < w; x++) | 95 | for (x = 0; x < w; x++) |
@@ -105,7 +105,7 @@ namespace libTerrain | |||
105 | return this; | 105 | return this; |
106 | } | 106 | } |
107 | 107 | ||
108 | public Channel crop(int x1, int y1, int x2, int y2) | 108 | public Channel Crop(int x1, int y1, int x2, int y2) |
109 | { | 109 | { |
110 | int width = x1 - x2 + 1; | 110 | int width = x1 - x2 + 1; |
111 | int height = y1 - y2 + 1; | 111 | int height = y1 - y2 + 1; |
@@ -130,7 +130,7 @@ namespace libTerrain | |||
130 | return this; | 130 | return this; |
131 | } | 131 | } |
132 | 132 | ||
133 | public Channel addClip(Channel other) | 133 | public Channel AddClip(Channel other) |
134 | { | 134 | { |
135 | int x, y; | 135 | int x, y; |
136 | for (x = 0; x < w; x++) | 136 | for (x = 0; x < w; x++) |
@@ -147,7 +147,7 @@ namespace libTerrain | |||
147 | return this; | 147 | return this; |
148 | } | 148 | } |
149 | 149 | ||
150 | public void smooth(double amount) | 150 | public void Smooth(double amount) |
151 | { | 151 | { |
152 | double area = amount; | 152 | double area = amount; |
153 | double step = amount / 4.0; | 153 | double step = amount / 4.0; |
@@ -167,7 +167,7 @@ namespace libTerrain | |||
167 | for (l = 0.0 - area; l < area; l += step) | 167 | for (l = 0.0 - area; l < area; l += step) |
168 | { | 168 | { |
169 | avgsteps++; | 169 | avgsteps++; |
170 | average += getBilinearInterpolate(x + n, y + l); | 170 | average += GetBilinearInterpolate(x + n, y + l); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
@@ -177,7 +177,7 @@ namespace libTerrain | |||
177 | map = manipulate; | 177 | map = manipulate; |
178 | } | 178 | } |
179 | 179 | ||
180 | public void pertubation(double amount) | 180 | public void Pertubation(double amount) |
181 | { | 181 | { |
182 | // Simple pertubation filter | 182 | // Simple pertubation filter |
183 | double[,] manipulated = new double[w, h]; | 183 | double[,] manipulated = new double[w, h]; |
@@ -191,14 +191,14 @@ namespace libTerrain | |||
191 | { | 191 | { |
192 | double offset_x = (double)x + (generator.NextDouble() * amount) - (amount / 2.0); | 192 | double offset_x = (double)x + (generator.NextDouble() * amount) - (amount / 2.0); |
193 | double offset_y = (double)y + (generator.NextDouble() * amount) - (amount / 2.0); | 193 | double offset_y = (double)y + (generator.NextDouble() * amount) - (amount / 2.0); |
194 | double p = getBilinearInterpolate(offset_x, offset_y); | 194 | double p = GetBilinearInterpolate(offset_x, offset_y); |
195 | manipulated[x, y] = p; | 195 | manipulated[x, y] = p; |
196 | } | 196 | } |
197 | } | 197 | } |
198 | map = manipulated; | 198 | map = manipulated; |
199 | } | 199 | } |
200 | 200 | ||
201 | public void pertubationMask(Channel mask) | 201 | public void PertubationMask(Channel mask) |
202 | { | 202 | { |
203 | // Simple pertubation filter | 203 | // Simple pertubation filter |
204 | double[,] manipulated = new double[w, h]; | 204 | double[,] manipulated = new double[w, h]; |
@@ -225,14 +225,14 @@ namespace libTerrain | |||
225 | if (offset_x < 0) | 225 | if (offset_x < 0) |
226 | offset_x = 0; | 226 | offset_x = 0; |
227 | 227 | ||
228 | double p = getBilinearInterpolate(offset_x, offset_y); | 228 | double p = GetBilinearInterpolate(offset_x, offset_y); |
229 | manipulated[x, y] = p; | 229 | manipulated[x, y] = p; |
230 | } | 230 | } |
231 | } | 231 | } |
232 | map = manipulated; | 232 | map = manipulated; |
233 | } | 233 | } |
234 | 234 | ||
235 | public Channel blend(Channel other, double amount) | 235 | public Channel Blend(Channel other, double amount) |
236 | { | 236 | { |
237 | int x, y; | 237 | int x, y; |
238 | for (x = 0; x < w; x++) | 238 | for (x = 0; x < w; x++) |
@@ -245,7 +245,7 @@ namespace libTerrain | |||
245 | return this; | 245 | return this; |
246 | } | 246 | } |
247 | 247 | ||
248 | public Channel blend(Channel other, Channel amount) | 248 | public Channel Blend(Channel other, Channel amount) |
249 | { | 249 | { |
250 | int x, y; | 250 | int x, y; |
251 | for (x = 0; x < w; x++) | 251 | for (x = 0; x < w; x++) |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs index 97c2762..198c337 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs | |||
@@ -74,14 +74,14 @@ namespace libTerrain | |||
74 | /// <param name="carry">The percentage of rock which can be picked up to pickup 0..1</param> | 74 | /// <param name="carry">The percentage of rock which can be picked up to pickup 0..1</param> |
75 | /// <param name="rounds">The number of erosion rounds (recommended: 25+)</param> | 75 | /// <param name="rounds">The number of erosion rounds (recommended: 25+)</param> |
76 | /// <param name="lowest">Drop sediment at the lowest point?</param> | 76 | /// <param name="lowest">Drop sediment at the lowest point?</param> |
77 | public void AerobicErosion(double windspeed, double pickup_talus_minimum, double drop_talus_minimum, double carry, int rounds, bool lowest, bool usingFluidDynamics) | 77 | public void AerobicErosion(double windspeed, double pickupTalusMinimum, double dropTalusMinimum, double carry, int rounds, bool lowest, bool usingFluidDynamics) |
78 | { | 78 | { |
79 | Channel wind = new Channel(w, h) ; | 79 | Channel wind = new Channel(w, h) ; |
80 | Channel sediment = new Channel(w, h); | 80 | Channel sediment = new Channel(w, h); |
81 | int x, y, i, j; | 81 | int x, y, i, j; |
82 | 82 | ||
83 | wind = this.copy(); | 83 | wind = this.Copy(); |
84 | wind.normalise(); // Cheap wind calculations | 84 | wind.Normalise(); // Cheap wind calculations |
85 | wind *= windspeed; | 85 | wind *= windspeed; |
86 | 86 | ||
87 | if (usingFluidDynamics) | 87 | if (usingFluidDynamics) |
@@ -90,7 +90,7 @@ namespace libTerrain | |||
90 | } | 90 | } |
91 | else | 91 | else |
92 | { | 92 | { |
93 | wind.pertubation(30); // Can do better later | 93 | wind.Pertubation(30); // Can do better later |
94 | } | 94 | } |
95 | 95 | ||
96 | for (i = 0; i < rounds; i++) | 96 | for (i = 0; i < rounds; i++) |
@@ -100,13 +100,13 @@ namespace libTerrain | |||
100 | { | 100 | { |
101 | for (y = 1; y < h - 1; y++) | 101 | for (y = 1; y < h - 1; y++) |
102 | { | 102 | { |
103 | double me = get(x, y); | 103 | double me = Get(x, y); |
104 | double surfacearea = 0.3; // Everything will erode even if it's flat. Just slower. | 104 | double surfacearea = 0.3; // Everything will erode even if it's flat. Just slower. |
105 | 105 | ||
106 | for (j = 0; j < 9; j++) | 106 | for (j = 0; j < 9; j++) |
107 | { | 107 | { |
108 | int[] coords = neighbours(NEIGHBOURS.NEIGHBOUR_MOORE, j); | 108 | int[] coords = Neighbours(NeighbourSystem.Moore, j); |
109 | double target = get(x + coords[0], y + coords[1]); | 109 | double target = Get(x + coords[0], y + coords[1]); |
110 | 110 | ||
111 | surfacearea += Math.Abs(target - me); | 111 | surfacearea += Math.Abs(target - me); |
112 | } | 112 | } |
@@ -116,7 +116,7 @@ namespace libTerrain | |||
116 | if (amount < 0) | 116 | if (amount < 0) |
117 | amount = 0; | 117 | amount = 0; |
118 | 118 | ||
119 | if (surfacearea > pickup_talus_minimum) | 119 | if (surfacearea > pickupTalusMinimum) |
120 | { | 120 | { |
121 | this.map[x, y] -= amount; | 121 | this.map[x, y] -= amount; |
122 | sediment.map[x, y] += amount; | 122 | sediment.map[x, y] += amount; |
@@ -131,9 +131,9 @@ namespace libTerrain | |||
131 | } | 131 | } |
132 | else | 132 | else |
133 | { | 133 | { |
134 | wind.pertubation(15); // Can do better later | 134 | wind.Pertubation(15); // Can do better later |
135 | wind.seed++; | 135 | wind.seed++; |
136 | sediment.pertubation(10); // Sediment is blown around a bit | 136 | sediment.Pertubation(10); // Sediment is blown around a bit |
137 | sediment.seed++; | 137 | sediment.seed++; |
138 | } | 138 | } |
139 | 139 | ||
@@ -142,15 +142,15 @@ namespace libTerrain | |||
142 | { | 142 | { |
143 | for (y = 1; y < h - 1; y++) | 143 | for (y = 1; y < h - 1; y++) |
144 | { | 144 | { |
145 | double me = get(x, y); | 145 | double me = Get(x, y); |
146 | double surfacearea = 0.01; // Flat land does not get deposition | 146 | double surfacearea = 0.01; // Flat land does not get deposition |
147 | double min = double.MaxValue; | 147 | double min = double.MaxValue; |
148 | int[] minside = new int[2]; | 148 | int[] minside = new int[2]; |
149 | 149 | ||
150 | for (j = 0; j < 9; j++) | 150 | for (j = 0; j < 9; j++) |
151 | { | 151 | { |
152 | int[] coords = neighbours(NEIGHBOURS.NEIGHBOUR_MOORE, j); | 152 | int[] coords = Neighbours(NeighbourSystem.Moore, j); |
153 | double target = get(x + coords[0], y + coords[1]); | 153 | double target = Get(x + coords[0], y + coords[1]); |
154 | 154 | ||
155 | surfacearea += Math.Abs(target - me); | 155 | surfacearea += Math.Abs(target - me); |
156 | 156 | ||
@@ -166,7 +166,7 @@ namespace libTerrain | |||
166 | if (amount < 0) | 166 | if (amount < 0) |
167 | amount = 0; | 167 | amount = 0; |
168 | 168 | ||
169 | if (surfacearea > drop_talus_minimum) | 169 | if (surfacearea > dropTalusMinimum) |
170 | { | 170 | { |
171 | this.map[x + minside[0], y + minside[1]] += amount; | 171 | this.map[x + minside[0], y + minside[1]] += amount; |
172 | sediment.map[x, y] -= amount; | 172 | sediment.map[x, y] -= amount; |
@@ -178,7 +178,7 @@ namespace libTerrain | |||
178 | 178 | ||
179 | Channel myself = this; | 179 | Channel myself = this; |
180 | myself += sediment; | 180 | myself += sediment; |
181 | myself.normalise(); | 181 | myself.Normalise(); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | } \ No newline at end of file | 184 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs index e3463c1..5ace241 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs | |||
@@ -34,17 +34,17 @@ namespace libTerrain | |||
34 | { | 34 | { |
35 | partial class Channel | 35 | partial class Channel |
36 | { | 36 | { |
37 | public void hydraulicErosion(Channel rain, double evaporation, double solubility, int frequency, int rounds) | 37 | public void HydraulicErosion(Channel rain, double evaporation, double solubility, int frequency, int rounds) |
38 | { | 38 | { |
39 | Channel water = new Channel(w, h); | 39 | Channel water = new Channel(w, h); |
40 | Channel sediment = new Channel(w, h); | 40 | Channel sediment = new Channel(w, h); |
41 | Channel terrain = this; | 41 | Channel terrain = this; |
42 | Channel waterFlow = new Channel(w, h); | 42 | Channel waterFlow = new Channel(w, h); |
43 | 43 | ||
44 | NEIGHBOURS type = NEIGHBOURS.NEIGHBOUR_MOORE; | 44 | NeighbourSystem type = NeighbourSystem.Moore; |
45 | int NEIGHBOUR_ME = 4; | 45 | int NEIGHBOUR_ME = 4; |
46 | 46 | ||
47 | int NEIGHBOUR_MAX = type == NEIGHBOURS.NEIGHBOUR_MOORE ? 9 : 5; | 47 | int NEIGHBOUR_MAX = type == NeighbourSystem.Moore ? 9 : 5; |
48 | 48 | ||
49 | for (int i = 0; i < rounds; i++) | 49 | for (int i = 0; i < rounds; i++) |
50 | { | 50 | { |
@@ -66,7 +66,7 @@ namespace libTerrain | |||
66 | { | 66 | { |
67 | if (j != NEIGHBOUR_ME) | 67 | if (j != NEIGHBOUR_ME) |
68 | { | 68 | { |
69 | int[] coords = neighbours(type, j); | 69 | int[] coords = Neighbours(type, j); |
70 | coords[0] += x; | 70 | coords[0] += x; |
71 | coords[1] += y; | 71 | coords[1] += y; |
72 | 72 | ||
@@ -107,13 +107,13 @@ namespace libTerrain | |||
107 | { | 107 | { |
108 | if (j != NEIGHBOUR_ME) | 108 | if (j != NEIGHBOUR_ME) |
109 | { | 109 | { |
110 | int[] coords = neighbours(type, j); | 110 | int[] coords = Neighbours(type, j); |
111 | coords[0] += x; | 111 | coords[0] += x; |
112 | coords[1] += y; | 112 | coords[1] += y; |
113 | 113 | ||
114 | if (diffs[j] > 0) | 114 | if (diffs[j] > 0) |
115 | { | 115 | { |
116 | waterFlow.setWrap(coords[0], coords[1], waterFlow.map[coords[0], coords[1]] + diffs[j] * totalInverseDiff); | 116 | waterFlow.SetWrap(coords[0], coords[1], waterFlow.map[coords[0], coords[1]] + diffs[j] * totalInverseDiff); |
117 | } | 117 | } |
118 | } | 118 | } |
119 | } | 119 | } |
@@ -121,7 +121,7 @@ namespace libTerrain | |||
121 | } | 121 | } |
122 | 122 | ||
123 | water += waterFlow; | 123 | water += waterFlow; |
124 | waterFlow.fill(0); | 124 | waterFlow.Fill(0); |
125 | 125 | ||
126 | water *= evaporation; | 126 | water *= evaporation; |
127 | 127 | ||
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs index 7514971..449bf85 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs | |||
@@ -40,7 +40,7 @@ namespace libTerrain | |||
40 | /// <param name="talus">The rock angle (represented as a dy/dx ratio) at which point it will be succeptible to breakage</param> | 40 | /// <param name="talus">The rock angle (represented as a dy/dx ratio) at which point it will be succeptible to breakage</param> |
41 | /// <param name="rounds">The number of erosion rounds</param> | 41 | /// <param name="rounds">The number of erosion rounds</param> |
42 | /// <param name="c">The amount of rock to carry each round</param> | 42 | /// <param name="c">The amount of rock to carry each round</param> |
43 | public Channel thermalWeathering(double talus, int rounds, double c) | 43 | public Channel ThermalWeathering(double talus, int rounds, double c) |
44 | { | 44 | { |
45 | double[,] lastFrame; | 45 | double[,] lastFrame; |
46 | double[,] thisFrame; | 46 | double[,] thisFrame; |
@@ -48,10 +48,10 @@ namespace libTerrain | |||
48 | lastFrame = (double[,])map.Clone(); | 48 | lastFrame = (double[,])map.Clone(); |
49 | thisFrame = (double[,])map.Clone(); | 49 | thisFrame = (double[,])map.Clone(); |
50 | 50 | ||
51 | NEIGHBOURS type = NEIGHBOURS.NEIGHBOUR_MOORE; // Using moore neighbourhood (twice as computationally expensive) | 51 | NeighbourSystem type = NeighbourSystem.Moore; // Using moore neighbourhood (twice as computationally expensive) |
52 | int NEIGHBOUR_ME = 4; // I am always 4 in both systems. | 52 | int NEIGHBOUR_ME = 4; // I am always 4 in both systems. |
53 | 53 | ||
54 | int NEIGHBOUR_MAX = type == NEIGHBOURS.NEIGHBOUR_MOORE ? 9 : 5; | 54 | int NEIGHBOUR_MAX = type == NeighbourSystem.Moore ? 9 : 5; |
55 | 55 | ||
56 | int frames = rounds; // Number of thermal erosion iterations to run | 56 | int frames = rounds; // Number of thermal erosion iterations to run |
57 | int i, j; | 57 | int i, j; |
@@ -67,7 +67,7 @@ namespace libTerrain | |||
67 | { | 67 | { |
68 | if (j != NEIGHBOUR_ME) | 68 | if (j != NEIGHBOUR_ME) |
69 | { | 69 | { |
70 | int[] coords = neighbours(type, j); | 70 | int[] coords = Neighbours(type, j); |
71 | 71 | ||
72 | coords[0] += x; | 72 | coords[0] += x; |
73 | coords[1] += y; | 73 | coords[1] += y; |
@@ -103,7 +103,7 @@ namespace libTerrain | |||
103 | 103 | ||
104 | map = thisFrame; | 104 | map = thisFrame; |
105 | 105 | ||
106 | normalise(); // Just to guaruntee a smooth 0..1 value | 106 | Normalise(); // Just to guaruntee a smooth 0..1 value |
107 | return this; | 107 | return this; |
108 | } | 108 | } |
109 | } | 109 | } |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs index cb63d21..6dc2e30 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs | |||
@@ -34,13 +34,13 @@ namespace libTerrain | |||
34 | { | 34 | { |
35 | partial class Channel | 35 | partial class Channel |
36 | { | 36 | { |
37 | enum NEIGHBOURS | 37 | enum NeighbourSystem |
38 | { | 38 | { |
39 | NEIGHBOUR_MOORE, | 39 | Moore, |
40 | NEIGHBOUR_VONNEUMANN | 40 | VonNeumann |
41 | }; | 41 | }; |
42 | 42 | ||
43 | private int[] neighbours(NEIGHBOURS type, int index) | 43 | private int[] Neighbours(NeighbourSystem type, int index) |
44 | { | 44 | { |
45 | int[] coord = new int[2]; | 45 | int[] coord = new int[2]; |
46 | 46 | ||
@@ -48,7 +48,7 @@ namespace libTerrain | |||
48 | 48 | ||
49 | switch (type) | 49 | switch (type) |
50 | { | 50 | { |
51 | case NEIGHBOURS.NEIGHBOUR_MOORE: | 51 | case NeighbourSystem.Moore: |
52 | switch (index) | 52 | switch (index) |
53 | { | 53 | { |
54 | case 1: | 54 | case 1: |
@@ -101,7 +101,7 @@ namespace libTerrain | |||
101 | } | 101 | } |
102 | break; | 102 | break; |
103 | 103 | ||
104 | case NEIGHBOURS.NEIGHBOUR_VONNEUMANN: | 104 | case NeighbourSystem.VonNeumann: |
105 | switch (index) | 105 | switch (index) |
106 | { | 106 | { |
107 | case 1: | 107 | case 1: |