aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs27
1 files changed, 12 insertions, 15 deletions
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs
index 7575b1b..d496069 100644
--- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs
+++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs
@@ -25,7 +25,6 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.IO; 28using System.IO;
30using OpenSim.Region.Environment.Interfaces; 29using OpenSim.Region.Environment.Interfaces;
31 30
@@ -57,11 +56,6 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders
57 return retval; 56 return retval;
58 } 57 }
59 58
60 public override string ToString()
61 {
62 return "RAW32";
63 }
64
65 public ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight) 59 public ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight)
66 { 60 {
67 TerrainChannel retval = new TerrainChannel(sectionWidth, sectionHeight); 61 TerrainChannel retval = new TerrainChannel(sectionWidth, sectionHeight);
@@ -69,7 +63,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders
69 FileInfo file = new FileInfo(filename); 63 FileInfo file = new FileInfo(filename);
70 FileStream s = file.Open(FileMode.Open, FileAccess.Read); 64 FileStream s = file.Open(FileMode.Open, FileAccess.Read);
71 BinaryReader bs = new BinaryReader(s); 65 BinaryReader bs = new BinaryReader(s);
72 66
73 int currFileXOffset = 0; 67 int currFileXOffset = 0;
74 int currFileYOffset = 0; 68 int currFileYOffset = 0;
75 69
@@ -79,7 +73,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders
79 { 73 {
80 // read a whole strip of regions 74 // read a whole strip of regions
81 int heightsToRead = sectionHeight * (fileWidth * sectionWidth); 75 int heightsToRead = sectionHeight * (fileWidth * sectionWidth);
82 bs.ReadBytes( heightsToRead * 4); // because the floats are 4 bytes in the file 76 bs.ReadBytes(heightsToRead * 4); // because the floats are 4 bytes in the file
83 currFileYOffset++; 77 currFileYOffset++;
84 } 78 }
85 79
@@ -90,13 +84,13 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders
90 for (y = 0; y < sectionHeight; y++) 84 for (y = 0; y < sectionHeight; y++)
91 { 85 {
92 currFileXOffset = 0; 86 currFileXOffset = 0;
93 87
94 // if our region isn't the first X section of the areas to be landscaped, then 88 // if our region isn't the first X section of the areas to be landscaped, then
95 // advance the stream to the X start pos of our section in the file 89 // advance the stream to the X start pos of our section in the file
96 // i.e. eat X upto where we start 90 // i.e. eat X upto where we start
97 while (currFileXOffset < offsetX) 91 while (currFileXOffset < offsetX)
98 { 92 {
99 bs.ReadBytes( sectionWidth * 4); // 4 bytes = single 93 bs.ReadBytes(sectionWidth * 4); // 4 bytes = single
100 currFileXOffset++; 94 currFileXOffset++;
101 } 95 }
102 96
@@ -111,14 +105,12 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders
111 105
112 // if our region isn't the last X section of the areas to be landscaped, then 106 // if our region isn't the last X section of the areas to be landscaped, then
113 // advance the stream to the end of this Y column 107 // advance the stream to the end of this Y column
114 while (currFileXOffset < fileWidth ) 108 while (currFileXOffset < fileWidth)
115 { 109 {
116 // eat the next regions x line 110 // eat the next regions x line
117 bs.ReadBytes(sectionWidth * 4); // 4 bytes = single 111 bs.ReadBytes(sectionWidth * 4); // 4 bytes = single
118 currFileXOffset++; 112 currFileXOffset++;
119 } 113 }
120
121
122 } 114 }
123 115
124 bs.Close(); 116 bs.Close();
@@ -138,7 +130,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders
138 { 130 {
139 for (x = 0; x < map.Width; x++) 131 for (x = 0; x < map.Width; x++)
140 { 132 {
141 bs.Write((float)map[x, y]); 133 bs.Write((float) map[x, y]);
142 } 134 }
143 } 135 }
144 136
@@ -147,5 +139,10 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders
147 } 139 }
148 140
149 #endregion 141 #endregion
142
143 public override string ToString()
144 {
145 return "RAW32";
146 }
150 } 147 }
151} 148} \ No newline at end of file