aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators
diff options
context:
space:
mode:
authorAdam Frisby2007-07-23 05:29:52 +0000
committerAdam Frisby2007-07-23 05:29:52 +0000
commitb8da9c3a64b84ab14642bad8c79d3b2ed62e62fb (patch)
treede4466ffdf017e140ec3aca9bb52cbe14e5e5b12 /OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators
parentCouple of small changes (diff)
downloadopensim-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/libTerrainBSD/Channel/Manipulators')
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs30
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs14
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs10
3 files changed, 27 insertions, 27 deletions
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 }