diff options
author | Teravus Ovares | 2008-03-03 16:52:25 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-03-03 16:52:25 +0000 |
commit | d01535690254a347939bc8946d8c10e78a8ea577 (patch) | |
tree | 638cae76c554d79425bcef4f64c1c96cfb2b4eb3 | |
parent | * More compiler warning nukage. (diff) | |
download | opensim-SC_OLD-d01535690254a347939bc8946d8c10e78a8ea577.zip opensim-SC_OLD-d01535690254a347939bc8946d8c10e78a8ea577.tar.gz opensim-SC_OLD-d01535690254a347939bc8946d8c10e78a8ea577.tar.bz2 opensim-SC_OLD-d01535690254a347939bc8946d8c10e78a8ea577.tar.xz |
* Applied patch 708 from devalnor. Thanks devalnor!
* ODE: Added support for larger box stacks. (they're slow, but they work)
* ODEPlugin no longer tries to 'catch up' with the simulator frame rate if it gets behind. Catching up was causing a lot of problems with larger box stacks and other things that stall the simulator (like saving prim in the datastore)
Diffstat (limited to '')
-rw-r--r-- | CONTRIBUTORS.txt | 1 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 45 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 25 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 149 |
5 files changed, 133 insertions, 89 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 58bef0c..4435385 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt | |||
@@ -46,6 +46,7 @@ Patches | |||
46 | * jimbo2120 (International Business Machines Corp.) | 46 | * jimbo2120 (International Business Machines Corp.) |
47 | * brianw/Sir_Ahzz | 47 | * brianw/Sir_Ahzz |
48 | * ChrisDown | 48 | * ChrisDown |
49 | * devalnor-#708 | ||
49 | 50 | ||
50 | 51 | ||
51 | LSL Devs | 52 | LSL Devs |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index e41f180..8481737 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -606,16 +606,47 @@ namespace OpenSim.Region.Environment.Scenes | |||
606 | public void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, | 606 | public void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, |
607 | uint primLocalID) | 607 | uint primLocalID) |
608 | { | 608 | { |
609 | |||
609 | SceneObjectGroup group = GetGroupByPrim(primLocalID); | 610 | SceneObjectGroup group = GetGroupByPrim(primLocalID); |
611 | |||
610 | if (group != null) | 612 | if (group != null) |
611 | { | 613 | { |
612 | // TODO Retrieve itemID from client's inventory to pass on | 614 | LLUUID copyID = LLUUID.Random(); |
613 | //group.AddInventoryItem(remoteClient, primLocalID, null); | 615 | if (itemID != LLUUID.Zero) |
614 | m_log.InfoFormat( | 616 | { |
615 | "[PRIM INVENTORY]: " + | 617 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
616 | "Non script prim inventory not yet implemented!" | 618 | |
617 | + "\nUpdateTaskInventory called with item {0}, folder {1}, primLocalID {2}, user {3}", | 619 | if (userInfo != null && userInfo.RootFolder != null) |
618 | itemID, folderID, primLocalID, remoteClient.Name); | 620 | { |
621 | InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); | ||
622 | |||
623 | // Try library | ||
624 | // XXX clumsy, possibly should be one call | ||
625 | if (null == item) | ||
626 | { | ||
627 | item = CommsManager.UserProfileCacheService.libraryRoot.HasItem(itemID); | ||
628 | } | ||
629 | |||
630 | if (item != null) | ||
631 | { | ||
632 | |||
633 | group.AddInventoryItem(remoteClient, primLocalID, item, copyID); | ||
634 | m_log.InfoFormat("[PRIMINVENTORY]: Update with item {0} requested of prim {1} for {2}", item.inventoryName, primLocalID, remoteClient.Name); | ||
635 | group.GetProperties(remoteClient); | ||
636 | |||
637 | } | ||
638 | else | ||
639 | { | ||
640 | m_log.ErrorFormat( | ||
641 | "[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!", | ||
642 | itemID, remoteClient.Name); | ||
643 | } | ||
644 | |||
645 | } | ||
646 | |||
647 | } | ||
648 | |||
649 | |||
619 | } | 650 | } |
620 | else | 651 | else |
621 | { | 652 | { |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 04fa03e..a6a5063 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -1844,7 +1844,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1844 | m_log.Info("[PHYSICS]: Physical Object went out of bounds."); | 1844 | m_log.Info("[PHYSICS]: Physical Object went out of bounds."); |
1845 | RemFlag(LLObject.ObjectFlags.Physics); | 1845 | RemFlag(LLObject.ObjectFlags.Physics); |
1846 | DoPhysicsPropertyUpdate(false, true); | 1846 | DoPhysicsPropertyUpdate(false, true); |
1847 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | 1847 | //m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); |
1848 | } | 1848 | } |
1849 | 1849 | ||
1850 | public virtual void OnGrab(LLVector3 offsetPos, IClientAPI remoteClient) | 1850 | public virtual void OnGrab(LLVector3 offsetPos, IClientAPI remoteClient) |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index eb90cf4..726f2e9 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -617,20 +617,23 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
617 | public void disableBody() | 617 | public void disableBody() |
618 | { | 618 | { |
619 | //this kills the body so things like 'mesh' can re-create it. | 619 | //this kills the body so things like 'mesh' can re-create it. |
620 | if (Body != (IntPtr) 0) | 620 | lock (this) |
621 | { | 621 | { |
622 | m_collisionCategories &= ~CollisionCategories.Body; | 622 | if (Body != (IntPtr)0) |
623 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); | ||
624 | |||
625 | if (prim_geom != (IntPtr)0) | ||
626 | { | 623 | { |
627 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 624 | m_collisionCategories &= ~CollisionCategories.Body; |
628 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 625 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); |
629 | } | ||
630 | 626 | ||
631 | _parent_scene.remActivePrim(this); | 627 | if (prim_geom != (IntPtr)0) |
632 | d.BodyDestroy(Body); | 628 | { |
633 | Body = (IntPtr) 0; | 629 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); |
630 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
631 | } | ||
632 | |||
633 | _parent_scene.remActivePrim(this); | ||
634 | d.BodyDestroy(Body); | ||
635 | Body = (IntPtr)0; | ||
636 | } | ||
634 | } | 637 | } |
635 | m_disabled = true; | 638 | m_disabled = true; |
636 | m_collisionscore = 0; | 639 | m_collisionscore = 0; |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 76bd3f2..563bf44 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -661,7 +661,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
661 | { | 661 | { |
662 | try | 662 | try |
663 | { | 663 | { |
664 | d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback); | 664 | |
665 | d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback); | ||
666 | |||
665 | } | 667 | } |
666 | catch (AccessViolationException) | 668 | catch (AccessViolationException) |
667 | { | 669 | { |
@@ -685,7 +687,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
685 | } | 687 | } |
686 | try | 688 | try |
687 | { | 689 | { |
688 | d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback); | 690 | lock (chr) |
691 | { | ||
692 | d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback); | ||
693 | } | ||
689 | } | 694 | } |
690 | catch (AccessViolationException) | 695 | catch (AccessViolationException) |
691 | { | 696 | { |
@@ -759,90 +764,93 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
759 | /// <param name="prim"></param> | 764 | /// <param name="prim"></param> |
760 | public void RemovePrimThreadLocked(OdePrim prim) | 765 | public void RemovePrimThreadLocked(OdePrim prim) |
761 | { | 766 | { |
762 | lock (ode) | 767 | lock (prim) |
763 | { | 768 | { |
764 | if (prim.prim_geom != (IntPtr)0) | 769 | lock (ode) |
765 | { | 770 | { |
766 | while (ode.lockquery()) | 771 | if (prim.prim_geom != (IntPtr)0) |
767 | { | 772 | { |
768 | } | 773 | while (ode.lockquery()) |
769 | ode.dlock(world); | 774 | { |
770 | //System.Threading.Thread.Sleep(20); | 775 | } |
771 | prim.ResetTaints(); | 776 | ode.dlock(world); |
772 | 777 | //System.Threading.Thread.Sleep(20); | |
778 | prim.ResetTaints(); | ||
773 | 779 | ||
774 | if (prim.IsPhysical) | ||
775 | { | ||
776 | prim.disableBody(); | ||
777 | } | ||
778 | // we don't want to remove the main space | ||
779 | |||
780 | // If the geometry is in the targetspace, remove it from the target space | ||
781 | //m_log.Warn(prim.m_targetSpace); | ||
782 | 780 | ||
783 | //if (prim.m_targetSpace != (IntPtr)0) | 781 | if (prim.IsPhysical) |
784 | //{ | ||
785 | if (d.SpaceQuery(prim.m_targetSpace, prim.prim_geom)) | ||
786 | { | 782 | { |
783 | prim.disableBody(); | ||
784 | } | ||
785 | // we don't want to remove the main space | ||
786 | |||
787 | // If the geometry is in the targetspace, remove it from the target space | ||
788 | //m_log.Warn(prim.m_targetSpace); | ||
789 | |||
790 | //if (prim.m_targetSpace != (IntPtr)0) | ||
791 | //{ | ||
792 | //if (d.SpaceQuery(prim.m_targetSpace, prim.prim_geom)) | ||
793 | //{ | ||
794 | |||
795 | //if (d.GeomIsSpace(prim.m_targetSpace)) | ||
796 | //{ | ||
797 | //waitForSpaceUnlock(prim.m_targetSpace); | ||
798 | //d.SpaceRemove(prim.m_targetSpace, prim.prim_geom); | ||
799 | prim.m_targetSpace = (IntPtr)0; | ||
800 | //} | ||
801 | //else | ||
802 | //{ | ||
803 | // m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" + | ||
804 | //((OdePrim)prim).m_targetSpace.ToString()); | ||
805 | //} | ||
787 | 806 | ||
788 | if (d.GeomIsSpace(prim.m_targetSpace)) | 807 | //} |
808 | //} | ||
809 | //m_log.Warn(prim.prim_geom); | ||
810 | try | ||
811 | { | ||
812 | if (prim.prim_geom != (IntPtr)0) | ||
789 | { | 813 | { |
790 | waitForSpaceUnlock(prim.m_targetSpace); | 814 | d.GeomDestroy(prim.prim_geom); |
791 | d.SpaceRemove(prim.m_targetSpace, prim.prim_geom); | 815 | prim.prim_geom = (IntPtr)0; |
792 | prim.m_targetSpace = (IntPtr) 0; | ||
793 | } | 816 | } |
794 | else | 817 | else |
795 | { | 818 | { |
796 | m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" + | 819 | m_log.Warn("[PHYSICS]: Unable to remove prim from physics scene"); |
797 | ((OdePrim)prim).m_targetSpace.ToString()); | ||
798 | } | 820 | } |
799 | 821 | ||
800 | } | 822 | } |
801 | //} | 823 | catch (System.AccessViolationException) |
802 | //m_log.Warn(prim.prim_geom); | ||
803 | try | ||
804 | { | ||
805 | if (prim.prim_geom != (IntPtr)0) | ||
806 | { | 824 | { |
807 | d.GeomDestroy(prim.prim_geom); | 825 | m_log.Info("[PHYSICS]: Couldn't remove prim from physics scene, it was already be removed."); |
808 | prim.prim_geom = (IntPtr)0; | ||
809 | } | ||
810 | else | ||
811 | { | ||
812 | m_log.Warn("[PHYSICS]: Unable to remove prim from physics scene"); | ||
813 | } | 826 | } |
827 | _prims.Remove(prim); | ||
814 | 828 | ||
829 | //If there are no more geometries in the sub-space, we don't need it in the main space anymore | ||
830 | //if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0) | ||
831 | //{ | ||
832 | //if (!(prim.m_targetSpace.Equals(null))) | ||
833 | //{ | ||
834 | //if (d.GeomIsSpace(prim.m_targetSpace)) | ||
835 | //{ | ||
836 | //waitForSpaceUnlock(prim.m_targetSpace); | ||
837 | //d.SpaceRemove(space, prim.m_targetSpace); | ||
838 | // free up memory used by the space. | ||
839 | //d.SpaceDestroy(prim.m_targetSpace); | ||
840 | //int[] xyspace = calculateSpaceArrayItemFromPos(prim.Position); | ||
841 | //resetSpaceArrayItemToZero(xyspace[0], xyspace[1]); | ||
842 | //} | ||
843 | //else | ||
844 | //{ | ||
845 | //m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" + | ||
846 | //((OdePrim) prim).m_targetSpace.ToString()); | ||
847 | //} | ||
848 | //} | ||
849 | //} | ||
815 | } | 850 | } |
816 | catch (System.AccessViolationException) | ||
817 | { | ||
818 | m_log.Info("[PHYSICS]: Couldn't remove prim from physics scene, it was already be removed."); | ||
819 | } | ||
820 | _prims.Remove(prim); | ||
821 | |||
822 | //If there are no more geometries in the sub-space, we don't need it in the main space anymore | ||
823 | //if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0) | ||
824 | //{ | ||
825 | //if (!(prim.m_targetSpace.Equals(null))) | ||
826 | //{ | ||
827 | //if (d.GeomIsSpace(prim.m_targetSpace)) | ||
828 | //{ | ||
829 | //waitForSpaceUnlock(prim.m_targetSpace); | ||
830 | //d.SpaceRemove(space, prim.m_targetSpace); | ||
831 | // free up memory used by the space. | ||
832 | //d.SpaceDestroy(prim.m_targetSpace); | ||
833 | //int[] xyspace = calculateSpaceArrayItemFromPos(prim.Position); | ||
834 | //resetSpaceArrayItemToZero(xyspace[0], xyspace[1]); | ||
835 | //} | ||
836 | //else | ||
837 | //{ | ||
838 | //m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" + | ||
839 | //((OdePrim) prim).m_targetSpace.ToString()); | ||
840 | //} | ||
841 | //} | ||
842 | //} | ||
843 | } | ||
844 | 851 | ||
845 | ode.dunlock(world); | 852 | ode.dunlock(world); |
853 | } | ||
846 | } | 854 | } |
847 | } | 855 | } |
848 | 856 | ||
@@ -934,7 +942,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
934 | d.SpaceRemove(space, currentspace); | 942 | d.SpaceRemove(space, currentspace); |
935 | // free up memory used by the space. | 943 | // free up memory used by the space. |
936 | 944 | ||
937 | d.SpaceDestroy(currentspace); | 945 | //d.SpaceDestroy(currentspace); |
938 | resetSpaceArrayItemToZero(currentspace); | 946 | resetSpaceArrayItemToZero(currentspace); |
939 | } | 947 | } |
940 | else | 948 | else |
@@ -1236,7 +1244,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1236 | public override float Simulate(float timeStep) | 1244 | public override float Simulate(float timeStep) |
1237 | { | 1245 | { |
1238 | float fps = 0; | 1246 | float fps = 0; |
1239 | 1247 | //m_log.Info(timeStep.ToString()); | |
1240 | step_time += timeStep; | 1248 | step_time += timeStep; |
1241 | 1249 | ||
1242 | 1250 | ||
@@ -1275,8 +1283,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1275 | 1283 | ||
1276 | // Figure out the Frames Per Second we're going at. | 1284 | // Figure out the Frames Per Second we're going at. |
1277 | //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size | 1285 | //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size |
1286 | step_time = 0.09375f; | ||
1278 | fps = (step_time/ODE_STEPSIZE) * 1000; | 1287 | fps = (step_time/ODE_STEPSIZE) * 1000; |
1279 | 1288 | ||
1280 | while (step_time > 0.0f) | 1289 | while (step_time > 0.0f) |
1281 | { | 1290 | { |
1282 | lock (ode) | 1291 | lock (ode) |