diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
10 files changed, 222 insertions, 222 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 7e50cc6..2da0a74 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | |||
@@ -1290,9 +1290,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles | |||
1290 | webRequest.ContentType = "application/json-rpc"; | 1290 | webRequest.ContentType = "application/json-rpc"; |
1291 | webRequest.Method = "POST"; | 1291 | webRequest.Method = "POST"; |
1292 | 1292 | ||
1293 | Stream dataStream = webRequest.GetRequestStream(); | 1293 | using (Stream dataStream = webRequest.GetRequestStream()) |
1294 | dataStream.Write(content, 0, content.Length); | 1294 | dataStream.Write(content, 0, content.Length); |
1295 | dataStream.Close(); | ||
1296 | 1295 | ||
1297 | WebResponse webResponse = null; | 1296 | WebResponse webResponse = null; |
1298 | try | 1297 | try |
@@ -1306,26 +1305,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles | |||
1306 | return false; | 1305 | return false; |
1307 | } | 1306 | } |
1308 | 1307 | ||
1309 | Stream rstream = webResponse.GetResponseStream(); | 1308 | using (webResponse) |
1310 | 1309 | using (Stream rstream = webResponse.GetResponseStream()) | |
1311 | OSDMap mret = new OSDMap(); | ||
1312 | try | ||
1313 | { | ||
1314 | mret = (OSDMap)OSDParser.DeserializeJson(rstream); | ||
1315 | } | ||
1316 | catch (Exception e) | ||
1317 | { | 1310 | { |
1318 | m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); | 1311 | OSDMap mret = (OSDMap)OSDParser.DeserializeJson(rstream); |
1319 | return false; | ||
1320 | } | ||
1321 | 1312 | ||
1313 | if (mret.ContainsKey("error")) | ||
1314 | return false; | ||
1322 | 1315 | ||
1323 | if (mret.ContainsKey("error")) | 1316 | // get params... |
1324 | return false; | 1317 | OSD.DeserializeMembers(ref parameters, (OSDMap)mret["result"]); |
1325 | 1318 | return true; | |
1326 | // get params... | 1319 | } |
1327 | OSD.DeserializeMembers(ref parameters, (OSDMap) mret["result"]); | ||
1328 | return true; | ||
1329 | } | 1320 | } |
1330 | 1321 | ||
1331 | /// <summary> | 1322 | /// <summary> |
@@ -1366,9 +1357,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles | |||
1366 | webRequest.ContentType = "application/json-rpc"; | 1357 | webRequest.ContentType = "application/json-rpc"; |
1367 | webRequest.Method = "POST"; | 1358 | webRequest.Method = "POST"; |
1368 | 1359 | ||
1369 | Stream dataStream = webRequest.GetRequestStream(); | 1360 | using (Stream dataStream = webRequest.GetRequestStream()) |
1370 | dataStream.Write(content, 0, content.Length); | 1361 | dataStream.Write(content, 0, content.Length); |
1371 | dataStream.Close(); | ||
1372 | 1362 | ||
1373 | WebResponse webResponse = null; | 1363 | WebResponse webResponse = null; |
1374 | try | 1364 | try |
@@ -1382,29 +1372,32 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles | |||
1382 | return false; | 1372 | return false; |
1383 | } | 1373 | } |
1384 | 1374 | ||
1385 | Stream rstream = webResponse.GetResponseStream(); | 1375 | using (webResponse) |
1386 | 1376 | using (Stream rstream = webResponse.GetResponseStream()) | |
1387 | OSDMap response = new OSDMap(); | ||
1388 | try | ||
1389 | { | ||
1390 | response = (OSDMap)OSDParser.DeserializeJson(rstream); | ||
1391 | } | ||
1392 | catch (Exception e) | ||
1393 | { | 1377 | { |
1394 | m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); | 1378 | OSDMap response = new OSDMap(); |
1395 | return false; | 1379 | try |
1396 | } | 1380 | { |
1381 | response = (OSDMap)OSDParser.DeserializeJson(rstream); | ||
1382 | } | ||
1383 | catch (Exception e) | ||
1384 | { | ||
1385 | m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); | ||
1386 | return false; | ||
1387 | } | ||
1397 | 1388 | ||
1398 | if(response.ContainsKey("error")) | 1389 | if (response.ContainsKey("error")) |
1399 | { | 1390 | { |
1400 | data = response["error"]; | 1391 | data = response["error"]; |
1401 | return false; | 1392 | return false; |
1402 | } | 1393 | } |
1403 | 1394 | ||
1404 | data = response; | 1395 | data = response; |
1405 | 1396 | ||
1406 | return true; | 1397 | return true; |
1398 | } | ||
1407 | } | 1399 | } |
1400 | |||
1408 | #endregion Web Util | 1401 | #endregion Web Util |
1409 | } | 1402 | } |
1410 | } \ No newline at end of file | 1403 | } |
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index c3a8afd..a7237ea 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -488,9 +488,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
488 | byte[] data = Util.UTF8.GetBytes(OutboundBody); | 488 | byte[] data = Util.UTF8.GetBytes(OutboundBody); |
489 | 489 | ||
490 | Request.ContentLength = data.Length; | 490 | Request.ContentLength = data.Length; |
491 | Stream bstream = Request.GetRequestStream(); | 491 | using (Stream bstream = Request.GetRequestStream()) |
492 | bstream.Write(data, 0, data.Length); | 492 | bstream.Write(data, 0, data.Length); |
493 | bstream.Close(); | ||
494 | } | 493 | } |
495 | 494 | ||
496 | try | 495 | try |
@@ -584,4 +583,4 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
584 | Request.Abort(); | 583 | Request.Abort(); |
585 | } | 584 | } |
586 | } | 585 | } |
587 | } \ No newline at end of file | 586 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index f4807ad..0c4b79b 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
121 | protected Vector3 m_displacement = Vector3.Zero; | 121 | protected Vector3 m_displacement = Vector3.Zero; |
122 | 122 | ||
123 | /// <value> | 123 | /// <value> |
124 | /// Rotation to apply to the objects as they are loaded. | 124 | /// Rotation (in radians) to apply to the objects as they are loaded. |
125 | /// </value> | 125 | /// </value> |
126 | protected float m_rotation = 0f; | 126 | protected float m_rotation = 0f; |
127 | 127 | ||
@@ -130,6 +130,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
130 | /// </value> | 130 | /// </value> |
131 | protected Vector3 m_rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0f); | 131 | protected Vector3 m_rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0f); |
132 | 132 | ||
133 | protected bool m_noObjects = false; | ||
134 | |||
133 | /// <summary> | 135 | /// <summary> |
134 | /// Used to cache lookups for valid uuids. | 136 | /// Used to cache lookups for valid uuids. |
135 | /// </summary> | 137 | /// </summary> |
@@ -177,14 +179,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
177 | 179 | ||
178 | m_errorMessage = String.Empty; | 180 | m_errorMessage = String.Empty; |
179 | m_merge = options.ContainsKey("merge"); | 181 | m_merge = options.ContainsKey("merge"); |
180 | m_forceTerrain = options.ContainsKey("forceTerrain"); | 182 | m_forceTerrain = options.ContainsKey("force-terrain"); |
181 | m_forceParcels = options.ContainsKey("forceParcels"); | 183 | m_forceParcels = options.ContainsKey("force-parcels"); |
184 | m_noObjects = options.ContainsKey("no-objects"); | ||
182 | m_skipAssets = options.ContainsKey("skipAssets"); | 185 | m_skipAssets = options.ContainsKey("skipAssets"); |
183 | m_requestId = requestId; | 186 | m_requestId = requestId; |
184 | m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero; | 187 | m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero; |
185 | m_rotation = options.ContainsKey("rotation") ? (float)options["rotation"] : 0f; | 188 | m_rotation = options.ContainsKey("rotation") ? (float)options["rotation"] : 0f; |
186 | m_rotationCenter = options.ContainsKey("rotationCenter") ? (Vector3)options["rotationCenter"] | 189 | m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"] |
187 | : new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0f); | 190 | : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f); |
188 | 191 | ||
189 | // Zero can never be a valid user id | 192 | // Zero can never be a valid user id |
190 | m_validUserUuids[UUID.Zero] = false; | 193 | m_validUserUuids[UUID.Zero] = false; |
@@ -261,7 +264,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
261 | 264 | ||
262 | // Process the file | 265 | // Process the file |
263 | 266 | ||
264 | if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) | 267 | if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH) && !m_noObjects) |
265 | { | 268 | { |
266 | sceneContext.SerialisedSceneObjects.Add(Encoding.UTF8.GetString(data)); | 269 | sceneContext.SerialisedSceneObjects.Add(Encoding.UTF8.GetString(data)); |
267 | } | 270 | } |
@@ -454,8 +457,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
454 | // Reload serialized prims | 457 | // Reload serialized prims |
455 | m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); | 458 | m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); |
456 | 459 | ||
457 | float angle = (float)(m_rotation / 180.0 * Math.PI); | 460 | OpenMetaverse.Quaternion rot = OpenMetaverse.Quaternion.CreateFromAxisAngle(0, 0, 1, m_rotation); |
458 | OpenMetaverse.Quaternion rot = OpenMetaverse.Quaternion.CreateFromAxisAngle(0, 0, 1, angle); | ||
459 | 461 | ||
460 | UUID oldTelehubUUID = scene.RegionInfo.RegionSettings.TelehubObject; | 462 | UUID oldTelehubUUID = scene.RegionInfo.RegionSettings.TelehubObject; |
461 | 463 | ||
@@ -483,16 +485,25 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
483 | // Happily this does not do much to the object since it hasn't been added to the scene yet | 485 | // Happily this does not do much to the object since it hasn't been added to the scene yet |
484 | if (sceneObject.AttachmentPoint == 0) | 486 | if (sceneObject.AttachmentPoint == 0) |
485 | { | 487 | { |
486 | if (angle != 0f) | 488 | if (m_displacement != Vector3.Zero || m_rotation != 0f) |
487 | { | ||
488 | sceneObject.RootPart.RotationOffset = rot * sceneObject.GroupRotation; | ||
489 | Vector3 offset = sceneObject.AbsolutePosition - m_rotationCenter; | ||
490 | offset *= rot; | ||
491 | sceneObject.AbsolutePosition = m_rotationCenter + offset; | ||
492 | } | ||
493 | if (m_displacement != Vector3.Zero) | ||
494 | { | 489 | { |
495 | sceneObject.AbsolutePosition += m_displacement; | 490 | Vector3 pos = sceneObject.AbsolutePosition; |
491 | if (m_rotation != 0f) | ||
492 | { | ||
493 | // Rotate the object | ||
494 | sceneObject.RootPart.RotationOffset = rot * sceneObject.GroupRotation; | ||
495 | // Get object position relative to rotation axis | ||
496 | Vector3 offset = pos - m_rotationCenter; | ||
497 | // Rotate the object position | ||
498 | offset *= rot; | ||
499 | // Restore the object position back to relative to the region | ||
500 | pos = m_rotationCenter + offset; | ||
501 | } | ||
502 | if (m_displacement != Vector3.Zero) | ||
503 | { | ||
504 | pos += m_displacement; | ||
505 | } | ||
506 | sceneObject.AbsolutePosition = pos; | ||
496 | } | 507 | } |
497 | } | 508 | } |
498 | 509 | ||
@@ -868,10 +879,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
868 | ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>(); | 879 | ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>(); |
869 | 880 | ||
870 | MemoryStream ms = new MemoryStream(data); | 881 | MemoryStream ms = new MemoryStream(data); |
871 | if (m_displacement != Vector3.Zero) | 882 | if (m_displacement != Vector3.Zero || m_rotation != 0f) |
872 | { | 883 | { |
873 | Vector2 terrainDisplacement = new Vector2(m_displacement.X, m_displacement.Y); | 884 | Vector2 rotationCenter = new Vector2(m_rotationCenter.X, m_rotationCenter.Y); |
874 | terrainModule.LoadFromStream(terrainPath, terrainDisplacement, ms); | 885 | terrainModule.LoadFromStream(terrainPath, m_displacement, m_rotation, rotationCenter, ms); |
875 | } | 886 | } |
876 | else | 887 | else |
877 | { | 888 | { |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 2a6f1eb..2b2da6f 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | |||
@@ -106,6 +106,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
106 | bool skipAssets = false; | 106 | bool skipAssets = false; |
107 | bool forceTerrain = false; | 107 | bool forceTerrain = false; |
108 | bool forceParcels = false; | 108 | bool forceParcels = false; |
109 | bool noObjects = false; | ||
109 | Vector3 displacement = new Vector3(0f, 0f, 0f); | 110 | Vector3 displacement = new Vector3(0f, 0f, 0f); |
110 | float rotation = 0f; | 111 | float rotation = 0f; |
111 | Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0); | 112 | Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0); |
@@ -113,26 +114,48 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
113 | OptionSet options = new OptionSet(); | 114 | OptionSet options = new OptionSet(); |
114 | options.Add("m|merge", delegate (string v) { mergeOar = (v != null); }); | 115 | options.Add("m|merge", delegate (string v) { mergeOar = (v != null); }); |
115 | options.Add("s|skip-assets", delegate (string v) { skipAssets = (v != null); }); | 116 | options.Add("s|skip-assets", delegate (string v) { skipAssets = (v != null); }); |
116 | options.Add("forceterrain", delegate (string v) { forceTerrain = (v != null); }); | 117 | options.Add("force-terrain", delegate (string v) { forceTerrain = (v != null); }); |
117 | options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); | 118 | options.Add("forceterrain", delegate (string v) { forceTerrain = (v != null); }); // downward compatibility |
119 | options.Add("force-parcels", delegate (string v) { forceParcels = (v != null); }); | ||
120 | options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); // downward compatibility | ||
121 | options.Add("no-objects", delegate (string v) { noObjects = (v != null); }); | ||
118 | options.Add("displacement=", delegate (string v) { | 122 | options.Add("displacement=", delegate (string v) { |
119 | try | 123 | try |
120 | { | 124 | { |
121 | displacement = v == null ? Vector3.Zero : Vector3.Parse(v); | 125 | displacement = v == null ? Vector3.Zero : Vector3.Parse(v); |
122 | } | 126 | } |
123 | catch (Exception e) | 127 | catch |
124 | { | 128 | { |
125 | m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing displacement"); | 129 | m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing displacement"); |
126 | displacement = new Vector3(0f, 0f, 0f); | 130 | m_log.ErrorFormat("[ARCHIVER MODULE] Must be represented as vector3: --displacement \"<128,128,0>\""); |
131 | return; | ||
127 | } | 132 | } |
128 | }); | 133 | }); |
129 | options.Add("rotation=", delegate (string v) { | 134 | options.Add("rotation=", delegate (string v) { |
130 | rotation = float.Parse(v); | 135 | try |
131 | rotation = Util.Clamp<float>(rotation, -359f, 359f); | 136 | { |
137 | rotation = v == null ? 0f : float.Parse(v); | ||
138 | } | ||
139 | catch | ||
140 | { | ||
141 | m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing rotation"); | ||
142 | m_log.ErrorFormat("[ARCHIVER MODULE] Must be an angle in degrees between -360 and +360: --rotation 45"); | ||
143 | return; | ||
144 | } | ||
145 | // Convert to radians for internals | ||
146 | rotation = Util.Clamp<float>(rotation, -359f, 359f) / 180f * (float)Math.PI; | ||
132 | }); | 147 | }); |
133 | options.Add("rotationcenter=", delegate (string v) { | 148 | options.Add("rotation-center=", delegate (string v) { |
134 | // RA 20130119: libomv's Vector2.Parse doesn't work. Need to use vector3 for the moment | 149 | try |
135 | rotationCenter = Vector3.Parse(v); | 150 | { |
151 | rotationCenter = v == null ? Vector3.Zero : Vector3.Parse(v); | ||
152 | } | ||
153 | catch | ||
154 | { | ||
155 | m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing rotation displacement"); | ||
156 | m_log.ErrorFormat("[ARCHIVER MODULE] Must be represented as vector3: --rotation-center \"<128,128,0>\""); | ||
157 | return; | ||
158 | } | ||
136 | }); | 159 | }); |
137 | 160 | ||
138 | // Send a message to the region ready module | 161 | // Send a message to the region ready module |
@@ -155,11 +178,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
155 | Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); | 178 | Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); |
156 | if (mergeOar) archiveOptions.Add("merge", null); | 179 | if (mergeOar) archiveOptions.Add("merge", null); |
157 | if (skipAssets) archiveOptions.Add("skipAssets", null); | 180 | if (skipAssets) archiveOptions.Add("skipAssets", null); |
158 | if (forceTerrain) archiveOptions.Add("forceTerrain", null); | 181 | if (forceTerrain) archiveOptions.Add("force-terrain", null); |
159 | if (forceParcels) archiveOptions.Add("forceParcels", null); | 182 | if (forceParcels) archiveOptions.Add("force-parcels", null); |
183 | if (noObjects) archiveOptions.Add("no-objects", null); | ||
160 | archiveOptions.Add("displacement", displacement); | 184 | archiveOptions.Add("displacement", displacement); |
161 | archiveOptions.Add("rotation", rotation); | 185 | archiveOptions.Add("rotation", rotation); |
162 | archiveOptions.Add("rotationCenter", rotationCenter); | 186 | archiveOptions.Add("rotation-center", rotationCenter); |
163 | 187 | ||
164 | if (mainParams.Count > 2) | 188 | if (mainParams.Count > 2) |
165 | { | 189 | { |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 53f41f9..e08a42d 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -579,7 +579,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
579 | ArchiveConstants.CONTROL_FILE_PATH, | 579 | ArchiveConstants.CONTROL_FILE_PATH, |
580 | new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup())); | 580 | new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup())); |
581 | 581 | ||
582 | LandObject lo = new LandObject(groupID, true, null); | 582 | LandObject lo = new LandObject(groupID, true, m_scene); |
583 | lo.SetLandBitmap(lo.BasicFullRegionLandBitmap()); | 583 | lo.SetLandBitmap(lo.BasicFullRegionLandBitmap()); |
584 | LandData ld = lo.LandData; | 584 | LandData ld = lo.LandData; |
585 | ld.GlobalID = landID; | 585 | ld.GlobalID = landID; |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index f8f4986..939512f 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -134,7 +134,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
134 | public LandObject(UUID owner_id, bool is_group_owned, Scene scene) | 134 | public LandObject(UUID owner_id, bool is_group_owned, Scene scene) |
135 | { | 135 | { |
136 | m_scene = scene; | 136 | m_scene = scene; |
137 | m_landBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; | 137 | if (m_scene == null) |
138 | m_landBitmap = new bool[Constants.RegionSize / landUnit, Constants.RegionSize / landUnit]; | ||
139 | else | ||
140 | m_landBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; | ||
138 | 141 | ||
139 | LandData.OwnerID = owner_id; | 142 | LandData.OwnerID = owner_id; |
140 | if (is_group_owned) | 143 | if (is_group_owned) |
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index 6f344c8..561552a 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs | |||
@@ -68,9 +68,6 @@ namespace OpenSim.Region.CoreModules | |||
68 | // updating those region settings in GenSunPos() | 68 | // updating those region settings in GenSunPos() |
69 | private bool receivedEstateToolsSunUpdate = false; | 69 | private bool receivedEstateToolsSunUpdate = false; |
70 | 70 | ||
71 | // Configurable values | ||
72 | private string m_RegionMode = "SL"; | ||
73 | |||
74 | // Sun's position information is updated and sent to clients every m_UpdateInterval frames | 71 | // Sun's position information is updated and sent to clients every m_UpdateInterval frames |
75 | private int m_UpdateInterval = 0; | 72 | private int m_UpdateInterval = 0; |
76 | 73 | ||
@@ -90,7 +87,6 @@ namespace OpenSim.Region.CoreModules | |||
90 | // private double m_longitude = 0; | 87 | // private double m_longitude = 0; |
91 | // private double m_latitude = 0; | 88 | // private double m_latitude = 0; |
92 | // Configurable defaults Defaults close to SL | 89 | // Configurable defaults Defaults close to SL |
93 | private string d_mode = "SL"; | ||
94 | private int d_frame_mod = 100; // Every 10 seconds (actually less) | 90 | private int d_frame_mod = 100; // Every 10 seconds (actually less) |
95 | private double d_day_length = 4; // A VW day is 4 RW hours long | 91 | private double d_day_length = 4; // A VW day is 4 RW hours long |
96 | private int d_year_length = 60; // There are 60 VW days in a VW year | 92 | private int d_year_length = 60; // There are 60 VW days in a VW year |
@@ -134,12 +130,15 @@ namespace OpenSim.Region.CoreModules | |||
134 | 130 | ||
135 | private const int TICKS_PER_SECOND = 10000000; | 131 | private const int TICKS_PER_SECOND = 10000000; |
136 | 132 | ||
133 | private ulong m_CurrentTimeOffset = 0; | ||
134 | |||
137 | // Current time in elapsed seconds since Jan 1st 1970 | 135 | // Current time in elapsed seconds since Jan 1st 1970 |
138 | private ulong CurrentTime | 136 | private ulong CurrentTime |
139 | { | 137 | { |
140 | get | 138 | get |
141 | { | 139 | { |
142 | return (ulong)(((DateTime.Now.Ticks) - TicksToEpoch + TicksUTCOffset) / TICKS_PER_SECOND); | 140 | ulong ctime = (ulong)(((DateTime.Now.Ticks) - TicksToEpoch + TicksUTCOffset) / TICKS_PER_SECOND); |
141 | return ctime + m_CurrentTimeOffset; | ||
143 | } | 142 | } |
144 | } | 143 | } |
145 | 144 | ||
@@ -262,10 +261,8 @@ namespace OpenSim.Region.CoreModules | |||
262 | 261 | ||
263 | private float GetCurrentTimeAsLindenSunHour() | 262 | private float GetCurrentTimeAsLindenSunHour() |
264 | { | 263 | { |
265 | if (m_SunFixed) | 264 | float curtime = m_SunFixed ? m_SunFixedHour : GetCurrentSunHour(); |
266 | return m_SunFixedHour + 6; | 265 | return (curtime + 6.0f) % 24.0f; |
267 | |||
268 | return GetCurrentSunHour() + 6.0f; | ||
269 | } | 266 | } |
270 | 267 | ||
271 | #region INonSharedRegion Methods | 268 | #region INonSharedRegion Methods |
@@ -291,8 +288,6 @@ namespace OpenSim.Region.CoreModules | |||
291 | try | 288 | try |
292 | { | 289 | { |
293 | // Mode: determines how the sun is handled | 290 | // Mode: determines how the sun is handled |
294 | m_RegionMode = config.Configs["Sun"].GetString("mode", d_mode); | ||
295 | // Mode: determines how the sun is handled | ||
296 | // m_latitude = config.Configs["Sun"].GetDouble("latitude", d_latitude); | 291 | // m_latitude = config.Configs["Sun"].GetDouble("latitude", d_latitude); |
297 | // Mode: determines how the sun is handled | 292 | // Mode: determines how the sun is handled |
298 | // m_longitude = config.Configs["Sun"].GetDouble("longitude", d_longitude); | 293 | // m_longitude = config.Configs["Sun"].GetDouble("longitude", d_longitude); |
@@ -314,7 +309,6 @@ namespace OpenSim.Region.CoreModules | |||
314 | catch (Exception e) | 309 | catch (Exception e) |
315 | { | 310 | { |
316 | m_log.Debug("[SUN]: Configuration access failed, using defaults. Reason: " + e.Message); | 311 | m_log.Debug("[SUN]: Configuration access failed, using defaults. Reason: " + e.Message); |
317 | m_RegionMode = d_mode; | ||
318 | m_YearLengthDays = d_year_length; | 312 | m_YearLengthDays = d_year_length; |
319 | m_DayLengthHours = d_day_length; | 313 | m_DayLengthHours = d_day_length; |
320 | m_HorizonShift = d_day_night; | 314 | m_HorizonShift = d_day_night; |
@@ -325,40 +319,28 @@ namespace OpenSim.Region.CoreModules | |||
325 | // m_longitude = d_longitude; | 319 | // m_longitude = d_longitude; |
326 | } | 320 | } |
327 | 321 | ||
328 | switch (m_RegionMode) | 322 | SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60); |
329 | { | 323 | SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays); |
330 | case "T1": | ||
331 | default: | ||
332 | case "SL": | ||
333 | // Time taken to complete a cycle (day and season) | ||
334 | |||
335 | SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60); | ||
336 | SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays); | ||
337 | 324 | ||
338 | // Ration of real-to-virtual time | 325 | // Ration of real-to-virtual time |
339 | 326 | ||
340 | // VWTimeRatio = 24/m_day_length; | 327 | // VWTimeRatio = 24/m_day_length; |
341 | 328 | ||
342 | // Speed of rotation needed to complete a cycle in the | 329 | // Speed of rotation needed to complete a cycle in the |
343 | // designated period (day and season) | 330 | // designated period (day and season) |
344 | 331 | ||
345 | SunSpeed = m_SunCycle/SecondsPerSunCycle; | 332 | SunSpeed = m_SunCycle/SecondsPerSunCycle; |
346 | SeasonSpeed = m_SeasonalCycle/SecondsPerYear; | 333 | SeasonSpeed = m_SeasonalCycle/SecondsPerYear; |
347 | 334 | ||
348 | // Horizon translation | 335 | // Horizon translation |
349 | 336 | ||
350 | HorizonShift = m_HorizonShift; // Z axis translation | 337 | HorizonShift = m_HorizonShift; // Z axis translation |
351 | // HoursToRadians = (SunCycle/24)*VWTimeRatio; | 338 | // HoursToRadians = (SunCycle/24)*VWTimeRatio; |
352 | |||
353 | m_log.Debug("[SUN]: Mode is " + m_RegionMode); | ||
354 | m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days"); | ||
355 | m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift); | ||
356 | m_log.Debug("[SUN]: Percentage of time for daylight " + m_DayTimeSunHourScale); | ||
357 | m_log.Debug("[SUN]: Positional data updated every " + m_UpdateInterval + " frames"); | ||
358 | |||
359 | break; | ||
360 | } | ||
361 | 339 | ||
340 | m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days"); | ||
341 | m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift); | ||
342 | m_log.Debug("[SUN]: Percentage of time for daylight " + m_DayTimeSunHourScale); | ||
343 | m_log.Debug("[SUN]: Positional data updated every " + m_UpdateInterval + " frames"); | ||
362 | } | 344 | } |
363 | 345 | ||
364 | public Type ReplaceableInterface | 346 | public Type ReplaceableInterface |
@@ -385,7 +367,8 @@ namespace OpenSim.Region.CoreModules | |||
385 | string sunCommand = string.Format("sun {0}", kvp.Key); | 367 | string sunCommand = string.Format("sun {0}", kvp.Key); |
386 | m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} [<value>]", sunCommand), kvp.Value, "", HandleSunConsoleCommand); | 368 | m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} [<value>]", sunCommand), kvp.Value, "", HandleSunConsoleCommand); |
387 | } | 369 | } |
388 | 370 | m_scene.AddCommand("Regions", this, "sun help", "sun help", "list parameters that can be changed", "", HandleSunConsoleCommand); | |
371 | m_scene.AddCommand("Regions", this, "sun list", "sun list", "list parameters that can be changed", "", HandleSunConsoleCommand); | ||
389 | ready = true; | 372 | ready = true; |
390 | } | 373 | } |
391 | 374 | ||
@@ -419,23 +402,22 @@ namespace OpenSim.Region.CoreModules | |||
419 | 402 | ||
420 | public void SunToClient(IClientAPI client) | 403 | public void SunToClient(IClientAPI client) |
421 | { | 404 | { |
422 | if (m_RegionMode != "T1") | 405 | if (ready) |
423 | { | 406 | { |
424 | if (ready) | 407 | if (m_SunFixed) |
425 | { | 408 | { |
426 | if (m_SunFixed) | 409 | // m_log.DebugFormat("[SUN]: Fixed SunHour {0}, Position {1}, PosTime {2}, OrbitalPosition : {3} ", |
427 | { | 410 | // m_SunFixedHour, Position.ToString(), PosTime.ToString(), OrbitalPosition.ToString()); |
428 | // m_log.DebugFormat("[SUN]: SunHour {0}, Position {1}, PosTime {2}, OrbitalPosition : {3} ", m_SunFixedHour, Position.ToString(), PosTime.ToString(), OrbitalPosition.ToString()); | 411 | client.SendSunPos(Position, Velocity, PosTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition); |
429 | client.SendSunPos(Position, Velocity, PosTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition); | 412 | } |
430 | } | 413 | else |
431 | else | 414 | { |
432 | { | 415 | // m_log.DebugFormat("[SUN]: SunHour {0}, Position {1}, PosTime {2}, OrbitalPosition : {3} ", |
433 | // m_log.DebugFormat("[SUN]: SunHour {0}, Position {1}, PosTime {2}, OrbitalPosition : {3} ", m_SunFixedHour, Position.ToString(), PosTime.ToString(), OrbitalPosition.ToString()); | 416 | // m_SunFixedHour, Position.ToString(), PosTime.ToString(), OrbitalPosition.ToString()); |
434 | client.SendSunPos(Position, Velocity, CurrentTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition); | 417 | client.SendSunPos(Position, Velocity, CurrentTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition); |
435 | } | ||
436 | } | 418 | } |
437 | } | 419 | } |
438 | } | 420 | } |
439 | 421 | ||
440 | public void SunUpdate() | 422 | public void SunUpdate() |
441 | { | 423 | { |
@@ -532,6 +514,9 @@ namespace OpenSim.Region.CoreModules | |||
532 | case "update_interval": | 514 | case "update_interval": |
533 | return m_UpdateInterval; | 515 | return m_UpdateInterval; |
534 | 516 | ||
517 | case "current_time": | ||
518 | return GetCurrentTimeAsLindenSunHour(); | ||
519 | |||
535 | default: | 520 | default: |
536 | throw new Exception("Unknown sun parameter."); | 521 | throw new Exception("Unknown sun parameter."); |
537 | } | 522 | } |
@@ -539,7 +524,51 @@ namespace OpenSim.Region.CoreModules | |||
539 | 524 | ||
540 | public void SetSunParameter(string param, double value) | 525 | public void SetSunParameter(string param, double value) |
541 | { | 526 | { |
542 | HandleSunConsoleCommand("sun", new string[] {param, value.ToString() }); | 527 | switch (param) |
528 | { | ||
529 | case "year_length": | ||
530 | m_YearLengthDays = (int)value; | ||
531 | SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays); | ||
532 | SeasonSpeed = m_SeasonalCycle/SecondsPerYear; | ||
533 | break; | ||
534 | |||
535 | case "day_length": | ||
536 | m_DayLengthHours = value; | ||
537 | SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60); | ||
538 | SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays); | ||
539 | SunSpeed = m_SunCycle/SecondsPerSunCycle; | ||
540 | SeasonSpeed = m_SeasonalCycle/SecondsPerYear; | ||
541 | break; | ||
542 | |||
543 | case "day_night_offset": | ||
544 | m_HorizonShift = value; | ||
545 | HorizonShift = m_HorizonShift; | ||
546 | break; | ||
547 | |||
548 | case "day_time_sun_hour_scale": | ||
549 | m_DayTimeSunHourScale = value; | ||
550 | break; | ||
551 | |||
552 | case "update_interval": | ||
553 | m_UpdateInterval = (int)value; | ||
554 | break; | ||
555 | |||
556 | case "current_time": | ||
557 | value = (value + 18.0) % 24.0; | ||
558 | // set the current offset so that the effective sun time is the parameter | ||
559 | m_CurrentTimeOffset = 0; // clear this first so we use raw time | ||
560 | m_CurrentTimeOffset = (ulong)(SecondsPerSunCycle * value/ 24.0) - (CurrentTime % SecondsPerSunCycle); | ||
561 | break; | ||
562 | |||
563 | default: | ||
564 | throw new Exception("Unknown sun parameter."); | ||
565 | |||
566 | // Generate shared values | ||
567 | GenSunPos(); | ||
568 | |||
569 | // When sun settings are updated, we should update all clients with new settings. | ||
570 | SunUpdateToAllClients(); | ||
571 | } | ||
543 | } | 572 | } |
544 | 573 | ||
545 | public float GetCurrentSunHour() | 574 | public float GetCurrentSunHour() |
@@ -572,7 +601,7 @@ namespace OpenSim.Region.CoreModules | |||
572 | 601 | ||
573 | foreach (string output in ParseCmdParams(cmdparams)) | 602 | foreach (string output in ParseCmdParams(cmdparams)) |
574 | { | 603 | { |
575 | m_log.Info("[SUN] " + output); | 604 | MainConsole.Instance.Output(output); |
576 | } | 605 | } |
577 | } | 606 | } |
578 | 607 | ||
@@ -581,10 +610,11 @@ namespace OpenSim.Region.CoreModules | |||
581 | Dictionary<string, string> Params = new Dictionary<string, string>(); | 610 | Dictionary<string, string> Params = new Dictionary<string, string>(); |
582 | 611 | ||
583 | Params.Add("year_length", "number of days to a year"); | 612 | Params.Add("year_length", "number of days to a year"); |
584 | Params.Add("day_length", "number of seconds to a day"); | 613 | Params.Add("day_length", "number of hours to a day"); |
585 | Params.Add("day_night_offset", "induces a horizon shift"); | 614 | Params.Add("day_night_offset", "induces a horizon shift"); |
586 | Params.Add("update_interval", "how often to update the sun's position in frames"); | 615 | Params.Add("update_interval", "how often to update the sun's position in frames"); |
587 | Params.Add("day_time_sun_hour_scale", "scales day light vs nite hours to change day/night ratio"); | 616 | Params.Add("day_time_sun_hour_scale", "scales day light vs nite hours to change day/night ratio"); |
617 | Params.Add("current_time", "time in seconds of the simulator"); | ||
588 | 618 | ||
589 | return Params; | 619 | return Params; |
590 | } | 620 | } |
@@ -618,46 +648,15 @@ namespace OpenSim.Region.CoreModules | |||
618 | } | 648 | } |
619 | else if (args.Length == 3) | 649 | else if (args.Length == 3) |
620 | { | 650 | { |
621 | float value = 0.0f; | 651 | double value = 0.0; |
622 | if (!float.TryParse(args[2], out value)) | 652 | if (! double.TryParse(args[2], out value)) |
623 | { | 653 | { |
624 | Output.Add(String.Format("The parameter value {0} is not a valid number.", args[2])); | 654 | Output.Add(String.Format("The parameter value {0} is not a valid number.", args[2])); |
655 | return Output; | ||
625 | } | 656 | } |
626 | 657 | ||
627 | switch (args[1].ToLower()) | 658 | SetSunParameter(args[1].ToLower(), value); |
628 | { | ||
629 | case "year_length": | ||
630 | m_YearLengthDays = (int)value; | ||
631 | break; | ||
632 | |||
633 | case "day_length": | ||
634 | m_DayLengthHours = value; | ||
635 | break; | ||
636 | |||
637 | case "day_night_offset": | ||
638 | m_HorizonShift = value; | ||
639 | break; | ||
640 | |||
641 | case "day_time_sun_hour_scale": | ||
642 | m_DayTimeSunHourScale = value; | ||
643 | break; | ||
644 | |||
645 | case "update_interval": | ||
646 | m_UpdateInterval = (int)value; | ||
647 | break; | ||
648 | |||
649 | default: | ||
650 | Output.Add(String.Format("Unknown parameter {0}.", args[1])); | ||
651 | return Output; | ||
652 | } | ||
653 | |||
654 | Output.Add(String.Format("Parameter {0} set to {1}.", args[1], value.ToString())); | 659 | Output.Add(String.Format("Parameter {0} set to {1}.", args[1], value.ToString())); |
655 | |||
656 | // Generate shared values | ||
657 | GenSunPos(); | ||
658 | |||
659 | // When sun settings are updated, we should update all clients with new settings. | ||
660 | SunUpdateToAllClients(); | ||
661 | } | 660 | } |
662 | 661 | ||
663 | return Output; | 662 | return Output; |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 7bc5e88..08891d9 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -316,8 +316,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
316 | 316 | ||
317 | public void LoadFromStream(string filename, Stream stream) | 317 | public void LoadFromStream(string filename, Stream stream) |
318 | { | 318 | { |
319 | Vector2 defaultDisplacement = new Vector2(0f, 0f); | 319 | LoadFromStream(filename, Vector3.Zero, 0f, Vector2.Zero, stream); |
320 | LoadFromStream(filename, defaultDisplacement, stream); | ||
321 | } | 320 | } |
322 | 321 | ||
323 | /// <summary> | 322 | /// <summary> |
@@ -325,7 +324,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
325 | /// </summary> | 324 | /// </summary> |
326 | /// <param name="filename">Filename to terrain file. Type is determined by extension.</param> | 325 | /// <param name="filename">Filename to terrain file. Type is determined by extension.</param> |
327 | /// <param name="stream"></param> | 326 | /// <param name="stream"></param> |
328 | public void LoadFromStream(string filename, Vector2 displacement, Stream stream) | 327 | public void LoadFromStream(string filename, Vector3 displacement, |
328 | float radianRotation, Vector2 rotationDisplacement, Stream stream) | ||
329 | { | 329 | { |
330 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) | 330 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) |
331 | { | 331 | { |
@@ -336,7 +336,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
336 | try | 336 | try |
337 | { | 337 | { |
338 | ITerrainChannel channel = loader.Value.LoadStream(stream); | 338 | ITerrainChannel channel = loader.Value.LoadStream(stream); |
339 | MergeTerrainIntoExisting(channel, displacement); | 339 | m_channel.Merge(channel, displacement, radianRotation, rotationDisplacement); |
340 | UpdateRevertMap(); | 340 | UpdateRevertMap(); |
341 | } | 341 | } |
342 | catch (NotImplementedException) | 342 | catch (NotImplementedException) |
@@ -356,33 +356,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
356 | throw new TerrainException(String.Format("unable to load heightmap from file {0}: no loader available for that format", filename)); | 356 | throw new TerrainException(String.Format("unable to load heightmap from file {0}: no loader available for that format", filename)); |
357 | } | 357 | } |
358 | 358 | ||
359 | private void MergeTerrainIntoExisting(ITerrainChannel channel, Vector2 displacement) | ||
360 | { | ||
361 | if (displacement == Vector2.Zero) | ||
362 | { | ||
363 | // If there is no displacement, just use this channel as the new heightmap | ||
364 | m_scene.Heightmap = channel; | ||
365 | m_channel = channel; | ||
366 | } | ||
367 | else | ||
368 | { | ||
369 | // If there is a displacement, we copy the loaded heightmap into the overall region | ||
370 | for (int xx = 0; xx < channel.Width; xx++) | ||
371 | { | ||
372 | for (int yy = 0; yy < channel.Height; yy++) | ||
373 | { | ||
374 | int dispX = xx + (int)displacement.X; | ||
375 | int dispY = yy + (int)displacement.Y; | ||
376 | if (dispX >= 0 && dispX < m_channel.Width | ||
377 | && dispY >= 0 && dispY < m_channel.Height) | ||
378 | { | ||
379 | m_channel[dispX, dispY] = channel[xx, yy]; | ||
380 | } | ||
381 | } | ||
382 | } | ||
383 | } | ||
384 | } | ||
385 | |||
386 | private static Stream URIFetch(Uri uri) | 359 | private static Stream URIFetch(Uri uri) |
387 | { | 360 | { |
388 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); | 361 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs index be719ea..96c16a9 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs | |||
@@ -40,10 +40,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests | |||
40 | [Test] | 40 | [Test] |
41 | public void BrushTest() | 41 | public void BrushTest() |
42 | { | 42 | { |
43 | int midRegion = (int)Constants.RegionSize / 2; | ||
44 | |||
45 | // Create a mask that covers only the left half of the region | ||
43 | bool[,] allowMask = new bool[(int)Constants.RegionSize, 256]; | 46 | bool[,] allowMask = new bool[(int)Constants.RegionSize, 256]; |
44 | int x; | 47 | int x; |
45 | int y; | 48 | int y; |
46 | for (x = 0; x < (int)((int)Constants.RegionSize * 0.5f); x++) | 49 | for (x = 0; x < midRegion; x++) |
47 | { | 50 | { |
48 | for (y = 0; y < (int)Constants.RegionSize; y++) | 51 | for (y = 0; y < (int)Constants.RegionSize; y++) |
49 | { | 52 | { |
@@ -57,13 +60,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests | |||
57 | TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize); | 60 | TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize); |
58 | ITerrainPaintableEffect effect = new RaiseSphere(); | 61 | ITerrainPaintableEffect effect = new RaiseSphere(); |
59 | 62 | ||
60 | effect.PaintEffect(map, allowMask, (int)Constants.RegionSize * 0.5f, (int)Constants.RegionSize * 0.5f, -1.0, 2, 0.1); | 63 | effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0); |
61 | Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] > 0.0, "Raise brush should raising value at this point (127,128)."); | 64 | Assert.That(map[127, midRegion] > 0.0, "Raise brush should raising value at this point (127,128)."); |
62 | Assert.That(map[124, (int)((int)Constants.RegionSize * 0.5f)] > 0.0, "Raise brush should raising value at this point (124,128)."); | 65 | Assert.That(map[125, midRegion] > 0.0, "Raise brush should raising value at this point (124,128)."); |
63 | Assert.That(map[123, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (123,128)."); | 66 | Assert.That(map[120, midRegion] == 0.0, "Raise brush should not change value at this point (120,128)."); |
64 | Assert.That(map[128, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (128,128)."); | 67 | Assert.That(map[128, midRegion] == 0.0, "Raise brush should not change value at this point (128,128)."); |
65 | Assert.That(map[0, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (0,128)."); | 68 | Assert.That(map[0, midRegion] == 0.0, "Raise brush should not change value at this point (0,128)."); |
66 | |||
67 | // | 69 | // |
68 | // Test LowerSphere | 70 | // Test LowerSphere |
69 | // | 71 | // |
@@ -77,13 +79,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests | |||
77 | } | 79 | } |
78 | effect = new LowerSphere(); | 80 | effect = new LowerSphere(); |
79 | 81 | ||
80 | effect.PaintEffect(map, allowMask, ((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), -1.0, 2, 6.0); | 82 | effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0); |
81 | Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); | 83 | Assert.That(map[127, midRegion] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); |
82 | Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); | 84 | Assert.That(map[127, midRegion] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); |
83 | Assert.That(map[124, (int)((int)Constants.RegionSize * 0.5f)] < 1.0, "Lower brush should lowering value at this point (124,128)."); | 85 | Assert.That(map[125, midRegion] < 1.0, "Lower brush should lowering value at this point (124,128)."); |
84 | Assert.That(map[123, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (123,128)."); | 86 | Assert.That(map[120, midRegion] == 1.0, "Lower brush should not change value at this point (120,128)."); |
85 | Assert.That(map[128, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (128,128)."); | 87 | Assert.That(map[128, midRegion] == 1.0, "Lower brush should not change value at this point (128,128)."); |
86 | Assert.That(map[0, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (0,128)."); | 88 | Assert.That(map[0, midRegion] == 1.0, "Lower brush should not change value at this point (0,128)."); |
87 | } | 89 | } |
88 | 90 | ||
89 | [Test] | 91 | [Test] |
@@ -100,10 +102,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests | |||
100 | x[0, 0] -= 1.0; | 102 | x[0, 0] -= 1.0; |
101 | Assert.That(x[0, 0] == 4.0, "Terrain addition/subtraction error."); | 103 | Assert.That(x[0, 0] == 4.0, "Terrain addition/subtraction error."); |
102 | 104 | ||
103 | x[0, 0] = Math.PI; | ||
104 | double[,] doublesExport = x.GetDoubles(); | ||
105 | Assert.That(doublesExport[0, 0] == Math.PI, "Export to double[,] array not working correctly."); | ||
106 | |||
107 | x[0, 0] = 1.0; | 105 | x[0, 0] = 1.0; |
108 | float[] floatsExport = x.GetFloatsSerialised(); | 106 | float[] floatsExport = x.GetFloatsSerialised(); |
109 | Assert.That(floatsExport[0] == 1.0f, "Export to float[] not working correctly."); | 107 | Assert.That(floatsExport[0] == 1.0f, "Export to float[] not working correctly."); |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index f57be83..a3b0f39 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -899,7 +899,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
899 | finally | 899 | finally |
900 | { | 900 | { |
901 | if (os != null) | 901 | if (os != null) |
902 | os.Close(); | 902 | os.Dispose(); |
903 | } | 903 | } |
904 | 904 | ||
905 | string response_mapItems_reply = null; | 905 | string response_mapItems_reply = null; |