aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim.Terrain.BasicTerrain/TerrainEngine.cs57
1 files changed, 57 insertions, 0 deletions
diff --git a/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
index 65e267a..080671b 100644
--- a/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
+++ b/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
@@ -103,6 +103,63 @@ namespace OpenSim.Terrain
103 } 103 }
104 104
105 /// <summary> 105 /// <summary>
106 /// Loads a file consisting of 256x256 floats and imports it as an array into the map.
107 /// </summary>
108 /// <remarks>TODO: Move this to libTerrain itself</remarks>
109 /// <param name="filename">The filename of the float array to import</param>
110 public void loadFromFileF32(string filename)
111 {
112 System.IO.FileInfo file = new System.IO.FileInfo(filename);
113 System.IO.FileStream s = file.Open(System.IO.FileMode.Open, System.IO.FileAccess.Read);
114 System.IO.BinaryReader bs = new System.IO.BinaryReader(s);
115 int x, y;
116 for (x = 0; x < w; x++)
117 {
118 for (y = 0; y < h; y++)
119 {
120 heightmap.map[x, y] = (double)bs.ReadSingle();
121 }
122 }
123 }
124
125 public void writeToFileF64(string filename)
126 {
127 System.IO.FileInfo file = new System.IO.FileInfo(filename);
128 System.IO.FileStream s = file.Open(System.IO.FileMode.CreateNew, System.IO.FileAccess.Write);
129 System.IO.BinaryWriter bs = new System.IO.BinaryWriter(s);
130
131 int x, y;
132 for (x = 0; x < w; x++)
133 {
134 for (y = 0; y < h; y++)
135 {
136 bs.Write(heightmap.get(x,y));
137 }
138 }
139 }
140
141 public void writeToFileF32(string filename)
142 {
143 System.IO.FileInfo file = new System.IO.FileInfo(filename);
144 System.IO.FileStream s = file.Open(System.IO.FileMode.CreateNew, System.IO.FileAccess.Write);
145 System.IO.BinaryWriter bs = new System.IO.BinaryWriter(s);
146
147 int x, y;
148 for (x = 0; x < w; x++)
149 {
150 for (y = 0; y < h; y++)
151 {
152 bs.Write((float)heightmap.get(x, y));
153 }
154 }
155 }
156
157 public void setSeed(int val)
158 {
159 heightmap.seed = val;
160 }
161
162 /// <summary>
106 /// Raises land in a sphere around the specified coordinates 163 /// Raises land in a sphere around the specified coordinates
107 /// </summary> 164 /// </summary>
108 /// <param name="rx">Center of the sphere on the X axis</param> 165 /// <param name="rx">Center of the sphere on the X axis</param>