aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
diff options
context:
space:
mode:
authorAdam Frisby2007-04-06 18:48:23 +0000
committerAdam Frisby2007-04-06 18:48:23 +0000
commitfb0dffbf13a79aabe9537f16b7bb151af62c75bf (patch)
tree28a8d468e5499a7af1e33eec7bbdeb9e82ae8732 /OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
parentAnd now for some solution files... (diff)
downloadopensim-SC_OLD-fb0dffbf13a79aabe9537f16b7bb151af62c75bf.zip
opensim-SC_OLD-fb0dffbf13a79aabe9537f16b7bb151af62c75bf.tar.gz
opensim-SC_OLD-fb0dffbf13a79aabe9537f16b7bb151af62c75bf.tar.bz2
opensim-SC_OLD-fb0dffbf13a79aabe9537f16b7bb151af62c75bf.tar.xz
**BREAKING CHANGE** Changing the way terrain is stored and used internally.
Diffstat (limited to 'OpenSim.Terrain.BasicTerrain/TerrainEngine.cs')
-rw-r--r--OpenSim.Terrain.BasicTerrain/TerrainEngine.cs64
1 files changed, 64 insertions, 0 deletions
diff --git a/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
new file mode 100644
index 0000000..f805d18
--- /dev/null
+++ b/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
@@ -0,0 +1,64 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Terrain.BasicTerrain;
5
6namespace OpenSim.Terrain
7{
8 public class TerrainEngine
9 {
10 public float[,] map;
11 public float[,] water;
12 int w, h;
13
14 public TerrainEngine()
15 {
16 w = 256;
17 h = 256;
18 map = new float[w, h];
19 water = new float[w, h];
20
21 }
22
23 /// <summary>
24 /// Swaps the references between the height and water buffers to allow you to edit the water heightmap. Remember to swap back when you are done.
25 /// </summary>
26 public void swapWaterBuffer()
27 {
28 float[,] temp = map;
29 map = water;
30 water = temp;
31 }
32
33 /// <summary>
34 /// Raises land in a sphere around the specified coordinates
35 /// </summary>
36 /// <param name="rx">Center of the sphere on the X axis</param>
37 /// <param name="ry">Center of the sphere on the Y axis</param>
38 /// <param name="size">The radius of the sphere</param>
39 /// <param name="amount">Scale the height of the sphere by this amount (recommended 0..2)</param>
40 public void raise(double rx, double ry, double size, double amount)
41 {
42 lock (map)
43 {
44 RaiseLower.raiseSphere(this.map, rx, ry, size, amount);
45 }
46 }
47 public void lower(double rx, double ry, double size, double amount)
48 {
49 lock (map)
50 {
51 RaiseLower.lowerSphere(this.map, rx, ry, size, amount);
52 }
53 }
54
55 public void hills()
56 {
57 lock (map)
58 {
59 Hills.hillsSpheres(this.map, 1337, 200, 20, 40, true, true, false);
60 }
61 }
62
63 }
64}