aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs')
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs276
1 files changed, 138 insertions, 138 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs
index 1d04a4f..64d175c 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs
@@ -1,139 +1,139 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28 28
29 29
30using System; 30using System;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Text; 32using System.Text;
33 33
34namespace libTerrain 34namespace libTerrain
35{ 35{
36 partial class Channel 36 partial class Channel
37 { 37 {
38 /// <summary> 38 /// <summary>
39 /// Raises land around the selection 39 /// Raises land around the selection
40 /// </summary> 40 /// </summary>
41 /// <param name="rx">The center the X coordinate of where you wish to raise the land</param> 41 /// <param name="rx">The center the X coordinate of where you wish to raise the land</param>
42 /// <param name="ry">The center the Y coordinate of where you wish to raise the land</param> 42 /// <param name="ry">The center the Y coordinate of where you wish to raise the land</param>
43 /// <param name="size">The radius of the dimple</param> 43 /// <param name="size">The radius of the dimple</param>
44 /// <param name="amount">How much impact to add to the terrain (0..2 usually)</param> 44 /// <param name="amount">How much impact to add to the terrain (0..2 usually)</param>
45 public void Raise(double rx, double ry, double size, double amount) 45 public void Raise(double rx, double ry, double size, double amount)
46 { 46 {
47 RaiseSphere(rx, ry, size, amount); 47 RaiseSphere(rx, ry, size, amount);
48 } 48 }
49 49
50 /// <summary> 50 /// <summary>
51 /// Raises land in a sphere around the selection 51 /// Raises land in a sphere around the selection
52 /// </summary> 52 /// </summary>
53 /// <param name="rx">The center the X coordinate of where you wish to raise the land</param> 53 /// <param name="rx">The center the X coordinate of where you wish to raise the land</param>
54 /// <param name="ry">The center the Y coordinate of where you wish to raise the land</param> 54 /// <param name="ry">The center the Y coordinate of where you wish to raise the land</param>
55 /// <param name="size">The radius of the sphere dimple</param> 55 /// <param name="size">The radius of the sphere dimple</param>
56 /// <param name="amount">How much impact to add to the terrain (0..2 usually)</param> 56 /// <param name="amount">How much impact to add to the terrain (0..2 usually)</param>
57 public void RaiseSphere(double rx, double ry, double size, double amount) 57 public void RaiseSphere(double rx, double ry, double size, double amount)
58 { 58 {
59 int x, y; 59 int x, y;
60 for (x = 0; x < w; x++) 60 for (x = 0; x < w; x++)
61 { 61 {
62 for (y = 0; y < h; y++) 62 for (y = 0; y < h; y++)
63 { 63 {
64 double z = size; 64 double z = size;
65 z *= z; 65 z *= z;
66 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); 66 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry));
67 67
68 if (z < 0) 68 if (z < 0)
69 z = 0; 69 z = 0;
70 70
71 Set(x, y, map[x, y] + (z * amount)); 71 Set(x, y, map[x, y] + (z * amount));
72 } 72 }
73 } 73 }
74 } 74 }
75 75
76 /// <summary> 76 /// <summary>
77 /// Raises land in a cone around the selection 77 /// Raises land in a cone around the selection
78 /// </summary> 78 /// </summary>
79 /// <param name="rx">The center the X coordinate of where you wish to raise the land</param> 79 /// <param name="rx">The center the X coordinate of where you wish to raise the land</param>
80 /// <param name="ry">The center the Y coordinate of where you wish to raise the land</param> 80 /// <param name="ry">The center the Y coordinate of where you wish to raise the land</param>
81 /// <param name="size">The radius of the cone</param> 81 /// <param name="size">The radius of the cone</param>
82 /// <param name="amount">How much impact to add to the terrain (0..2 usually)</param> 82 /// <param name="amount">How much impact to add to the terrain (0..2 usually)</param>
83 public void RaiseCone(double rx, double ry, double size, double amount) 83 public void RaiseCone(double rx, double ry, double size, double amount)
84 { 84 {
85 int x, y; 85 int x, y;
86 for (x = 0; x < w; x++) 86 for (x = 0; x < w; x++)
87 { 87 {
88 for (y = 0; y < h; y++) 88 for (y = 0; y < h; y++)
89 { 89 {
90 double z = size; 90 double z = size;
91 z -= Math.Sqrt(((x - rx) * (x - rx)) + ((y - ry) * (y - ry))); 91 z -= Math.Sqrt(((x - rx) * (x - rx)) + ((y - ry) * (y - ry)));
92 92
93 if (z < 0) 93 if (z < 0)
94 z = 0; 94 z = 0;
95 95
96 Set(x, y, map[x, y] + (z * amount)); 96 Set(x, y, map[x, y] + (z * amount));
97 } 97 }
98 } 98 }
99 } 99 }
100 100
101 /// <summary> 101 /// <summary>
102 /// Lowers land in a sphere around the selection 102 /// Lowers land in a sphere around the selection
103 /// </summary> 103 /// </summary>
104 /// <param name="rx">The center the X coordinate of where you wish to lower the land</param> 104 /// <param name="rx">The center the X coordinate of where you wish to lower the land</param>
105 /// <param name="ry">The center the Y coordinate of where you wish to lower the land</param> 105 /// <param name="ry">The center the Y coordinate of where you wish to lower the land</param>
106 /// <param name="size">The radius of the sphere dimple</param> 106 /// <param name="size">The radius of the sphere dimple</param>
107 /// <param name="amount">How much impact to remove from the terrain (0..2 usually)</param> 107 /// <param name="amount">How much impact to remove from the terrain (0..2 usually)</param>
108 public void Lower(double rx, double ry, double size, double amount) 108 public void Lower(double rx, double ry, double size, double amount)
109 { 109 {
110 LowerSphere(rx, ry, size, amount); 110 LowerSphere(rx, ry, size, amount);
111 } 111 }
112 112
113 /// <summary> 113 /// <summary>
114 /// Lowers land in a sphere around the selection 114 /// Lowers land in a sphere around the selection
115 /// </summary> 115 /// </summary>
116 /// <param name="rx">The center the X coordinate of where you wish to lower the land</param> 116 /// <param name="rx">The center the X coordinate of where you wish to lower the land</param>
117 /// <param name="ry">The center the Y coordinate of where you wish to lower the land</param> 117 /// <param name="ry">The center the Y coordinate of where you wish to lower the land</param>
118 /// <param name="size">The radius of the sphere dimple</param> 118 /// <param name="size">The radius of the sphere dimple</param>
119 /// <param name="amount">How much impact to remove from the terrain (0..2 usually)</param> 119 /// <param name="amount">How much impact to remove from the terrain (0..2 usually)</param>
120 public void LowerSphere(double rx, double ry, double size, double amount) 120 public void LowerSphere(double rx, double ry, double size, double amount)
121 { 121 {
122 int x, y; 122 int x, y;
123 for (x = 0; x < w; x++) 123 for (x = 0; x < w; x++)
124 { 124 {
125 for (y = 0; y < h; y++) 125 for (y = 0; y < h; y++)
126 { 126 {
127 double z = size; 127 double z = size;
128 z *= z; 128 z *= z;
129 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); 129 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry));
130 130
131 if (z < 0) 131 if (z < 0)
132 z = 0; 132 z = 0;
133 133
134 Set(x, y, map[x, y] - (z * amount)); 134 Set(x, y, map[x, y] - (z * amount));
135 } 135 }
136 } 136 }
137 } 137 }
138 } 138 }
139} \ No newline at end of file 139} \ No newline at end of file