diff options
Diffstat (limited to 'OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel')
-rw-r--r-- | OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs | 85 | ||||
-rw-r--r-- | OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs | 13 |
2 files changed, 50 insertions, 48 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs index aa102b8..ba076c2 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs | |||
@@ -70,48 +70,49 @@ namespace libTerrain | |||
70 | Blend(flat, temp); | 70 | Blend(flat, temp); |
71 | } | 71 | } |
72 | 72 | ||
73 | private void FlattenFast(double rx, double ry, double size, double amount) | 73 | // TODO: unused |
74 | { | 74 | // private void FlattenFast(double rx, double ry, double size, double amount) |
75 | int x, y; | 75 | // { |
76 | double avg = 0; | 76 | // int x, y; |
77 | double div = 0; | 77 | // double avg = 0; |
78 | 78 | // double div = 0; | |
79 | int minX = Math.Max(0, (int) (rx - (size + 1))); | 79 | |
80 | int maxX = Math.Min(w, (int) (rx + (size + 1))); | 80 | // int minX = Math.Max(0, (int) (rx - (size + 1))); |
81 | int minY = Math.Max(0, (int) (ry - (size + 1))); | 81 | // int maxX = Math.Min(w, (int) (rx + (size + 1))); |
82 | int maxY = Math.Min(h, (int) (ry + (size + 1))); | 82 | // int minY = Math.Max(0, (int) (ry - (size + 1))); |
83 | 83 | // int maxY = Math.Min(h, (int) (ry + (size + 1))); | |
84 | for (x = minX; x < maxX; x++) | 84 | |
85 | { | 85 | // for (x = minX; x < maxX; x++) |
86 | for (y = minY; y < maxY; y++) | 86 | // { |
87 | { | 87 | // for (y = minY; y < maxY; y++) |
88 | double z = size; | 88 | // { |
89 | z *= z; | 89 | // double z = size; |
90 | z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry)); | 90 | // z *= z; |
91 | 91 | // z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry)); | |
92 | if (z < 0) | 92 | |
93 | z = 0; | 93 | // if (z < 0) |
94 | 94 | // z = 0; | |
95 | avg += z*amount; | 95 | |
96 | div += z; | 96 | // avg += z*amount; |
97 | } | 97 | // div += z; |
98 | } | 98 | // } |
99 | 99 | // } | |
100 | double height = avg/div; | 100 | |
101 | 101 | // double height = avg/div; | |
102 | for (x = minX; x < maxX; x++) | 102 | |
103 | { | 103 | // for (x = minX; x < maxX; x++) |
104 | for (y = minY; y < maxY; y++) | 104 | // { |
105 | { | 105 | // for (y = minY; y < maxY; y++) |
106 | double z = size; | 106 | // { |
107 | z *= z; | 107 | // double z = size; |
108 | z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry)); | 108 | // z *= z; |
109 | 109 | // z -= ((x - rx)*(x - rx)) + ((y - ry)*(y - ry)); | |
110 | if (z > 0.0) | 110 | |
111 | Set(x, y, Tools.LinearInterpolate(map[x, y], height, z)); | 111 | // if (z > 0.0) |
112 | } | 112 | // Set(x, y, Tools.LinearInterpolate(map[x, y], height, z)); |
113 | } | 113 | // } |
114 | } | 114 | // } |
115 | // } | ||
115 | 116 | ||
116 | public void Flatten(Channel mask, double amount) | 117 | public void Flatten(Channel mask, double amount) |
117 | { | 118 | { |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs index 7840f8b..8f12637 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs | |||
@@ -40,12 +40,13 @@ namespace libTerrain | |||
40 | return ((i) + (N + 2)*(j)); | 40 | return ((i) + (N + 2)*(j)); |
41 | } | 41 | } |
42 | 42 | ||
43 | private static void nsSwap(ref double x0, ref double x) | 43 | // TODO: unused |
44 | { | 44 | // private static void nsSwap(ref double x0, ref double x) |
45 | double tmp = x0; | 45 | // { |
46 | x0 = x; | 46 | // double tmp = x0; |
47 | x = tmp; | 47 | // x0 = x; |
48 | } | 48 | // x = tmp; |
49 | // } | ||
49 | 50 | ||
50 | private static void nsSwap(ref double[] x0, ref double[] x) | 51 | private static void nsSwap(ref double[] x0, ref double[] x) |
51 | { | 52 | { |