diff options
* Assorted terrain fixes
Diffstat (limited to 'OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs')
-rw-r--r-- | OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs index f4dfe1d..fecb748 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs | |||
@@ -76,13 +76,19 @@ namespace libTerrain | |||
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 pickupTalusMinimum, double dropTalusMinimum, 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 | bool debugImages = true; | ||
80 | |||
79 | Channel wind = new Channel(w, h) ; | 81 | Channel wind = new Channel(w, h) ; |
80 | Channel sediment = new Channel(w, h); | 82 | Channel sediment = new Channel(w, h); |
81 | int x, y, i, j; | 83 | int x, y, i, j; |
82 | 84 | ||
85 | this.Normalise(); | ||
86 | |||
83 | wind = this.Copy(); | 87 | wind = this.Copy(); |
84 | wind.Normalise(); // Cheap wind calculations | 88 | wind.Noise(); |
85 | wind *= windspeed; | 89 | |
90 | if (debugImages) | ||
91 | wind.SaveImage("testimg/wind_start.png"); | ||
86 | 92 | ||
87 | if (usingFluidDynamics) | 93 | if (usingFluidDynamics) |
88 | { | 94 | { |
@@ -90,9 +96,12 @@ namespace libTerrain | |||
90 | } | 96 | } |
91 | else | 97 | else |
92 | { | 98 | { |
93 | wind.Pertubation(30); // Can do better later | 99 | wind.Pertubation(30); |
94 | } | 100 | } |
95 | 101 | ||
102 | if (debugImages) | ||
103 | wind.SaveImage("testimg/wind_begin.png"); | ||
104 | |||
96 | for (i = 0; i < rounds; i++) | 105 | for (i = 0; i < rounds; i++) |
97 | { | 106 | { |
98 | // Convert some rocks to sand | 107 | // Convert some rocks to sand |
@@ -127,7 +136,14 @@ namespace libTerrain | |||
127 | if (usingFluidDynamics) | 136 | if (usingFluidDynamics) |
128 | { | 137 | { |
129 | sediment.navierStokes(7, 0.1, 0.0, 0.1); | 138 | sediment.navierStokes(7, 0.1, 0.0, 0.1); |
130 | wind.navierStokes(10, 0.1, 0.0, 0.0); | 139 | |
140 | Channel noiseChan = new Channel(w, h); | ||
141 | noiseChan.Noise(); | ||
142 | wind.Blend(noiseChan, 0.01); | ||
143 | |||
144 | wind.navierStokes(10, 0.1, 0.01, 0.01); | ||
145 | |||
146 | sediment.Distort(wind, windspeed); | ||
131 | } | 147 | } |
132 | else | 148 | else |
133 | { | 149 | { |
@@ -137,6 +153,9 @@ namespace libTerrain | |||
137 | sediment.seed++; | 153 | sediment.seed++; |
138 | } | 154 | } |
139 | 155 | ||
156 | if (debugImages) | ||
157 | wind.SaveImage("testimg/wind_" + i.ToString() + ".png"); | ||
158 | |||
140 | // Convert some sand to rock | 159 | // Convert some sand to rock |
141 | for (x = 1; x < w - 1; x++) | 160 | for (x = 1; x < w - 1; x++) |
142 | { | 161 | { |
@@ -174,11 +193,21 @@ namespace libTerrain | |||
174 | } | 193 | } |
175 | } | 194 | } |
176 | 195 | ||
196 | if (debugImages) | ||
197 | sediment.SaveImage("testimg/sediment_" + i.ToString() + ".png"); | ||
198 | |||
199 | wind.Normalise(); | ||
200 | wind *= windspeed; | ||
201 | |||
202 | this.Normalise(); | ||
177 | } | 203 | } |
178 | 204 | ||
179 | Channel myself = this; | 205 | Channel myself = this; |
180 | myself += sediment; | 206 | myself += sediment; |
181 | myself.Normalise(); | 207 | myself.Normalise(); |
208 | |||
209 | if (debugImages) | ||
210 | this.SaveImage("testimg/output.png"); | ||
182 | } | 211 | } |
183 | } | 212 | } |
184 | } \ No newline at end of file | 213 | } \ No newline at end of file |