diff options
author | Robert Adams | 2015-05-03 21:56:41 -0700 |
---|---|---|
committer | Robert Adams | 2015-05-03 21:56:41 -0700 |
commit | 30f9e5372e7b999ace8334825237a3512c9e40fb (patch) | |
tree | f657d2d1de924a0bba20c6ade9ef1fc7a23eb8ff | |
parent | lock collision mesh cache when accessing (diff) | |
download | opensim-SC_OLD-30f9e5372e7b999ace8334825237a3512c9e40fb.zip opensim-SC_OLD-30f9e5372e7b999ace8334825237a3512c9e40fb.tar.gz opensim-SC_OLD-30f9e5372e7b999ace8334825237a3512c9e40fb.tar.bz2 opensim-SC_OLD-30f9e5372e7b999ace8334825237a3512c9e40fb.tar.xz |
Only send parcel layer data around the point of interest. Can be disabled
by setting [LandManagement]LimitParcelLayerUpdateDistance=false
New parameters added to OpenSimDefaults for the distance and enablement.
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 84 | ||||
-rw-r--r-- | bin/OpenSimDefaults.ini | 12 |
2 files changed, 91 insertions, 5 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 13485bf..25e1454 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -98,11 +98,17 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
98 | // caches ExtendedLandData | 98 | // caches ExtendedLandData |
99 | private Cache parcelInfoCache; | 99 | private Cache parcelInfoCache; |
100 | 100 | ||
101 | |||
101 | /// <summary> | 102 | /// <summary> |
102 | /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions. | 103 | /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions. |
103 | /// </summary> | 104 | /// </summary> |
104 | private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>(); | 105 | private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>(); |
105 | 106 | ||
107 | // Enables limiting parcel layer info transmission when doing simple updates | ||
108 | private bool shouldLimitParcelLayerInfoToViewDistance { get; set; } | ||
109 | // "View distance" for sending parcel layer info if asked for from a view point in the region | ||
110 | private int parcelLayerViewDistance { get; set; } | ||
111 | |||
106 | #region INonSharedRegionModule Members | 112 | #region INonSharedRegionModule Members |
107 | 113 | ||
108 | public Type ReplaceableInterface | 114 | public Type ReplaceableInterface |
@@ -112,6 +118,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
112 | 118 | ||
113 | public void Initialise(IConfigSource source) | 119 | public void Initialise(IConfigSource source) |
114 | { | 120 | { |
121 | shouldLimitParcelLayerInfoToViewDistance = true; | ||
122 | parcelLayerViewDistance = 128; | ||
123 | IConfig landManagementConfig = source.Configs["LandManagement"]; | ||
124 | if (landManagementConfig != null) | ||
125 | { | ||
126 | shouldLimitParcelLayerInfoToViewDistance = landManagementConfig.GetBoolean("LimitParcelLayerUpdateDistance", shouldLimitParcelLayerInfoToViewDistance); | ||
127 | parcelLayerViewDistance = landManagementConfig.GetInt("ParcelLayerViewDistance", parcelLayerViewDistance); | ||
128 | } | ||
115 | } | 129 | } |
116 | 130 | ||
117 | public void AddRegion(Scene scene) | 131 | public void AddRegion(Scene scene) |
@@ -1129,11 +1143,26 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1129 | 1143 | ||
1130 | #region Parcel Updating | 1144 | #region Parcel Updating |
1131 | 1145 | ||
1146 | // Send parcel layer info for the whole region | ||
1147 | public void SendParcelOverlay(IClientAPI remote_client) | ||
1148 | { | ||
1149 | SendParcelOverlay(remote_client, 0, 0, (int)Constants.MaximumRegionSize); | ||
1150 | } | ||
1151 | |||
1132 | /// <summary> | 1152 | /// <summary> |
1133 | /// Where we send the ParcelOverlay packet to the client | 1153 | /// Send the parcel overlay blocks to the client. We send the overlay packets |
1154 | /// around a location and limited by the 'parcelLayerViewDistance'. This number | ||
1155 | /// is usually 128 and the code is arranged so it sends all the parcel overlay | ||
1156 | /// information for a whole region if the region is legacy sized (256x256). If | ||
1157 | /// the region is larger, only the parcel layer information is sent around | ||
1158 | /// the point specified. This reduces the problem of parcel layer information | ||
1159 | /// blocks increasing exponentially as region size increases. | ||
1134 | /// </summary> | 1160 | /// </summary> |
1135 | /// <param name="remote_client">The object representing the client</param> | 1161 | /// <param name="remote_client">The object representing the client</param> |
1136 | public void SendParcelOverlay(IClientAPI remote_client) | 1162 | /// <param name="xPlace">X position in the region to send surrounding parcel layer info</param> |
1163 | /// <param name="yPlace">y position in the region to send surrounding parcel layer info</param> | ||
1164 | /// <param name="layerViewDistance">Distance from x,y position to send parcel layer info</param> | ||
1165 | private void SendParcelOverlay(IClientAPI remote_client, int xPlace, int yPlace, int layerViewDistance) | ||
1137 | { | 1166 | { |
1138 | const int LAND_BLOCKS_PER_PACKET = 1024; | 1167 | const int LAND_BLOCKS_PER_PACKET = 1024; |
1139 | 1168 | ||
@@ -1141,15 +1170,58 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1141 | int byteArrayCount = 0; | 1170 | int byteArrayCount = 0; |
1142 | int sequenceID = 0; | 1171 | int sequenceID = 0; |
1143 | 1172 | ||
1173 | int xLow = 0; | ||
1174 | int xHigh = (int)m_scene.RegionInfo.RegionSizeX; | ||
1175 | int yLow = 0; | ||
1176 | int yHigh = (int)m_scene.RegionInfo.RegionSizeY; | ||
1177 | |||
1178 | if (shouldLimitParcelLayerInfoToViewDistance) | ||
1179 | { | ||
1180 | // Compute view distance around the given point | ||
1181 | int txLow = xPlace - layerViewDistance; | ||
1182 | int txHigh = xPlace + layerViewDistance; | ||
1183 | // If the distance is outside the region area, move the view distance to ba all in the region | ||
1184 | if (txLow < xLow) | ||
1185 | { | ||
1186 | txLow = xLow; | ||
1187 | txHigh = Math.Min(yLow + (layerViewDistance * 2), xHigh); | ||
1188 | } | ||
1189 | if (txHigh > xHigh) | ||
1190 | { | ||
1191 | txLow = Math.Max(xLow, xHigh - (layerViewDistance * 2)); | ||
1192 | txHigh = xHigh; | ||
1193 | } | ||
1194 | xLow = txLow; | ||
1195 | xHigh = txHigh; | ||
1196 | |||
1197 | int tyLow = yPlace - layerViewDistance; | ||
1198 | int tyHigh = yPlace + layerViewDistance; | ||
1199 | if (tyLow < yLow) | ||
1200 | { | ||
1201 | tyLow = yLow; | ||
1202 | tyHigh = Math.Min(yLow + (layerViewDistance * 2), yHigh); | ||
1203 | } | ||
1204 | if (tyHigh > yHigh) | ||
1205 | { | ||
1206 | tyLow = Math.Max(yLow, yHigh - (layerViewDistance * 2)); | ||
1207 | tyHigh = yHigh; | ||
1208 | } | ||
1209 | yLow = tyLow; | ||
1210 | yHigh = tyHigh; | ||
1211 | } | ||
1212 | // m_log.DebugFormat("{0} SendParcelOverlay: place=<{1},{2}>, vDist={3}, xLH=<{4},{5}, yLH=<{6},{7}>", | ||
1213 | // LogHeader, xPlace, yPlace, layerViewDistance, xLow, xHigh, yLow, yHigh); | ||
1214 | |||
1144 | // Layer data is in landUnit (4m) chunks | 1215 | // Layer data is in landUnit (4m) chunks |
1145 | for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++) | 1216 | for (int y = yLow; y < yHigh / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++) |
1146 | { | 1217 | { |
1147 | for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++) | 1218 | for (int x = xLow; x < xHigh / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++) |
1148 | { | 1219 | { |
1149 | byteArray[byteArrayCount] = BuildLayerByte(GetLandObject(x * LandUnit, y * LandUnit), x, y, remote_client); | 1220 | byteArray[byteArrayCount] = BuildLayerByte(GetLandObject(x * LandUnit, y * LandUnit), x, y, remote_client); |
1150 | byteArrayCount++; | 1221 | byteArrayCount++; |
1151 | if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) | 1222 | if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) |
1152 | { | 1223 | { |
1224 | // m_log.DebugFormat("{0} SendParcelOverlay, sending packet, bytes={1}", LogHeader, byteArray.Length); | ||
1153 | remote_client.SendLandParcelOverlay(byteArray, sequenceID); | 1225 | remote_client.SendLandParcelOverlay(byteArray, sequenceID); |
1154 | byteArrayCount = 0; | 1226 | byteArrayCount = 0; |
1155 | sequenceID++; | 1227 | sequenceID++; |
@@ -1162,6 +1234,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1162 | if (byteArrayCount != 0) | 1234 | if (byteArrayCount != 0) |
1163 | { | 1235 | { |
1164 | remote_client.SendLandParcelOverlay(byteArray, sequenceID); | 1236 | remote_client.SendLandParcelOverlay(byteArray, sequenceID); |
1237 | // m_log.DebugFormat("{0} SendParcelOverlay, complete sending packet, bytes={1}", LogHeader, byteArray.Length); | ||
1165 | } | 1238 | } |
1166 | } | 1239 | } |
1167 | 1240 | ||
@@ -1265,7 +1338,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1265 | temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client); | 1338 | temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client); |
1266 | } | 1339 | } |
1267 | 1340 | ||
1268 | SendParcelOverlay(remote_client); | 1341 | // Also send the layer data around the point of interest |
1342 | SendParcelOverlay(remote_client, (start_x + end_x) / 2, (start_y + end_y) / 2, parcelLayerViewDistance); | ||
1269 | } | 1343 | } |
1270 | 1344 | ||
1271 | public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client) | 1345 | public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client) |
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 55ca32f..a5d7f1d 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini | |||
@@ -1940,6 +1940,18 @@ | |||
1940 | ; the avatar outward. | 1940 | ; the avatar outward. |
1941 | SendTerrainUpdatesByViewDistance = True | 1941 | SendTerrainUpdatesByViewDistance = True |
1942 | 1942 | ||
1943 | [LandManagement] | ||
1944 | ; When editing terrain or objects, parcel layer info is updated in the viewer. | ||
1945 | ; This can be expensive for large regions. If this variable is 'true', only the | ||
1946 | ; parcel layer data around the area of interest is sent. The parcel layer info | ||
1947 | ; is sent for 'ParcelLayerViewDistance' around the interest point. | ||
1948 | ; If 'ParcelLayerViewDistance' is >= 128, the operation for legacy sized regions | ||
1949 | ; will be what it has always been (send the whole region's parcel layer info). | ||
1950 | ; Other parcel updates (login, changing parcel ownership, ...) will still send | ||
1951 | ; whole region. | ||
1952 | LimitParcelLayerUpdateDistance = true | ||
1953 | ParcelLayerViewDistance = 128 | ||
1954 | |||
1943 | ;; | 1955 | ;; |
1944 | ;; If you are using a simian grid frontend you can enable | 1956 | ;; If you are using a simian grid frontend you can enable |
1945 | ;; this module to upload tile images for the mapping fn | 1957 | ;; this module to upload tile images for the mapping fn |