diff options
author | Jeff Ames | 2008-02-27 15:57:00 +0000 |
---|---|---|
committer | Jeff Ames | 2008-02-27 15:57:00 +0000 |
commit | f218e7e090156622a0acf2603dd644e239240571 (patch) | |
tree | 601e10b16932e718623c24d118642e671525b303 /OpenSim/Region/Environment | |
parent | Hopefully fixed the bug that was causing a lot of the freezing. Which was hap... (diff) | |
download | opensim-SC-f218e7e090156622a0acf2603dd644e239240571.zip opensim-SC-f218e7e090156622a0acf2603dd644e239240571.tar.gz opensim-SC-f218e7e090156622a0acf2603dd644e239240571.tar.bz2 opensim-SC-f218e7e090156622a0acf2603dd644e239240571.tar.xz |
Update svn properties.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs | 86 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/Terrain/FileLoaders/Terragen.cs | 178 |
2 files changed, 132 insertions, 132 deletions
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs index d0f5d07..bf716c5 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs | |||
@@ -1,43 +1,43 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using System.IO; | 4 | using System.IO; |
5 | using OpenSim.Region.Environment.Modules.Terrain; | 5 | using OpenSim.Region.Environment.Modules.Terrain; |
6 | using OpenSim.Region.Environment.Interfaces; | 6 | using OpenSim.Region.Environment.Interfaces; |
7 | 7 | ||
8 | namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | 8 | namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders |
9 | { | 9 | { |
10 | public class RAW32 : ITerrainLoader | 10 | public class RAW32 : ITerrainLoader |
11 | { | 11 | { |
12 | #region ITerrainLoader Members | 12 | #region ITerrainLoader Members |
13 | 13 | ||
14 | public ITerrainChannel LoadFile(string filename) | 14 | public ITerrainChannel LoadFile(string filename) |
15 | { | 15 | { |
16 | TerrainChannel retval = new TerrainChannel(); | 16 | TerrainChannel retval = new TerrainChannel(); |
17 | 17 | ||
18 | FileInfo file = new FileInfo(filename); | 18 | FileInfo file = new FileInfo(filename); |
19 | FileStream s = file.Open(FileMode.Open, FileAccess.Read); | 19 | FileStream s = file.Open(FileMode.Open, FileAccess.Read); |
20 | BinaryReader bs = new BinaryReader(s); | 20 | BinaryReader bs = new BinaryReader(s); |
21 | int x, y; | 21 | int x, y; |
22 | for (y = 0; y < retval.Height; y++) | 22 | for (y = 0; y < retval.Height; y++) |
23 | { | 23 | { |
24 | for (x = 0; x < retval.Width; x++) | 24 | for (x = 0; x < retval.Width; x++) |
25 | { | 25 | { |
26 | retval[x, y] = bs.ReadSingle(); | 26 | retval[x, y] = bs.ReadSingle(); |
27 | } | 27 | } |
28 | } | 28 | } |
29 | 29 | ||
30 | bs.Close(); | 30 | bs.Close(); |
31 | s.Close(); | 31 | s.Close(); |
32 | 32 | ||
33 | return retval; | 33 | return retval; |
34 | } | 34 | } |
35 | 35 | ||
36 | public void SaveFile(string filename) | 36 | public void SaveFile(string filename) |
37 | { | 37 | { |
38 | throw new NotImplementedException(); | 38 | throw new NotImplementedException(); |
39 | } | 39 | } |
40 | 40 | ||
41 | #endregion | 41 | #endregion |
42 | } | 42 | } |
43 | } | 43 | } |
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/Terragen.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/Terragen.cs index 2443173..b12d99f 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/Terragen.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/Terragen.cs | |||
@@ -1,89 +1,89 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using System.IO; | 4 | using System.IO; |
5 | using OpenSim.Region.Environment.Modules.Terrain; | 5 | using OpenSim.Region.Environment.Modules.Terrain; |
6 | using OpenSim.Region.Environment.Interfaces; | 6 | using OpenSim.Region.Environment.Interfaces; |
7 | 7 | ||
8 | namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | 8 | namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders |
9 | { | 9 | { |
10 | /// <summary> | 10 | /// <summary> |
11 | /// Terragen File Format Loader | 11 | /// Terragen File Format Loader |
12 | /// Built from specification at | 12 | /// Built from specification at |
13 | /// http://www.planetside.co.uk/terragen/dev/tgterrain.html | 13 | /// http://www.planetside.co.uk/terragen/dev/tgterrain.html |
14 | /// </summary> | 14 | /// </summary> |
15 | class Terragen : ITerrainLoader | 15 | class Terragen : ITerrainLoader |
16 | { | 16 | { |
17 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 17 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
18 | 18 | ||
19 | #region ITerrainLoader Members | 19 | #region ITerrainLoader Members |
20 | 20 | ||
21 | public ITerrainChannel LoadFile(string filename) | 21 | public ITerrainChannel LoadFile(string filename) |
22 | { | 22 | { |
23 | TerrainChannel retval = new TerrainChannel(); | 23 | TerrainChannel retval = new TerrainChannel(); |
24 | 24 | ||
25 | FileInfo file = new FileInfo(filename); | 25 | FileInfo file = new FileInfo(filename); |
26 | FileStream s = file.Open(FileMode.Open, FileAccess.Read); | 26 | FileStream s = file.Open(FileMode.Open, FileAccess.Read); |
27 | BinaryReader bs = new BinaryReader(s); | 27 | BinaryReader bs = new BinaryReader(s); |
28 | 28 | ||
29 | bool eof = false; | 29 | bool eof = false; |
30 | 30 | ||
31 | if (ASCIIEncoding.ASCII.GetString(bs.ReadBytes(16)) == "TERRAGENTERRAIN") | 31 | if (ASCIIEncoding.ASCII.GetString(bs.ReadBytes(16)) == "TERRAGENTERRAIN") |
32 | { | 32 | { |
33 | // Terragen file | 33 | // Terragen file |
34 | while (eof == false) | 34 | while (eof == false) |
35 | { | 35 | { |
36 | int w = 256; | 36 | int w = 256; |
37 | int h = 256; | 37 | int h = 256; |
38 | string tmp = ASCIIEncoding.ASCII.GetString(bs.ReadBytes(4)); | 38 | string tmp = ASCIIEncoding.ASCII.GetString(bs.ReadBytes(4)); |
39 | switch (tmp) | 39 | switch (tmp) |
40 | { | 40 | { |
41 | case "SIZE": | 41 | case "SIZE": |
42 | int sztmp = bs.ReadInt16() + 1; | 42 | int sztmp = bs.ReadInt16() + 1; |
43 | w = sztmp; | 43 | w = sztmp; |
44 | h = sztmp; | 44 | h = sztmp; |
45 | bs.ReadInt16(); | 45 | bs.ReadInt16(); |
46 | break; | 46 | break; |
47 | case "XPTS": | 47 | case "XPTS": |
48 | w = bs.ReadInt16(); | 48 | w = bs.ReadInt16(); |
49 | bs.ReadInt16(); | 49 | bs.ReadInt16(); |
50 | break; | 50 | break; |
51 | case "YPTS": | 51 | case "YPTS": |
52 | h = bs.ReadInt16(); | 52 | h = bs.ReadInt16(); |
53 | bs.ReadInt16(); | 53 | bs.ReadInt16(); |
54 | break; | 54 | break; |
55 | case "ALTW": | 55 | case "ALTW": |
56 | eof = true; | 56 | eof = true; |
57 | Int16 heightScale = bs.ReadInt16(); | 57 | Int16 heightScale = bs.ReadInt16(); |
58 | Int16 baseHeight = bs.ReadInt16(); | 58 | Int16 baseHeight = bs.ReadInt16(); |
59 | retval = new TerrainChannel(w, h); | 59 | retval = new TerrainChannel(w, h); |
60 | int x, y; | 60 | int x, y; |
61 | for (x = 0; x < w; x++) | 61 | for (x = 0; x < w; x++) |
62 | { | 62 | { |
63 | for (y = 0; y < h; y++) | 63 | for (y = 0; y < h; y++) |
64 | { | 64 | { |
65 | retval[x, y] = (double)baseHeight + (double)bs.ReadInt16() * (double)heightScale / 65536.0; | 65 | retval[x, y] = (double)baseHeight + (double)bs.ReadInt16() * (double)heightScale / 65536.0; |
66 | } | 66 | } |
67 | } | 67 | } |
68 | break; | 68 | break; |
69 | default: | 69 | default: |
70 | bs.ReadInt32(); | 70 | bs.ReadInt32(); |
71 | break; | 71 | break; |
72 | } | 72 | } |
73 | } | 73 | } |
74 | } | 74 | } |
75 | 75 | ||
76 | bs.Close(); | 76 | bs.Close(); |
77 | s.Close(); | 77 | s.Close(); |
78 | 78 | ||
79 | return retval; | 79 | return retval; |
80 | } | 80 | } |
81 | 81 | ||
82 | public void SaveFile(string filename) | 82 | public void SaveFile(string filename) |
83 | { | 83 | { |
84 | throw new NotImplementedException(); | 84 | throw new NotImplementedException(); |
85 | } | 85 | } |
86 | 86 | ||
87 | #endregion | 87 | #endregion |
88 | } | 88 | } |
89 | } | 89 | } |