diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index ed2aad4..d15568e 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | |||
@@ -126,7 +126,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
126 | /// </remarks> | 126 | /// </remarks> |
127 | internal static Object UniversalColliderSyncObject = new Object(); | 127 | internal static Object UniversalColliderSyncObject = new Object(); |
128 | internal static Object SimulationLock = new Object(); | 128 | internal static Object SimulationLock = new Object(); |
129 | 129 | ||
130 | /// <summary> | 130 | /// <summary> |
131 | /// Is stats collecting enabled for this ODE scene? | 131 | /// Is stats collecting enabled for this ODE scene? |
132 | /// </summary> | 132 | /// </summary> |
@@ -495,14 +495,14 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
495 | int spaceGridMaxY; | 495 | int spaceGridMaxY; |
496 | 496 | ||
497 | private ODERayCastRequestManager m_rayCastManager; | 497 | private ODERayCastRequestManager m_rayCastManager; |
498 | 498 | ||
499 | public Scene m_frameWorkScene = null; | 499 | public Scene m_frameWorkScene = null; |
500 | 500 | ||
501 | public OdeScene(Scene pscene, IConfigSource psourceconfig, string pname, string pversion) | 501 | public OdeScene(Scene pscene, IConfigSource psourceconfig, string pname, string pversion) |
502 | { | 502 | { |
503 | m_config = psourceconfig; | 503 | m_config = psourceconfig; |
504 | m_frameWorkScene = pscene; | 504 | m_frameWorkScene = pscene; |
505 | 505 | ||
506 | EngineType = pname; | 506 | EngineType = pname; |
507 | PhysicsSceneName = EngineType + "/" + pscene.RegionInfo.RegionName; | 507 | PhysicsSceneName = EngineType + "/" + pscene.RegionInfo.RegionName; |
508 | EngineName = pname + " " + pversion; | 508 | EngineName = pname + " " + pversion; |
@@ -513,8 +513,8 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
513 | InitialiseFromConfig(m_config); | 513 | InitialiseFromConfig(m_config); |
514 | 514 | ||
515 | // This may not be that good since terrain may not be avaiable at this point | 515 | // This may not be that good since terrain may not be avaiable at this point |
516 | base.Initialise(pscene.PhysicsRequestAsset, | 516 | base.Initialise(pscene.PhysicsRequestAsset, |
517 | (pscene.Heightmap != null ? pscene.Heightmap.GetFloatsSerialised() : new float[(int)(extent.X * extent.Y)]), | 517 | (pscene.Heightmap != null ? pscene.Heightmap.GetFloatsSerialised() : new float[(int)(extent.X * extent.Y)]), |
518 | (float)pscene.RegionInfo.RegionSettings.WaterHeight); | 518 | (float)pscene.RegionInfo.RegionSettings.WaterHeight); |
519 | 519 | ||
520 | } | 520 | } |
@@ -524,8 +524,8 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
524 | mesher = m_frameWorkScene.RequestModuleInterface<IMesher>(); | 524 | mesher = m_frameWorkScene.RequestModuleInterface<IMesher>(); |
525 | if (mesher == null) | 525 | if (mesher == null) |
526 | m_log.WarnFormat("[ODE SCENE]: No mesher in {0}. Things will not work well.", PhysicsSceneName); | 526 | m_log.WarnFormat("[ODE SCENE]: No mesher in {0}. Things will not work well.", PhysicsSceneName); |
527 | 527 | ||
528 | m_frameWorkScene.PhysicsEnabled = true; | 528 | m_frameWorkScene.PhysicsEnabled = true; |
529 | } | 529 | } |
530 | 530 | ||
531 | /// <summary> | 531 | /// <summary> |
@@ -535,11 +535,11 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
535 | /// </summary> | 535 | /// </summary> |
536 | private void Initialise(Vector3 regionExtent) | 536 | private void Initialise(Vector3 regionExtent) |
537 | { | 537 | { |
538 | WorldExtents.X = regionExtent.X; | 538 | WorldExtents.X = regionExtent.X; |
539 | m_regionWidth = (uint)regionExtent.X; | 539 | m_regionWidth = (uint)regionExtent.X; |
540 | WorldExtents.Y = regionExtent.Y; | 540 | WorldExtents.Y = regionExtent.Y; |
541 | m_regionHeight = (uint)regionExtent.Y; | 541 | m_regionHeight = (uint)regionExtent.Y; |
542 | 542 | ||
543 | nearCallback = near; | 543 | nearCallback = near; |
544 | m_rayCastManager = new ODERayCastRequestManager(this); | 544 | m_rayCastManager = new ODERayCastRequestManager(this); |
545 | 545 | ||
@@ -671,7 +671,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
671 | spacesPerMeterY = spaceGridMaxY / WorldExtents.Y; | 671 | spacesPerMeterY = spaceGridMaxY / WorldExtents.Y; |
672 | } | 672 | } |
673 | 673 | ||
674 | staticPrimspace = new IntPtr[spaceGridMaxX, spaceGridMaxY]; | 674 | staticPrimspace = new IntPtr[spaceGridMaxX, spaceGridMaxY]; |
675 | 675 | ||
676 | // make this index limits | 676 | // make this index limits |
677 | spaceGridMaxX--; | 677 | spaceGridMaxX--; |
@@ -948,7 +948,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
948 | { | 948 | { |
949 | if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) | 949 | if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) |
950 | return; | 950 | return; |
951 | 951 | ||
952 | // Separating static prim geometry spaces. | 952 | // Separating static prim geometry spaces. |
953 | // We'll be calling near recursivly if one | 953 | // We'll be calling near recursivly if one |
954 | // of them is a space to find all of the | 954 | // of them is a space to find all of the |
@@ -1027,10 +1027,10 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1027 | 1027 | ||
1028 | PhysicsActor p1; | 1028 | PhysicsActor p1; |
1029 | PhysicsActor p2; | 1029 | PhysicsActor p2; |
1030 | 1030 | ||
1031 | p1ExpectedPoints = 0; | 1031 | p1ExpectedPoints = 0; |
1032 | p2ExpectedPoints = 0; | 1032 | p2ExpectedPoints = 0; |
1033 | 1033 | ||
1034 | if (!actor_name_map.TryGetValue(g1, out p1)) | 1034 | if (!actor_name_map.TryGetValue(g1, out p1)) |
1035 | { | 1035 | { |
1036 | p1 = PANull; | 1036 | p1 = PANull; |
@@ -1067,7 +1067,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1067 | IntPtr joint; | 1067 | IntPtr joint; |
1068 | // If we're colliding with terrain, use 'TerrainContact' instead of contact. | 1068 | // If we're colliding with terrain, use 'TerrainContact' instead of contact. |
1069 | // allows us to have different settings | 1069 | // allows us to have different settings |
1070 | 1070 | ||
1071 | // We only need to test p2 for 'jump crouch purposes' | 1071 | // We only need to test p2 for 'jump crouch purposes' |
1072 | if (p2 is OdeCharacter && p1.PhysicsActorType == (int)ActorTypes.Prim) | 1072 | if (p2 is OdeCharacter && p1.PhysicsActorType == (int)ActorTypes.Prim) |
1073 | { | 1073 | { |
@@ -1081,7 +1081,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1081 | { | 1081 | { |
1082 | p2.IsColliding = true; | 1082 | p2.IsColliding = true; |
1083 | } | 1083 | } |
1084 | 1084 | ||
1085 | //if ((framecount % m_returncollisions) == 0) | 1085 | //if ((framecount % m_returncollisions) == 0) |
1086 | 1086 | ||
1087 | switch (p1.PhysicsActorType) | 1087 | switch (p1.PhysicsActorType) |
@@ -1160,7 +1160,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1160 | 1160 | ||
1161 | // Logic for collision handling | 1161 | // Logic for collision handling |
1162 | // Note, that if *all* contacts are skipped (VolumeDetect) | 1162 | // Note, that if *all* contacts are skipped (VolumeDetect) |
1163 | // The prim still detects (and forwards) collision events but | 1163 | // The prim still detects (and forwards) collision events but |
1164 | // appears to be phantom for the world | 1164 | // appears to be phantom for the world |
1165 | Boolean skipThisContact = false; | 1165 | Boolean skipThisContact = false; |
1166 | 1166 | ||
@@ -1235,10 +1235,10 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1235 | material = ((OdePrim) p2).m_material; | 1235 | material = ((OdePrim) p2).m_material; |
1236 | p2ExpectedPoints = ((OdePrim)p2).ExpectedCollisionContacts; | 1236 | p2ExpectedPoints = ((OdePrim)p2).ExpectedCollisionContacts; |
1237 | } | 1237 | } |
1238 | 1238 | ||
1239 | // Unnessesary because p1 is defined above | 1239 | // Unnessesary because p1 is defined above |
1240 | //if (p1 is OdePrim) | 1240 | //if (p1 is OdePrim) |
1241 | // { | 1241 | // { |
1242 | // p1ExpectedPoints = ((OdePrim)p1).ExpectedCollisionContacts; | 1242 | // p1ExpectedPoints = ((OdePrim)p1).ExpectedCollisionContacts; |
1243 | // } | 1243 | // } |
1244 | //m_log.DebugFormat("Material: {0}", material); | 1244 | //m_log.DebugFormat("Material: {0}", material); |
@@ -1350,7 +1350,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1350 | material = ((OdePrim)p2).m_material; | 1350 | material = ((OdePrim)p2).m_material; |
1351 | p2ExpectedPoints = ((OdePrim)p2).ExpectedCollisionContacts; | 1351 | p2ExpectedPoints = ((OdePrim)p2).ExpectedCollisionContacts; |
1352 | } | 1352 | } |
1353 | 1353 | ||
1354 | //m_log.DebugFormat("Material: {0}", material); | 1354 | //m_log.DebugFormat("Material: {0}", material); |
1355 | m_materialContacts[material, 0].geom = curContact; | 1355 | m_materialContacts[material, 0].geom = curContact; |
1356 | 1356 | ||
@@ -1370,7 +1370,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1370 | } | 1370 | } |
1371 | 1371 | ||
1372 | collision_accounting_events(p1, p2, maxDepthContact); | 1372 | collision_accounting_events(p1, p2, maxDepthContact); |
1373 | 1373 | ||
1374 | if (count > ((p1ExpectedPoints + p2ExpectedPoints) * 0.25) + (geomContactPointsStartthrottle)) | 1374 | if (count > ((p1ExpectedPoints + p2ExpectedPoints) * 0.25) + (geomContactPointsStartthrottle)) |
1375 | { | 1375 | { |
1376 | // If there are more then 3 contact points, it's likely | 1376 | // If there are more then 3 contact points, it's likely |
@@ -1410,7 +1410,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1410 | break; | 1410 | break; |
1411 | } | 1411 | } |
1412 | } | 1412 | } |
1413 | } | 1413 | } |
1414 | else if (at == ActorTypes.Prim) | 1414 | else if (at == ActorTypes.Prim) |
1415 | { | 1415 | { |
1416 | if (((Math.Abs(contactGeom.normal.X - contact.normal.X) < 1.026f) && (Math.Abs(contactGeom.normal.Y - contact.normal.Y) < 0.303f) && (Math.Abs(contactGeom.normal.Z - contact.normal.Z) < 0.065f))) | 1416 | if (((Math.Abs(contactGeom.normal.X - contact.normal.X) < 1.026f) && (Math.Abs(contactGeom.normal.Y - contact.normal.Y) < 0.303f) && (Math.Abs(contactGeom.normal.Z - contact.normal.Z) < 0.065f))) |
@@ -1544,11 +1544,11 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1544 | // since we don't know if we're colliding yet | 1544 | // since we don't know if we're colliding yet |
1545 | if (chr.Shell == IntPtr.Zero || chr.Body == IntPtr.Zero) | 1545 | if (chr.Shell == IntPtr.Zero || chr.Body == IntPtr.Zero) |
1546 | continue; | 1546 | continue; |
1547 | 1547 | ||
1548 | chr.IsColliding = false; | 1548 | chr.IsColliding = false; |
1549 | chr.CollidingGround = false; | 1549 | chr.CollidingGround = false; |
1550 | chr.CollidingObj = false; | 1550 | chr.CollidingObj = false; |
1551 | 1551 | ||
1552 | // Test the avatar's geometry for collision with the space | 1552 | // Test the avatar's geometry for collision with the space |
1553 | // This will return near and the space that they are the closest to | 1553 | // This will return near and the space that they are the closest to |
1554 | // And we'll run this again against the avatar and the space segment | 1554 | // And we'll run this again against the avatar and the space segment |
@@ -1562,7 +1562,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1562 | { | 1562 | { |
1563 | m_log.ErrorFormat("[ODE SCENE]: Unable to space collide {0}", PhysicsSceneName); | 1563 | m_log.ErrorFormat("[ODE SCENE]: Unable to space collide {0}", PhysicsSceneName); |
1564 | } | 1564 | } |
1565 | 1565 | ||
1566 | //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); | 1566 | //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); |
1567 | //if (chr.Position.Z + (chr.Velocity.Z * timeStep) < terrainheight + 10) | 1567 | //if (chr.Position.Z + (chr.Velocity.Z * timeStep) < terrainheight + 10) |
1568 | //{ | 1568 | //{ |
@@ -1655,7 +1655,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1655 | //m_log.DebugFormat("x{0} y{1} = {2}", x, y, (float)TerrainHeightFieldHeights[heightFieldGeom][index]); | 1655 | //m_log.DebugFormat("x{0} y{1} = {2}", x, y, (float)TerrainHeightFieldHeights[heightFieldGeom][index]); |
1656 | return (float)TerrainHeightFieldHeights[heightFieldGeom][index]; | 1656 | return (float)TerrainHeightFieldHeights[heightFieldGeom][index]; |
1657 | } | 1657 | } |
1658 | 1658 | ||
1659 | else | 1659 | else |
1660 | return 0f; | 1660 | return 0f; |
1661 | } | 1661 | } |
@@ -1675,7 +1675,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1675 | { | 1675 | { |
1676 | return 0f; | 1676 | return 0f; |
1677 | } | 1677 | } |
1678 | } | 1678 | } |
1679 | // End recovered. Kitto Flora | 1679 | // End recovered. Kitto Flora |
1680 | 1680 | ||
1681 | /// <summary> | 1681 | /// <summary> |
@@ -1685,7 +1685,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1685 | internal void AddCollisionEventReporting(PhysicsActor obj) | 1685 | internal void AddCollisionEventReporting(PhysicsActor obj) |
1686 | { | 1686 | { |
1687 | // m_log.DebugFormat("[PHYSICS]: Adding {0} {1} to collision event reporting", obj.SOPName, obj.LocalID); | 1687 | // m_log.DebugFormat("[PHYSICS]: Adding {0} {1} to collision event reporting", obj.SOPName, obj.LocalID); |
1688 | 1688 | ||
1689 | lock (m_collisionEventActorsChanges) | 1689 | lock (m_collisionEventActorsChanges) |
1690 | m_collisionEventActorsChanges[obj.LocalID] = obj; | 1690 | m_collisionEventActorsChanges[obj.LocalID] = obj; |
1691 | } | 1691 | } |
@@ -2071,7 +2071,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2071 | 2071 | ||
2072 | lock (externalJointRequestsLock) | 2072 | lock (externalJointRequestsLock) |
2073 | { | 2073 | { |
2074 | if (!requestedJointsToBeCreated.Contains(joint)) // forbid same creation request from entering twice | 2074 | if (!requestedJointsToBeCreated.Contains(joint)) // forbid same creation request from entering twice |
2075 | { | 2075 | { |
2076 | requestedJointsToBeCreated.Add(joint); | 2076 | requestedJointsToBeCreated.Add(joint); |
2077 | } | 2077 | } |
@@ -2417,7 +2417,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2417 | // waitForSpaceUnlock(space); | 2417 | // waitForSpaceUnlock(space); |
2418 | d.SpaceSetSublevel(space, 1); | 2418 | d.SpaceSetSublevel(space, 1); |
2419 | d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]); | 2419 | d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]); |
2420 | 2420 | ||
2421 | return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]; | 2421 | return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]; |
2422 | } | 2422 | } |
2423 | 2423 | ||
@@ -2514,7 +2514,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2514 | iPropertiesNotSupportedDefault++; | 2514 | iPropertiesNotSupportedDefault++; |
2515 | 2515 | ||
2516 | if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0)) | 2516 | if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0)) |
2517 | iPropertiesNotSupportedDefault++; | 2517 | iPropertiesNotSupportedDefault++; |
2518 | 2518 | ||
2519 | if ((pbs.ProfileBegin != 0) || pbs.ProfileEnd != 0) | 2519 | if ((pbs.ProfileBegin != 0) || pbs.ProfileEnd != 0) |
2520 | iPropertiesNotSupportedDefault++; | 2520 | iPropertiesNotSupportedDefault++; |
@@ -2587,7 +2587,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2587 | #if SPAM | 2587 | #if SPAM |
2588 | m_log.Debug("Mesh"); | 2588 | m_log.Debug("Mesh"); |
2589 | #endif | 2589 | #endif |
2590 | return true; | 2590 | return true; |
2591 | } | 2591 | } |
2592 | 2592 | ||
2593 | /// <summary> | 2593 | /// <summary> |
@@ -2652,7 +2652,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2652 | } | 2652 | } |
2653 | _taintedPrims.Clear(); | 2653 | _taintedPrims.Clear(); |
2654 | } | 2654 | } |
2655 | 2655 | ||
2656 | int time = Util.EnvironmentTickCountSubtract(tstart); | 2656 | int time = Util.EnvironmentTickCountSubtract(tstart); |
2657 | m_log.InfoFormat("[Ode] finished {0} operations in {1}ms", donechanges, time); | 2657 | m_log.InfoFormat("[Ode] finished {0} operations in {1}ms", donechanges, time); |
2658 | } | 2658 | } |
@@ -2716,7 +2716,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2716 | CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks | 2716 | CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks |
2717 | } | 2717 | } |
2718 | 2718 | ||
2719 | 2719 | ||
2720 | lock (OdeLock) | 2720 | lock (OdeLock) |
2721 | { | 2721 | { |
2722 | d.AllocateODEDataForThread(~0U); | 2722 | d.AllocateODEDataForThread(~0U); |
@@ -3109,7 +3109,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3109 | // as the axis for the hinge. | 3109 | // as the axis for the hinge. |
3110 | 3110 | ||
3111 | // Therefore, we must get the joint's coordinate frame based on the | 3111 | // Therefore, we must get the joint's coordinate frame based on the |
3112 | // joint.Rotation field, which originates from the orientation of the | 3112 | // joint.Rotation field, which originates from the orientation of the |
3113 | // joint's proxy object in the scene. | 3113 | // joint's proxy object in the scene. |
3114 | 3114 | ||
3115 | // The joint's coordinate frame is defined as the transformation matrix | 3115 | // The joint's coordinate frame is defined as the transformation matrix |
@@ -3237,7 +3237,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3237 | int startTime = Util.EnvironmentTickCount(); | 3237 | int startTime = Util.EnvironmentTickCount(); |
3238 | m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0} with offset {1}", PhysicsSceneName, pOffset); | 3238 | m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0} with offset {1}", PhysicsSceneName, pOffset); |
3239 | 3239 | ||
3240 | 3240 | ||
3241 | float[] _heightmap; | 3241 | float[] _heightmap; |
3242 | 3242 | ||
3243 | // ok im lasy this are just a aliases | 3243 | // ok im lasy this are just a aliases |