aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs')
-rw-r--r--OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs24
1 files changed, 23 insertions, 1 deletions
diff --git a/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
index 047187a..a018ce8 100644
--- a/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
+++ b/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
@@ -175,7 +175,7 @@ namespace OpenSim.Terrain
175 break; 175 break;
176 176
177 case "img": 177 case "img":
178 resultText = "Error - IMG mode is presently unsupported."; 178 loadFromFileIMG(args[2]);
179 return false; 179 return false;
180 180
181 default: 181 default:
@@ -230,6 +230,28 @@ namespace OpenSim.Terrain
230 } 230 }
231 231
232 /// <summary> 232 /// <summary>
233 /// Loads a file from an image compatible with System.Drawing
234 /// </summary>
235 /// <param name="filename">File to load</param>
236 public void loadFromFileIMG(string filename)
237 {
238 System.Drawing.Bitmap bmp = new Bitmap(filename);
239
240 if (bmp.Width != heightmap.w && bmp.Height != heightmap.h)
241 throw new Exception("Wrong image size! Images for this region must be " + heightmap.w.ToString() + " by " + heightmap.h.ToString() + " pixels in dimension");
242
243 int x, y;
244
245 for (x = 0; x < w; x++)
246 {
247 for (y = 0; y < h; y++)
248 {
249 Color c = bmp.GetPixel(x, y);
250 }
251 }
252 }
253
254 /// <summary>
233 /// Loads a file consisting of 256x256 doubles and imports it as an array into the map. 255 /// Loads a file consisting of 256x256 doubles and imports it as an array into the map.
234 /// </summary> 256 /// </summary>
235 /// <remarks>TODO: Move this to libTerrain itself</remarks> 257 /// <remarks>TODO: Move this to libTerrain itself</remarks>