From: mike pitman <pitman@us.ibm.com>
New patch (terrainedit2.patch) is attached that passes unit tests ( and in fact supplies the new unit test to pass..:) The previous failure was due to the change of the brush size to be linear instead of exponential, and the fact that the test parameters were assuming the exponentional brush size. This patch also removes dependency on 'duration' argument for adjustment step size. This should address the widely differing reports of instability with terrain editing. Note: 'doing this right' implies ultimately reading the parameters from the ini file, which this patch does not do.0.6.0-stable
parent
ae63b2d2ca
commit
03e3f88059
|
@ -42,6 +42,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
|||
|
||||
double sum = 0.0;
|
||||
double step2 = 0.0;
|
||||
duration = 0.009; //MCP Should be read from ini file
|
||||
|
||||
|
||||
// compute delta map
|
||||
for (x = 0; x < map.Width; x++)
|
||||
|
@ -80,4 +82,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
|||
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
|
||||
{
|
||||
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
||||
|
||||
duration = 0.03; //MCP Should be read from ini file
|
||||
|
||||
int x;
|
||||
for (x = 0; x < map.Width; x++)
|
||||
{
|
||||
|
|
|
@ -33,9 +33,11 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
|||
public class RaiseSphere : ITerrainPaintableEffect
|
||||
{
|
||||
#region ITerrainPaintableEffect Members
|
||||
|
||||
|
||||
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
|
||||
{
|
||||
duration = 0.03; //MCP Should be read from ini file
|
||||
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
||||
|
||||
int x;
|
||||
|
|
|
@ -44,7 +44,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
|||
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)
|
||||
{
|
||||
strength = TerrainUtil.MetersToSphericalStrength(strength);
|
||||
|
||||
duration = 0.03; //MCP Should be read from ini file
|
||||
|
||||
if (duration > 1.0)
|
||||
duration = 1.0;
|
||||
if (duration < 0)
|
||||
|
|
|
@ -40,8 +40,10 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
|||
int x, y;
|
||||
double[,] tweak = new double[map.Width,map.Height];
|
||||
|
||||
double area = strength;
|
||||
double area = strength;
|
||||
double step = strength / 4.0;
|
||||
duration = 0.0045; //MCP Should be read from ini file
|
||||
|
||||
|
||||
// compute delta map
|
||||
for (x = 0; x < map.Width; x++)
|
||||
|
@ -91,4 +93,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
|
|||
{
|
||||
public static double MetersToSphericalStrength(double size)
|
||||
{
|
||||
return Math.Pow(2, size);
|
||||
//return Math.Pow(2, size);
|
||||
return (size + 1) * 2.5; // MCP: a more useful brush size range
|
||||
}
|
||||
|
||||
public static double SphericalFactor(double x, double y, double rx, double ry, double size)
|
||||
|
|
|
@ -40,14 +40,14 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.Tests
|
|||
TerrainChannel x = new TerrainChannel(256, 256);
|
||||
ITerrainPaintableEffect effect = new RaiseSphere();
|
||||
|
||||
effect.PaintEffect(x, 128.0, 128.0, 50, 0.1);
|
||||
effect.PaintEffect(x, 128.0, 128.0, 100, 0.1);
|
||||
Assert.That(x[128, 128] > 0.0, "Raise brush not raising values.");
|
||||
Assert.That(x[0, 128] > 0.0, "Raise brush lowering edge values.");
|
||||
|
||||
x = new TerrainChannel(256, 256);
|
||||
effect = new LowerSphere();
|
||||
|
||||
effect.PaintEffect(x, 128.0, 128.0, 50, 0.1);
|
||||
effect.PaintEffect(x, 128.0, 128.0, 100, 0.1);
|
||||
Assert.That(x[128, 128] < 0.0, "Lower not lowering values.");
|
||||
Assert.That(x[0, 128] < 0.0, "Lower brush affecting edge values.");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue