aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs31
-rw-r--r--OpenSim/Region/Framework/Interfaces/ITerrainModule.cs2
2 files changed, 33 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index 5e35d95..275aa2a 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -456,6 +456,37 @@ namespace OpenSim.Region.CoreModules.World.Terrain
456 throw new TerrainException(String.Format("unable to load heightmap from file {0}: no loader available for that format", filename)); 456 throw new TerrainException(String.Format("unable to load heightmap from file {0}: no loader available for that format", filename));
457 } 457 }
458 458
459 public void LoadFromStream(string filename, Vector3 displacement,
460 float rotationDegrees, Vector2 boundingOrigin, Vector2 boundingSize, Stream stream)
461 {
462 foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders)
463 {
464 if (filename.EndsWith(loader.Key))
465 {
466 lock (m_scene)
467 {
468 try
469 {
470 ITerrainChannel channel = loader.Value.LoadStream(stream);
471 m_channel.MergeWithBounding(channel, displacement, rotationDegrees, boundingOrigin, boundingSize);
472 UpdateBakedMap();
473 }
474 catch (NotImplementedException)
475 {
476 m_log.Error("[TERRAIN]: Unable to load heightmap, the " + loader.Value +
477 " parser does not support file loading. (May be save only)");
478 throw new TerrainException(String.Format("unable to load heightmap: parser {0} does not support loading", loader.Value));
479 }
480 }
481
482 m_log.Info("[TERRAIN]: File (" + filename + ") loaded successfully");
483 return;
484 }
485 }
486 m_log.Error("[TERRAIN]: Unable to load heightmap, no file loader available for that format.");
487 throw new TerrainException(String.Format("unable to load heightmap from file {0}: no loader available for that format", filename));
488 }
489
459 private static Stream URIFetch(Uri uri) 490 private static Stream URIFetch(Uri uri)
460 { 491 {
461 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); 492 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
diff --git a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
index b8c313a..2d33f51 100644
--- a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
@@ -60,6 +60,8 @@ namespace OpenSim.Region.Framework.Interfaces
60 void LoadFromStream(string filename, System.Uri pathToTerrainHeightmap); 60 void LoadFromStream(string filename, System.Uri pathToTerrainHeightmap);
61 void LoadFromStream(string filename, Vector3 displacement, 61 void LoadFromStream(string filename, Vector3 displacement,
62 float radianRotation, Vector2 rotationDisplacement, Stream stream); 62 float radianRotation, Vector2 rotationDisplacement, Stream stream);
63 void LoadFromStream(string filename, Vector3 displacement,
64 float rotationDegress, Vector2 boundingOrigin, Vector2 boundingSize, Stream stream);
63 /// <summary> 65 /// <summary>
64 /// Save a terrain to a stream. 66 /// Save a terrain to a stream.
65 /// </summary> 67 /// </summary>