diff options
author | Robert Adams | 2013-11-03 08:14:51 -0800 |
---|---|---|
committer | Robert Adams | 2013-11-03 08:14:51 -0800 |
commit | 9bf363e9be948dc0db62c560d9827072c682e994 (patch) | |
tree | d6ecdb40502060aa75c8b1738d7135190184c1a4 /OpenSim | |
parent | varregion: send region size in LLLoginResponse. (diff) | |
download | opensim-SC-9bf363e9be948dc0db62c560d9827072c682e994.zip opensim-SC-9bf363e9be948dc0db62c560d9827072c682e994.tar.gz opensim-SC-9bf363e9be948dc0db62c560d9827072c682e994.tar.bz2 opensim-SC-9bf363e9be948dc0db62c560d9827072c682e994.tar.xz |
varregion: send the proper terrain patch layer code for large terrain.
Code cleanups.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/TerrainCompressor.cs | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs b/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs index e4513ad..5ecde87 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs | |||
@@ -116,7 +116,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
116 | xPieces[0] = patchX; // patch X dimension | 116 | xPieces[0] = patchX; // patch X dimension |
117 | yPieces[0] = patchY; | 117 | yPieces[0] = patchY; |
118 | 118 | ||
119 | return CreateLandPacket(terrData, xPieces, yPieces, (int)TerrainPatch.LayerType.Land); | 119 | byte landPacketType = (byte)TerrainPatch.LayerType.Land; |
120 | if (terrData.SizeX > Constants.RegionSize || terrData.SizeY > Constants.RegionSize) | ||
121 | { | ||
122 | // libOMV does not have a packet type defined for the extended parcel format. | ||
123 | // We just happen to know the extended parcel format code is one more than the usual code. | ||
124 | landPacketType++; | ||
125 | } | ||
126 | |||
127 | return CreateLandPacket(terrData, xPieces, yPieces, landPacketType); | ||
120 | } | 128 | } |
121 | 129 | ||
122 | /// <summary> | 130 | /// <summary> |
@@ -258,19 +266,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
258 | float zmax = -99999999.0f; | 266 | float zmax = -99999999.0f; |
259 | float zmin = 99999999.0f; | 267 | float zmin = 99999999.0f; |
260 | 268 | ||
261 | for (int j = patchY*16; j < (patchY + 1)*16; j++) | 269 | for (int j = patchY*Constants.TerrainPatchSize; j < (patchY + 1)*Constants.TerrainPatchSize; j++) |
262 | { | 270 | { |
263 | for (int i = patchX*16; i < (patchX + 1)*16; i++) | 271 | for (int i = patchX*Constants.TerrainPatchSize; i < (patchX + 1)*Constants.TerrainPatchSize; i++) |
264 | { | 272 | { |
265 | // short val = heightmap[j*pRegionSizeX + i]; | ||
266 | float val = terrData[i, j]; | 273 | float val = terrData[i, j]; |
267 | if (val > zmax) zmax = val; | 274 | if (val > zmax) zmax = val; |
268 | if (val < zmin) zmin = val; | 275 | if (val < zmin) zmin = val; |
269 | } | 276 | } |
270 | } | 277 | } |
271 | 278 | ||
272 | // Since the the min and max values are the shorts, rescale to be real values. | ||
273 | // TODO: all this logic should go into the class wrapping the short values. | ||
274 | header.DCOffset = zmin; | 279 | header.DCOffset = zmin; |
275 | header.Range = (int)(zmax - zmin + 1.0f); | 280 | header.Range = (int)(zmax - zmin + 1.0f); |
276 | 281 | ||
@@ -816,26 +821,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
816 | 821 | ||
817 | int k = 0; | 822 | int k = 0; |
818 | 823 | ||
819 | int jPatchLimit = patchY; | 824 | int yPatchLimit = patchY >= (terrData.SizeY / Constants.TerrainPatchSize) ? |
820 | if (patchY >= (terrData.SizeY / Constants.TerrainPatchSize)) | 825 | (terrData.SizeY - Constants.TerrainPatchSize) / Constants.TerrainPatchSize : patchY; |
821 | { | 826 | yPatchLimit = (yPatchLimit + 1) * Constants.TerrainPatchSize; |
822 | jPatchLimit = (int)(terrData.SizeY - Constants.TerrainPatchSize) / Constants.TerrainPatchSize; | ||
823 | } | ||
824 | jPatchLimit = (jPatchLimit + 1) * Constants.TerrainPatchSize; | ||
825 | 827 | ||
826 | int iPatchLimit = patchX; | 828 | int xPatchLimit = patchX >= (terrData.SizeX / Constants.TerrainPatchSize) ? |
827 | if (patchX >= (terrData.SizeX / Constants.TerrainPatchSize)) | 829 | (terrData.SizeX - Constants.TerrainPatchSize) / Constants.TerrainPatchSize : patchX; |
828 | { | 830 | xPatchLimit = (xPatchLimit + 1) * Constants.TerrainPatchSize; |
829 | iPatchLimit = (int)(terrData.SizeX - Constants.TerrainPatchSize) / Constants.TerrainPatchSize; | ||
830 | } | ||
831 | iPatchLimit = (iPatchLimit + 1) * Constants.TerrainPatchSize; | ||
832 | 831 | ||
833 | for (int j = patchY * Constants.TerrainPatchSize; j < jPatchLimit; j++) | 832 | for (int yy = patchY * Constants.TerrainPatchSize; yy < yPatchLimit; yy++) |
834 | { | 833 | { |
835 | for (int i = patchX * Constants.TerrainPatchSize; i < iPatchLimit; i++) | 834 | for (int xx = patchX * Constants.TerrainPatchSize; xx < xPatchLimit; xx++) |
836 | { | 835 | { |
837 | // block[k++] = (heightmap[j*pRegionSizeX + i])*premult - sub; | 836 | block[k++] = terrData[xx, yy] * premult - sub; |
838 | block[k++] = terrData[i, j] * premult - sub; | ||
839 | } | 837 | } |
840 | } | 838 | } |
841 | 839 | ||
@@ -943,4 +941,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
943 | 941 | ||
944 | #endregion Initialization | 942 | #endregion Initialization |
945 | } | 943 | } |
946 | } \ No newline at end of file | 944 | } |