diff options
author | Dr Scofield | 2008-09-15 13:44:58 +0000 |
---|---|---|
committer | Dr Scofield | 2008-09-15 13:44:58 +0000 |
commit | 0e2edbb5d4ce62697b4a9625cdaba63d97fac059 (patch) | |
tree | dcc516c465a90b99b220138d1467e55a218f1a4c /OpenSim/Region/Environment/Modules | |
parent | * Remove a hack I put into OGP so that I could test OGP over SSL with the See... (diff) | |
download | opensim-SC-0e2edbb5d4ce62697b4a9625cdaba63d97fac059.zip opensim-SC-0e2edbb5d4ce62697b4a9625cdaba63d97fac059.tar.gz opensim-SC-0e2edbb5d4ce62697b4a9625cdaba63d97fac059.tar.bz2 opensim-SC-0e2edbb5d4ce62697b4a9625cdaba63d97fac059.tar.xz |
From: mike pitman <pitman@us.ibm.com>
fixes the terrain spikes, and is the result of mostly a tuning
operation on the smooth and flatten tools. I dug in and found that the
spikes apparently result from smooth's overly aggressive iteration
steps toward the average curvature, which leads to an instability that
blows up the heights. I introduced a scaling factor to dampen the
'duration' parameter which tames progress and seems to keep things
stable.
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
3 files changed, 6 insertions, 3 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..e1d651b 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs | |||
@@ -42,6 +42,7 @@ 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 | double durationFactor = 0.15; //MCP: tuned, but would be nice to come from ini file | ||
45 | 46 | ||
46 | // compute delta map | 47 | // compute delta map |
47 | for (x = 0; x < map.Width; x++) | 48 | for (x = 0; x < map.Width; x++) |
@@ -65,7 +66,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | |||
65 | { | 66 | { |
66 | for (y = 0; y < map.Height; y++) | 67 | for (y = 0; y < map.Height; y++) |
67 | { | 68 | { |
68 | double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * duration; | 69 | double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * duration * durationFactor; |
69 | 70 | ||
70 | if (z > 0) // add in non-zero amount | 71 | if (z > 0) // add in non-zero amount |
71 | { | 72 | { |
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs index fc0a579..fa0389d 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs | |||
@@ -42,6 +42,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | |||
42 | 42 | ||
43 | double area = strength; | 43 | double area = strength; |
44 | double step = strength / 4.0; | 44 | double step = strength / 4.0; |
45 | double durationFactor = 0.15; //MCP: tuned, but would be nice to come from ini file | ||
45 | 46 | ||
46 | // compute delta map | 47 | // compute delta map |
47 | for (x = 0; x < map.Width; x++) | 48 | for (x = 0; x < map.Width; x++) |
@@ -80,7 +81,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes | |||
80 | { | 81 | { |
81 | double da = z; | 82 | double da = z; |
82 | double a = (map[x, y] - tweak[x, y]) * da; | 83 | double a = (map[x, y] - tweak[x, y]) * da; |
83 | double newz = map[x, y] - (a * duration); | 84 | double newz = map[x, y] - (a * duration * durationFactor); |
84 | 85 | ||
85 | if (newz > 0.0) | 86 | if (newz > 0.0) |
86 | map[x, y] = newz; | 87 | map[x, y] = newz; |
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainUtil.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainUtil.cs index def28eb..797c6a0 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.0; // 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) |