aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorRobert Adams2013-10-16 07:52:30 -0700
committerRobert Adams2013-10-16 07:52:30 -0700
commit97bc5263de990ce80fc0adfbdb632ba8c5cbb77b (patch)
tree6d6d27ea6f8b8d93a8622f6fd9b257387ac7ca94 /OpenSim/Region/Framework
parentMerge branch 'master' into varregion (diff)
downloadopensim-SC-97bc5263de990ce80fc0adfbdb632ba8c5cbb77b.zip
opensim-SC-97bc5263de990ce80fc0adfbdb632ba8c5cbb77b.tar.gz
opensim-SC-97bc5263de990ce80fc0adfbdb632ba8c5cbb77b.tar.bz2
opensim-SC-97bc5263de990ce80fc0adfbdb632ba8c5cbb77b.tar.xz
varregion: move the compressed heighmap compression factor from
Constants into TerrainData. Save compression factor with the terrain blob in the database.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/TerrainChannel.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/TerrainCompressor.cs2
2 files changed, 7 insertions, 19 deletions
diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
index 65e890f..6d245cb 100644
--- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
+++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
@@ -183,21 +183,6 @@ namespace OpenSim.Region.Framework.Scenes
183 183
184 #endregion 184 #endregion
185 185
186 /*
187 // To save space (especially for large regions), keep the height as a short integer
188 // that is coded as the float height times the compression factor (usually '100'
189 // to make for two decimal points).
190 public static short ToCompressedHeight(double pHeight)
191 {
192 return (short)(pHeight * Constants.TerrainCompression);
193 }
194
195 public static float FromCompressedHeight(short pHeight)
196 {
197 return ((float)pHeight) / Constants.TerrainCompression;
198 }
199 */
200
201 public TerrainChannel Copy() 186 public TerrainChannel Copy()
202 { 187 {
203 TerrainChannel copy = new TerrainChannel(); 188 TerrainChannel copy = new TerrainChannel();
@@ -280,13 +265,15 @@ namespace OpenSim.Region.Framework.Scenes
280 public int SizeX; 265 public int SizeX;
281 public int SizeY; 266 public int SizeY;
282 public int SizeZ; 267 public int SizeZ;
268 public float CompressionFactor;
283 public short[] Map; 269 public short[] Map;
284 public TerrainChannelXMLPackage(int pX, int pY, int pZ, short[] pMap) 270 public TerrainChannelXMLPackage(int pX, int pY, int pZ, float pCompressionFactor, short[] pMap)
285 { 271 {
286 Version = 1; 272 Version = 1;
287 SizeX = pX; 273 SizeX = pX;
288 SizeY = pY; 274 SizeY = pY;
289 SizeZ = pZ; 275 SizeZ = pZ;
276 CompressionFactor = pCompressionFactor;
290 Map = pMap; 277 Map = pMap;
291 } 278 }
292 } 279 }
@@ -294,7 +281,8 @@ namespace OpenSim.Region.Framework.Scenes
294 // New terrain serialization format that includes the width and length. 281 // New terrain serialization format that includes the width and length.
295 private void ToXml2(XmlWriter xmlWriter) 282 private void ToXml2(XmlWriter xmlWriter)
296 { 283 {
297 TerrainChannelXMLPackage package = new TerrainChannelXMLPackage(Width, Height, Altitude, m_terrainData.GetCompressedMap()); 284 TerrainChannelXMLPackage package = new TerrainChannelXMLPackage(Width, Height, Altitude, m_terrainData.CompressionFactor,
285 m_terrainData.GetCompressedMap());
298 XmlSerializer serializer = new XmlSerializer(typeof(TerrainChannelXMLPackage)); 286 XmlSerializer serializer = new XmlSerializer(typeof(TerrainChannelXMLPackage));
299 serializer.Serialize(xmlWriter, package); 287 serializer.Serialize(xmlWriter, package);
300 } 288 }
@@ -304,7 +292,7 @@ namespace OpenSim.Region.Framework.Scenes
304 { 292 {
305 XmlSerializer serializer = new XmlSerializer(typeof(TerrainChannelXMLPackage)); 293 XmlSerializer serializer = new XmlSerializer(typeof(TerrainChannelXMLPackage));
306 TerrainChannelXMLPackage package = (TerrainChannelXMLPackage)serializer.Deserialize(xmlReader); 294 TerrainChannelXMLPackage package = (TerrainChannelXMLPackage)serializer.Deserialize(xmlReader);
307 m_terrainData = new HeightmapTerrainData(package.Map, package.SizeX, package.SizeY, package.SizeZ); 295 m_terrainData = new HeightmapTerrainData(package.Map, package.CompressionFactor, package.SizeX, package.SizeY, package.SizeZ);
308 } 296 }
309 297
310 // Fill the heightmap with the center bump terrain 298 // Fill the heightmap with the center bump terrain
diff --git a/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs b/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs
index 511745d..e91c959 100644
--- a/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs
+++ b/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs
@@ -112,7 +112,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
112 // This is an intermediate step in converting terrain into a variable sized heightmap. Some of the 112 // This is an intermediate step in converting terrain into a variable sized heightmap. Some of the
113 // routines (like IClientAPI) only pass the float array of heights around. This entry 113 // routines (like IClientAPI) only pass the float array of heights around. This entry
114 // converts that legacy representation into the more compact represenation used in 114 // converts that legacy representation into the more compact represenation used in
115 // TerrainChannel. Someday fix the plumbing between here and the scene. 115 // TerrainData. Someday fix the plumbing between here and the scene.
116 public static LayerDataPacket CreateLandPacket(TerrainData terrData, int patchX, int patchY) 116 public static LayerDataPacket CreateLandPacket(TerrainData terrData, int patchX, int patchY)
117 { 117 {
118 int[] xPieces = new int[1]; 118 int[] xPieces = new int[1];