diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Terrain')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | 31 |
1 files changed, 31 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); |