diff options
author | Melanie | 2012-08-01 23:03:03 +0100 |
---|---|---|
committer | Melanie | 2012-08-01 23:03:03 +0100 |
commit | ecffcf7f65151a45b6396354d66fec70a7f3bad8 (patch) | |
tree | c2b98c522344cf713421b21ddb4452e537396f5a /OpenSim/Region | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC_OLD-ecffcf7f65151a45b6396354d66fec70a7f3bad8.zip opensim-SC_OLD-ecffcf7f65151a45b6396354d66fec70a7f3bad8.tar.gz opensim-SC_OLD-ecffcf7f65151a45b6396354d66fec70a7f3bad8.tar.bz2 opensim-SC_OLD-ecffcf7f65151a45b6396354d66fec70a7f3bad8.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Framework/Scenes/Scene.cs
OpenSim/Region/Physics/Manager/PhysicsScene.cs
Diffstat (limited to 'OpenSim/Region')
7 files changed, 42 insertions, 17 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index f378153..aed10f6 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -783,6 +783,7 @@ namespace OpenSim | |||
783 | scene.LoadWorldMap(); | 783 | scene.LoadWorldMap(); |
784 | 784 | ||
785 | scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); | 785 | scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); |
786 | scene.PhysicsScene.RequestAssetMethod = scene.PhysicsRequestAsset; | ||
786 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); | 787 | scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); |
787 | scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight); | 788 | scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight); |
788 | 789 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f7d74db..3a28d42 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -5816,5 +5816,21 @@ Environment.Exit(1); | |||
5816 | { | 5816 | { |
5817 | GC.Collect(); | 5817 | GC.Collect(); |
5818 | } | 5818 | } |
5819 | |||
5820 | // Wrappers to get physics modules retrieve assets. Has to be done this way | ||
5821 | // because we can't assign the asset service to physics directly - at the | ||
5822 | // time physics are instantiated it's not registered but it will be by | ||
5823 | // the time the first prim exists. | ||
5824 | public void PhysicsRequestAsset(UUID assetID, AssetReceivedDelegate callback) | ||
5825 | { | ||
5826 | AssetService.Get(assetID.ToString(), callback, PhysicsAssetReceived); | ||
5827 | } | ||
5828 | |||
5829 | private void PhysicsAssetReceived(string id, Object sender, AssetBase asset) | ||
5830 | { | ||
5831 | AssetReceivedDelegate callback = (AssetReceivedDelegate)sender; | ||
5832 | |||
5833 | callback(asset); | ||
5834 | } | ||
5819 | } | 5835 | } |
5820 | } | 5836 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs index 07f5a21..ea3093a 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs | |||
@@ -86,7 +86,7 @@ public class BSConstraint : IDisposable | |||
86 | 86 | ||
87 | public bool SetCFMAndERP(float cfm, float erp) | 87 | public bool SetCFMAndERP(float cfm, float erp) |
88 | { | 88 | { |
89 | bool ret = false; | 89 | bool ret = true; |
90 | BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_STOP_CFM, cfm, ConstraintParamAxis.AXIS_ALL); | 90 | BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_STOP_CFM, cfm, ConstraintParamAxis.AXIS_ALL); |
91 | BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_STOP_ERP, erp, ConstraintParamAxis.AXIS_ALL); | 91 | BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_STOP_ERP, erp, ConstraintParamAxis.AXIS_ALL); |
92 | BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_CFM, cfm, ConstraintParamAxis.AXIS_ALL); | 92 | BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_CFM, cfm, ConstraintParamAxis.AXIS_ALL); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 50d11e6..a4ab702 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -187,6 +187,7 @@ public sealed class BSPrim : PhysicsActor | |||
187 | { | 187 | { |
188 | _mass = CalculateMass(); // changing size changes the mass | 188 | _mass = CalculateMass(); // changing size changes the mass |
189 | BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, (IsPhysical ? _mass : 0f), IsPhysical); | 189 | BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, (IsPhysical ? _mass : 0f), IsPhysical); |
190 | DetailLog("{0}: setSize: size={1}, mass={2}, physical={3}", LocalID, _size, _mass, IsPhysical); | ||
190 | RecreateGeomAndObject(); | 191 | RecreateGeomAndObject(); |
191 | }); | 192 | }); |
192 | } | 193 | } |
@@ -972,7 +973,7 @@ public sealed class BSPrim : PhysicsActor | |||
972 | if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z) | 973 | if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z) |
973 | { | 974 | { |
974 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size); | 975 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size); |
975 | if (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE) | 976 | if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE)) |
976 | { | 977 | { |
977 | DetailLog("{0},CreateGeom,sphere", LocalID); | 978 | DetailLog("{0},CreateGeom,sphere", LocalID); |
978 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE; | 979 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE; |
@@ -986,7 +987,7 @@ public sealed class BSPrim : PhysicsActor | |||
986 | else | 987 | else |
987 | { | 988 | { |
988 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, type={2}, size={3}", LogHeader, LocalID, _shapeType, _size); | 989 | // m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, type={2}, size={3}", LogHeader, LocalID, _shapeType, _size); |
989 | if (_shapeType != ShapeData.PhysicsShapeType.SHAPE_BOX) | 990 | if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_BOX)) |
990 | { | 991 | { |
991 | DetailLog("{0},CreateGeom,box", LocalID); | 992 | DetailLog("{0},CreateGeom,box", LocalID); |
992 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX; | 993 | _shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX; |
@@ -1201,7 +1202,8 @@ public sealed class BSPrim : PhysicsActor | |||
1201 | 1202 | ||
1202 | // Create an object in Bullet if it has not already been created | 1203 | // Create an object in Bullet if it has not already been created |
1203 | // No locking here because this is done when the physics engine is not simulating | 1204 | // No locking here because this is done when the physics engine is not simulating |
1204 | private void CreateObject() | 1205 | // Returns 'true' if an object was actually created. |
1206 | private bool CreateObject() | ||
1205 | { | 1207 | { |
1206 | // this routine is called when objects are rebuilt. | 1208 | // this routine is called when objects are rebuilt. |
1207 | 1209 | ||
@@ -1209,10 +1211,12 @@ public sealed class BSPrim : PhysicsActor | |||
1209 | ShapeData shape; | 1211 | ShapeData shape; |
1210 | FillShapeInfo(out shape); | 1212 | FillShapeInfo(out shape); |
1211 | // m_log.DebugFormat("{0}: CreateObject: lID={1}, shape={2}", LogHeader, _localID, shape.Type); | 1213 | // m_log.DebugFormat("{0}: CreateObject: lID={1}, shape={2}", LogHeader, _localID, shape.Type); |
1212 | BulletSimAPI.CreateObject(_scene.WorldID, shape); | 1214 | bool ret = BulletSimAPI.CreateObject(_scene.WorldID, shape); |
1213 | 1215 | ||
1214 | // the CreateObject() may have recreated the rigid body. Make sure we have the latest. | 1216 | // the CreateObject() may have recreated the rigid body. Make sure we have the latest. |
1215 | m_body.Ptr = BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID); | 1217 | m_body.Ptr = BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID); |
1218 | |||
1219 | return ret; | ||
1216 | } | 1220 | } |
1217 | 1221 | ||
1218 | // Copy prim's info into the BulletSim shape description structure | 1222 | // Copy prim's info into the BulletSim shape description structure |
@@ -1327,7 +1331,6 @@ public sealed class BSPrim : PhysicsActor | |||
1327 | 1331 | ||
1328 | base.RequestPhysicsterseUpdate(); | 1332 | base.RequestPhysicsterseUpdate(); |
1329 | } | 1333 | } |
1330 | /* | ||
1331 | else | 1334 | else |
1332 | { | 1335 | { |
1333 | // For debugging, we can also report the movement of children | 1336 | // For debugging, we can also report the movement of children |
@@ -1335,7 +1338,6 @@ public sealed class BSPrim : PhysicsActor | |||
1335 | LocalID, entprop.Position, entprop.Rotation, entprop.Velocity, | 1338 | LocalID, entprop.Position, entprop.Rotation, entprop.Velocity, |
1336 | entprop.Acceleration, entprop.RotationalVelocity); | 1339 | entprop.Acceleration, entprop.RotationalVelocity); |
1337 | } | 1340 | } |
1338 | */ | ||
1339 | } | 1341 | } |
1340 | 1342 | ||
1341 | // I've collided with something | 1343 | // I've collided with something |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs index fe705cc..0ffbc94 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | |||
@@ -87,12 +87,12 @@ public struct ShapeData | |||
87 | public System.UInt64 MeshKey; | 87 | public System.UInt64 MeshKey; |
88 | public float Friction; | 88 | public float Friction; |
89 | public float Restitution; | 89 | public float Restitution; |
90 | public int Collidable; | 90 | public float Collidable; // true of things bump into this |
91 | public int Static; // true if a static object. Otherwise gravity, etc. | 91 | public float Static; // true if a static object. Otherwise gravity, etc. |
92 | 92 | ||
93 | // note that bools are passed as ints since bool size changes by language and architecture | 93 | // note that bools are passed as floats since bool size changes by language and architecture |
94 | public const int numericTrue = 1; | 94 | public const float numericTrue = 1f; |
95 | public const int numericFalse = 0; | 95 | public const float numericFalse = 0f; |
96 | } | 96 | } |
97 | [StructLayout(LayoutKind.Sequential)] | 97 | [StructLayout(LayoutKind.Sequential)] |
98 | public struct SweepHit | 98 | public struct SweepHit |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index cfede55..5274f3b 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -71,6 +71,9 @@ namespace OpenSim.Region.Physics.Manager | |||
71 | All = 0x3f | 71 | All = 0x3f |
72 | } | 72 | } |
73 | 73 | ||
74 | public delegate void RequestAssetDelegate(UUID assetID, AssetReceivedDelegate callback); | ||
75 | public delegate void AssetReceivedDelegate(AssetBase asset); | ||
76 | |||
74 | /// <summary> | 77 | /// <summary> |
75 | /// Contact result from a raycast. | 78 | /// Contact result from a raycast. |
76 | /// </summary> | 79 | /// </summary> |
@@ -103,6 +106,8 @@ namespace OpenSim.Region.Physics.Manager | |||
103 | get { return new NullPhysicsScene(); } | 106 | get { return new NullPhysicsScene(); } |
104 | } | 107 | } |
105 | 108 | ||
109 | public RequestAssetDelegate RequestAssetMethod { private get; set; } | ||
110 | |||
106 | public virtual void TriggerPhysicsBasedRestart() | 111 | public virtual void TriggerPhysicsBasedRestart() |
107 | { | 112 | { |
108 | physicsCrash handler = OnPhysicsCrash; | 113 | physicsCrash handler = OnPhysicsCrash; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index f6c8e38..678f9d5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -60,8 +60,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
60 | m_CmdManager = CmdManager; | 60 | m_CmdManager = CmdManager; |
61 | maximumRange = CmdManager.m_ScriptEngine.Config.GetDouble("SensorMaxRange", 96.0d); | 61 | maximumRange = CmdManager.m_ScriptEngine.Config.GetDouble("SensorMaxRange", 96.0d); |
62 | maximumToReturn = CmdManager.m_ScriptEngine.Config.GetInt("SensorMaxResults", 16); | 62 | maximumToReturn = CmdManager.m_ScriptEngine.Config.GetInt("SensorMaxResults", 16); |
63 | m_npcModule = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<INPCModule>(); | ||
63 | } | 64 | } |
64 | 65 | ||
66 | private INPCModule m_npcModule; | ||
67 | |||
65 | private Object SenseLock = new Object(); | 68 | private Object SenseLock = new Object(); |
66 | 69 | ||
67 | private const int AGENT = 1; | 70 | private const int AGENT = 1; |
@@ -451,8 +454,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
451 | 454 | ||
452 | private List<SensedEntity> doAgentSensor(SenseRepeatClass ts) | 455 | private List<SensedEntity> doAgentSensor(SenseRepeatClass ts) |
453 | { | 456 | { |
454 | INPCModule npcModule = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<INPCModule>(); | ||
455 | |||
456 | List<SensedEntity> sensedEntities = new List<SensedEntity>(); | 457 | List<SensedEntity> sensedEntities = new List<SensedEntity>(); |
457 | 458 | ||
458 | // If nobody about quit fast | 459 | // If nobody about quit fast |
@@ -488,7 +489,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
488 | bool attached = (SensePoint.ParentGroup.AttachmentPoint != 0); | 489 | bool attached = (SensePoint.ParentGroup.AttachmentPoint != 0); |
489 | Vector3 toRegionPos; | 490 | Vector3 toRegionPos; |
490 | double dis; | 491 | double dis; |
491 | 492 | ||
492 | Action<ScenePresence> senseEntity = new Action<ScenePresence>(presence => | 493 | Action<ScenePresence> senseEntity = new Action<ScenePresence>(presence => |
493 | { | 494 | { |
494 | // m_log.DebugFormat( | 495 | // m_log.DebugFormat( |
@@ -497,7 +498,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
497 | 498 | ||
498 | if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc) | 499 | if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc) |
499 | { | 500 | { |
500 | INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); | 501 | INPC npcData = m_npcModule.GetNPC(presence.UUID, presence.Scene); |
501 | if (npcData == null || !npcData.SenseAsAgent) | 502 | if (npcData == null || !npcData.SenseAsAgent) |
502 | { | 503 | { |
503 | // m_log.DebugFormat( | 504 | // m_log.DebugFormat( |
@@ -515,7 +516,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
515 | } | 516 | } |
516 | else | 517 | else |
517 | { | 518 | { |
518 | INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); | 519 | INPC npcData = m_npcModule.GetNPC(presence.UUID, presence.Scene); |
519 | if (npcData != null && npcData.SenseAsAgent) | 520 | if (npcData != null && npcData.SenseAsAgent) |
520 | { | 521 | { |
521 | // m_log.DebugFormat( | 522 | // m_log.DebugFormat( |