diff options
author | Adam Frisby | 2007-08-16 23:29:28 +0000 |
---|---|---|
committer | Adam Frisby | 2007-08-16 23:29:28 +0000 |
commit | 4a9e40ea472f2e3ae45945392093ef54a8e026bd (patch) | |
tree | 9cdf086457ffe89c9710180c1b84265f57ae1ac8 | |
parent | * Now sending manager, host and root host to Script in constructor. (diff) | |
download | opensim-SC_OLD-4a9e40ea472f2e3ae45945392093ef54a8e026bd.zip opensim-SC_OLD-4a9e40ea472f2e3ae45945392093ef54a8e026bd.tar.gz opensim-SC_OLD-4a9e40ea472f2e3ae45945392093ef54a8e026bd.tar.bz2 opensim-SC_OLD-4a9e40ea472f2e3ae45945392093ef54a8e026bd.tar.xz |
* Added support for the IMG-format loader to terrain's load-tile function.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs index 4b9c5d6..4976e5d 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs | |||
@@ -400,6 +400,10 @@ namespace OpenSim.Region.Terrain | |||
400 | LoadFromFileF32(args[2], Convert.ToInt32(args[3]), Convert.ToInt32(args[4]), | 400 | LoadFromFileF32(args[2], Convert.ToInt32(args[3]), Convert.ToInt32(args[4]), |
401 | Convert.ToInt32(args[5]), Convert.ToInt32(args[6])); | 401 | Convert.ToInt32(args[5]), Convert.ToInt32(args[6])); |
402 | break; | 402 | break; |
403 | case "img": | ||
404 | LoadFromFileIMG(args[2], Convert.ToInt32(args[3]), Convert.ToInt32(args[4]), | ||
405 | Convert.ToInt32(args[5]), Convert.ToInt32(args[6])); | ||
406 | break; | ||
403 | default: | 407 | default: |
404 | resultText = "Unknown or unsupported image or data format"; | 408 | resultText = "Unknown or unsupported image or data format"; |
405 | return false; | 409 | return false; |
@@ -658,6 +662,43 @@ namespace OpenSim.Region.Terrain | |||
658 | } | 662 | } |
659 | 663 | ||
660 | /// <summary> | 664 | /// <summary> |
665 | /// Loads a larger tiled image across a terrain | ||
666 | /// </summary> | ||
667 | /// <param name="filename">Filename to load from (any generic image format should work)</param> | ||
668 | /// <param name="dimensionX">The dimensions of the image</param> | ||
669 | /// <param name="dimensionY">The dimensions of the image</param> | ||
670 | /// <param name="lowerboundX">Where sim coords begin for this patch</param> | ||
671 | /// <param name="lowerboundY">Where sim coords begin for this patch</param> | ||
672 | public void LoadFromFileIMG(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY) | ||
673 | { | ||
674 | int sectionToLoadX = ((this.offsetX - lowerboundX) * this.w); | ||
675 | int sectionToLoadY = ((this.offsetY - lowerboundY) * this.h); | ||
676 | |||
677 | double[,] tempMap = new double[dimensionX, dimensionY]; | ||
678 | |||
679 | System.Drawing.Bitmap lgrBmp = new Bitmap(filename); | ||
680 | |||
681 | int x, y; | ||
682 | for (x = 0; x < dimensionX; x++) | ||
683 | { | ||
684 | for (y = 0; y < dimensionY; y++) | ||
685 | { | ||
686 | tempMap[x, y] = (float)lgrBmp.GetPixel(x, y).GetBrightness(); | ||
687 | } | ||
688 | } | ||
689 | |||
690 | for (y = 0; y < h; y++) | ||
691 | { | ||
692 | for (x = 0; x < w; x++) | ||
693 | { | ||
694 | heightmap.Set(x, y, tempMap[x + sectionToLoadX, y + sectionToLoadY]); | ||
695 | } | ||
696 | } | ||
697 | |||
698 | tainted++; | ||
699 | } | ||
700 | |||
701 | /// <summary> | ||
661 | /// Loads a file formatted in the SL .RAW Format used on the main grid | 702 | /// Loads a file formatted in the SL .RAW Format used on the main grid |
662 | /// </summary> | 703 | /// </summary> |
663 | /// <remarks>This file format stinks and is best avoided.</remarks> | 704 | /// <remarks>This file format stinks and is best avoided.</remarks> |