diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 71 |
1 files changed, 41 insertions, 30 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index c92c9b9..b3dfa41 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -157,12 +157,20 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
157 | public delegate void TaintCallback(); | 157 | public delegate void TaintCallback(); |
158 | private struct TaintCallbackEntry | 158 | private struct TaintCallbackEntry |
159 | { | 159 | { |
160 | public String originator; | ||
160 | public String ident; | 161 | public String ident; |
161 | public TaintCallback callback; | 162 | public TaintCallback callback; |
162 | public TaintCallbackEntry(string i, TaintCallback c) | 163 | public TaintCallbackEntry(string pIdent, TaintCallback pCallBack) |
163 | { | 164 | { |
164 | ident = i; | 165 | originator = BSScene.DetailLogZero; |
165 | callback = c; | 166 | ident = pIdent; |
167 | callback = pCallBack; | ||
168 | } | ||
169 | public TaintCallbackEntry(string pOrigin, string pIdent, TaintCallback pCallBack) | ||
170 | { | ||
171 | originator = pOrigin; | ||
172 | ident = pIdent; | ||
173 | callback = pCallBack; | ||
166 | } | 174 | } |
167 | } | 175 | } |
168 | private Object _taintLock = new Object(); // lock for using the next object | 176 | private Object _taintLock = new Object(); // lock for using the next object |
@@ -867,18 +875,9 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
867 | public override bool IsThreaded { get { return false; } } | 875 | public override bool IsThreaded { get { return false; } } |
868 | 876 | ||
869 | #region Extensions | 877 | #region Extensions |
870 | // ============================================================= | ||
871 | // Per scene functions. See below. | ||
872 | |||
873 | // Per avatar functions. See BSCharacter. | ||
874 | |||
875 | // Per prim functions. See BSPrim. | ||
876 | public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType"; | ||
877 | public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType"; | ||
878 | // ============================================================= | ||
879 | |||
880 | public override object Extension(string pFunct, params object[] pParams) | 878 | public override object Extension(string pFunct, params object[] pParams) |
881 | { | 879 | { |
880 | DetailLog("{0} BSScene.Extension,op={1}", DetailLogZero, pFunct); | ||
882 | return base.Extension(pFunct, pParams); | 881 | return base.Extension(pFunct, pParams); |
883 | } | 882 | } |
884 | #endregion // Extensions | 883 | #endregion // Extensions |
@@ -897,26 +896,37 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
897 | // Calls to the PhysicsActors can't directly call into the physics engine | 896 | // Calls to the PhysicsActors can't directly call into the physics engine |
898 | // because it might be busy. We delay changes to a known time. | 897 | // because it might be busy. We delay changes to a known time. |
899 | // We rely on C#'s closure to save and restore the context for the delegate. | 898 | // We rely on C#'s closure to save and restore the context for the delegate. |
900 | public void TaintedObject(String ident, TaintCallback callback) | 899 | public void TaintedObject(string pOriginator, string pIdent, TaintCallback pCallback) |
901 | { | 900 | { |
902 | if (!m_initialized) return; | 901 | TaintedObject(false /*inTaintTime*/, pOriginator, pIdent, pCallback); |
903 | 902 | } | |
904 | lock (_taintLock) | 903 | public void TaintedObject(uint pOriginator, String pIdent, TaintCallback pCallback) |
905 | { | 904 | { |
906 | _taintOperations.Add(new TaintCallbackEntry(ident, callback)); | 905 | TaintedObject(false /*inTaintTime*/, m_physicsLoggingEnabled ? pOriginator.ToString() : BSScene.DetailLogZero, pIdent, pCallback); |
907 | } | 906 | } |
908 | 907 | public void TaintedObject(bool inTaintTime, String pIdent, TaintCallback pCallback) | |
909 | return; | 908 | { |
909 | TaintedObject(inTaintTime, BSScene.DetailLogZero, pIdent, pCallback); | ||
910 | } | ||
911 | public void TaintedObject(bool inTaintTime, uint pOriginator, String pIdent, TaintCallback pCallback) | ||
912 | { | ||
913 | TaintedObject(inTaintTime, m_physicsLoggingEnabled ? pOriginator.ToString() : BSScene.DetailLogZero, pIdent, pCallback); | ||
910 | } | 914 | } |
911 | |||
912 | // Sometimes a potentially tainted operation can be used in and out of taint time. | 915 | // Sometimes a potentially tainted operation can be used in and out of taint time. |
913 | // This routine executes the command immediately if in taint-time otherwise it is queued. | 916 | // This routine executes the command immediately if in taint-time otherwise it is queued. |
914 | public void TaintedObject(bool inTaintTime, string ident, TaintCallback callback) | 917 | public void TaintedObject(bool inTaintTime, string pOriginator, string pIdent, TaintCallback pCallback) |
915 | { | 918 | { |
919 | if (!m_initialized) return; | ||
920 | |||
916 | if (inTaintTime) | 921 | if (inTaintTime) |
917 | callback(); | 922 | pCallback(); |
918 | else | 923 | else |
919 | TaintedObject(ident, callback); | 924 | { |
925 | lock (_taintLock) | ||
926 | { | ||
927 | _taintOperations.Add(new TaintCallbackEntry(pOriginator, pIdent, pCallback)); | ||
928 | } | ||
929 | } | ||
920 | } | 930 | } |
921 | 931 | ||
922 | private void TriggerPreStepEvent(float timeStep) | 932 | private void TriggerPreStepEvent(float timeStep) |
@@ -960,7 +970,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
960 | { | 970 | { |
961 | try | 971 | try |
962 | { | 972 | { |
963 | DetailLog("{0},BSScene.ProcessTaints,doTaint,id={1}", DetailLogZero, tcbe.ident); // DEBUG DEBUG DEBUG | 973 | DetailLog("{0},BSScene.ProcessTaints,doTaint,id={1}", tcbe.originator, tcbe.ident); // DEBUG DEBUG DEBUG |
964 | tcbe.callback(); | 974 | tcbe.callback(); |
965 | } | 975 | } |
966 | catch (Exception e) | 976 | catch (Exception e) |
@@ -977,10 +987,11 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
977 | // will replace any previous operation by the same object. | 987 | // will replace any previous operation by the same object. |
978 | public void PostTaintObject(String ident, uint ID, TaintCallback callback) | 988 | public void PostTaintObject(String ident, uint ID, TaintCallback callback) |
979 | { | 989 | { |
980 | string uniqueIdent = ident + "-" + ID.ToString(); | 990 | string IDAsString = ID.ToString(); |
991 | string uniqueIdent = ident + "-" + IDAsString; | ||
981 | lock (_taintLock) | 992 | lock (_taintLock) |
982 | { | 993 | { |
983 | _postTaintOperations[uniqueIdent] = new TaintCallbackEntry(uniqueIdent, callback); | 994 | _postTaintOperations[uniqueIdent] = new TaintCallbackEntry(IDAsString, uniqueIdent, callback); |
984 | } | 995 | } |
985 | 996 | ||
986 | return; | 997 | return; |
@@ -1090,7 +1101,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
1090 | string xval = val; | 1101 | string xval = val; |
1091 | List<uint> xlIDs = lIDs; | 1102 | List<uint> xlIDs = lIDs; |
1092 | string xparm = parm; | 1103 | string xparm = parm; |
1093 | TaintedObject("BSScene.UpdateParameterSet", delegate() { | 1104 | TaintedObject(DetailLogZero, "BSScene.UpdateParameterSet", delegate() { |
1094 | BSParam.ParameterDefnBase thisParam; | 1105 | BSParam.ParameterDefnBase thisParam; |
1095 | if (BSParam.TryGetParameter(xparm, out thisParam)) | 1106 | if (BSParam.TryGetParameter(xparm, out thisParam)) |
1096 | { | 1107 | { |