diff options
author | Diva Canto | 2011-03-28 16:48:12 -0700 |
---|---|---|
committer | Diva Canto | 2011-03-28 16:48:12 -0700 |
commit | d3771e536645f50401e9737a693fcbb1fb3b6a01 (patch) | |
tree | 0ebcfa607a35e0fdb308ec8e27a6c7dbfd2a10f2 /OpenSim/Region/CoreModules/World/Terrain/FileLoaders | |
parent | Fix mantis #5413. WARNING: new config variable in section [GridService] of th... (diff) | |
download | opensim-SC_OLD-d3771e536645f50401e9737a693fcbb1fb3b6a01.zip opensim-SC_OLD-d3771e536645f50401e9737a693fcbb1fb3b6a01.tar.gz opensim-SC_OLD-d3771e536645f50401e9737a693fcbb1fb3b6a01.tar.bz2 opensim-SC_OLD-d3771e536645f50401e9737a693fcbb1fb3b6a01.tar.xz |
Added code to load a terrain tile of tiff/jpg format. Previously it only worked for one single region.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Terrain/FileLoaders')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs index 6676ec8..d6fa093 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs | |||
@@ -62,9 +62,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
62 | return LoadBitmap(new Bitmap(filename)); | 62 | return LoadBitmap(new Bitmap(filename)); |
63 | } | 63 | } |
64 | 64 | ||
65 | public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h) | 65 | public virtual ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int w, int h) |
66 | { | 66 | { |
67 | throw new NotImplementedException(); | 67 | Bitmap bitmap = new Bitmap(filename); |
68 | ITerrainChannel retval = new TerrainChannel(true); | ||
69 | |||
70 | for (int x = 0; x < retval.Width; x++) | ||
71 | { | ||
72 | for (int y = 0; y < retval.Height; y++) | ||
73 | { | ||
74 | retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | return retval; | ||
68 | } | 79 | } |
69 | 80 | ||
70 | public virtual ITerrainChannel LoadStream(Stream stream) | 81 | public virtual ITerrainChannel LoadStream(Stream stream) |