aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
diff options
context:
space:
mode:
authorlbsa712007-12-27 21:41:48 +0000
committerlbsa712007-12-27 21:41:48 +0000
commitefd90b56b761219af6425b1c7a2cdd3b6ffb4de2 (patch)
treebf5b897e1e3c13211e3e2fc61d30508b94c928c0 /OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
parent* removed always true if (diff)
downloadopensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.zip
opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.gz
opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.bz2
opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.xz
* Optimized usings
* shortened references * Removed redundant 'this' * Normalized EOF
Diffstat (limited to 'OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs')
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs35
1 files changed, 18 insertions, 17 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
index e89ff62..2405e86 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
@@ -159,12 +159,13 @@ namespace OpenSim.Region.Terrain
159 /// <param name="action">The action to be performed</param> 159 /// <param name="action">The action to be performed</param>
160 /// <param name="north">Distance from the north border where the cursor is located</param> 160 /// <param name="north">Distance from the north border where the cursor is located</param>
161 /// <param name="west">Distance from the west border where the cursor is located</param> 161 /// <param name="west">Distance from the west border where the cursor is located</param>
162 public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, float south, float east, 162 public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west,
163 float south, float east,
163 IClientAPI remoteUser) 164 IClientAPI remoteUser)
164 { 165 {
165 // Shiny. 166 // Shiny.
166 double size = (double) (1 << brushsize); 167 double size = (double) (1 << brushsize);
167 168
168 /* Okay, so here's the deal 169 /* Okay, so here's the deal
169 * This has to handle both when a user draws on the terrain *and* when a user selects 170 * This has to handle both when a user draws on the terrain *and* when a user selects
170 * a selection of AABB on terrain and applies whatever routine the client requests 171 * a selection of AABB on terrain and applies whatever routine the client requests
@@ -189,8 +190,8 @@ namespace OpenSim.Region.Terrain
189 * Again, libTerrain is yx instead of xy.. so, it's reflected in the function calls 190 * Again, libTerrain is yx instead of xy.. so, it's reflected in the function calls
190 * 191 *
191 */ 192 */
192 193
193 194
194 switch (action) 195 switch (action)
195 { 196 {
196 case 0: 197 case 0:
@@ -199,7 +200,7 @@ namespace OpenSim.Region.Terrain
199 { 200 {
200 for (float y = west; y <= east; y++) 201 for (float y = west; y <= east; y++)
201 { 202 {
202 FlattenTerrain(y, x, size, (double)seconds / 5.0); 203 FlattenTerrain(y, x, size, (double) seconds/5.0);
203 lastEdit = DateTime.Now; 204 lastEdit = DateTime.Now;
204 } 205 }
205 } 206 }
@@ -210,7 +211,7 @@ namespace OpenSim.Region.Terrain
210 { 211 {
211 for (float y = west; y <= east; y++) 212 for (float y = west; y <= east; y++)
212 { 213 {
213 RaiseTerrain(y, x, size, (double)seconds / 5.0); 214 RaiseTerrain(y, x, size, (double) seconds/5.0);
214 lastEdit = DateTime.Now; 215 lastEdit = DateTime.Now;
215 } 216 }
216 } 217 }
@@ -221,7 +222,7 @@ namespace OpenSim.Region.Terrain
221 { 222 {
222 for (float y = west; y <= east; y++) 223 for (float y = west; y <= east; y++)
223 { 224 {
224 LowerTerrain(y, x, size, (double)seconds / 5.0); 225 LowerTerrain(y, x, size, (double) seconds/5.0);
225 lastEdit = DateTime.Now; 226 lastEdit = DateTime.Now;
226 } 227 }
227 } 228 }
@@ -235,13 +236,13 @@ namespace OpenSim.Region.Terrain
235 // 236 //
236 //for (float x = south; x <= north; x++) 237 //for (float x = south; x <= north; x++)
237 //{ 238 //{
238 //for (float y = west; y <= east; y++) 239 //for (float y = west; y <= east; y++)
239 //{ 240 //{
240 //SmoothTerrain(y, x , size, (double)seconds / 5.0); 241 //SmoothTerrain(y, x , size, (double)seconds / 5.0);
241 //} 242 //}
242 //} 243 //}
243 244
244 SmoothTerrain(west, north, size, (double)seconds / 5.0); 245 SmoothTerrain(west, north, size, (double) seconds/5.0);
245 246
246 break; 247 break;
247 case 4: 248 case 4:
@@ -250,7 +251,7 @@ namespace OpenSim.Region.Terrain
250 { 251 {
251 for (float y = west; y <= east; y++) 252 for (float y = west; y <= east; y++)
252 { 253 {
253 NoiseTerrain(y, x, size, (double)seconds / 5.0); 254 NoiseTerrain(y, x, size, (double) seconds/5.0);
254 lastEdit = DateTime.Now; 255 lastEdit = DateTime.Now;
255 } 256 }
256 } 257 }
@@ -261,7 +262,7 @@ namespace OpenSim.Region.Terrain
261 { 262 {
262 for (float y = west; y <= east; y++) 263 for (float y = west; y <= east; y++)
263 { 264 {
264 RevertTerrain(y, x, size, (double)seconds / 5.0); 265 RevertTerrain(y, x, size, (double) seconds/5.0);
265 lastEdit = DateTime.Now; 266 lastEdit = DateTime.Now;
266 } 267 }
267 } 268 }
@@ -1351,16 +1352,16 @@ namespace OpenSim.Region.Terrain
1351 } 1352 }
1352 1353
1353 Channel copy = heightmap.Copy(); 1354 Channel copy = heightmap.Copy();
1354 for (int y = 0; y <copy.h; y++) 1355 for (int y = 0; y < copy.h; y++)
1355 { 1356 {
1356 for (int x = 0; x < copy.w; x++) 1357 for (int x = 0; x < copy.w; x++)
1357 { 1358 {
1358 // 512 is the largest possible height before colours clamp 1359 // 512 is the largest possible height before colours clamp
1359 int colorindex = (int) (Math.Max(Math.Min(1.0, copy.Get(x, y)/512.0), 0.0)*(pallete - 1)); 1360 int colorindex = (int) (Math.Max(Math.Min(1.0, copy.Get(x, y)/512.0), 0.0)*(pallete - 1));
1360 bmp.SetPixel(x, copy.h-y-1, colours[colorindex]); 1361 bmp.SetPixel(x, copy.h - y - 1, colours[colorindex]);
1361 } 1362 }
1362 } 1363 }
1363 return bmp; 1364 return bmp;
1364 } 1365 }
1365 } 1366 }
1366} 1367} \ No newline at end of file