diff options
Merge commit 'f2132329a358db2c66c29501d35ef54eae8d6eed' into bigmerge
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsScene.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 190 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 133 |
3 files changed, 195 insertions, 129 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 30623a0..e3b222c 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -188,7 +188,6 @@ namespace OpenSim.Region.Physics.Manager | |||
188 | public virtual Vector3 GetJointAxis(PhysicsJoint joint) | 188 | public virtual Vector3 GetJointAxis(PhysicsJoint joint) |
189 | { return Vector3.Zero; } | 189 | { return Vector3.Zero; } |
190 | 190 | ||
191 | |||
192 | public abstract void AddPhysicsActorTaint(PhysicsActor prim); | 191 | public abstract void AddPhysicsActorTaint(PhysicsActor prim); |
193 | 192 | ||
194 | public abstract float Simulate(float timeStep); | 193 | public abstract float Simulate(float timeStep); |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 8ad0b7f..e86a5b6 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -326,7 +326,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
326 | /// Set a new geometry for this prim. | 326 | /// Set a new geometry for this prim. |
327 | /// </summary> | 327 | /// </summary> |
328 | /// <param name="geom"></param> | 328 | /// <param name="geom"></param> |
329 | public void SetGeom(IntPtr geom) | 329 | private void SetGeom(IntPtr geom) |
330 | { | 330 | { |
331 | prim_geom = geom; | 331 | prim_geom = geom; |
332 | //Console.WriteLine("SetGeom to " + prim_geom + " for " + Name); | 332 | //Console.WriteLine("SetGeom to " + prim_geom + " for " + Name); |
@@ -351,7 +351,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
351 | //m_log.Warn("Setting Geom to: " + prim_geom); | 351 | //m_log.Warn("Setting Geom to: " + prim_geom); |
352 | } | 352 | } |
353 | 353 | ||
354 | public void enableBodySoft() | 354 | private void enableBodySoft() |
355 | { | 355 | { |
356 | if (!childPrim) | 356 | if (!childPrim) |
357 | { | 357 | { |
@@ -366,7 +366,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
366 | } | 366 | } |
367 | } | 367 | } |
368 | 368 | ||
369 | public void disableBodySoft() | 369 | private void disableBodySoft() |
370 | { | 370 | { |
371 | m_disabled = true; | 371 | m_disabled = true; |
372 | 372 | ||
@@ -379,7 +379,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
379 | /// <summary> | 379 | /// <summary> |
380 | /// Make a prim subject to physics. | 380 | /// Make a prim subject to physics. |
381 | /// </summary> | 381 | /// </summary> |
382 | public void enableBody() | 382 | private void enableBody() |
383 | { | 383 | { |
384 | // Don't enable this body if we're a child prim | 384 | // Don't enable this body if we're a child prim |
385 | // this should be taken care of in the parent function not here | 385 | // this should be taken care of in the parent function not here |
@@ -423,7 +423,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
423 | m_vehicle.Enable(Body, _parent_scene); | 423 | m_vehicle.Enable(Body, _parent_scene); |
424 | } | 424 | } |
425 | 425 | ||
426 | _parent_scene.addActivePrim(this); | 426 | _parent_scene.ActivatePrim(this); |
427 | } | 427 | } |
428 | } | 428 | } |
429 | 429 | ||
@@ -741,7 +741,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
741 | 741 | ||
742 | #endregion | 742 | #endregion |
743 | 743 | ||
744 | public void setMass() | 744 | private void setMass() |
745 | { | 745 | { |
746 | if (Body != (IntPtr) 0) | 746 | if (Body != (IntPtr) 0) |
747 | { | 747 | { |
@@ -757,7 +757,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
757 | /// <summary> | 757 | /// <summary> |
758 | /// Stop a prim from being subject to physics. | 758 | /// Stop a prim from being subject to physics. |
759 | /// </summary> | 759 | /// </summary> |
760 | public void disableBody() | 760 | internal void disableBody() |
761 | { | 761 | { |
762 | //this kills the body so things like 'mesh' can re-create it. | 762 | //this kills the body so things like 'mesh' can re-create it. |
763 | lock (this) | 763 | lock (this) |
@@ -766,7 +766,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
766 | { | 766 | { |
767 | if (Body != IntPtr.Zero) | 767 | if (Body != IntPtr.Zero) |
768 | { | 768 | { |
769 | _parent_scene.remActivePrim(this); | 769 | _parent_scene.DeactivatePrim(this); |
770 | m_collisionCategories &= ~CollisionCategories.Body; | 770 | m_collisionCategories &= ~CollisionCategories.Body; |
771 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); | 771 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); |
772 | 772 | ||
@@ -783,7 +783,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
783 | { | 783 | { |
784 | foreach (OdePrim prm in childrenPrim) | 784 | foreach (OdePrim prm in childrenPrim) |
785 | { | 785 | { |
786 | _parent_scene.remActivePrim(prm); | 786 | _parent_scene.DeactivatePrim(prm); |
787 | prm.Body = IntPtr.Zero; | 787 | prm.Body = IntPtr.Zero; |
788 | } | 788 | } |
789 | } | 789 | } |
@@ -793,7 +793,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
793 | } | 793 | } |
794 | else | 794 | else |
795 | { | 795 | { |
796 | _parent_scene.remActivePrim(this); | 796 | _parent_scene.DeactivatePrim(this); |
797 | 797 | ||
798 | m_collisionCategories &= ~CollisionCategories.Body; | 798 | m_collisionCategories &= ~CollisionCategories.Body; |
799 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); | 799 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); |
@@ -814,7 +814,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
814 | 814 | ||
815 | private static Dictionary<IMesh, IntPtr> m_MeshToTriMeshMap = new Dictionary<IMesh, IntPtr>(); | 815 | private static Dictionary<IMesh, IntPtr> m_MeshToTriMeshMap = new Dictionary<IMesh, IntPtr>(); |
816 | 816 | ||
817 | public void setMesh(OdeScene parent_scene, IMesh mesh) | 817 | private void setMesh(OdeScene parent_scene, IMesh mesh) |
818 | { | 818 | { |
819 | // m_log.DebugFormat("[ODE PRIM]: Setting mesh on {0} to {1}", Name, mesh); | 819 | // m_log.DebugFormat("[ODE PRIM]: Setting mesh on {0} to {1}", Name, mesh); |
820 | 820 | ||
@@ -884,73 +884,73 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
884 | // } | 884 | // } |
885 | } | 885 | } |
886 | 886 | ||
887 | public void ProcessTaints(float timestep) | 887 | internal void ProcessTaints() |
888 | { | 888 | { |
889 | #if SPAM | 889 | #if SPAM |
890 | Console.WriteLine("ZProcessTaints for " + Name); | 890 | Console.WriteLine("ZProcessTaints for " + Name); |
891 | #endif | 891 | #endif |
892 | if (m_taintadd) | 892 | if (m_taintadd) |
893 | { | 893 | { |
894 | changeadd(timestep); | 894 | changeadd(); |
895 | } | 895 | } |
896 | 896 | ||
897 | if (prim_geom != IntPtr.Zero) | 897 | if (prim_geom != IntPtr.Zero) |
898 | { | 898 | { |
899 | if (!_position.ApproxEquals(m_taintposition, 0f)) | 899 | if (!_position.ApproxEquals(m_taintposition, 0f)) |
900 | changemove(timestep); | 900 | changemove(); |
901 | 901 | ||
902 | if (m_taintrot != _orientation) | 902 | if (m_taintrot != _orientation) |
903 | { | 903 | { |
904 | if (childPrim && IsPhysical) // For physical child prim... | 904 | if (childPrim && IsPhysical) // For physical child prim... |
905 | { | 905 | { |
906 | rotate(timestep); | 906 | rotate(); |
907 | // KF: ODE will also rotate the parent prim! | 907 | // KF: ODE will also rotate the parent prim! |
908 | // so rotate the root back to where it was | 908 | // so rotate the root back to where it was |
909 | OdePrim parent = (OdePrim)_parent; | 909 | OdePrim parent = (OdePrim)_parent; |
910 | parent.rotate(timestep); | 910 | parent.rotate(); |
911 | } | 911 | } |
912 | else | 912 | else |
913 | { | 913 | { |
914 | //Just rotate the prim | 914 | //Just rotate the prim |
915 | rotate(timestep); | 915 | rotate(); |
916 | } | 916 | } |
917 | } | 917 | } |
918 | 918 | ||
919 | if (m_taintPhysics != IsPhysical && !(m_taintparent != _parent)) | 919 | if (m_taintPhysics != IsPhysical && !(m_taintparent != _parent)) |
920 | changePhysicsStatus(timestep); | 920 | changePhysicsStatus(); |
921 | 921 | ||
922 | if (!_size.ApproxEquals(m_taintsize, 0f)) | 922 | if (!_size.ApproxEquals(m_taintsize, 0f)) |
923 | changesize(timestep); | 923 | changesize(); |
924 | 924 | ||
925 | if (m_taintshape) | 925 | if (m_taintshape) |
926 | changeshape(timestep); | 926 | changeshape(); |
927 | 927 | ||
928 | if (m_taintforce) | 928 | if (m_taintforce) |
929 | changeAddForce(timestep); | 929 | changeAddForce(); |
930 | 930 | ||
931 | if (m_taintaddangularforce) | 931 | if (m_taintaddangularforce) |
932 | changeAddAngularForce(timestep); | 932 | changeAddAngularForce(); |
933 | 933 | ||
934 | if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f)) | 934 | if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f)) |
935 | changeSetTorque(timestep); | 935 | changeSetTorque(); |
936 | 936 | ||
937 | if (m_taintdisable) | 937 | if (m_taintdisable) |
938 | changedisable(timestep); | 938 | changedisable(); |
939 | 939 | ||
940 | if (m_taintselected != m_isSelected) | 940 | if (m_taintselected != m_isSelected) |
941 | changeSelectedStatus(timestep); | 941 | changeSelectedStatus(); |
942 | 942 | ||
943 | if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f)) | 943 | if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f)) |
944 | changevelocity(timestep); | 944 | changevelocity(); |
945 | 945 | ||
946 | if (m_taintparent != _parent) | 946 | if (m_taintparent != _parent) |
947 | changelink(timestep); | 947 | changelink(); |
948 | 948 | ||
949 | if (m_taintCollidesWater != m_collidesWater) | 949 | if (m_taintCollidesWater != m_collidesWater) |
950 | changefloatonwater(timestep); | 950 | changefloatonwater(); |
951 | 951 | ||
952 | if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f)) | 952 | if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f)) |
953 | changeAngularLock(timestep); | 953 | changeAngularLock(); |
954 | } | 954 | } |
955 | else | 955 | else |
956 | { | 956 | { |
@@ -958,7 +958,10 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
958 | } | 958 | } |
959 | } | 959 | } |
960 | 960 | ||
961 | private void changeAngularLock(float timestep) | 961 | /// <summary> |
962 | /// Change prim in response to an angular lock taint. | ||
963 | /// </summary> | ||
964 | private void changeAngularLock() | ||
962 | { | 965 | { |
963 | // do we have a Physical object? | 966 | // do we have a Physical object? |
964 | if (Body != IntPtr.Zero) | 967 | if (Body != IntPtr.Zero) |
@@ -983,11 +986,15 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
983 | } | 986 | } |
984 | } | 987 | } |
985 | } | 988 | } |
989 | |||
986 | // Store this for later in case we get turned into a separate body | 990 | // Store this for later in case we get turned into a separate body |
987 | m_angularlock = m_taintAngularLock; | 991 | m_angularlock = m_taintAngularLock; |
988 | } | 992 | } |
989 | 993 | ||
990 | private void changelink(float timestep) | 994 | /// <summary> |
995 | /// Change prim in response to a link taint. | ||
996 | /// </summary> | ||
997 | private void changelink() | ||
991 | { | 998 | { |
992 | // If the newly set parent is not null | 999 | // If the newly set parent is not null |
993 | // create link | 1000 | // create link |
@@ -1042,7 +1049,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1042 | /// Add a child prim to this parent prim. | 1049 | /// Add a child prim to this parent prim. |
1043 | /// </summary> | 1050 | /// </summary> |
1044 | /// <param name="prim">Child prim</param> | 1051 | /// <param name="prim">Child prim</param> |
1045 | public void AddChildPrim(OdePrim prim) | 1052 | private void AddChildPrim(OdePrim prim) |
1046 | { | 1053 | { |
1047 | //Console.WriteLine("AddChildPrim " + Name); | 1054 | //Console.WriteLine("AddChildPrim " + Name); |
1048 | if (this.m_localID != prim.m_localID) | 1055 | if (this.m_localID != prim.m_localID) |
@@ -1134,7 +1141,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1134 | prm.createAMotor(m_angularlock); | 1141 | prm.createAMotor(m_angularlock); |
1135 | } | 1142 | } |
1136 | prm.Body = Body; | 1143 | prm.Body = Body; |
1137 | _parent_scene.addActivePrim(prm); | 1144 | _parent_scene.ActivatePrim(prm); |
1138 | } | 1145 | } |
1139 | 1146 | ||
1140 | m_collisionCategories |= CollisionCategories.Body; | 1147 | m_collisionCategories |= CollisionCategories.Body; |
@@ -1179,7 +1186,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1179 | if (m_vehicle.Type != Vehicle.TYPE_NONE) | 1186 | if (m_vehicle.Type != Vehicle.TYPE_NONE) |
1180 | m_vehicle.Enable(Body, _parent_scene); | 1187 | m_vehicle.Enable(Body, _parent_scene); |
1181 | 1188 | ||
1182 | _parent_scene.addActivePrim(this); | 1189 | _parent_scene.ActivatePrim(this); |
1183 | } | 1190 | } |
1184 | } | 1191 | } |
1185 | } | 1192 | } |
@@ -1206,7 +1213,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1206 | 1213 | ||
1207 | if (Body != IntPtr.Zero) | 1214 | if (Body != IntPtr.Zero) |
1208 | { | 1215 | { |
1209 | _parent_scene.remActivePrim(this); | 1216 | _parent_scene.DeactivatePrim(this); |
1210 | } | 1217 | } |
1211 | 1218 | ||
1212 | lock (childrenPrim) | 1219 | lock (childrenPrim) |
@@ -1245,7 +1252,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1245 | 1252 | ||
1246 | if (Body != IntPtr.Zero) | 1253 | if (Body != IntPtr.Zero) |
1247 | { | 1254 | { |
1248 | _parent_scene.remActivePrim(this); | 1255 | _parent_scene.DeactivatePrim(this); |
1249 | } | 1256 | } |
1250 | 1257 | ||
1251 | lock (childrenPrim) | 1258 | lock (childrenPrim) |
@@ -1258,7 +1265,10 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1258 | } | 1265 | } |
1259 | } | 1266 | } |
1260 | 1267 | ||
1261 | private void changeSelectedStatus(float timestep) | 1268 | /// <summary> |
1269 | /// Change prim in response to a selection taint. | ||
1270 | /// </summary> | ||
1271 | private void changeSelectedStatus() | ||
1262 | { | 1272 | { |
1263 | if (m_taintselected) | 1273 | if (m_taintselected) |
1264 | { | 1274 | { |
@@ -1338,7 +1348,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1338 | m_isSelected = m_taintselected; | 1348 | m_isSelected = m_taintselected; |
1339 | }//end changeSelectedStatus | 1349 | }//end changeSelectedStatus |
1340 | 1350 | ||
1341 | public void ResetTaints() | 1351 | internal void ResetTaints() |
1342 | { | 1352 | { |
1343 | m_taintposition = _position; | 1353 | m_taintposition = _position; |
1344 | m_taintrot = _orientation; | 1354 | m_taintrot = _orientation; |
@@ -1356,7 +1366,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1356 | /// </summary> | 1366 | /// </summary> |
1357 | /// <param name="m_targetSpace"></param> | 1367 | /// <param name="m_targetSpace"></param> |
1358 | /// <param name="mesh">If null, then a mesh is used that is based on the profile shape data.</param> | 1368 | /// <param name="mesh">If null, then a mesh is used that is based on the profile shape data.</param> |
1359 | public void CreateGeom(IntPtr m_targetSpace, IMesh mesh) | 1369 | private void CreateGeom(IntPtr m_targetSpace, IMesh mesh) |
1360 | { | 1370 | { |
1361 | #if SPAM | 1371 | #if SPAM |
1362 | Console.WriteLine("CreateGeom:"); | 1372 | Console.WriteLine("CreateGeom:"); |
@@ -1442,7 +1452,7 @@ Console.WriteLine("CreateGeom:"); | |||
1442 | /// <param name="m_targetSpace"></param> | 1452 | /// <param name="m_targetSpace"></param> |
1443 | /// <param name="mesh">If null, then a mesh is used that is based on the profile shape data.</param> | 1453 | /// <param name="mesh">If null, then a mesh is used that is based on the profile shape data.</param> |
1444 | /// <returns>true if the geom was successfully removed, false if it was already gone or the remove failed.</returns> | 1454 | /// <returns>true if the geom was successfully removed, false if it was already gone or the remove failed.</returns> |
1445 | public bool RemoveGeom() | 1455 | internal bool RemoveGeom() |
1446 | { | 1456 | { |
1447 | if (prim_geom != IntPtr.Zero) | 1457 | if (prim_geom != IntPtr.Zero) |
1448 | { | 1458 | { |
@@ -1468,8 +1478,10 @@ Console.WriteLine("CreateGeom:"); | |||
1468 | return false; | 1478 | return false; |
1469 | } | 1479 | } |
1470 | } | 1480 | } |
1471 | 1481 | /// <summary> | |
1472 | public void changeadd(float timestep) | 1482 | /// Add prim in response to an add taint. |
1483 | /// </summary> | ||
1484 | private void changeadd() | ||
1473 | { | 1485 | { |
1474 | int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); | 1486 | int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); |
1475 | IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); | 1487 | IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); |
@@ -1513,12 +1525,15 @@ Console.WriteLine("changeadd 1"); | |||
1513 | } | 1525 | } |
1514 | } | 1526 | } |
1515 | 1527 | ||
1516 | changeSelectedStatus(timestep); | 1528 | changeSelectedStatus(); |
1517 | 1529 | ||
1518 | m_taintadd = false; | 1530 | m_taintadd = false; |
1519 | } | 1531 | } |
1520 | 1532 | ||
1521 | public void changemove(float timestep) | 1533 | /// <summary> |
1534 | /// Move prim in response to a move taint. | ||
1535 | /// </summary> | ||
1536 | private void changemove() | ||
1522 | { | 1537 | { |
1523 | if (IsPhysical) | 1538 | if (IsPhysical) |
1524 | { | 1539 | { |
@@ -1589,13 +1604,13 @@ Console.WriteLine(" JointCreateFixed"); | |||
1589 | } | 1604 | } |
1590 | } | 1605 | } |
1591 | 1606 | ||
1592 | changeSelectedStatus(timestep); | 1607 | changeSelectedStatus(); |
1593 | 1608 | ||
1594 | resetCollisionAccounting(); | 1609 | resetCollisionAccounting(); |
1595 | m_taintposition = _position; | 1610 | m_taintposition = _position; |
1596 | } | 1611 | } |
1597 | 1612 | ||
1598 | public void Move(float timestep) | 1613 | internal void Move(float timestep) |
1599 | { | 1614 | { |
1600 | float fx = 0; | 1615 | float fx = 0; |
1601 | float fy = 0; | 1616 | float fy = 0; |
@@ -1842,7 +1857,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1842 | } | 1857 | } |
1843 | } | 1858 | } |
1844 | 1859 | ||
1845 | public void rotate(float timestep) | 1860 | private void rotate() |
1846 | { | 1861 | { |
1847 | d.Quaternion myrot = new d.Quaternion(); | 1862 | d.Quaternion myrot = new d.Quaternion(); |
1848 | myrot.X = _orientation.X; | 1863 | myrot.X = _orientation.X; |
@@ -1876,7 +1891,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
1876 | m_disabled = false; | 1891 | m_disabled = false; |
1877 | } | 1892 | } |
1878 | 1893 | ||
1879 | public void changedisable(float timestep) | 1894 | /// <summary> |
1895 | /// Change prim in response to a disable taint. | ||
1896 | /// </summary> | ||
1897 | private void changedisable() | ||
1880 | { | 1898 | { |
1881 | m_disabled = true; | 1899 | m_disabled = true; |
1882 | if (Body != IntPtr.Zero) | 1900 | if (Body != IntPtr.Zero) |
@@ -1888,7 +1906,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
1888 | m_taintdisable = false; | 1906 | m_taintdisable = false; |
1889 | } | 1907 | } |
1890 | 1908 | ||
1891 | public void changePhysicsStatus(float timestep) | 1909 | /// <summary> |
1910 | /// Change prim in response to a physics status taint | ||
1911 | /// </summary> | ||
1912 | private void changePhysicsStatus() | ||
1892 | { | 1913 | { |
1893 | if (IsPhysical) | 1914 | if (IsPhysical) |
1894 | { | 1915 | { |
@@ -1896,7 +1917,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1896 | { | 1917 | { |
1897 | if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim) | 1918 | if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim) |
1898 | { | 1919 | { |
1899 | changeshape(2f); | 1920 | changeshape(); |
1900 | } | 1921 | } |
1901 | else | 1922 | else |
1902 | { | 1923 | { |
@@ -1913,7 +1934,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1913 | RemoveGeom(); | 1934 | RemoveGeom(); |
1914 | 1935 | ||
1915 | //Console.WriteLine("changePhysicsStatus for " + Name); | 1936 | //Console.WriteLine("changePhysicsStatus for " + Name); |
1916 | changeadd(2f); | 1937 | changeadd(); |
1917 | } | 1938 | } |
1918 | 1939 | ||
1919 | if (childPrim) | 1940 | if (childPrim) |
@@ -1931,13 +1952,16 @@ Console.WriteLine(" JointCreateFixed"); | |||
1931 | } | 1952 | } |
1932 | } | 1953 | } |
1933 | 1954 | ||
1934 | changeSelectedStatus(timestep); | 1955 | changeSelectedStatus(); |
1935 | 1956 | ||
1936 | resetCollisionAccounting(); | 1957 | resetCollisionAccounting(); |
1937 | m_taintPhysics = IsPhysical; | 1958 | m_taintPhysics = IsPhysical; |
1938 | } | 1959 | } |
1939 | 1960 | ||
1940 | public void changesize(float timestamp) | 1961 | /// <summary> |
1962 | /// Change prim in response to a size taint. | ||
1963 | /// </summary> | ||
1964 | private void changesize() | ||
1941 | { | 1965 | { |
1942 | #if SPAM | 1966 | #if SPAM |
1943 | m_log.DebugFormat("[ODE PRIM]: Called changesize"); | 1967 | m_log.DebugFormat("[ODE PRIM]: Called changesize"); |
@@ -2007,7 +2031,8 @@ Console.WriteLine(" JointCreateFixed"); | |||
2007 | d.BodyEnable(Body); | 2031 | d.BodyEnable(Body); |
2008 | } | 2032 | } |
2009 | 2033 | ||
2010 | changeSelectedStatus(timestamp); | 2034 | changeSelectedStatus(); |
2035 | |||
2011 | if (childPrim) | 2036 | if (childPrim) |
2012 | { | 2037 | { |
2013 | if (_parent is OdePrim) | 2038 | if (_parent is OdePrim) |
@@ -2020,7 +2045,11 @@ Console.WriteLine(" JointCreateFixed"); | |||
2020 | m_taintsize = _size; | 2045 | m_taintsize = _size; |
2021 | } | 2046 | } |
2022 | 2047 | ||
2023 | public void changefloatonwater(float timestep) | 2048 | /// <summary> |
2049 | /// Change prim in response to a float on water taint. | ||
2050 | /// </summary> | ||
2051 | /// <param name="timestep"></param> | ||
2052 | private void changefloatonwater() | ||
2024 | { | 2053 | { |
2025 | m_collidesWater = m_taintCollidesWater; | 2054 | m_collidesWater = m_taintCollidesWater; |
2026 | 2055 | ||
@@ -2038,7 +2067,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
2038 | } | 2067 | } |
2039 | } | 2068 | } |
2040 | 2069 | ||
2041 | public void changeshape(float timestamp) | 2070 | /// <summary> |
2071 | /// Change prim in response to a shape taint. | ||
2072 | /// </summary> | ||
2073 | private void changeshape() | ||
2042 | { | 2074 | { |
2043 | // Cleanup of old prim geometry and Bodies | 2075 | // Cleanup of old prim geometry and Bodies |
2044 | if (IsPhysical && Body != IntPtr.Zero) | 2076 | if (IsPhysical && Body != IntPtr.Zero) |
@@ -2101,7 +2133,8 @@ Console.WriteLine(" JointCreateFixed"); | |||
2101 | } | 2133 | } |
2102 | } | 2134 | } |
2103 | 2135 | ||
2104 | changeSelectedStatus(timestamp); | 2136 | changeSelectedStatus(); |
2137 | |||
2105 | if (childPrim) | 2138 | if (childPrim) |
2106 | { | 2139 | { |
2107 | if (_parent is OdePrim) | 2140 | if (_parent is OdePrim) |
@@ -2115,7 +2148,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
2115 | m_taintshape = false; | 2148 | m_taintshape = false; |
2116 | } | 2149 | } |
2117 | 2150 | ||
2118 | public void changeAddForce(float timestamp) | 2151 | /// <summary> |
2152 | /// Change prim in response to an add force taint. | ||
2153 | /// </summary> | ||
2154 | private void changeAddForce() | ||
2119 | { | 2155 | { |
2120 | if (!m_isSelected) | 2156 | if (!m_isSelected) |
2121 | { | 2157 | { |
@@ -2163,7 +2199,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
2163 | m_taintforce = false; | 2199 | m_taintforce = false; |
2164 | } | 2200 | } |
2165 | 2201 | ||
2166 | public void changeSetTorque(float timestamp) | 2202 | /// <summary> |
2203 | /// Change prim in response to a torque taint. | ||
2204 | /// </summary> | ||
2205 | private void changeSetTorque() | ||
2167 | { | 2206 | { |
2168 | if (!m_isSelected) | 2207 | if (!m_isSelected) |
2169 | { | 2208 | { |
@@ -2176,7 +2215,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
2176 | m_taintTorque = Vector3.Zero; | 2215 | m_taintTorque = Vector3.Zero; |
2177 | } | 2216 | } |
2178 | 2217 | ||
2179 | public void changeAddAngularForce(float timestamp) | 2218 | /// <summary> |
2219 | /// Change prim in response to an angular force taint. | ||
2220 | /// </summary> | ||
2221 | private void changeAddAngularForce() | ||
2180 | { | 2222 | { |
2181 | if (!m_isSelected) | 2223 | if (!m_isSelected) |
2182 | { | 2224 | { |
@@ -2204,7 +2246,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
2204 | m_taintaddangularforce = false; | 2246 | m_taintaddangularforce = false; |
2205 | } | 2247 | } |
2206 | 2248 | ||
2207 | private void changevelocity(float timestep) | 2249 | /// <summary> |
2250 | /// Change prim in response to a velocity taint. | ||
2251 | /// </summary> | ||
2252 | private void changevelocity() | ||
2208 | { | 2253 | { |
2209 | if (!m_isSelected) | 2254 | if (!m_isSelected) |
2210 | { | 2255 | { |
@@ -2219,10 +2264,11 @@ Console.WriteLine(" JointCreateFixed"); | |||
2219 | 2264 | ||
2220 | //resetCollisionAccounting(); | 2265 | //resetCollisionAccounting(); |
2221 | } | 2266 | } |
2267 | |||
2222 | m_taintVelocity = Vector3.Zero; | 2268 | m_taintVelocity = Vector3.Zero; |
2223 | } | 2269 | } |
2224 | 2270 | ||
2225 | public void setPrimForRemoval() | 2271 | internal void setPrimForRemoval() |
2226 | { | 2272 | { |
2227 | m_taintremove = true; | 2273 | m_taintremove = true; |
2228 | } | 2274 | } |
@@ -2438,16 +2484,13 @@ Console.WriteLine(" JointCreateFixed"); | |||
2438 | set | 2484 | set |
2439 | { | 2485 | { |
2440 | if (QuaternionIsFinite(value)) | 2486 | if (QuaternionIsFinite(value)) |
2441 | { | ||
2442 | _orientation = value; | 2487 | _orientation = value; |
2443 | } | ||
2444 | else | 2488 | else |
2445 | m_log.WarnFormat("[PHYSICS]: Got NaN quaternion Orientation from Scene in Object {0}", Name); | 2489 | m_log.WarnFormat("[PHYSICS]: Got NaN quaternion Orientation from Scene in Object {0}", Name); |
2446 | |||
2447 | } | 2490 | } |
2448 | } | 2491 | } |
2449 | 2492 | ||
2450 | internal static bool QuaternionIsFinite(Quaternion q) | 2493 | private static bool QuaternionIsFinite(Quaternion q) |
2451 | { | 2494 | { |
2452 | if (Single.IsNaN(q.X) || Single.IsInfinity(q.X)) | 2495 | if (Single.IsNaN(q.X) || Single.IsInfinity(q.X)) |
2453 | return false; | 2496 | return false; |
@@ -2465,12 +2508,6 @@ Console.WriteLine(" JointCreateFixed"); | |||
2465 | get { return _acceleration; } | 2508 | get { return _acceleration; } |
2466 | } | 2509 | } |
2467 | 2510 | ||
2468 | |||
2469 | public void SetAcceleration(Vector3 accel) | ||
2470 | { | ||
2471 | _acceleration = accel; | ||
2472 | } | ||
2473 | |||
2474 | public override void AddForce(Vector3 force, bool pushforce) | 2511 | public override void AddForce(Vector3 force, bool pushforce) |
2475 | { | 2512 | { |
2476 | if (force.IsFinite()) | 2513 | if (force.IsFinite()) |
@@ -2574,7 +2611,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2574 | } | 2611 | } |
2575 | } | 2612 | } |
2576 | 2613 | ||
2577 | public void UpdatePositionAndVelocity() | 2614 | internal void UpdatePositionAndVelocity() |
2578 | { | 2615 | { |
2579 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! | 2616 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! |
2580 | if (_parent == null) | 2617 | if (_parent == null) |
@@ -2943,7 +2980,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2943 | d.JointSetAMotorParam(Amotor, (int)dParam.FMax, Mass * 50f);// | 2980 | d.JointSetAMotorParam(Amotor, (int)dParam.FMax, Mass * 50f);// |
2944 | } | 2981 | } |
2945 | 2982 | ||
2946 | public Matrix4 FromDMass(d.Mass pMass) | 2983 | private Matrix4 FromDMass(d.Mass pMass) |
2947 | { | 2984 | { |
2948 | Matrix4 obj; | 2985 | Matrix4 obj; |
2949 | obj.M11 = pMass.I.M00; | 2986 | obj.M11 = pMass.I.M00; |
@@ -2965,7 +3002,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2965 | return obj; | 3002 | return obj; |
2966 | } | 3003 | } |
2967 | 3004 | ||
2968 | public d.Mass FromMatrix4(Matrix4 pMat, ref d.Mass obj) | 3005 | private d.Mass FromMatrix4(Matrix4 pMat, ref d.Mass obj) |
2969 | { | 3006 | { |
2970 | obj.I.M00 = pMat[0, 0]; | 3007 | obj.I.M00 = pMat[0, 0]; |
2971 | obj.I.M01 = pMat[0, 1]; | 3008 | obj.I.M01 = pMat[0, 1]; |
@@ -3153,6 +3190,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
3153 | break; | 3190 | break; |
3154 | } | 3191 | } |
3155 | } | 3192 | } |
3193 | |||
3156 | private static float determinant3x3(Matrix4 pMat) | 3194 | private static float determinant3x3(Matrix4 pMat) |
3157 | { | 3195 | { |
3158 | float det = 0; | 3196 | float det = 0; |
@@ -3190,4 +3228,4 @@ Console.WriteLine(" JointCreateFixed"); | |||
3190 | m_material = pMaterial; | 3228 | m_material = pMaterial; |
3191 | } | 3229 | } |
3192 | } | 3230 | } |
3193 | } | 3231 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index e8689a6..355d30b 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |||
@@ -193,9 +193,30 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
193 | private readonly HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>(); | 193 | private readonly HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>(); |
194 | private readonly HashSet<OdePrim> _prims = new HashSet<OdePrim>(); | 194 | private readonly HashSet<OdePrim> _prims = new HashSet<OdePrim>(); |
195 | private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>(); | 195 | private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>(); |
196 | private readonly HashSet<OdePrim> _taintedPrimH = new HashSet<OdePrim>(); | 196 | |
197 | /// <summary> | ||
198 | /// Used to lock on manipulation of _taintedPrimL and _taintedPrimH | ||
199 | /// </summary> | ||
197 | private readonly Object _taintedPrimLock = new Object(); | 200 | private readonly Object _taintedPrimLock = new Object(); |
201 | |||
202 | /// <summary> | ||
203 | /// List of tainted prims. | ||
204 | /// </summary> | ||
205 | /// <remarks> | ||
206 | /// A tainted prim is one that has taints to process before performing any other operations. The list is | ||
207 | /// cleared after processing. | ||
208 | /// </remarks> | ||
198 | private readonly List<OdePrim> _taintedPrimL = new List<OdePrim>(); | 209 | private readonly List<OdePrim> _taintedPrimL = new List<OdePrim>(); |
210 | |||
211 | /// <summary> | ||
212 | /// HashSet of tainted prims. | ||
213 | /// </summary> | ||
214 | /// <remarks> | ||
215 | /// A tainted prim is one that has taints to process before performing any other operations. The hashset is | ||
216 | /// cleared after processing. | ||
217 | /// </remarks> | ||
218 | private readonly HashSet<OdePrim> _taintedPrimH = new HashSet<OdePrim>(); | ||
219 | |||
199 | private readonly HashSet<OdeCharacter> _taintedActors = new HashSet<OdeCharacter>(); | 220 | private readonly HashSet<OdeCharacter> _taintedActors = new HashSet<OdeCharacter>(); |
200 | private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>(); | 221 | private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>(); |
201 | 222 | ||
@@ -257,6 +278,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
257 | // split static geometry collision handling into spaces of 30 meters | 278 | // split static geometry collision handling into spaces of 30 meters |
258 | public IntPtr[,] staticPrimspace; | 279 | public IntPtr[,] staticPrimspace; |
259 | 280 | ||
281 | /// <summary> | ||
282 | /// Used to lock the entire physics scene. Locked during the main part of Simulate() | ||
283 | /// </summary> | ||
260 | public Object OdeLock; | 284 | public Object OdeLock; |
261 | 285 | ||
262 | public IMesher mesher; | 286 | public IMesher mesher; |
@@ -643,15 +667,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
643 | //while (d.SpaceLockQuery(space)) { } // Wait and do nothing | 667 | //while (d.SpaceLockQuery(space)) { } // Wait and do nothing |
644 | } | 668 | } |
645 | 669 | ||
646 | /// <summary> | 670 | // /// <summary> |
647 | /// Debug space message for printing the space that a prim/avatar is in. | 671 | // /// Debug space message for printing the space that a prim/avatar is in. |
648 | /// </summary> | 672 | // /// </summary> |
649 | /// <param name="pos"></param> | 673 | // /// <param name="pos"></param> |
650 | /// <returns>Returns which split up space the given position is in.</returns> | 674 | // /// <returns>Returns which split up space the given position is in.</returns> |
651 | public string whichspaceamIin(Vector3 pos) | 675 | // public string whichspaceamIin(Vector3 pos) |
652 | { | 676 | // { |
653 | return calculateSpaceForGeom(pos).ToString(); | 677 | // return calculateSpaceForGeom(pos).ToString(); |
654 | } | 678 | // } |
655 | 679 | ||
656 | #region Collision Detection | 680 | #region Collision Detection |
657 | 681 | ||
@@ -1402,7 +1426,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1402 | // } | 1426 | // } |
1403 | } | 1427 | } |
1404 | 1428 | ||
1405 | public int TriArrayCallback(IntPtr trimesh, IntPtr refObject, int[] triangleIndex, int triCount) | 1429 | private int TriArrayCallback(IntPtr trimesh, IntPtr refObject, int[] triangleIndex, int triCount) |
1406 | { | 1430 | { |
1407 | /* String name1 = null; | 1431 | /* String name1 = null; |
1408 | String name2 = null; | 1432 | String name2 = null; |
@@ -1421,7 +1445,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1421 | return 1; | 1445 | return 1; |
1422 | } | 1446 | } |
1423 | 1447 | ||
1424 | public int TriCallback(IntPtr trimesh, IntPtr refObject, int triangleIndex) | 1448 | private int TriCallback(IntPtr trimesh, IntPtr refObject, int triangleIndex) |
1425 | { | 1449 | { |
1426 | // String name1 = null; | 1450 | // String name1 = null; |
1427 | // String name2 = null; | 1451 | // String name2 = null; |
@@ -1552,7 +1576,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1552 | } | 1576 | } |
1553 | 1577 | ||
1554 | // Recovered for use by fly height. Kitto Flora | 1578 | // Recovered for use by fly height. Kitto Flora |
1555 | public float GetTerrainHeightAtXY(float x, float y) | 1579 | internal float GetTerrainHeightAtXY(float x, float y) |
1556 | { | 1580 | { |
1557 | int offsetX = ((int)(x / (int)Constants.RegionSize)) * (int)Constants.RegionSize; | 1581 | int offsetX = ((int)(x / (int)Constants.RegionSize)) * (int)Constants.RegionSize; |
1558 | int offsetY = ((int)(y / (int)Constants.RegionSize)) * (int)Constants.RegionSize; | 1582 | int offsetY = ((int)(y / (int)Constants.RegionSize)) * (int)Constants.RegionSize; |
@@ -1610,7 +1634,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1610 | /// Add actor to the list that should receive collision events in the simulate loop. | 1634 | /// Add actor to the list that should receive collision events in the simulate loop. |
1611 | /// </summary> | 1635 | /// </summary> |
1612 | /// <param name="obj"></param> | 1636 | /// <param name="obj"></param> |
1613 | public void AddCollisionEventReporting(PhysicsActor obj) | 1637 | internal void AddCollisionEventReporting(PhysicsActor obj) |
1614 | { | 1638 | { |
1615 | lock (_collisionEventPrim) | 1639 | lock (_collisionEventPrim) |
1616 | { | 1640 | { |
@@ -1623,7 +1647,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1623 | /// Remove actor from the list that should receive collision events in the simulate loop. | 1647 | /// Remove actor from the list that should receive collision events in the simulate loop. |
1624 | /// </summary> | 1648 | /// </summary> |
1625 | /// <param name="obj"></param> | 1649 | /// <param name="obj"></param> |
1626 | public void RemoveCollisionEventReporting(PhysicsActor obj) | 1650 | internal void RemoveCollisionEventReporting(PhysicsActor obj) |
1627 | { | 1651 | { |
1628 | lock (_collisionEventPrim) | 1652 | lock (_collisionEventPrim) |
1629 | { | 1653 | { |
@@ -1647,7 +1671,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1647 | return newAv; | 1671 | return newAv; |
1648 | } | 1672 | } |
1649 | 1673 | ||
1650 | public void AddCharacter(OdeCharacter chr) | 1674 | public override void RemoveAvatar(PhysicsActor actor) |
1675 | { | ||
1676 | //m_log.Debug("[PHYSICS]:ODELOCK"); | ||
1677 | ((OdeCharacter) actor).Destroy(); | ||
1678 | } | ||
1679 | |||
1680 | internal void AddCharacter(OdeCharacter chr) | ||
1651 | { | 1681 | { |
1652 | lock (_characters) | 1682 | lock (_characters) |
1653 | { | 1683 | { |
@@ -1660,7 +1690,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1660 | } | 1690 | } |
1661 | } | 1691 | } |
1662 | 1692 | ||
1663 | public void RemoveCharacter(OdeCharacter chr) | 1693 | internal void RemoveCharacter(OdeCharacter chr) |
1664 | { | 1694 | { |
1665 | lock (_characters) | 1695 | lock (_characters) |
1666 | { | 1696 | { |
@@ -1671,7 +1701,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1671 | } | 1701 | } |
1672 | } | 1702 | } |
1673 | 1703 | ||
1674 | public void BadCharacter(OdeCharacter chr) | 1704 | internal void BadCharacter(OdeCharacter chr) |
1675 | { | 1705 | { |
1676 | lock (_badCharacter) | 1706 | lock (_badCharacter) |
1677 | { | 1707 | { |
@@ -1680,12 +1710,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1680 | } | 1710 | } |
1681 | } | 1711 | } |
1682 | 1712 | ||
1683 | public override void RemoveAvatar(PhysicsActor actor) | ||
1684 | { | ||
1685 | //m_log.Debug("[PHYSICS]:ODELOCK"); | ||
1686 | ((OdeCharacter) actor).Destroy(); | ||
1687 | } | ||
1688 | |||
1689 | private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, | 1713 | private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, |
1690 | PrimitiveBaseShape pbs, bool isphysical, uint localID) | 1714 | PrimitiveBaseShape pbs, bool isphysical, uint localID) |
1691 | { | 1715 | { |
@@ -1705,13 +1729,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1705 | return newPrim; | 1729 | return newPrim; |
1706 | } | 1730 | } |
1707 | 1731 | ||
1708 | public void addActivePrim(OdePrim activatePrim) | 1732 | /// <summary> |
1733 | /// Make this prim subject to physics. | ||
1734 | /// </summary> | ||
1735 | /// <param name="prim"></param> | ||
1736 | internal void ActivatePrim(OdePrim prim) | ||
1709 | { | 1737 | { |
1710 | // adds active prim.. (ones that should be iterated over in collisions_optimized | 1738 | // adds active prim.. (ones that should be iterated over in collisions_optimized |
1711 | lock (_activeprims) | 1739 | lock (_activeprims) |
1712 | { | 1740 | { |
1713 | if (!_activeprims.Contains(activatePrim)) | 1741 | if (!_activeprims.Contains(prim)) |
1714 | _activeprims.Add(activatePrim); | 1742 | _activeprims.Add(prim); |
1715 | //else | 1743 | //else |
1716 | // m_log.Warn("[PHYSICS]: Double Entry in _activeprims detected, potential crash immenent"); | 1744 | // m_log.Warn("[PHYSICS]: Double Entry in _activeprims detected, potential crash immenent"); |
1717 | } | 1745 | } |
@@ -2084,12 +2112,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2084 | return new Vector3(axis.X, axis.Y, axis.Z); | 2112 | return new Vector3(axis.X, axis.Y, axis.Z); |
2085 | } | 2113 | } |
2086 | 2114 | ||
2087 | public void remActivePrim(OdePrim deactivatePrim) | 2115 | /// <summary> |
2116 | /// Stop this prim being subject to physics | ||
2117 | /// </summary> | ||
2118 | /// <param name="prim"></param> | ||
2119 | internal void DeactivatePrim(OdePrim prim) | ||
2088 | { | 2120 | { |
2089 | lock (_activeprims) | 2121 | lock (_activeprims) |
2090 | { | 2122 | _activeprims.Remove(prim); |
2091 | _activeprims.Remove(deactivatePrim); | ||
2092 | } | ||
2093 | } | 2123 | } |
2094 | 2124 | ||
2095 | public override void RemovePrim(PhysicsActor prim) | 2125 | public override void RemovePrim(PhysicsActor prim) |
@@ -2121,7 +2151,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2121 | /// that the space was using. | 2151 | /// that the space was using. |
2122 | /// </summary> | 2152 | /// </summary> |
2123 | /// <param name="prim"></param> | 2153 | /// <param name="prim"></param> |
2124 | public void RemovePrimThreadLocked(OdePrim prim) | 2154 | internal void RemovePrimThreadLocked(OdePrim prim) |
2125 | { | 2155 | { |
2126 | //Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName); | 2156 | //Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName); |
2127 | lock (prim) | 2157 | lock (prim) |
@@ -2217,7 +2247,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2217 | /// Takes a space pointer and zeros out the array we're using to hold the spaces | 2247 | /// Takes a space pointer and zeros out the array we're using to hold the spaces |
2218 | /// </summary> | 2248 | /// </summary> |
2219 | /// <param name="pSpace"></param> | 2249 | /// <param name="pSpace"></param> |
2220 | public void resetSpaceArrayItemToZero(IntPtr pSpace) | 2250 | private void resetSpaceArrayItemToZero(IntPtr pSpace) |
2221 | { | 2251 | { |
2222 | for (int x = 0; x < staticPrimspace.GetLength(0); x++) | 2252 | for (int x = 0; x < staticPrimspace.GetLength(0); x++) |
2223 | { | 2253 | { |
@@ -2229,10 +2259,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2229 | } | 2259 | } |
2230 | } | 2260 | } |
2231 | 2261 | ||
2232 | public void resetSpaceArrayItemToZero(int arrayitemX, int arrayitemY) | 2262 | // private void resetSpaceArrayItemToZero(int arrayitemX, int arrayitemY) |
2233 | { | 2263 | // { |
2234 | staticPrimspace[arrayitemX, arrayitemY] = IntPtr.Zero; | 2264 | // staticPrimspace[arrayitemX, arrayitemY] = IntPtr.Zero; |
2235 | } | 2265 | // } |
2236 | 2266 | ||
2237 | /// <summary> | 2267 | /// <summary> |
2238 | /// Called when a static prim moves. Allocates a space for the prim based on its position | 2268 | /// Called when a static prim moves. Allocates a space for the prim based on its position |
@@ -2241,7 +2271,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2241 | /// <param name="pos">the position that the geom moved to</param> | 2271 | /// <param name="pos">the position that the geom moved to</param> |
2242 | /// <param name="currentspace">a pointer to the space it was in before it was moved.</param> | 2272 | /// <param name="currentspace">a pointer to the space it was in before it was moved.</param> |
2243 | /// <returns>a pointer to the new space it's in</returns> | 2273 | /// <returns>a pointer to the new space it's in</returns> |
2244 | public IntPtr recalculateSpaceForGeom(IntPtr geom, Vector3 pos, IntPtr currentspace) | 2274 | internal IntPtr recalculateSpaceForGeom(IntPtr geom, Vector3 pos, IntPtr currentspace) |
2245 | { | 2275 | { |
2246 | // Called from setting the Position and Size of an ODEPrim so | 2276 | // Called from setting the Position and Size of an ODEPrim so |
2247 | // it's already in locked space. | 2277 | // it's already in locked space. |
@@ -2372,7 +2402,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2372 | /// <param name="iprimspaceArrItemX"></param> | 2402 | /// <param name="iprimspaceArrItemX"></param> |
2373 | /// <param name="iprimspaceArrItemY"></param> | 2403 | /// <param name="iprimspaceArrItemY"></param> |
2374 | /// <returns>A pointer to the created space</returns> | 2404 | /// <returns>A pointer to the created space</returns> |
2375 | public IntPtr createprimspace(int iprimspaceArrItemX, int iprimspaceArrItemY) | 2405 | internal IntPtr createprimspace(int iprimspaceArrItemX, int iprimspaceArrItemY) |
2376 | { | 2406 | { |
2377 | // creating a new space for prim and inserting it into main space. | 2407 | // creating a new space for prim and inserting it into main space. |
2378 | staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = d.HashSpaceCreate(IntPtr.Zero); | 2408 | staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = d.HashSpaceCreate(IntPtr.Zero); |
@@ -2388,7 +2418,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2388 | /// </summary> | 2418 | /// </summary> |
2389 | /// <param name="pos"></param> | 2419 | /// <param name="pos"></param> |
2390 | /// <returns>a pointer to the space. This could be a new space or reused space.</returns> | 2420 | /// <returns>a pointer to the space. This could be a new space or reused space.</returns> |
2391 | public IntPtr calculateSpaceForGeom(Vector3 pos) | 2421 | internal IntPtr calculateSpaceForGeom(Vector3 pos) |
2392 | { | 2422 | { |
2393 | int[] xyspace = calculateSpaceArrayItemFromPos(pos); | 2423 | int[] xyspace = calculateSpaceArrayItemFromPos(pos); |
2394 | //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); | 2424 | //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); |
@@ -2400,7 +2430,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2400 | /// </summary> | 2430 | /// </summary> |
2401 | /// <param name="pos"></param> | 2431 | /// <param name="pos"></param> |
2402 | /// <returns>an array item based on the position</returns> | 2432 | /// <returns>an array item based on the position</returns> |
2403 | public int[] calculateSpaceArrayItemFromPos(Vector3 pos) | 2433 | internal int[] calculateSpaceArrayItemFromPos(Vector3 pos) |
2404 | { | 2434 | { |
2405 | int[] returnint = new int[2]; | 2435 | int[] returnint = new int[2]; |
2406 | 2436 | ||
@@ -2427,7 +2457,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2427 | /// </summary> | 2457 | /// </summary> |
2428 | /// <param name="pbs"></param> | 2458 | /// <param name="pbs"></param> |
2429 | /// <returns></returns> | 2459 | /// <returns></returns> |
2430 | public bool needsMeshing(PrimitiveBaseShape pbs) | 2460 | internal bool needsMeshing(PrimitiveBaseShape pbs) |
2431 | { | 2461 | { |
2432 | // most of this is redundant now as the mesher will return null if it cant mesh a prim | 2462 | // most of this is redundant now as the mesher will return null if it cant mesh a prim |
2433 | // but we still need to check for sculptie meshing being enabled so this is the most | 2463 | // but we still need to check for sculptie meshing being enabled so this is the most |
@@ -2705,7 +2735,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
2705 | else | 2735 | else |
2706 | { | 2736 | { |
2707 | // Console.WriteLine("Simulate calls ProcessTaints for {0}", prim.Name); | 2737 | // Console.WriteLine("Simulate calls ProcessTaints for {0}", prim.Name); |
2708 | prim.ProcessTaints(timeStep); | 2738 | prim.ProcessTaints(); |
2709 | } | 2739 | } |
2710 | 2740 | ||
2711 | processedtaints = true; | 2741 | processedtaints = true; |
@@ -2910,7 +2940,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
2910 | /// <remarks> | 2940 | /// <remarks> |
2911 | /// Called by the main Simulate() loop if NINJA joints are active. Should not be called from anywhere else. | 2941 | /// Called by the main Simulate() loop if NINJA joints are active. Should not be called from anywhere else. |
2912 | /// </remarks> | 2942 | /// </remarks> |
2913 | protected void SimulatePendingNINJAJoints() | 2943 | private void SimulatePendingNINJAJoints() |
2914 | { | 2944 | { |
2915 | // Create pending joints, if possible | 2945 | // Create pending joints, if possible |
2916 | 2946 | ||
@@ -3101,7 +3131,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
3101 | /// Called as part of the Simulate() loop if NINJA physics is active. Must only be called from there. | 3131 | /// Called as part of the Simulate() loop if NINJA physics is active. Must only be called from there. |
3102 | /// </remarks> | 3132 | /// </remarks> |
3103 | /// <param name="actor"></param> | 3133 | /// <param name="actor"></param> |
3104 | protected void SimulateActorPendingJoints(OdePrim actor) | 3134 | private void SimulateActorPendingJoints(OdePrim actor) |
3105 | { | 3135 | { |
3106 | // If an actor moved, move its joint proxy objects as well. | 3136 | // If an actor moved, move its joint proxy objects as well. |
3107 | // There seems to be an event PhysicsActor.OnPositionUpdate that could be used | 3137 | // There seems to be an event PhysicsActor.OnPositionUpdate that could be used |
@@ -3138,7 +3168,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
3138 | } | 3168 | } |
3139 | 3169 | ||
3140 | #region ODE Specific Terrain Fixes | 3170 | #region ODE Specific Terrain Fixes |
3141 | public float[] ResizeTerrain512NearestNeighbour(float[] heightMap) | 3171 | private float[] ResizeTerrain512NearestNeighbour(float[] heightMap) |
3142 | { | 3172 | { |
3143 | float[] returnarr = new float[262144]; | 3173 | float[] returnarr = new float[262144]; |
3144 | float[,] resultarr = new float[(int)WorldExtents.X, (int)WorldExtents.Y]; | 3174 | float[,] resultarr = new float[(int)WorldExtents.X, (int)WorldExtents.Y]; |
@@ -3251,7 +3281,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
3251 | return returnarr; | 3281 | return returnarr; |
3252 | } | 3282 | } |
3253 | 3283 | ||
3254 | public float[] ResizeTerrain512Interpolation(float[] heightMap) | 3284 | private float[] ResizeTerrain512Interpolation(float[] heightMap) |
3255 | { | 3285 | { |
3256 | float[] returnarr = new float[262144]; | 3286 | float[] returnarr = new float[262144]; |
3257 | float[,] resultarr = new float[512,512]; | 3287 | float[,] resultarr = new float[512,512]; |
@@ -3419,7 +3449,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
3419 | } | 3449 | } |
3420 | } | 3450 | } |
3421 | 3451 | ||
3422 | public void SetTerrain(float[] heightMap, Vector3 pOffset) | 3452 | private void SetTerrain(float[] heightMap, Vector3 pOffset) |
3423 | { | 3453 | { |
3424 | // this._heightmap[i] = (double)heightMap[i]; | 3454 | // this._heightmap[i] = (double)heightMap[i]; |
3425 | // dbm (danx0r) -- creating a buffer zone of one extra sample all around | 3455 | // dbm (danx0r) -- creating a buffer zone of one extra sample all around |
@@ -3548,7 +3578,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
3548 | { | 3578 | { |
3549 | } | 3579 | } |
3550 | 3580 | ||
3551 | public float GetWaterLevel() | 3581 | internal float GetWaterLevel() |
3552 | { | 3582 | { |
3553 | return waterlevel; | 3583 | return waterlevel; |
3554 | } | 3584 | } |
@@ -3623,7 +3653,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
3623 | randomizeWater(waterlevel); | 3653 | randomizeWater(waterlevel); |
3624 | } | 3654 | } |
3625 | 3655 | ||
3626 | public void randomizeWater(float baseheight) | 3656 | private void randomizeWater(float baseheight) |
3627 | { | 3657 | { |
3628 | const uint heightmapWidth = m_regionWidth + 2; | 3658 | const uint heightmapWidth = m_regionWidth + 2; |
3629 | const uint heightmapHeight = m_regionHeight + 2; | 3659 | const uint heightmapHeight = m_regionHeight + 2; |
@@ -3675,9 +3705,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
3675 | d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); | 3705 | d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); |
3676 | d.GeomSetRotation(WaterGeom, ref R); | 3706 | d.GeomSetRotation(WaterGeom, ref R); |
3677 | d.GeomSetPosition(WaterGeom, 128, 128, 0); | 3707 | d.GeomSetPosition(WaterGeom, 128, 128, 0); |
3678 | |||
3679 | } | 3708 | } |
3680 | |||
3681 | } | 3709 | } |
3682 | 3710 | ||
3683 | public override void Dispose() | 3711 | public override void Dispose() |
@@ -3724,6 +3752,7 @@ Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | |||
3724 | } | 3752 | } |
3725 | } | 3753 | } |
3726 | } | 3754 | } |
3755 | |||
3727 | return returncolliders; | 3756 | return returncolliders; |
3728 | } | 3757 | } |
3729 | 3758 | ||