also limit terrain flood effects ( like on pait change this should have

no visible impact, just cpu saving)
avinationmerge
UbitUmarov 2015-08-28 02:33:54 +01:00
parent bd4ec5f26c
commit c967ecf0c7
9 changed files with 37 additions and 35 deletions

View File

@ -64,7 +64,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Effects
for (int i = 0; i < rounds; i++) 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);
} }
} }
} }

View File

@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Effects
for (y = 0; y < map.Height; y++) for (y = 0; y < map.Height; y++)
{ {
if (cliffMask[x, 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);
} }
} }

View File

@ -33,15 +33,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
{ {
#region ITerrainFloodEffect Members #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 sum = 0.0;
double steps = 0.0; double steps = 0.0;
int x, y; 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]) 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 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]) if (fillArea[x, y])
map[x, y] = (map[x, y] * (1.0 - str)) + (avg * str); map[x, y] = (map[x, y] * (1.0 - str)) + (avg * str);

View File

@ -33,13 +33,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
{ {
#region ITerrainFloodEffect Members #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; int x,y;
for (x = 0; x < map.Width; x++) for (x = startX; x <= endX; x++)
{ {
int y; for (y = startY; y <= endY; y++)
for (y = 0; y < map.Height; y++)
{ {
if (fillArea[x, y]) if (fillArea[x, y])
{ {

View File

@ -35,18 +35,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
{ {
#region ITerrainFloodEffect Members #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; int x, y;
for (x = 0; x < map.Width; x++) for (x = startX; x <= endX; x++)
{ {
int y; for (y = startY; y <= endY; y++)
for (y = 0; y < map.Height; y++)
{ {
if (fillArea[x, y]) if (fillArea[x, y])
{ {
double noise = TerrainUtil.PerlinNoise2D((double) x / map.Width, (double) y / map.Height, 8, 1.0); double noise = TerrainUtil.PerlinNoise2D((double) x / map.Width, (double) y / map.Height, 8, 1.0);
map[x, y] += noise * strength; map[x, y] += noise * strength;
} }
} }

View File

@ -33,13 +33,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
{ {
#region ITerrainFloodEffect Members #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; int x,y;
for (x = 0; x < map.Width; x++) for (x = startX; x <= endX; x++)
{ {
int y; for (y = startY; y <= endY; y++)
for (y = 0; y < map.Height; y++)
{ {
if (fillArea[x, y]) if (fillArea[x, y])
{ {

View File

@ -46,13 +46,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
/// <param name="map">the current heightmap</param> /// <param name="map">the current heightmap</param>
/// <param name="fillArea">array indicating which sections of the map are to be reverted</param> /// <param name="fillArea">array indicating which sections of the map are to be reverted</param>
/// <param name="strength">unused</param> /// <param name="strength">unused</param>
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; int x, y;
for (x = 0; x < map.Width; x++) for (x = startX; x <= endX; x++)
{ {
int y; for (y = startY; y <= endY; y++)
for (y = 0; y < map.Height; y++)
{ {
if (fillArea[x, y]) if (fillArea[x, y])
{ {

View File

@ -33,16 +33,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
{ {
#region ITerrainFloodEffect Members #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 area = strength;
double step = strength / 4.0; double step = strength / 4.0;
double[,] manipulate = new double[map.Width,map.Height]; double[,] manipulate = new double[map.Width,map.Height];
int x, y; 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]) if (!fillArea[x, y])
continue; continue;
@ -64,9 +65,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
manipulate[x, y] = average / avgsteps; 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]) if (!fillArea[x, y])
continue; continue;

View File

@ -32,6 +32,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
{ {
public interface ITerrainFloodEffect 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);
} }
} }