diff options
author | Robert Adams | 2013-10-16 07:52:30 -0700 |
---|---|---|
committer | Robert Adams | 2013-10-16 07:52:30 -0700 |
commit | 97bc5263de990ce80fc0adfbdb632ba8c5cbb77b (patch) | |
tree | 6d6d27ea6f8b8d93a8622f6fd9b257387ac7ca94 /OpenSim/Region | |
parent | Merge branch 'master' into varregion (diff) | |
download | opensim-SC_OLD-97bc5263de990ce80fc0adfbdb632ba8c5cbb77b.zip opensim-SC_OLD-97bc5263de990ce80fc0adfbdb632ba8c5cbb77b.tar.gz opensim-SC_OLD-97bc5263de990ce80fc0adfbdb632ba8c5cbb77b.tar.bz2 opensim-SC_OLD-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')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/TerrainChannel.cs | 24 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/TerrainCompressor.cs | 2 |
3 files changed, 12 insertions, 22 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index eb6187b..459af73 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -74,6 +74,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
74 | #endregion | 74 | #endregion |
75 | 75 | ||
76 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 76 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
77 | private static readonly string LogHeader = "[TERRAIN MODULE]"; | ||
77 | 78 | ||
78 | private readonly Commander m_commander = new Commander("terrain"); | 79 | private readonly Commander m_commander = new Commander("terrain"); |
79 | 80 | ||
@@ -712,7 +713,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
712 | private void CheckForTerrainUpdates(bool respectEstateSettings) | 713 | private void CheckForTerrainUpdates(bool respectEstateSettings) |
713 | { | 714 | { |
714 | bool shouldTaint = false; | 715 | bool shouldTaint = false; |
715 | float[] terrData = m_channel.GetFloatsSerialised(); | 716 | float[] terrHeights = m_channel.GetFloatsSerialised(); |
716 | int x; | 717 | int x; |
717 | for (x = 0; x < m_channel.Width; x += Constants.TerrainPatchSize) | 718 | for (x = 0; x < m_channel.Width; x += Constants.TerrainPatchSize) |
718 | { | 719 | { |
@@ -727,10 +728,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
727 | if (respectEstateSettings && LimitChannelChanges(x, y)) | 728 | if (respectEstateSettings && LimitChannelChanges(x, y)) |
728 | { | 729 | { |
729 | // Terrain heights were modified. Refetch the terrain info. | 730 | // Terrain heights were modified. Refetch the terrain info. |
730 | terrData = m_channel.GetFloatsSerialised(); | 731 | terrHeights = m_channel.GetFloatsSerialised(); |
731 | } | 732 | } |
732 | 733 | ||
733 | SendToClients(terrData, x, y); | 734 | // m_log.DebugFormat("{0} Patch modified. Sending (x,y) = ({1},{2})", LogHeader, x, y); |
735 | SendToClients(terrHeights, x, y); | ||
734 | shouldTaint = true; | 736 | shouldTaint = true; |
735 | } | 737 | } |
736 | } | 738 | } |
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]; |