From c967ecf0c7a4e895ef9626dbb44f9801fb5d57d1 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 28 Aug 2015 02:33:54 +0100
Subject: also limit terrain flood effects ( like on pait change this should
have no visible impact, just cpu saving)
---
.../Region/CoreModules/World/Terrain/Effects/ChannelDigger.cs | 4 ++--
.../Region/CoreModules/World/Terrain/Effects/CookieCutter.cs | 2 +-
.../CoreModules/World/Terrain/FloodBrushes/FlattenArea.cs | 11 ++++++-----
.../CoreModules/World/Terrain/FloodBrushes/LowerArea.cs | 10 +++++-----
.../CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs | 11 +++++------
.../CoreModules/World/Terrain/FloodBrushes/RaiseArea.cs | 10 +++++-----
.../CoreModules/World/Terrain/FloodBrushes/RevertArea.cs | 10 +++++-----
.../CoreModules/World/Terrain/FloodBrushes/SmoothArea.cs | 11 ++++++-----
.../Region/CoreModules/World/Terrain/ITerrainFloodEffect.cs | 3 ++-
9 files changed, 37 insertions(+), 35 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Effects/ChannelDigger.cs b/OpenSim/Region/CoreModules/World/Terrain/Effects/ChannelDigger.cs
index 36917e9..b456aa1 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/Effects/ChannelDigger.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/Effects/ChannelDigger.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Effects
for (int i = 0; i < rounds; i++)
{
- smoothFunction.FloodEffect(map, bitmap, 1.0);
+ smoothFunction.FloodEffect(map, bitmap, 1.0, 0, map.Width - 1, 0, map.Height - 1);
}
}
@@ -99,7 +99,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Effects
}
}
- raiseFunction.FloodEffect(map, bitmap, height);
+ raiseFunction.FloodEffect(map, bitmap, height, 0, map.Width - 1, 0, map.Height - 1);
}
}
}
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Effects/CookieCutter.cs b/OpenSim/Region/CoreModules/World/Terrain/Effects/CookieCutter.cs
index dc76ad5..3222524 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/Effects/CookieCutter.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/Effects/CookieCutter.cs
@@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Effects
for (y = 0; y < map.Height; y++)
{
if (cliffMask[x, y])
- eroder.PaintEffect(map, allowMask, x, y, -1, 4, 0.1);
+ eroder.PaintEffect(map, allowMask, x, y, -1, 4, 0.1,0,map.Width - 1,0,map.Height - 1);
}
}
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/FlattenArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/FlattenArea.cs
index 774e7b2..8bdf55f 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/FlattenArea.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/FlattenArea.cs
@@ -33,15 +33,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
{
#region ITerrainFloodEffect Members
- public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength)
+ public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength,
+ int startX, int endX, int startY, int endY)
{
double sum = 0.0;
double steps = 0.0;
int x, y;
- for (x = 0; x < map.Width; x++)
+ for (x = startX; x <= endX; x++)
{
- for (y = 0; y < map.Height; y++)
+ for (y = startY; y <= endY; y++)
{
if (fillArea[x, y])
{
@@ -55,9 +56,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
double str = 0.1 * strength; // == 0.2 in the default client
- for (x = 0; x < map.Width; x++)
+ for (x = startX; x <= endX; x++)
{
- for (y = 0; y < map.Height; y++)
+ for (y = startY; y < endY; y++)
{
if (fillArea[x, y])
map[x, y] = (map[x, y] * (1.0 - str)) + (avg * str);
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/LowerArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/LowerArea.cs
index 3e87390..a275a86 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/LowerArea.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/LowerArea.cs
@@ -33,13 +33,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
{
#region ITerrainFloodEffect Members
- public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength)
+ public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength,
+ int startX, int endX, int startY, int endY)
{
- int x;
- for (x = 0; x < map.Width; x++)
+ int x,y;
+ for (x = startX; x <= endX; x++)
{
- int y;
- for (y = 0; y < map.Height; y++)
+ for (y = startY; y <= endY; y++)
{
if (fillArea[x, y])
{
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs
index d3e2533..d634e8b 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs
@@ -35,18 +35,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
{
#region ITerrainFloodEffect Members
- public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength)
+ public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength,
+ int startX, int endX, int startY, int endY)
{
- int x;
- for (x = 0; x < map.Width; x++)
+ int x, y;
+ for (x = startX; x <= endX; x++)
{
- int y;
- for (y = 0; y < map.Height; y++)
+ for (y = startY; y <= endY; y++)
{
if (fillArea[x, y])
{
double noise = TerrainUtil.PerlinNoise2D((double) x / map.Width, (double) y / map.Height, 8, 1.0);
-
map[x, y] += noise * strength;
}
}
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/RaiseArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/RaiseArea.cs
index 3bdc5e7..6ccd5df 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/RaiseArea.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/RaiseArea.cs
@@ -33,13 +33,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
{
#region ITerrainFloodEffect Members
- public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength)
+ public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength,
+ int startX, int endX, int startY, int endY)
{
- int x;
- for (x = 0; x < map.Width; x++)
+ int x,y;
+ for (x = startX; x <= endX; x++)
{
- int y;
- for (y = 0; y < map.Height; y++)
+ for (y = startY; y <= endY; y++)
{
if (fillArea[x, y])
{
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/RevertArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/RevertArea.cs
index c5527fa..4230133 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/RevertArea.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/RevertArea.cs
@@ -46,13 +46,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
/// the current heightmap
/// array indicating which sections of the map are to be reverted
/// unused
- public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength)
+ public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength,
+ int startX, int endX, int startY, int endY)
{
- int x;
- for (x = 0; x < map.Width; x++)
+ int x, y;
+ for (x = startX; x <= endX; x++)
{
- int y;
- for (y = 0; y < map.Height; y++)
+ for (y = startY; y <= endY; y++)
{
if (fillArea[x, y])
{
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/SmoothArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/SmoothArea.cs
index 6b07747..6c0d60d 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/SmoothArea.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/SmoothArea.cs
@@ -33,16 +33,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
{
#region ITerrainFloodEffect Members
- public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength)
+ public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength,
+ int startX, int endX, int startY, int endY)
{
double area = strength;
double step = strength / 4.0;
double[,] manipulate = new double[map.Width,map.Height];
int x, y;
- for (x = 0; x < map.Width; x++)
+ for (x = startX; x <= endX; x++)
{
- for (y = 0; y < map.Height; y++)
+ for (y = startY; y <= endY; y++)
{
if (!fillArea[x, y])
continue;
@@ -64,9 +65,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
manipulate[x, y] = average / avgsteps;
}
}
- for (x = 0; x < map.Width; x++)
+ for (x = startX; x <= endX; x++)
{
- for (y = 0; y < map.Height; y++)
+ for (y = startY; y <= endY; y++)
{
if (!fillArea[x, y])
continue;
diff --git a/OpenSim/Region/CoreModules/World/Terrain/ITerrainFloodEffect.cs b/OpenSim/Region/CoreModules/World/Terrain/ITerrainFloodEffect.cs
index 3984a30..6324aca 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/ITerrainFloodEffect.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/ITerrainFloodEffect.cs
@@ -32,6 +32,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
{
public interface ITerrainFloodEffect
{
- void FloodEffect(ITerrainChannel map, Boolean[,] fillArea, double strength);
+ void FloodEffect(ITerrainChannel map, Boolean[,] fillArea, double strength,
+ int startX, int endX, int startY, int endY);
}
}
\ No newline at end of file
--
cgit v1.1