diff options
Diffstat (limited to 'OpenSim/Region/Terrain.BasicTerrain')
3 files changed, 72 insertions, 74 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs index 308f35b..4ab535b 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs | |||
@@ -310,37 +310,33 @@ namespace OpenSim.Region.Terrain | |||
310 | } | 310 | } |
311 | } | 311 | } |
312 | 312 | ||
313 | |||
314 | lastEdit = DateTime.Now; | 313 | lastEdit = DateTime.Now; |
315 | 314 | ||
316 | return; | 315 | return; |
317 | } | 316 | } |
318 | 317 | ||
319 | 318 | // TODO: unused | |
320 | 319 | // /// <summary> | |
321 | 320 | // /// Checks to make sure the terrain is within baked values +/- maxRaise/minLower | |
322 | /// <summary> | 321 | // /// </summary> |
323 | /// Checks to make sure the terrain is within baked values +/- maxRaise/minLower | 322 | // private void SetTerrainWithinBounds() |
324 | /// </summary> | 323 | // { |
325 | private void SetTerrainWithinBounds() | 324 | // int x, y; |
326 | { | 325 | // for (x = 0; x < w; x++) |
327 | int x, y; | 326 | // { |
328 | for (x = 0; x < w; x++) | 327 | // for (y = 0; y < h; y++) |
329 | { | 328 | // { |
330 | for (y = 0; y < h; y++) | 329 | // if ((heightmap.Get(x, y) > revertmap.Get(x, y) + maxRaise)) |
331 | { | 330 | // { |
332 | if ((heightmap.Get(x, y) > revertmap.Get(x, y) + maxRaise)) | 331 | // heightmap.map[x, y] = revertmap.Get(x, y) + maxRaise; |
333 | { | 332 | // } |
334 | heightmap.map[x, y] = revertmap.Get(x, y) + maxRaise; | 333 | // if ((heightmap.Get(x, y) > revertmap.Get(x, y) - minLower)) |
335 | } | 334 | // { |
336 | if ((heightmap.Get(x, y) > revertmap.Get(x, y) - minLower)) | 335 | // heightmap.map[x, y] = revertmap.Get(x, y) - minLower; |
337 | { | 336 | // } |
338 | heightmap.map[x, y] = revertmap.Get(x, y) - minLower; | 337 | // } |
339 | } | 338 | // } |
340 | } | 339 | // } |
341 | } | ||
342 | } | ||
343 | |||
344 | 340 | ||
345 | /// <summary> | 341 | /// <summary> |
346 | /// Converts the heightmap to a 65536 value 1D floating point array | 342 | /// Converts the heightmap to a 65536 value 1D floating point array |
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 | { |