diff options
author | UbitUmarov | 2016-09-03 07:51:53 +0100 |
---|---|---|
committer | UbitUmarov | 2016-09-03 07:51:53 +0100 |
commit | 9aec227767cf726216514d0494f11b5d8bf5b807 (patch) | |
tree | 8f308f4c1eefa19954fc30a560ac780f8a8e916a /OpenSim/Region/CoreModules | |
parent | merge issue (diff) | |
parent | tests making sure evering thing is coerently wrong.. (diff) | |
download | opensim-SC-9aec227767cf726216514d0494f11b5d8bf5b807.zip opensim-SC-9aec227767cf726216514d0494f11b5d8bf5b807.tar.gz opensim-SC-9aec227767cf726216514d0494f11b5d8bf5b807.tar.bz2 opensim-SC-9aec227767cf726216514d0494f11b5d8bf5b807.tar.xz |
Merge branch 'master' into httptests
Diffstat (limited to 'OpenSim/Region/CoreModules')
24 files changed, 316 insertions, 294 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index 41ce860..1391013 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs | |||
@@ -124,20 +124,26 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
124 | double now = Util.GetTimeStampMS(); | 124 | double now = Util.GetTimeStampMS(); |
125 | if(now - lastTimeTick > 1750.0) | 125 | if(now - lastTimeTick > 1750.0) |
126 | { | 126 | { |
127 | inTimeTick = true; | ||
128 | |||
129 | //don't overload busy heartbeat | ||
130 | WorkManager.RunInThread( | ||
131 | delegate | ||
132 | { | ||
133 | transfersTimeTick(now); | ||
134 | expireFiles(now); | ||
135 | 127 | ||
128 | if(Transfers.Count == 0 && NewFiles.Count == 0) | ||
136 | lastTimeTick = now; | 129 | lastTimeTick = now; |
137 | inTimeTick = false; | 130 | else |
138 | }, | 131 | { |
139 | null, | 132 | inTimeTick = true; |
140 | "XferTimeTick"); | 133 | |
134 | //don't overload busy heartbeat | ||
135 | WorkManager.RunInThreadPool( | ||
136 | delegate | ||
137 | { | ||
138 | transfersTimeTick(now); | ||
139 | expireFiles(now); | ||
140 | |||
141 | lastTimeTick = now; | ||
142 | inTimeTick = false; | ||
143 | }, | ||
144 | null, | ||
145 | "XferTimeTick"); | ||
146 | } | ||
141 | } | 147 | } |
142 | } | 148 | } |
143 | Monitor.Exit(timeTickLock); | 149 | Monitor.Exit(timeTickLock); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 8f03a0a..d5c81ce 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -594,8 +594,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
594 | group.ResumeScripts(); | 594 | group.ResumeScripts(); |
595 | } | 595 | } |
596 | 596 | ||
597 | else | ||
597 | // Do this last so that event listeners have access to all the effects of the attachment | 598 | // Do this last so that event listeners have access to all the effects of the attachment |
598 | m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID); | 599 | // this can't be done when creating scripts: |
600 | // scripts do internal enqueue of attach event | ||
601 | // and not all scripts are loaded at this point | ||
602 | m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID); | ||
599 | } | 603 | } |
600 | 604 | ||
601 | return true; | 605 | return true; |
@@ -1053,7 +1057,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
1053 | if (fireDetachEvent) | 1057 | if (fireDetachEvent) |
1054 | { | 1058 | { |
1055 | m_scene.EventManager.TriggerOnAttach(grp.LocalId, grp.FromItemID, UUID.Zero); | 1059 | m_scene.EventManager.TriggerOnAttach(grp.LocalId, grp.FromItemID, UUID.Zero); |
1056 | |||
1057 | // Allow detach event time to do some work before stopping the script | 1060 | // Allow detach event time to do some work before stopping the script |
1058 | Thread.Sleep(2); | 1061 | Thread.Sleep(2); |
1059 | } | 1062 | } |
@@ -1115,13 +1118,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
1115 | 1118 | ||
1116 | SceneObjectGroup objatt; | 1119 | SceneObjectGroup objatt; |
1117 | 1120 | ||
1121 | UUID rezGroupID = sp.ControllingClient.ActiveGroupId; | ||
1122 | |||
1118 | if (itemID != UUID.Zero) | 1123 | if (itemID != UUID.Zero) |
1119 | objatt = m_invAccessModule.RezObject(sp.ControllingClient, | 1124 | objatt = m_invAccessModule.RezObject(sp.ControllingClient, |
1120 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | 1125 | itemID, rezGroupID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, |
1121 | false, false, sp.UUID, true); | 1126 | false, false, sp.UUID, true); |
1122 | else | 1127 | else |
1123 | objatt = m_invAccessModule.RezObject(sp.ControllingClient, | 1128 | objatt = m_invAccessModule.RezObject(sp.ControllingClient, |
1124 | null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | 1129 | null, rezGroupID, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, |
1125 | false, false, sp.UUID, true); | 1130 | false, false, sp.UUID, true); |
1126 | 1131 | ||
1127 | if (objatt == null) | 1132 | if (objatt == null) |
@@ -1318,7 +1323,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
1318 | AttachmentPt &= 0x7f; | 1323 | AttachmentPt &= 0x7f; |
1319 | 1324 | ||
1320 | // Calls attach with a Zero position | 1325 | // Calls attach with a Zero position |
1321 | if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, true, append)) | 1326 | SceneObjectGroup group = part.ParentGroup; |
1327 | if (AttachObject(sp, group , AttachmentPt, false, true, append)) | ||
1322 | { | 1328 | { |
1323 | if (DebugLevel > 0) | 1329 | if (DebugLevel > 0) |
1324 | m_log.Debug( | 1330 | m_log.Debug( |
@@ -1377,7 +1383,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
1377 | if (sp != null) | 1383 | if (sp != null) |
1378 | DetachSingleAttachmentToGround(sp, soLocalId); | 1384 | DetachSingleAttachmentToGround(sp, soLocalId); |
1379 | } | 1385 | } |
1380 | |||
1381 | #endregion | 1386 | #endregion |
1382 | } | 1387 | } |
1383 | } | 1388 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index a83342c..16f1952 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -55,6 +55,7 @@ using OpenSim.Tests.Common; | |||
55 | 55 | ||
56 | namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | 56 | namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests |
57 | { | 57 | { |
58 | /* | ||
58 | /// <summary> | 59 | /// <summary> |
59 | /// Attachment tests | 60 | /// Attachment tests |
60 | /// </summary> | 61 | /// </summary> |
@@ -804,7 +805,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
804 | Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0)); | 805 | Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0)); |
805 | } | 806 | } |
806 | 807 | ||
807 | /* | 808 | |
808 | [Test] | 809 | [Test] |
809 | public void TestSameSimulatorNeighbouringRegionsTeleportV1() | 810 | public void TestSameSimulatorNeighbouringRegionsTeleportV1() |
810 | { | 811 | { |
@@ -844,7 +845,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
844 | sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule()); | 845 | sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule()); |
845 | 846 | ||
846 | // FIXME: Hack - this is here temporarily to revert back to older entity transfer behaviour | 847 | // FIXME: Hack - this is here temporarily to revert back to older entity transfer behaviour |
847 | lscm.ServiceVersion = 0.1f; | 848 | //lscm.ServiceVersion = 0.1f; |
848 | 849 | ||
849 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1); | 850 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1); |
850 | 851 | ||
@@ -912,7 +913,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
912 | // Check events | 913 | // Check events |
913 | Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0)); | 914 | Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0)); |
914 | } | 915 | } |
915 | */ | 916 | |
916 | 917 | ||
917 | [Test] | 918 | [Test] |
918 | public void TestSameSimulatorNeighbouringRegionsTeleportV2() | 919 | public void TestSameSimulatorNeighbouringRegionsTeleportV2() |
@@ -1025,4 +1026,5 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
1025 | Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0)); | 1026 | Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0)); |
1026 | } | 1027 | } |
1027 | } | 1028 | } |
1029 | */ | ||
1028 | } | 1030 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 6c2cf0a..46da5a9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -324,15 +324,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
324 | if (destinationFolderID != UUID.Zero) | 324 | if (destinationFolderID != UUID.Zero) |
325 | { | 325 | { |
326 | InventoryFolderBase destinationFolder = new InventoryFolderBase(destinationFolderID, client.AgentId); | 326 | InventoryFolderBase destinationFolder = new InventoryFolderBase(destinationFolderID, client.AgentId); |
327 | if (destinationFolder == null) | ||
328 | { | ||
329 | m_log.WarnFormat( | ||
330 | "[INVENTORY TRANSFER]: TaskInventoryAccepted message from {0} in {1} specified folder {2} which does not exist", | ||
331 | client.Name, scene.Name, destinationFolderID); | ||
332 | |||
333 | return; | ||
334 | } | ||
335 | |||
336 | IInventoryService invService = scene.InventoryService; | 327 | IInventoryService invService = scene.InventoryService; |
337 | 328 | ||
338 | UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip | 329 | UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip |
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 145f3db..61835f9 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | |||
@@ -31,6 +31,7 @@ using System.Text; | |||
31 | using System.Collections; | 31 | using System.Collections; |
32 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
33 | using System.Globalization; | 33 | using System.Globalization; |
34 | using System.Linq; | ||
34 | using System.Net; | 35 | using System.Net; |
35 | using System.Net.Sockets; | 36 | using System.Net.Sockets; |
36 | using System.Reflection; | 37 | using System.Reflection; |
@@ -458,36 +459,43 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
458 | int queryclassifiedPrice, IClientAPI remoteClient) | 459 | int queryclassifiedPrice, IClientAPI remoteClient) |
459 | { | 460 | { |
460 | Scene s = (Scene)remoteClient.Scene; | 461 | Scene s = (Scene)remoteClient.Scene; |
461 | IMoneyModule money = s.RequestModuleInterface<IMoneyModule>(); | ||
462 | |||
463 | if (money != null) | ||
464 | { | ||
465 | if (!money.AmountCovered(remoteClient.AgentId, queryclassifiedPrice)) | ||
466 | { | ||
467 | remoteClient.SendAgentAlertMessage("You do not have enough money to create requested classified.", false); | ||
468 | return; | ||
469 | } | ||
470 | money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice, MoneyTransactionType.ClassifiedCharge); | ||
471 | } | ||
472 | |||
473 | UserClassifiedAdd ad = new UserClassifiedAdd(); | ||
474 | |||
475 | Vector3 pos = remoteClient.SceneAgent.AbsolutePosition; | 462 | Vector3 pos = remoteClient.SceneAgent.AbsolutePosition; |
476 | ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y); | 463 | ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y); |
477 | ScenePresence p = FindPresence(remoteClient.AgentId); | 464 | UUID creatorId = remoteClient.AgentId; |
478 | 465 | ScenePresence p = FindPresence(creatorId); | |
466 | |||
479 | string serverURI = string.Empty; | 467 | string serverURI = string.Empty; |
480 | GetUserProfileServerURI(remoteClient.AgentId, out serverURI); | 468 | GetUserProfileServerURI(remoteClient.AgentId, out serverURI); |
481 | 469 | ||
482 | if (land == null) | 470 | OSDMap parameters = new OSDMap {{"creatorId", OSD.FromUUID(creatorId)}}; |
471 | OSD Params = (OSD)parameters; | ||
472 | if (!rpc.JsonRpcRequest(ref Params, "avatarclassifiedsrequest", serverURI, UUID.Random().ToString())) | ||
483 | { | 473 | { |
484 | ad.ParcelName = string.Empty; | 474 | remoteClient.SendAgentAlertMessage("Error fetching classifieds", false); |
475 | return; | ||
485 | } | 476 | } |
486 | else | 477 | parameters = (OSDMap)Params; |
478 | OSDArray list = (OSDArray)parameters["result"]; | ||
479 | bool exists = list.Cast<OSDMap>().Where(map => map.ContainsKey("classifieduuid")) | ||
480 | .Any(map => map["classifieduuid"].AsUUID().Equals(queryclassifiedID)); | ||
481 | |||
482 | if (!exists) | ||
487 | { | 483 | { |
488 | ad.ParcelName = land.LandData.Name; | 484 | IMoneyModule money = s.RequestModuleInterface<IMoneyModule>(); |
485 | if (money != null) | ||
486 | { | ||
487 | if (!money.AmountCovered(remoteClient.AgentId, queryclassifiedPrice)) | ||
488 | { | ||
489 | remoteClient.SendAgentAlertMessage("You do not have enough money to create this classified.", false); | ||
490 | return; | ||
491 | } | ||
492 | money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice, MoneyTransactionType.ClassifiedCharge); | ||
493 | } | ||
489 | } | 494 | } |
490 | 495 | ||
496 | UserClassifiedAdd ad = new UserClassifiedAdd(); | ||
497 | |||
498 | ad.ParcelName = land == null ? string.Empty : land.LandData.Name; | ||
491 | ad.CreatorId = remoteClient.AgentId; | 499 | ad.CreatorId = remoteClient.AgentId; |
492 | ad.ClassifiedId = queryclassifiedID; | 500 | ad.ClassifiedId = queryclassifiedID; |
493 | ad.Category = Convert.ToInt32(queryCategory); | 501 | ad.Category = Convert.ToInt32(queryCategory); |
@@ -507,9 +515,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
507 | 515 | ||
508 | if(!rpc.JsonRpcRequest(ref Ad, "classified_update", serverURI, UUID.Random().ToString())) | 516 | if(!rpc.JsonRpcRequest(ref Ad, "classified_update", serverURI, UUID.Random().ToString())) |
509 | { | 517 | { |
510 | remoteClient.SendAgentAlertMessage( | 518 | remoteClient.SendAgentAlertMessage("Error updating classified", false); |
511 | "Error updating classified", false); | ||
512 | return; | ||
513 | } | 519 | } |
514 | } | 520 | } |
515 | 521 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 58f3dde..71a0e52 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -478,9 +478,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
478 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); | 478 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); |
479 | 479 | ||
480 | sp.ControllingClient.SendTeleportStart(teleportFlags); | 480 | sp.ControllingClient.SendTeleportStart(teleportFlags); |
481 | lookAt.Z = 0f; | ||
482 | |||
483 | if(Math.Abs(lookAt.X) < 0.01f && Math.Abs(lookAt.Y) < 0.01f) | ||
484 | { | ||
485 | lookAt.X = 1.0f; | ||
486 | lookAt.Y = 0; | ||
487 | } | ||
481 | 488 | ||
482 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | 489 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); |
483 | sp.TeleportFlags = (Constants.TeleportFlags)teleportFlags; | 490 | sp.TeleportFlags = (Constants.TeleportFlags)teleportFlags; |
491 | sp.RotateToLookAt(lookAt); | ||
484 | sp.Velocity = Vector3.Zero; | 492 | sp.Velocity = Vector3.Zero; |
485 | sp.Teleport(position); | 493 | sp.Teleport(position); |
486 | 494 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 00e2670..fa7803f 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -261,64 +261,60 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
261 | { | 261 | { |
262 | InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID); | 262 | InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID); |
263 | 263 | ||
264 | if (item == null) | ||
265 | { | ||
266 | m_log.ErrorFormat( | ||
267 | "[INVENTORY ACCESS MODULE]: Could not find item {0} for caps inventory update", itemID); | ||
268 | return UUID.Zero; | ||
269 | } | ||
270 | |||
264 | if (item.Owner != remoteClient.AgentId) | 271 | if (item.Owner != remoteClient.AgentId) |
265 | return UUID.Zero; | 272 | return UUID.Zero; |
266 | 273 | ||
267 | if (item != null) | 274 | if ((InventoryType)item.InvType == InventoryType.Notecard) |
268 | { | 275 | { |
269 | if ((InventoryType)item.InvType == InventoryType.Notecard) | 276 | if (!m_Scene.Permissions.CanEditNotecard(itemID, UUID.Zero, remoteClient.AgentId)) |
270 | { | 277 | { |
271 | if (!m_Scene.Permissions.CanEditNotecard(itemID, UUID.Zero, remoteClient.AgentId)) | 278 | remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false); |
272 | { | 279 | return UUID.Zero; |
273 | remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false); | ||
274 | return UUID.Zero; | ||
275 | } | ||
276 | |||
277 | remoteClient.SendAlertMessage("Notecard saved"); | ||
278 | } | 280 | } |
279 | else if ((InventoryType)item.InvType == InventoryType.LSL) | ||
280 | { | ||
281 | if (!m_Scene.Permissions.CanEditScript(itemID, UUID.Zero, remoteClient.AgentId)) | ||
282 | { | ||
283 | remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); | ||
284 | return UUID.Zero; | ||
285 | } | ||
286 | 281 | ||
287 | remoteClient.SendAlertMessage("Script saved"); | 282 | remoteClient.SendAlertMessage("Notecard saved"); |
288 | } | 283 | } |
289 | else if ((CustomInventoryType)item.InvType == CustomInventoryType.AnimationSet) | 284 | else if ((InventoryType)item.InvType == InventoryType.LSL) |
285 | { | ||
286 | if (!m_Scene.Permissions.CanEditScript(itemID, UUID.Zero, remoteClient.AgentId)) | ||
290 | { | 287 | { |
291 | AnimationSet animSet = new AnimationSet(data); | 288 | remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); |
292 | if (!animSet.Validate(x => { | 289 | return UUID.Zero; |
290 | } | ||
291 | |||
292 | remoteClient.SendAlertMessage("Script saved"); | ||
293 | } | ||
294 | else if ((CustomInventoryType)item.InvType == CustomInventoryType.AnimationSet) | ||
295 | { | ||
296 | AnimationSet animSet = new AnimationSet(data); | ||
297 | if (!animSet.Validate(x => { | ||
293 | int perms = m_Scene.InventoryService.GetAssetPermissions(remoteClient.AgentId, x); | 298 | int perms = m_Scene.InventoryService.GetAssetPermissions(remoteClient.AgentId, x); |
294 | int required = (int)(PermissionMask.Transfer | PermissionMask.Copy); | 299 | int required = (int)(PermissionMask.Transfer | PermissionMask.Copy); |
295 | if ((perms & required) != required) | 300 | if ((perms & required) != required) |
296 | return false; | 301 | return false; |
297 | return true; | 302 | return true; |
298 | })) | 303 | })) |
299 | { | 304 | { |
300 | data = animSet.ToBytes(); | 305 | data = animSet.ToBytes(); |
301 | } | ||
302 | } | 306 | } |
307 | } | ||
303 | 308 | ||
304 | AssetBase asset = | 309 | AssetBase asset = |
305 | CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data, remoteClient.AgentId.ToString()); | 310 | CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data, remoteClient.AgentId.ToString()); |
306 | item.AssetID = asset.FullID; | 311 | item.AssetID = asset.FullID; |
307 | m_Scene.AssetService.Store(asset); | 312 | m_Scene.AssetService.Store(asset); |
308 | |||
309 | m_Scene.InventoryService.UpdateItem(item); | ||
310 | 313 | ||
311 | // remoteClient.SendInventoryItemCreateUpdate(item); | 314 | m_Scene.InventoryService.UpdateItem(item); |
312 | return (asset.FullID); | ||
313 | } | ||
314 | else | ||
315 | { | ||
316 | m_log.ErrorFormat( | ||
317 | "[INVENTORY ACCESS MODULE]: Could not find item {0} for caps inventory update", | ||
318 | itemID); | ||
319 | } | ||
320 | 315 | ||
321 | return UUID.Zero; | 316 | // remoteClient.SendInventoryItemCreateUpdate(item); |
317 | return (asset.FullID); | ||
322 | } | 318 | } |
323 | 319 | ||
324 | public virtual bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset) | 320 | public virtual bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset) |
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index a686a4d..665d7f7 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs | |||
@@ -553,37 +553,44 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
553 | ManagedImage managedImage; | 553 | ManagedImage managedImage; |
554 | Image image; | 554 | Image image; |
555 | 555 | ||
556 | if (OpenJPEG.DecodeToImage(frontImage, out managedImage, out image)) | 556 | if (!OpenJPEG.DecodeToImage(frontImage, out managedImage, out image) || image == null) |
557 | return null; | ||
558 | |||
559 | Bitmap image1 = new Bitmap(image); | ||
560 | image.Dispose(); | ||
561 | |||
562 | if (!OpenJPEG.DecodeToImage(backImage, out managedImage, out image) || image == null) | ||
557 | { | 563 | { |
558 | Bitmap image1 = new Bitmap(image); | 564 | image1.Dispose(); |
565 | return null; | ||
566 | } | ||
559 | 567 | ||
560 | if (OpenJPEG.DecodeToImage(backImage, out managedImage, out image)) | 568 | Bitmap image2 = new Bitmap(image); |
561 | { | 569 | image.Dispose(); |
562 | Bitmap image2 = new Bitmap(image); | ||
563 | 570 | ||
564 | if (setNewAlpha) | 571 | if (setNewAlpha) |
565 | SetAlpha(ref image1, newAlpha); | 572 | SetAlpha(ref image1, newAlpha); |
566 | 573 | ||
567 | Bitmap joint = MergeBitMaps(image1, image2); | 574 | using(Bitmap joint = MergeBitMaps(image1, image2)) |
575 | { | ||
576 | image1.Dispose(); | ||
577 | image2.Dispose(); | ||
568 | 578 | ||
569 | byte[] result = new byte[0]; | 579 | byte[] result = new byte[0]; |
570 | 580 | ||
571 | try | 581 | try |
572 | { | 582 | { |
573 | result = OpenJPEG.EncodeFromImage(joint, true); | 583 | result = OpenJPEG.EncodeFromImage(joint, true); |
574 | } | 584 | } |
575 | catch (Exception e) | 585 | catch (Exception e) |
576 | { | 586 | { |
577 | m_log.ErrorFormat( | 587 | m_log.ErrorFormat( |
578 | "[DYNAMICTEXTUREMODULE]: OpenJpeg Encode Failed. Exception {0}{1}", | 588 | "[DYNAMICTEXTUREMODULE]: OpenJpeg Encode Failed. Exception {0}{1}", |
579 | e.Message, e.StackTrace); | 589 | e.Message, e.StackTrace); |
580 | } | ||
581 | |||
582 | return result; | ||
583 | } | 590 | } |
584 | } | ||
585 | 591 | ||
586 | return null; | 592 | return result; |
593 | } | ||
587 | } | 594 | } |
588 | 595 | ||
589 | public Bitmap MergeBitMaps(Bitmap front, Bitmap back) | 596 | public Bitmap MergeBitMaps(Bitmap front, Bitmap back) |
@@ -592,12 +599,12 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
592 | Graphics jG; | 599 | Graphics jG; |
593 | 600 | ||
594 | joint = new Bitmap(back.Width, back.Height, PixelFormat.Format32bppArgb); | 601 | joint = new Bitmap(back.Width, back.Height, PixelFormat.Format32bppArgb); |
595 | jG = Graphics.FromImage(joint); | 602 | using(jG = Graphics.FromImage(joint)) |
596 | 603 | { | |
597 | jG.DrawImage(back, 0, 0, back.Width, back.Height); | 604 | jG.DrawImage(back, 0, 0, back.Width, back.Height); |
598 | jG.DrawImage(front, 0, 0, back.Width, back.Height); | 605 | jG.DrawImage(front, 0, 0, back.Width, back.Height); |
599 | 606 | return joint; | |
600 | return joint; | 607 | } |
601 | } | 608 | } |
602 | 609 | ||
603 | private void SetAlpha(ref Bitmap b, byte alpha) | 610 | private void SetAlpha(ref Bitmap b, byte alpha) |
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 68ca2ad..483c25f 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | |||
@@ -559,9 +559,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
559 | return coll[0].GetHandle(); | 559 | return coll[0].GetHandle(); |
560 | } | 560 | } |
561 | 561 | ||
562 | if (m_curlisteners < m_maxlisteners) | 562 | lock (m_listeners) |
563 | { | 563 | { |
564 | lock (m_listeners) | 564 | if (m_curlisteners < m_maxlisteners) |
565 | { | 565 | { |
566 | int newHandle = GetNewHandle(itemID); | 566 | int newHandle = GetNewHandle(itemID); |
567 | 567 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs index 2fd21be..b632146 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs | |||
@@ -126,13 +126,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land | |||
126 | 126 | ||
127 | public LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess) | 127 | public LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess) |
128 | { | 128 | { |
129 | m_log.DebugFormat("[LAND IN CONNECTOR]: GetLandData for {0}. Count = {1}", | 129 | // m_log.DebugFormat("[LAND IN CONNECTOR]: GetLandData for {0}. Count = {1}", |
130 | regionHandle, m_Scenes.Count); | 130 | // regionHandle, m_Scenes.Count); |
131 | |||
132 | uint rx = 0, ry = 0; | ||
133 | Util.RegionHandleToWorldLoc(regionHandle, out rx, out ry); | ||
134 | |||
131 | foreach (Scene s in m_Scenes) | 135 | foreach (Scene s in m_Scenes) |
132 | { | 136 | { |
133 | if (s.RegionInfo.RegionHandle == regionHandle) | 137 | uint t = s.RegionInfo.WorldLocX; |
138 | if( rx < t) | ||
139 | continue; | ||
140 | t += s.RegionInfo.RegionSizeX; | ||
141 | if( rx >= t) | ||
142 | continue; | ||
143 | t = s.RegionInfo.WorldLocY; | ||
144 | if( ry < t) | ||
145 | continue; | ||
146 | t += s.RegionInfo.RegionSizeY; | ||
147 | if( ry < t) | ||
134 | { | 148 | { |
135 | m_log.Debug("[LAND IN CONNECTOR]: Found region to GetLandData from"); | 149 | // m_log.Debug("[LAND IN CONNECTOR]: Found region to GetLandData from"); |
136 | regionAccess = s.RegionInfo.AccessLevel; | 150 | regionAccess = s.RegionInfo.AccessLevel; |
137 | return s.GetLandData(x, y); | 151 | return s.GetLandData(x, y); |
138 | } | 152 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index ade6381..9eb41f9 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs | |||
@@ -367,12 +367,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
367 | if (String.IsNullOrEmpty(id)) | 367 | if (String.IsNullOrEmpty(id)) |
368 | return string.Empty; | 368 | return string.Empty; |
369 | 369 | ||
370 | asset.ID = id; | 370 | if(asset.ID != id) |
371 | 371 | { | |
372 | if (isHG && m_Cache != null) | 372 | asset.ID = id; |
373 | m_Cache.Cache(asset); | 373 | if (m_Cache != null) |
374 | m_Cache.Cache(asset); | ||
375 | } | ||
374 | 376 | ||
375 | return id; | 377 | return id; |
376 | } | 378 | } |
377 | 379 | ||
378 | public bool UpdateContent(string id, byte[] data) | 380 | public bool UpdateContent(string id, byte[] data) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs index 5329933..9e251aa 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs | |||
@@ -121,12 +121,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land | |||
121 | public LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess) | 121 | public LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess) |
122 | { | 122 | { |
123 | regionAccess = 2; | 123 | regionAccess = 2; |
124 | m_log.DebugFormat("[LAND CONNECTOR]: request for land data in {0} at {1}, {2}", | 124 | // m_log.DebugFormat("[LAND CONNECTOR]: request for land data in {0} at {1}, {2}", |
125 | regionHandle, x, y); | 125 | // regionHandle, x, y); |
126 | |||
127 | uint rx = 0, ry = 0; | ||
128 | Util.RegionHandleToWorldLoc(regionHandle, out rx, out ry); | ||
126 | 129 | ||
127 | foreach (Scene s in m_Scenes) | 130 | foreach (Scene s in m_Scenes) |
128 | { | 131 | { |
129 | if (s.RegionInfo.RegionHandle == regionHandle) | 132 | uint t = s.RegionInfo.WorldLocX; |
133 | if( rx < t) | ||
134 | continue; | ||
135 | t += s.RegionInfo.RegionSizeX; | ||
136 | if( rx >= t) | ||
137 | continue; | ||
138 | t = s.RegionInfo.WorldLocY; | ||
139 | if( ry < t) | ||
140 | continue; | ||
141 | t += s.RegionInfo.RegionSizeY; | ||
142 | if( ry < t) | ||
130 | { | 143 | { |
131 | LandData land = s.GetLandData(x, y); | 144 | LandData land = s.GetLandData(x, y); |
132 | regionAccess = s.RegionInfo.AccessLevel; | 145 | regionAccess = s.RegionInfo.AccessLevel; |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 839072e..2d590fc 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -1193,6 +1193,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
1193 | } | 1193 | } |
1194 | 1194 | ||
1195 | ControlFileLoaded = true; | 1195 | ControlFileLoaded = true; |
1196 | if(xtr != null) | ||
1197 | xtr.Close(); | ||
1196 | 1198 | ||
1197 | return dearchivedScenes; | 1199 | return dearchivedScenes; |
1198 | } | 1200 | } |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 56d41a8..425562f 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -1229,15 +1229,24 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1229 | } | 1229 | } |
1230 | terr.SaveToFile(Util.dataDir() + "/terrain.raw"); | 1230 | terr.SaveToFile(Util.dataDir() + "/terrain.raw"); |
1231 | 1231 | ||
1232 | FileStream input = new FileStream(Util.dataDir() + "/terrain.raw", FileMode.Open); | 1232 | byte[] bdata; |
1233 | byte[] bdata = new byte[input.Length]; | 1233 | using(FileStream input = new FileStream(Util.dataDir() + "/terrain.raw",FileMode.Open)) |
1234 | input.Read(bdata, 0, (int)input.Length); | 1234 | { |
1235 | bdata = new byte[input.Length]; | ||
1236 | input.Read(bdata, 0, (int)input.Length); | ||
1237 | } | ||
1238 | if(bdata == null || bdata.Length == 0) | ||
1239 | { | ||
1240 | remote_client.SendAlertMessage("Terrain error"); | ||
1241 | return; | ||
1242 | } | ||
1243 | |||
1235 | remote_client.SendAlertMessage("Terrain file written, starting download..."); | 1244 | remote_client.SendAlertMessage("Terrain file written, starting download..."); |
1236 | Scene.XferManager.AddNewFile("terrain.raw", bdata); | 1245 | string xfername = (UUID.Random()).ToString(); |
1246 | Scene.XferManager.AddNewFile(xfername, bdata); | ||
1237 | 1247 | ||
1238 | m_log.DebugFormat("[CLIENT]: Sending terrain for region {0} to {1}", Scene.Name, remote_client.Name); | 1248 | m_log.DebugFormat("[CLIENT]: Sending terrain for region {0} to {1}", Scene.Name, remote_client.Name); |
1239 | 1249 | remote_client.SendInitiateDownload(xfername, clientFileName); | |
1240 | remote_client.SendInitiateDownload("terrain.raw", clientFileName); | ||
1241 | } | 1250 | } |
1242 | } | 1251 | } |
1243 | 1252 | ||
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index 5155804..1f2b7c4 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | |||
@@ -382,7 +382,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
382 | 382 | ||
383 | Vector3 pos = part.GetWorldPosition(); | 383 | Vector3 pos = part.GetWorldPosition(); |
384 | 384 | ||
385 | // skip prim outside of retion | 385 | // skip prim outside of region |
386 | if (!m_scene.PositionIsInCurrentRegion(pos)) | 386 | if (!m_scene.PositionIsInCurrentRegion(pos)) |
387 | continue; | 387 | continue; |
388 | 388 | ||
@@ -406,12 +406,13 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
406 | { | 406 | { |
407 | // Translate scale by rotation so scale is represented properly when object is rotated | 407 | // Translate scale by rotation so scale is represented properly when object is rotated |
408 | Vector3 lscale = new Vector3(part.Shape.Scale.X, part.Shape.Scale.Y, part.Shape.Scale.Z); | 408 | Vector3 lscale = new Vector3(part.Shape.Scale.X, part.Shape.Scale.Y, part.Shape.Scale.Z); |
409 | lscale *= 0.5f; | ||
410 | |||
409 | Vector3 scale = new Vector3(); | 411 | Vector3 scale = new Vector3(); |
410 | Vector3 tScale = new Vector3(); | 412 | Vector3 tScale = new Vector3(); |
411 | Vector3 axPos = new Vector3(pos.X, pos.Y, pos.Z); | 413 | Vector3 axPos = new Vector3(pos.X, pos.Y, pos.Z); |
412 | 414 | ||
413 | Quaternion llrot = part.GetWorldRotation(); | 415 | Quaternion rot = part.GetWorldRotation(); |
414 | Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z); | ||
415 | scale = lscale * rot; | 416 | scale = lscale * rot; |
416 | 417 | ||
417 | // negative scales don't work in this situation | 418 | // negative scales don't work in this situation |
@@ -470,7 +471,6 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
470 | 471 | ||
471 | tScale = new Vector3(lscale.X, -lscale.Y, -lscale.Z); | 472 | tScale = new Vector3(lscale.X, -lscale.Y, -lscale.Z); |
472 | scale = ((tScale * rot)); | 473 | scale = ((tScale * rot)); |
473 | |||
474 | vertexes[2] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z))); | 474 | vertexes[2] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z))); |
475 | 475 | ||
476 | //vertexes[2].x = pos.X + vertexes[2].x; | 476 | //vertexes[2].x = pos.X + vertexes[2].x; |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/BMP.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/BMP.cs index fb57c82..ec2d085 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/BMP.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/BMP.cs | |||
@@ -47,9 +47,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
47 | /// <param name="map">The terrain channel being saved</param> | 47 | /// <param name="map">The terrain channel being saved</param> |
48 | public override void SaveFile(string filename, ITerrainChannel map) | 48 | public override void SaveFile(string filename, ITerrainChannel map) |
49 | { | 49 | { |
50 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 50 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
51 | 51 | colours.Save(filename,ImageFormat.Bmp); | |
52 | colours.Save(filename, ImageFormat.Bmp); | ||
53 | } | 52 | } |
54 | 53 | ||
55 | /// <summary> | 54 | /// <summary> |
@@ -59,9 +58,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
59 | /// <param name="map">The terrain channel being saved</param> | 58 | /// <param name="map">The terrain channel being saved</param> |
60 | public override void SaveStream(Stream stream, ITerrainChannel map) | 59 | public override void SaveStream(Stream stream, ITerrainChannel map) |
61 | { | 60 | { |
62 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 61 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
63 | 62 | colours.Save(stream,ImageFormat.Bmp); | |
64 | colours.Save(stream, ImageFormat.Png); | ||
65 | } | 63 | } |
66 | 64 | ||
67 | /// <summary> | 65 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GIF.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GIF.cs index 79cc50b..3843708 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GIF.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GIF.cs | |||
@@ -36,9 +36,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
36 | { | 36 | { |
37 | public override void SaveFile(string filename, ITerrainChannel map) | 37 | public override void SaveFile(string filename, ITerrainChannel map) |
38 | { | 38 | { |
39 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 39 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
40 | 40 | colours.Save(filename,ImageFormat.Gif); | |
41 | colours.Save(filename, ImageFormat.Gif); | ||
42 | } | 41 | } |
43 | 42 | ||
44 | /// <summary> | 43 | /// <summary> |
@@ -48,9 +47,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
48 | /// <param name="map">The terrain channel being saved</param> | 47 | /// <param name="map">The terrain channel being saved</param> |
49 | public override void SaveStream(Stream stream, ITerrainChannel map) | 48 | public override void SaveStream(Stream stream, ITerrainChannel map) |
50 | { | 49 | { |
51 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 50 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
52 | 51 | colours.Save(stream,ImageFormat.Gif); | |
53 | colours.Save(stream, ImageFormat.Gif); | ||
54 | } | 52 | } |
55 | 53 | ||
56 | public override string ToString() | 54 | public override string ToString() |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs index e8c719a..1e67f72 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
59 | /// <returns>A terrain channel generated from the image.</returns> | 59 | /// <returns>A terrain channel generated from the image.</returns> |
60 | public virtual ITerrainChannel LoadFile(string filename) | 60 | public virtual ITerrainChannel LoadFile(string filename) |
61 | { | 61 | { |
62 | using (Bitmap b = new Bitmap(filename)) | 62 | using(Bitmap b = new Bitmap(filename)) |
63 | return LoadBitmap(b); | 63 | return LoadBitmap(b); |
64 | } | 64 | } |
65 | 65 | ||
@@ -111,9 +111,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
111 | /// <param name="map">The terrain channel being saved</param> | 111 | /// <param name="map">The terrain channel being saved</param> |
112 | public virtual void SaveFile(string filename, ITerrainChannel map) | 112 | public virtual void SaveFile(string filename, ITerrainChannel map) |
113 | { | 113 | { |
114 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 114 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
115 | 115 | colours.Save(filename,ImageFormat.Png); | |
116 | colours.Save(filename, ImageFormat.Png); | ||
117 | } | 116 | } |
118 | 117 | ||
119 | /// <summary> | 118 | /// <summary> |
@@ -123,9 +122,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
123 | /// <param name="map">The terrain channel being saved</param> | 122 | /// <param name="map">The terrain channel being saved</param> |
124 | public virtual void SaveStream(Stream stream, ITerrainChannel map) | 123 | public virtual void SaveStream(Stream stream, ITerrainChannel map) |
125 | { | 124 | { |
126 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 125 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
127 | 126 | colours.Save(stream,ImageFormat.Png); | |
128 | colours.Save(stream, ImageFormat.Png); | ||
129 | } | 127 | } |
130 | 128 | ||
131 | public virtual void SaveFile(ITerrainChannel m_channel, string filename, | 129 | public virtual void SaveFile(ITerrainChannel m_channel, string filename, |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs index 9cc767a..36c2bbf 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs | |||
@@ -59,9 +59,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
59 | 59 | ||
60 | public void SaveFile(string filename, ITerrainChannel map) | 60 | public void SaveFile(string filename, ITerrainChannel map) |
61 | { | 61 | { |
62 | Bitmap colours = CreateBitmapFromMap(map); | 62 | using(Bitmap colours = CreateBitmapFromMap(map)) |
63 | 63 | colours.Save(filename,ImageFormat.Jpeg); | |
64 | colours.Save(filename, ImageFormat.Jpeg); | ||
65 | } | 64 | } |
66 | 65 | ||
67 | /// <summary> | 66 | /// <summary> |
@@ -71,9 +70,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
71 | /// <param name="map">The terrain channel being saved</param> | 70 | /// <param name="map">The terrain channel being saved</param> |
72 | public void SaveStream(Stream stream, ITerrainChannel map) | 71 | public void SaveStream(Stream stream, ITerrainChannel map) |
73 | { | 72 | { |
74 | Bitmap colours = CreateBitmapFromMap(map); | 73 | using(Bitmap colours = CreateBitmapFromMap(map)) |
75 | 74 | colours.Save(stream,ImageFormat.Jpeg); | |
76 | colours.Save(stream, ImageFormat.Jpeg); | ||
77 | } | 75 | } |
78 | 76 | ||
79 | public virtual void SaveFile(ITerrainChannel m_channel, string filename, | 77 | public virtual void SaveFile(ITerrainChannel m_channel, string filename, |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/PNG.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/PNG.cs index c5c12ae..8ea8e9d 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/PNG.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/PNG.cs | |||
@@ -36,9 +36,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
36 | { | 36 | { |
37 | public override void SaveFile(string filename, ITerrainChannel map) | 37 | public override void SaveFile(string filename, ITerrainChannel map) |
38 | { | 38 | { |
39 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 39 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
40 | 40 | colours.Save(filename,ImageFormat.Png); | |
41 | colours.Save(filename, ImageFormat.Png); | ||
42 | } | 41 | } |
43 | 42 | ||
44 | /// <summary> | 43 | /// <summary> |
@@ -48,9 +47,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
48 | /// <param name="map">The terrain channel being saved</param> | 47 | /// <param name="map">The terrain channel being saved</param> |
49 | public override void SaveStream(Stream stream, ITerrainChannel map) | 48 | public override void SaveStream(Stream stream, ITerrainChannel map) |
50 | { | 49 | { |
51 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 50 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
52 | 51 | colours.Save(stream,ImageFormat.Png); | |
53 | colours.Save(stream, ImageFormat.Png); | ||
54 | } | 52 | } |
55 | 53 | ||
56 | public override string ToString() | 54 | public override string ToString() |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs index b416b82..d103a6f 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/TIFF.cs | |||
@@ -36,9 +36,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
36 | { | 36 | { |
37 | public override void SaveFile(string filename, ITerrainChannel map) | 37 | public override void SaveFile(string filename, ITerrainChannel map) |
38 | { | 38 | { |
39 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 39 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
40 | 40 | colours.Save(filename,ImageFormat.Tiff); | |
41 | colours.Save(filename, ImageFormat.Tiff); | ||
42 | } | 41 | } |
43 | 42 | ||
44 | /// <summary> | 43 | /// <summary> |
@@ -48,9 +47,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
48 | /// <param name="map">The terrain channel being saved</param> | 47 | /// <param name="map">The terrain channel being saved</param> |
49 | public override void SaveStream(Stream stream, ITerrainChannel map) | 48 | public override void SaveStream(Stream stream, ITerrainChannel map) |
50 | { | 49 | { |
51 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 50 | using(Bitmap colours = CreateGrayscaleBitmapFromMap(map)) |
52 | 51 | colours.Save(stream,ImageFormat.Tiff); | |
53 | colours.Save(stream, ImageFormat.Tiff); | ||
54 | } | 52 | } |
55 | 53 | ||
56 | public override string ToString() | 54 | public override string ToString() |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 275aa2a..05d18da 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -963,6 +963,27 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
963 | return wasLimited; | 963 | return wasLimited; |
964 | } | 964 | } |
965 | 965 | ||
966 | private bool EnforceEstateLimits(int startX, int startY, int endX, int endY) | ||
967 | { | ||
968 | TerrainData terrData = m_channel.GetTerrainData(); | ||
969 | |||
970 | bool wasLimited = false; | ||
971 | for (int x = startX; x <= endX; x += Constants.TerrainPatchSize) | ||
972 | { | ||
973 | for (int y = startX; y <= endY; y += Constants.TerrainPatchSize) | ||
974 | { | ||
975 | if (terrData.IsTaintedAt(x, y, false /* clearOnTest */)) | ||
976 | { | ||
977 | // If we should respect the estate settings then | ||
978 | // fixup and height deltas that don't respect them. | ||
979 | // Note that LimitChannelChanges() modifies the TerrainChannel with the limited height values. | ||
980 | wasLimited |= LimitChannelChanges(terrData, x, y); | ||
981 | } | ||
982 | } | ||
983 | } | ||
984 | return wasLimited; | ||
985 | } | ||
986 | |||
966 | /// <summary> | 987 | /// <summary> |
967 | /// Checks to see height deltas in the tainted terrain patch at xStart ,yStart | 988 | /// Checks to see height deltas in the tainted terrain patch at xStart ,yStart |
968 | /// are all within the current estate limits | 989 | /// are all within the current estate limits |
@@ -1341,7 +1362,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1341 | 1362 | ||
1342 | //block changes outside estate limits | 1363 | //block changes outside estate limits |
1343 | if (!god) | 1364 | if (!god) |
1344 | EnforceEstateLimits(); | 1365 | EnforceEstateLimits(startX, endX, startY, endY); |
1345 | } | 1366 | } |
1346 | } | 1367 | } |
1347 | else | 1368 | else |
@@ -1404,7 +1425,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1404 | 1425 | ||
1405 | //block changes outside estate limits | 1426 | //block changes outside estate limits |
1406 | if (!god) | 1427 | if (!god) |
1407 | EnforceEstateLimits(); | 1428 | EnforceEstateLimits(startX, endX, startY, endY); |
1408 | } | 1429 | } |
1409 | } | 1430 | } |
1410 | else | 1431 | else |
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index 443eee1..cb37067 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs | |||
@@ -35,7 +35,7 @@ using System.Reflection; | |||
35 | using CSJ2K; | 35 | using CSJ2K; |
36 | using Nini.Config; | 36 | using Nini.Config; |
37 | using log4net; | 37 | using log4net; |
38 | using Rednettle.Warp3D; | 38 | using Warp3D; |
39 | using Mono.Addins; | 39 | using Mono.Addins; |
40 | 40 | ||
41 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
@@ -76,11 +76,10 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
76 | private bool m_texturePrims = true; // true if should texture the rendered prims | 76 | private bool m_texturePrims = true; // true if should texture the rendered prims |
77 | private float m_texturePrimSize = 48f; // size of prim before we consider texturing it | 77 | private float m_texturePrimSize = 48f; // size of prim before we consider texturing it |
78 | private bool m_renderMeshes = false; // true if to render meshes rather than just bounding boxes | 78 | private bool m_renderMeshes = false; // true if to render meshes rather than just bounding boxes |
79 | private bool m_useAntiAliasing = false; // true if to anti-alias the rendered image | ||
80 | 79 | ||
81 | private bool m_Enabled = false; | 80 | private bool m_Enabled = false; |
82 | 81 | ||
83 | private Bitmap lastImage = null; | 82 | // private Bitmap lastImage = null; |
84 | private DateTime lastImageTime = DateTime.MinValue; | 83 | private DateTime lastImageTime = DateTime.MinValue; |
85 | 84 | ||
86 | #region Region Module interface | 85 | #region Region Module interface |
@@ -107,10 +106,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
107 | = Util.GetConfigVarFromSections<float>(m_config, "TexturePrimSize", configSections, m_texturePrimSize); | 106 | = Util.GetConfigVarFromSections<float>(m_config, "TexturePrimSize", configSections, m_texturePrimSize); |
108 | m_renderMeshes | 107 | m_renderMeshes |
109 | = Util.GetConfigVarFromSections<bool>(m_config, "RenderMeshes", configSections, m_renderMeshes); | 108 | = Util.GetConfigVarFromSections<bool>(m_config, "RenderMeshes", configSections, m_renderMeshes); |
110 | m_useAntiAliasing | 109 | } |
111 | = Util.GetConfigVarFromSections<bool>(m_config, "UseAntiAliasing", configSections, m_useAntiAliasing); | ||
112 | |||
113 | } | ||
114 | 110 | ||
115 | public void AddRegion(Scene scene) | 111 | public void AddRegion(Scene scene) |
116 | { | 112 | { |
@@ -201,21 +197,14 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
201 | int width = viewport.Width; | 197 | int width = viewport.Width; |
202 | int height = viewport.Height; | 198 | int height = viewport.Height; |
203 | 199 | ||
204 | if (m_useAntiAliasing) | ||
205 | { | ||
206 | width *= 2; | ||
207 | height *= 2; | ||
208 | } | ||
209 | |||
210 | WarpRenderer renderer = new WarpRenderer(); | 200 | WarpRenderer renderer = new WarpRenderer(); |
211 | 201 | ||
212 | renderer.CreateScene(width, height); | 202 | if(!renderer.CreateScene(width, height)) |
213 | renderer.Scene.autoCalcNormals = false; | 203 | return new Bitmap(width,height); |
214 | 204 | ||
215 | #region Camera | 205 | #region Camera |
216 | 206 | ||
217 | warp_Vector pos = ConvertVector(viewport.Position); | 207 | warp_Vector pos = ConvertVector(viewport.Position); |
218 | pos.z -= 0.001f; // Works around an issue with the Warp3D camera | ||
219 | warp_Vector lookat = warp_Vector.add(ConvertVector(viewport.Position), ConvertVector(viewport.LookDirection)); | 208 | warp_Vector lookat = warp_Vector.add(ConvertVector(viewport.Position), ConvertVector(viewport.LookDirection)); |
220 | 209 | ||
221 | renderer.Scene.defaultCamera.setPos(pos); | 210 | renderer.Scene.defaultCamera.setPos(pos); |
@@ -223,9 +212,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
223 | 212 | ||
224 | if (viewport.Orthographic) | 213 | if (viewport.Orthographic) |
225 | { | 214 | { |
226 | renderer.Scene.defaultCamera.isOrthographic = true; | 215 | renderer.Scene.defaultCamera.setOrthographic(true,viewport.OrthoWindowWidth, viewport.OrthoWindowHeight); |
227 | renderer.Scene.defaultCamera.orthoViewWidth = viewport.OrthoWindowWidth; | ||
228 | renderer.Scene.defaultCamera.orthoViewHeight = viewport.OrthoWindowHeight; | ||
229 | } | 216 | } |
230 | else | 217 | else |
231 | { | 218 | { |
@@ -247,24 +234,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
247 | renderer.Render(); | 234 | renderer.Render(); |
248 | Bitmap bitmap = renderer.Scene.getImage(); | 235 | Bitmap bitmap = renderer.Scene.getImage(); |
249 | 236 | ||
250 | if (m_useAntiAliasing) | 237 | renderer.Scene.destroy(); |
251 | { | 238 | renderer.Reset(); |
252 | using (Bitmap origBitmap = bitmap) | ||
253 | bitmap = ImageUtils.ResizeImage(origBitmap, viewport.Width, viewport.Height); | ||
254 | } | ||
255 | |||
256 | // XXX: It shouldn't really be necesary to force a GC here as one should occur anyway pretty shortly | ||
257 | // afterwards. It's generally regarded as a bad idea to manually GC. If Warp3D is using lots of memory | ||
258 | // then this may be some issue with the Warp3D code itself, though it's also quite possible that generating | ||
259 | // this map tile simply takes a lot of memory. | ||
260 | foreach (var o in renderer.Scene.objectData.Values) | ||
261 | { | ||
262 | warp_Object obj = (warp_Object)o; | ||
263 | obj.vertexData = null; | ||
264 | obj.triangleData = null; | ||
265 | } | ||
266 | |||
267 | renderer.Scene.removeAllObjects(); | ||
268 | renderer = null; | 239 | renderer = null; |
269 | viewport = null; | 240 | viewport = null; |
270 | 241 | ||
@@ -301,9 +272,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
301 | float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; | 272 | float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; |
302 | 273 | ||
303 | renderer.AddPlane("Water", m_scene.RegionInfo.RegionSizeX * 0.5f); | 274 | renderer.AddPlane("Water", m_scene.RegionInfo.RegionSizeX * 0.5f); |
304 | renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX / 2 - 0.5f, | 275 | renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX * 0.5f - 0.5f, |
305 | waterHeight, | 276 | waterHeight, |
306 | m_scene.RegionInfo.RegionSizeY / 2 - 0.5f); | 277 | m_scene.RegionInfo.RegionSizeY * 0.5f - 0.5f); |
307 | 278 | ||
308 | warp_Material waterColorMaterial = new warp_Material(ConvertColor(WATER_COLOR)); | 279 | warp_Material waterColorMaterial = new warp_Material(ConvertColor(WATER_COLOR)); |
309 | waterColorMaterial.setReflectivity(0); // match water color with standard map module thanks lkalif | 280 | waterColorMaterial.setReflectivity(0); // match water color with standard map module thanks lkalif |
@@ -319,53 +290,53 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
319 | { | 290 | { |
320 | ITerrainChannel terrain = m_scene.Heightmap; | 291 | ITerrainChannel terrain = m_scene.Heightmap; |
321 | 292 | ||
293 | float regionsx = m_scene.RegionInfo.RegionSizeX; | ||
294 | float regionsy = m_scene.RegionInfo.RegionSizeY; | ||
295 | |||
322 | // 'diff' is the difference in scale between the real region size and the size of terrain we're buiding | 296 | // 'diff' is the difference in scale between the real region size and the size of terrain we're buiding |
323 | float diff = (float)m_scene.RegionInfo.RegionSizeX / 256f; | 297 | float diff = regionsx / 256f; |
324 | 298 | ||
325 | warp_Object obj = new warp_Object(256 * 256, 255 * 255 * 2); | 299 | int npointsx =(int)(regionsx / diff); |
300 | int npointsy =(int)(regionsy / diff); | ||
301 | |||
302 | float invsx = 1.0f / regionsx; | ||
303 | float invsy = 1.0f / (float)m_scene.RegionInfo.RegionSizeY; | ||
326 | 304 | ||
327 | // Create all the vertices for the terrain | 305 | // Create all the vertices for the terrain |
328 | for (float y = 0; y < m_scene.RegionInfo.RegionSizeY; y += diff) | 306 | warp_Object obj = new warp_Object(); |
307 | for (float y = 0; y < regionsy; y += diff) | ||
329 | { | 308 | { |
330 | for (float x = 0; x < m_scene.RegionInfo.RegionSizeX; x += diff) | 309 | for (float x = 0; x < regionsx; x += diff) |
331 | { | 310 | { |
332 | warp_Vector pos = ConvertVector(x, y, (float)terrain[(int)x, (int)y]); | 311 | warp_Vector pos = ConvertVector(x , y , (float)terrain[(int)x, (int)y]); |
333 | obj.addVertex(new warp_Vertex(pos, | 312 | obj.addVertex(new warp_Vertex(pos, x * invsx, 1.0f - y * invsy)); |
334 | x / (float)m_scene.RegionInfo.RegionSizeX, | ||
335 | (((float)m_scene.RegionInfo.RegionSizeY) - y) / m_scene.RegionInfo.RegionSizeY)); | ||
336 | } | 313 | } |
337 | } | 314 | } |
338 | 315 | ||
339 | // Now that we have all the vertices, make another pass and create | 316 | // Now that we have all the vertices, make another pass and |
340 | // the normals for each of the surface triangles and | 317 | // create the list of triangle indices. |
341 | // create the list of triangle indices. | 318 | float invdiff = 1.0f / diff; |
342 | for (float y = 0; y < m_scene.RegionInfo.RegionSizeY; y += diff) | 319 | int limx = npointsx - 1; |
320 | int limy = npointsy - 1; | ||
321 | for (float y = 0; y < regionsy; y += diff) | ||
343 | { | 322 | { |
344 | for (float x = 0; x < m_scene.RegionInfo.RegionSizeX; x += diff) | 323 | for (float x = 0; x < regionsx; x += diff) |
345 | { | 324 | { |
346 | float newX = x / diff; | 325 | float newX = x * invdiff; |
347 | float newY = y / diff; | 326 | float newY = y * invdiff; |
348 | if (newX < 255 && newY < 255) | 327 | if (newX < limx && newY < limy) |
349 | { | 328 | { |
350 | int v = (int)newY * 256 + (int)newX; | 329 | int v = (int)newY * npointsx + (int)newX; |
351 | |||
352 | // Normal for a triangle made up of three adjacent vertices | ||
353 | Vector3 v1 = new Vector3(newX, newY, (float)terrain[(int)x, (int)y]); | ||
354 | Vector3 v2 = new Vector3(newX + 1, newY, (float)terrain[(int)(x + 1), (int)y]); | ||
355 | Vector3 v3 = new Vector3(newX, newY + 1, (float)terrain[(int)x, ((int)(y + 1))]); | ||
356 | warp_Vector norm = ConvertVector(SurfaceNormal(v1, v2, v3)); | ||
357 | norm = norm.reverse(); | ||
358 | obj.vertex(v).n = norm; | ||
359 | 330 | ||
360 | // Make two triangles for each of the squares in the grid of vertices | 331 | // Make two triangles for each of the squares in the grid of vertices |
361 | obj.addTriangle( | 332 | obj.addTriangle( |
362 | v, | 333 | v, |
363 | v + 1, | 334 | v + 1, |
364 | v + 256); | 335 | v + npointsx); |
365 | 336 | ||
366 | obj.addTriangle( | 337 | obj.addTriangle( |
367 | v + 256 + 1, | 338 | v + npointsx + 1, |
368 | v + 256, | 339 | v + npointsx, |
369 | v + 1); | 340 | v + 1); |
370 | } | 341 | } |
371 | } | 342 | } |
@@ -398,14 +369,10 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
398 | Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out globalX, out globalY); | 369 | Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out globalX, out globalY); |
399 | 370 | ||
400 | warp_Texture texture; | 371 | warp_Texture texture; |
401 | using ( | 372 | using (Bitmap image = TerrainSplat.Splat( |
402 | Bitmap image | ||
403 | = TerrainSplat.Splat( | ||
404 | terrain, textureIDs, startHeights, heightRanges, | 373 | terrain, textureIDs, startHeights, heightRanges, |
405 | new Vector3d(globalX, globalY, 0.0), m_scene.AssetService, textureTerrain)) | 374 | new Vector3d(globalX, globalY, 0.0), m_scene.AssetService, textureTerrain)) |
406 | { | ||
407 | texture = new warp_Texture(image); | 375 | texture = new warp_Texture(image); |
408 | } | ||
409 | 376 | ||
410 | warp_Material material = new warp_Material(texture); | 377 | warp_Material material = new warp_Material(texture); |
411 | material.setReflectivity(50); | 378 | material.setReflectivity(50); |
@@ -431,11 +398,13 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
431 | private void CreatePrim(WarpRenderer renderer, SceneObjectPart prim, | 398 | private void CreatePrim(WarpRenderer renderer, SceneObjectPart prim, |
432 | bool useTextures) | 399 | bool useTextures) |
433 | { | 400 | { |
434 | const float MIN_SIZE = 2f; | 401 | const float MIN_SIZE_SQUARE = 4f; |
435 | 402 | ||
436 | if ((PCode)prim.Shape.PCode != PCode.Prim) | 403 | if ((PCode)prim.Shape.PCode != PCode.Prim) |
437 | return; | 404 | return; |
438 | if (prim.Scale.LengthSquared() < MIN_SIZE * MIN_SIZE) | 405 | float primScaleLenSquared = prim.Scale.LengthSquared(); |
406 | |||
407 | if (primScaleLenSquared < MIN_SIZE_SQUARE) | ||
439 | return; | 408 | return; |
440 | 409 | ||
441 | FacetedMesh renderMesh = null; | 410 | FacetedMesh renderMesh = null; |
@@ -459,13 +428,13 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
459 | else // It's sculptie | 428 | else // It's sculptie |
460 | { | 429 | { |
461 | IJ2KDecoder imgDecoder = m_scene.RequestModuleInterface<IJ2KDecoder>(); | 430 | IJ2KDecoder imgDecoder = m_scene.RequestModuleInterface<IJ2KDecoder>(); |
462 | if (imgDecoder != null) | 431 | if(imgDecoder != null) |
463 | { | 432 | { |
464 | Image sculpt = imgDecoder.DecodeToImage(sculptAsset); | 433 | Image sculpt = imgDecoder.DecodeToImage(sculptAsset); |
465 | if (sculpt != null) | 434 | if(sculpt != null) |
466 | { | 435 | { |
467 | renderMesh = m_primMesher.GenerateFacetedSculptMesh(omvPrim, (Bitmap)sculpt, | 436 | renderMesh = m_primMesher.GenerateFacetedSculptMesh(omvPrim,(Bitmap)sculpt, |
468 | DetailLevel.Medium); | 437 | DetailLevel.Medium); |
469 | sculpt.Dispose(); | 438 | sculpt.Dispose(); |
470 | } | 439 | } |
471 | } | 440 | } |
@@ -483,20 +452,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
483 | if (renderMesh == null) | 452 | if (renderMesh == null) |
484 | return; | 453 | return; |
485 | 454 | ||
486 | warp_Vector primPos = ConvertVector(prim.GetWorldPosition()); | ||
487 | warp_Quaternion primRot = ConvertQuaternion(prim.RotationOffset); | ||
488 | |||
489 | warp_Matrix m = warp_Matrix.quaternionMatrix(primRot); | ||
490 | |||
491 | if (prim.ParentID != 0) | ||
492 | { | ||
493 | SceneObjectGroup group = m_scene.SceneGraph.GetGroupByPrim(prim.LocalId); | ||
494 | if (group != null) | ||
495 | m.transform(warp_Matrix.quaternionMatrix(ConvertQuaternion(group.RootPart.RotationOffset))); | ||
496 | } | ||
497 | |||
498 | warp_Vector primScale = ConvertVector(prim.Scale); | ||
499 | |||
500 | string primID = prim.UUID.ToString(); | 455 | string primID = prim.UUID.ToString(); |
501 | 456 | ||
502 | // Create the prim faces | 457 | // Create the prim faces |
@@ -504,27 +459,18 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
504 | for (int i = 0; i < renderMesh.Faces.Count; i++) | 459 | for (int i = 0; i < renderMesh.Faces.Count; i++) |
505 | { | 460 | { |
506 | Face face = renderMesh.Faces[i]; | 461 | Face face = renderMesh.Faces[i]; |
507 | string meshName = primID + "-Face-" + i.ToString(); | 462 | string meshName = primID + i.ToString(); |
508 | 463 | ||
509 | // Avoid adding duplicate meshes to the scene | 464 | // Avoid adding duplicate meshes to the scene |
510 | if (renderer.Scene.objectData.ContainsKey(meshName)) | 465 | if (renderer.Scene.objectData.ContainsKey(meshName)) |
511 | { | ||
512 | continue; | 466 | continue; |
513 | } | ||
514 | |||
515 | warp_Object faceObj = new warp_Object(face.Vertices.Count, face.Indices.Count / 3); | ||
516 | 467 | ||
468 | warp_Object faceObj = new warp_Object(); | ||
517 | for (int j = 0; j < face.Vertices.Count; j++) | 469 | for (int j = 0; j < face.Vertices.Count; j++) |
518 | { | 470 | { |
519 | Vertex v = face.Vertices[j]; | 471 | Vertex v = face.Vertices[j]; |
520 | |||
521 | warp_Vector pos = ConvertVector(v.Position); | 472 | warp_Vector pos = ConvertVector(v.Position); |
522 | warp_Vector norm = ConvertVector(v.Normal); | 473 | warp_Vertex vert = new warp_Vertex(pos, v.TexCoord.X, v.TexCoord.Y); |
523 | |||
524 | if (prim.Shape.SculptTexture == UUID.Zero) | ||
525 | norm = norm.reverse(); | ||
526 | warp_Vertex vert = new warp_Vertex(pos, norm, v.TexCoord.X, v.TexCoord.Y); | ||
527 | |||
528 | faceObj.addVertex(vert); | 474 | faceObj.addVertex(vert); |
529 | } | 475 | } |
530 | 476 | ||
@@ -539,17 +485,19 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
539 | Primitive.TextureEntryFace teFace = prim.Shape.Textures.GetFace((uint)i); | 485 | Primitive.TextureEntryFace teFace = prim.Shape.Textures.GetFace((uint)i); |
540 | Color4 faceColor = GetFaceColor(teFace); | 486 | Color4 faceColor = GetFaceColor(teFace); |
541 | string materialName = String.Empty; | 487 | string materialName = String.Empty; |
542 | if (m_texturePrims && prim.Scale.LengthSquared() > m_texturePrimSize*m_texturePrimSize) | 488 | if (m_texturePrims && primScaleLenSquared > m_texturePrimSize*m_texturePrimSize) |
543 | materialName = GetOrCreateMaterial(renderer, faceColor, teFace.TextureID); | 489 | materialName = GetOrCreateMaterial(renderer, faceColor, teFace.TextureID); |
544 | else | 490 | else |
545 | materialName = GetOrCreateMaterial(renderer, faceColor); | 491 | materialName = GetOrCreateMaterial(renderer, faceColor); |
546 | 492 | ||
493 | warp_Vector primPos = ConvertVector(prim.GetWorldPosition()); | ||
494 | warp_Quaternion primRot = ConvertQuaternion(prim.GetWorldRotation()); | ||
495 | warp_Matrix m = warp_Matrix.quaternionMatrix(primRot); | ||
547 | faceObj.transform(m); | 496 | faceObj.transform(m); |
548 | faceObj.setPos(primPos); | 497 | faceObj.setPos(primPos); |
549 | faceObj.scaleSelf(primScale.x, primScale.y, primScale.z); | 498 | faceObj.scaleSelf(prim.Scale.X, prim.Scale.Z, prim.Scale.Y); |
550 | 499 | ||
551 | renderer.Scene.addObject(meshName, faceObj); | 500 | renderer.Scene.addObject(meshName, faceObj); |
552 | |||
553 | renderer.SetObjectMaterial(meshName, materialName); | 501 | renderer.SetObjectMaterial(meshName, materialName); |
554 | } | 502 | } |
555 | } | 503 | } |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 959829c..57ec800 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1428,6 +1428,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1428 | 1428 | ||
1429 | mapTexture.Save(exportPath, ImageFormat.Jpeg); | 1429 | mapTexture.Save(exportPath, ImageFormat.Jpeg); |
1430 | 1430 | ||
1431 | g.Dispose(); | ||
1432 | mapTexture.Dispose(); | ||
1433 | sea.Dispose(); | ||
1434 | |||
1431 | m_log.InfoFormat( | 1435 | m_log.InfoFormat( |
1432 | "[WORLD MAP]: Successfully exported world map for {0} to {1}", | 1436 | "[WORLD MAP]: Successfully exported world map for {0} to {1}", |
1433 | m_scene.RegionInfo.RegionName, exportPath); | 1437 | m_scene.RegionInfo.RegionName, exportPath); |
@@ -1613,9 +1617,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1613 | int mb = bx; | 1617 | int mb = bx; |
1614 | if(mb < by) | 1618 | if(mb < by) |
1615 | mb = by; | 1619 | mb = by; |
1616 | if(mb > 2 * Constants.RegionSize && mb > 0) | 1620 | if(mb > Constants.RegionSize && mb > 0) |
1617 | { | 1621 | { |
1618 | float scale = 2.0f * (float)Constants.RegionSize/(float)mb; | 1622 | float scale = (float)Constants.RegionSize/(float)mb; |
1619 | Size newsize = new Size(); | 1623 | Size newsize = new Size(); |
1620 | newsize.Width = (int)(bx * scale); | 1624 | newsize.Width = (int)(bx * scale); |
1621 | newsize.Height = (int)(by * scale); | 1625 | newsize.Height = (int)(by * scale); |