diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Terrain/PaintBrushes')
5 files changed, 421 insertions, 4 deletions
diff --git a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/FlattenSphere.cs b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/FlattenSphere.cs new file mode 100644 index 0000000..d2cf1bc --- /dev/null +++ b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/FlattenSphere.cs | |||
@@ -0,0 +1,125 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using OpenSim.Region.Environment.Interfaces; | ||
29 | |||
30 | namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes | ||
31 | { | ||
32 | public class FlattenSphere : ITerrainPaintableEffect | ||
33 | { | ||
34 | private double SphericalFactor(double x, double y, double rx, double ry, double size) | ||
35 | { | ||
36 | double z = size * size - ((x - rx) * (x - rx) + (y - ry) * (y - ry)); | ||
37 | return z; | ||
38 | } | ||
39 | |||
40 | private double GetBilinearInterpolate(double x, double y, ITerrainChannel map) | ||
41 | { | ||
42 | int w = map.Width; | ||
43 | int h = map.Height; | ||
44 | |||
45 | if (x > w - 2.0) | ||
46 | x = w - 2.0; | ||
47 | if (y > h - 2.0) | ||
48 | y = h - 2.0; | ||
49 | if (x < 0.0) | ||
50 | x = 0.0; | ||
51 | if (y < 0.0) | ||
52 | y = 0.0; | ||
53 | |||
54 | int stepSize = 1; | ||
55 | double h00 = map[(int)x, (int)y]; | ||
56 | double h10 = map[(int)x + stepSize, (int)y]; | ||
57 | double h01 = map[(int)x, (int)y + stepSize]; | ||
58 | double h11 = map[(int)x + stepSize, (int)y + stepSize]; | ||
59 | double h1 = h00; | ||
60 | double h2 = h10; | ||
61 | double h3 = h01; | ||
62 | double h4 = h11; | ||
63 | double a00 = h1; | ||
64 | double a10 = h2 - h1; | ||
65 | double a01 = h3 - h1; | ||
66 | double a11 = h1 - h2 - h3 + h4; | ||
67 | double partialx = x - (int)x; | ||
68 | double partialz = y - (int)y; | ||
69 | double hi = a00 + (a10 * partialx) + (a01 * partialz) + (a11 * partialx * partialz); | ||
70 | return hi; | ||
71 | } | ||
72 | |||
73 | #region ITerrainPaintableEffect Members | ||
74 | |||
75 | public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength) | ||
76 | { | ||
77 | int x, y; | ||
78 | double[,] tweak = new double[map.Width, map.Height]; | ||
79 | |||
80 | double n, l; | ||
81 | double area = strength; | ||
82 | double step = strength / 4.0; | ||
83 | |||
84 | double sum = 0.0; | ||
85 | double step2 = 0.0; | ||
86 | double avg = 0.0; | ||
87 | |||
88 | // compute delta map | ||
89 | for (x = 0; x < map.Width; x++) | ||
90 | { | ||
91 | for (y = 0; y < map.Height; y++) | ||
92 | { | ||
93 | double z = SphericalFactor(x, y, rx, ry, strength); | ||
94 | |||
95 | if (z > 0) // add in non-zero amount | ||
96 | { | ||
97 | sum += map[x, y] * z; | ||
98 | step2 += z; | ||
99 | } | ||
100 | } | ||
101 | } | ||
102 | |||
103 | avg = sum / step2; | ||
104 | |||
105 | // blend in map | ||
106 | for (x = 0; x < map.Width; x++) | ||
107 | { | ||
108 | for (y = 0; y < map.Height; y++) | ||
109 | { | ||
110 | double z = SphericalFactor(x, y, rx, ry, strength); | ||
111 | |||
112 | if (z > 0) // add in non-zero amount | ||
113 | { | ||
114 | if (z > 1.0) | ||
115 | z = 1.0; | ||
116 | |||
117 | map[x, y] = (map[x, y] * (1.0 - z)) + (avg * z); | ||
118 | } | ||
119 | } | ||
120 | } | ||
121 | } | ||
122 | |||
123 | #endregion | ||
124 | } | ||
125 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/LowerSphere.cs b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/LowerSphere.cs new file mode 100644 index 0000000..4a05e76 --- /dev/null +++ b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/LowerSphere.cs | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using OpenSim.Region.Environment.Interfaces; | ||
30 | |||
31 | namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes | ||
32 | { | ||
33 | public class LowerSphere : ITerrainPaintableEffect | ||
34 | { | ||
35 | #region ITerrainPaintableEffect Members | ||
36 | |||
37 | public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength) | ||
38 | { | ||
39 | int x, y; | ||
40 | for (x = 0; x < map.Width; x++) | ||
41 | { | ||
42 | // Skip everything unlikely to be affected | ||
43 | if (Math.Abs(x - rx) > strength * 1.1) | ||
44 | continue; | ||
45 | |||
46 | for (y = 0; y < map.Height; y++) | ||
47 | { | ||
48 | // Skip everything unlikely to be affected | ||
49 | if (Math.Abs(y - ry) > strength * 1.1) | ||
50 | continue; | ||
51 | |||
52 | // Calculate a sphere and add it to the heighmap | ||
53 | double z = strength; | ||
54 | z *= z; | ||
55 | z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); | ||
56 | |||
57 | if (z > 0.0) | ||
58 | map[x, y] -= z; | ||
59 | } | ||
60 | } | ||
61 | } | ||
62 | |||
63 | #endregion | ||
64 | } | ||
65 | } | ||
diff --git a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/NoiseSphere.cs b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/NoiseSphere.cs new file mode 100644 index 0000000..226bd3e --- /dev/null +++ b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/NoiseSphere.cs | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using OpenSim.Framework; | ||
30 | using OpenSim.Region.Environment.Interfaces; | ||
31 | |||
32 | namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes | ||
33 | { | ||
34 | public class NoiseSphere : ITerrainPaintableEffect | ||
35 | { | ||
36 | #region ITerrainPaintableEffect Members | ||
37 | |||
38 | public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength) | ||
39 | { | ||
40 | int x, y; | ||
41 | for (x = 0; x < map.Width; x++) | ||
42 | { | ||
43 | // Skip everything unlikely to be affected | ||
44 | if (Math.Abs(x - rx) > strength * 1.1) | ||
45 | continue; | ||
46 | |||
47 | for (y = 0; y < map.Height; y++) | ||
48 | { | ||
49 | // Skip everything unlikely to be affected | ||
50 | if (Math.Abs(y - ry) > strength * 1.1) | ||
51 | continue; | ||
52 | |||
53 | // Calculate a sphere and add it to the heighmap | ||
54 | double z = strength; | ||
55 | z *= z; | ||
56 | z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); | ||
57 | |||
58 | double noise; | ||
59 | |||
60 | lock (Util.RandomClass) | ||
61 | { | ||
62 | noise = Util.RandomClass.NextDouble(); | ||
63 | } | ||
64 | |||
65 | if (z > 0.0) | ||
66 | map[x, y] += (noise - 0.5) * z; | ||
67 | } | ||
68 | } | ||
69 | } | ||
70 | |||
71 | #endregion | ||
72 | } | ||
73 | } | ||
diff --git a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs index ff7ec0b..fad5b11 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs | |||
@@ -1,7 +1,31 @@ | |||
1 | using System; | 1 | /* |
2 | using System.Collections.Generic; | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | using System.Text; | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | using OpenSim.Region.Environment.Modules.Terrain; | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
5 | using OpenSim.Region.Environment.Interfaces; | 29 | using OpenSim.Region.Environment.Interfaces; |
6 | 30 | ||
7 | namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes | 31 | namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes |
diff --git a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/SmoothSphere.cs b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/SmoothSphere.cs new file mode 100644 index 0000000..076b3cc --- /dev/null +++ b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/SmoothSphere.cs | |||
@@ -0,0 +1,130 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using OpenSim.Region.Environment.Interfaces; | ||
29 | |||
30 | namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes | ||
31 | { | ||
32 | public class SmoothSphere : ITerrainPaintableEffect | ||
33 | { | ||
34 | private double SphericalFactor(double x, double y, double rx, double ry, double size) | ||
35 | { | ||
36 | double z = size * size - ((x - rx) * (x - rx) + (y - ry) * (y - ry)); | ||
37 | return z; | ||
38 | } | ||
39 | |||
40 | private double GetBilinearInterpolate(double x, double y, ITerrainChannel map) | ||
41 | { | ||
42 | int w = map.Width; | ||
43 | int h = map.Height; | ||
44 | |||
45 | if (x > w - 2.0) | ||
46 | x = w - 2.0; | ||
47 | if (y > h - 2.0) | ||
48 | y = h - 2.0; | ||
49 | if (x < 0.0) | ||
50 | x = 0.0; | ||
51 | if (y < 0.0) | ||
52 | y = 0.0; | ||
53 | |||
54 | int stepSize = 1; | ||
55 | double h00 = map[(int)x, (int)y]; | ||
56 | double h10 = map[(int)x + stepSize, (int)y]; | ||
57 | double h01 = map[(int)x, (int)y + stepSize]; | ||
58 | double h11 = map[(int)x + stepSize, (int)y + stepSize]; | ||
59 | double h1 = h00; | ||
60 | double h2 = h10; | ||
61 | double h3 = h01; | ||
62 | double h4 = h11; | ||
63 | double a00 = h1; | ||
64 | double a10 = h2 - h1; | ||
65 | double a01 = h3 - h1; | ||
66 | double a11 = h1 - h2 - h3 + h4; | ||
67 | double partialx = x - (int)x; | ||
68 | double partialz = y - (int)y; | ||
69 | double hi = a00 + (a10 * partialx) + (a01 * partialz) + (a11 * partialx * partialz); | ||
70 | return hi; | ||
71 | } | ||
72 | |||
73 | #region ITerrainPaintableEffect Members | ||
74 | |||
75 | public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength) | ||
76 | { | ||
77 | int x, y; | ||
78 | double[,] tweak = new double[map.Width, map.Height]; | ||
79 | |||
80 | double n, l; | ||
81 | double area = strength; | ||
82 | double step = strength / 4.0; | ||
83 | |||
84 | // compute delta map | ||
85 | for (x = 0; x < map.Width; x++) | ||
86 | { | ||
87 | for (y = 0; y < map.Height; y++) | ||
88 | { | ||
89 | double z = SphericalFactor(x, y, rx, ry, strength); | ||
90 | |||
91 | if (z > 0) // add in non-zero amount | ||
92 | { | ||
93 | double average = 0.0; | ||
94 | int avgsteps = 0; | ||
95 | |||
96 | for (n = 0.0 - area; n < area; n += step) | ||
97 | { | ||
98 | for (l = 0.0 - area; l < area; l += step) | ||
99 | { | ||
100 | avgsteps++; | ||
101 | average += GetBilinearInterpolate(x + n, y + l, map); | ||
102 | } | ||
103 | } | ||
104 | tweak[x, y] = average / avgsteps; | ||
105 | } | ||
106 | } | ||
107 | } | ||
108 | // blend in map | ||
109 | for (x = 0; x < map.Width; x++) | ||
110 | { | ||
111 | for (y = 0; y < map.Height; y++) | ||
112 | { | ||
113 | double z = SphericalFactor(x, y, rx, ry, strength); | ||
114 | |||
115 | if (z > 0) // add in non-zero amount | ||
116 | { | ||
117 | double da = z; | ||
118 | double a = (map[x, y] - tweak[x, y]) * da; | ||
119 | double newz = map[x, y] - a; | ||
120 | |||
121 | if (newz > 0.0) | ||
122 | map[x, y] = newz; | ||
123 | } | ||
124 | } | ||
125 | } | ||
126 | } | ||
127 | |||
128 | #endregion | ||
129 | } | ||
130 | } \ No newline at end of file | ||