diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/ErodeSphere.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/ErodeSphere.cs | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/ErodeSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/ErodeSphere.cs index 7a78cd8..7358ba3 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/ErodeSphere.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/ErodeSphere.cs | |||
@@ -151,7 +151,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
151 | 151 | ||
152 | #region ITerrainPaintableEffect Members | 152 | #region ITerrainPaintableEffect Members |
153 | 153 | ||
154 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) | 154 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, |
155 | double strength, double duration, int startX, int endX, int startY, int endY) | ||
155 | { | 156 | { |
156 | strength = TerrainUtil.MetersToSphericalStrength(strength); | 157 | strength = TerrainUtil.MetersToSphericalStrength(strength); |
157 | 158 | ||
@@ -163,18 +164,23 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
163 | ITerrainChannel sediment = new TerrainChannel(map.Width, map.Height); | 164 | ITerrainChannel sediment = new TerrainChannel(map.Width, map.Height); |
164 | 165 | ||
165 | // Fill with rain | 166 | // Fill with rain |
166 | for (x = 0; x < water.Width; x++) | 167 | for (x = startX; x <= endX; x++) |
167 | for (y = 0; y < water.Height; y++) | 168 | { |
168 | water[x, y] = Math.Max(0.0, TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * rainHeight * duration); | 169 | for (y = startY; y <= endY; y++) |
170 | { | ||
171 | if (mask[x, y]) | ||
172 | water[x, y] = Math.Max(0.0, TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * rainHeight * duration); | ||
173 | } | ||
174 | } | ||
169 | 175 | ||
170 | for (int i = 0; i < rounds; i++) | 176 | for (int i = 0; i < rounds; i++) |
171 | { | 177 | { |
172 | // Erode underlying terrain | 178 | // Erode underlying terrain |
173 | for (x = 0; x < water.Width; x++) | 179 | for (x = startX; x <= endX; x++) |
174 | { | 180 | { |
175 | for (y = 0; y < water.Height; y++) | 181 | for (y = startY; y <= endY; y++) |
176 | { | 182 | { |
177 | if (mask[x,y]) | 183 | if (mask[x, y]) |
178 | { | 184 | { |
179 | const double solConst = (1.0 / rounds); | 185 | const double solConst = (1.0 / rounds); |
180 | double sedDelta = water[x, y] * solConst; | 186 | double sedDelta = water[x, y] * solConst; |
@@ -185,9 +191,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
185 | } | 191 | } |
186 | 192 | ||
187 | // Move water | 193 | // Move water |
188 | for (x = 0; x < water.Width; x++) | 194 | for (x = startX; x <= endX; x++) |
189 | { | 195 | { |
190 | for (y = 0; y < water.Height; y++) | 196 | for (y = startY; y <= endY; y++) |
191 | { | 197 | { |
192 | if (water[x, y] <= 0) | 198 | if (water[x, y] <= 0) |
193 | continue; | 199 | continue; |
@@ -296,7 +302,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
296 | double sedimentDeposit = sediment[x, y] - waterCapacity; | 302 | double sedimentDeposit = sediment[x, y] - waterCapacity; |
297 | if (sedimentDeposit > 0) | 303 | if (sedimentDeposit > 0) |
298 | { | 304 | { |
299 | if (mask[x,y]) | 305 | if (mask[x, y]) |
300 | { | 306 | { |
301 | sediment[x, y] -= sedimentDeposit; | 307 | sediment[x, y] -= sedimentDeposit; |
302 | map[x, y] += sedimentDeposit; | 308 | map[x, y] += sedimentDeposit; |
@@ -309,10 +315,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
309 | // Deposit any remainder (should be minimal) | 315 | // Deposit any remainder (should be minimal) |
310 | for (x = 0; x < water.Width; x++) | 316 | for (x = 0; x < water.Width; x++) |
311 | for (y = 0; y < water.Height; y++) | 317 | for (y = 0; y < water.Height; y++) |
312 | if (mask[x,y] && sediment[x, y] > 0) | 318 | if (mask[x, y] && sediment[x, y] > 0) |
313 | map[x, y] += sediment[x, y]; | 319 | map[x, y] += sediment[x, y]; |
314 | } | 320 | } |
315 | |||
316 | #endregion | 321 | #endregion |
317 | } | 322 | } |
318 | } | 323 | } |