diff options
author | Dr Scofield | 2008-09-16 07:19:22 +0000 |
---|---|---|
committer | Dr Scofield | 2008-09-16 07:19:22 +0000 |
commit | 03e3f88059908675652ec3da3b267bc04bab6c37 (patch) | |
tree | c46dac28d3f93b44cebff046bed8e1e18d17e9c5 /OpenSim/Region/Environment/Modules/World/Terrain | |
parent | Finish up OSSL enable/disable options in XEngine. (diff) | |
download | opensim-SC_OLD-03e3f88059908675652ec3da3b267bc04bab6c37.zip opensim-SC_OLD-03e3f88059908675652ec3da3b267bc04bab6c37.tar.gz opensim-SC_OLD-03e3f88059908675652ec3da3b267bc04bab6c37.tar.bz2 opensim-SC_OLD-03e3f88059908675652ec3da3b267bc04bab6c37.tar.xz |
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.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Terrain')
7 files changed, 17 insertions, 8 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs index 7bf88f0..40fb01e 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs | |||
@@ -42,6 +42,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | |||
42 | 42 | ||
43 | double sum = 0.0; | 43 | double sum = 0.0; |
44 | double step2 = 0.0; | 44 | double step2 = 0.0; |
45 | duration = 0.009; //MCP Should be read from ini file | ||
46 | |||
45 | 47 | ||
46 | // compute delta map | 48 | // compute delta map |
47 | for (x = 0; x < map.Width; x++) | 49 | for (x = 0; x < map.Width; x++) |
@@ -80,4 +82,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | |||
80 | 82 | ||
81 | #endregion | 83 | #endregion |
82 | } | 84 | } |
83 | } \ No newline at end of file | 85 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs index 202ab3b..08b2879 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/LowerSphere.cs | |||
@@ -37,7 +37,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | |||
37 | public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration) | 37 | public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration) |
38 | { | 38 | { |
39 | strength = TerrainUtil.MetersToSphericalStrength(strength); | 39 | strength = TerrainUtil.MetersToSphericalStrength(strength); |
40 | 40 | duration = 0.03; //MCP Should be read from ini file | |
41 | |||
41 | int x; | 42 | int x; |
42 | for (x = 0; x < map.Width; x++) | 43 | for (x = 0; x < map.Width; x++) |
43 | { | 44 | { |
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs index f5344a0..e4fe091 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs | |||
@@ -33,9 +33,11 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | |||
33 | public class RaiseSphere : ITerrainPaintableEffect | 33 | public class RaiseSphere : ITerrainPaintableEffect |
34 | { | 34 | { |
35 | #region ITerrainPaintableEffect Members | 35 | #region ITerrainPaintableEffect Members |
36 | |||
36 | 37 | ||
37 | public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration) | 38 | public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration) |
38 | { | 39 | { |
40 | duration = 0.03; //MCP Should be read from ini file | ||
39 | strength = TerrainUtil.MetersToSphericalStrength(strength); | 41 | strength = TerrainUtil.MetersToSphericalStrength(strength); |
40 | 42 | ||
41 | int x; | 43 | int x; |
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RevertSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RevertSphere.cs index db3fef7..64c0a07 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RevertSphere.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/RevertSphere.cs | |||
@@ -44,7 +44,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | |||
44 | public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration) | 44 | public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration) |
45 | { | 45 | { |
46 | strength = TerrainUtil.MetersToSphericalStrength(strength); | 46 | strength = TerrainUtil.MetersToSphericalStrength(strength); |
47 | 47 | duration = 0.03; //MCP Should be read from ini file | |
48 | |||
48 | if (duration > 1.0) | 49 | if (duration > 1.0) |
49 | duration = 1.0; | 50 | duration = 1.0; |
50 | if (duration < 0) | 51 | if (duration < 0) |
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs index fc0a579..89d9063 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs | |||
@@ -40,8 +40,10 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | |||
40 | int x, y; | 40 | int x, y; |
41 | double[,] tweak = new double[map.Width,map.Height]; | 41 | double[,] tweak = new double[map.Width,map.Height]; |
42 | 42 | ||
43 | double area = strength; | 43 | double area = strength; |
44 | double step = strength / 4.0; | 44 | double step = strength / 4.0; |
45 | duration = 0.0045; //MCP Should be read from ini file | ||
46 | |||
45 | 47 | ||
46 | // compute delta map | 48 | // compute delta map |
47 | for (x = 0; x < map.Width; x++) | 49 | for (x = 0; x < map.Width; x++) |
@@ -91,4 +93,4 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | |||
91 | 93 | ||
92 | #endregion | 94 | #endregion |
93 | } | 95 | } |
94 | } \ No newline at end of file | 96 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainUtil.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainUtil.cs index def28eb..2e6595a 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainUtil.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainUtil.cs | |||
@@ -34,7 +34,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain | |||
34 | { | 34 | { |
35 | public static double MetersToSphericalStrength(double size) | 35 | public static double MetersToSphericalStrength(double size) |
36 | { | 36 | { |
37 | return Math.Pow(2, size); | 37 | //return Math.Pow(2, size); |
38 | return (size + 1) * 2.5; // MCP: a more useful brush size range | ||
38 | } | 39 | } |
39 | 40 | ||
40 | public static double SphericalFactor(double x, double y, double rx, double ry, double size) | 41 | public static double SphericalFactor(double x, double y, double rx, double ry, double size) |
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs index 61ebc5c..eaa674e 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/Tests/TerrainTest.cs | |||
@@ -40,14 +40,14 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.Tests | |||
40 | TerrainChannel x = new TerrainChannel(256, 256); | 40 | TerrainChannel x = new TerrainChannel(256, 256); |
41 | ITerrainPaintableEffect effect = new RaiseSphere(); | 41 | ITerrainPaintableEffect effect = new RaiseSphere(); |
42 | 42 | ||
43 | effect.PaintEffect(x, 128.0, 128.0, 50, 0.1); | 43 | effect.PaintEffect(x, 128.0, 128.0, 100, 0.1); |
44 | Assert.That(x[128, 128] > 0.0, "Raise brush not raising values."); | 44 | Assert.That(x[128, 128] > 0.0, "Raise brush not raising values."); |
45 | Assert.That(x[0, 128] > 0.0, "Raise brush lowering edge values."); | 45 | Assert.That(x[0, 128] > 0.0, "Raise brush lowering edge values."); |
46 | 46 | ||
47 | x = new TerrainChannel(256, 256); | 47 | x = new TerrainChannel(256, 256); |
48 | effect = new LowerSphere(); | 48 | effect = new LowerSphere(); |
49 | 49 | ||
50 | effect.PaintEffect(x, 128.0, 128.0, 50, 0.1); | 50 | effect.PaintEffect(x, 128.0, 128.0, 100, 0.1); |
51 | Assert.That(x[128, 128] < 0.0, "Lower not lowering values."); | 51 | Assert.That(x[128, 128] < 0.0, "Lower not lowering values."); |
52 | Assert.That(x[0, 128] < 0.0, "Lower brush affecting edge values."); | 52 | Assert.That(x[0, 128] < 0.0, "Lower brush affecting edge values."); |
53 | } | 53 | } |