diff options
author | Robert Adams | 2012-12-30 10:37:37 -0800 |
---|---|---|
committer | Robert Adams | 2012-12-31 19:57:22 -0800 |
commit | 5379d6d112a8027c8f0f62ba77303e8b69e24332 (patch) | |
tree | 5c8200326768218d59745da8cb6aab658ad6b311 /OpenSim/Region | |
parent | BulletSim: another round of conversion: dynamics world and collision object f... (diff) | |
download | opensim-SC-5379d6d112a8027c8f0f62ba77303e8b69e24332.zip opensim-SC-5379d6d112a8027c8f0f62ba77303e8b69e24332.tar.gz opensim-SC-5379d6d112a8027c8f0f62ba77303e8b69e24332.tar.bz2 opensim-SC-5379d6d112a8027c8f0f62ba77303e8b69e24332.tar.xz |
BulletSim: remove all the debug printing of pointer formatting (.ToString(X)) and replace it with a method on BulletBody, BulletShape, ...
Diffstat (limited to 'OpenSim/Region')
7 files changed, 58 insertions, 25 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs index c9c7c2e..b813974 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs | |||
@@ -65,8 +65,8 @@ public abstract class BSConstraint : IDisposable | |||
65 | bool success = PhysicsScene.PE.DestroyConstraint(m_world, m_constraint); | 65 | bool success = PhysicsScene.PE.DestroyConstraint(m_world, m_constraint); |
66 | m_world.physicsScene.DetailLog("{0},BSConstraint.Dispose,taint,id1={1},body1={2},id2={3},body2={4},success={5}", | 66 | m_world.physicsScene.DetailLog("{0},BSConstraint.Dispose,taint,id1={1},body1={2},id2={3},body2={4},success={5}", |
67 | BSScene.DetailLogZero, | 67 | BSScene.DetailLogZero, |
68 | m_body1.ID, m_body1.ptr.ToString("X"), | 68 | m_body1.ID, m_body1.AddrString, |
69 | m_body2.ID, m_body2.ptr.ToString("X"), | 69 | m_body2.ID, m_body2.AddrString, |
70 | success); | 70 | success); |
71 | m_constraint.Clear(); | 71 | m_constraint.Clear(); |
72 | } | 72 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs index aee93c9..ecb1b32 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs | |||
@@ -54,7 +54,7 @@ public sealed class BSConstraint6Dof : BSConstraint | |||
54 | m_enabled = true; | 54 | m_enabled = true; |
55 | world.physicsScene.DetailLog("{0},BS6DofConstraint,createFrame,wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}", | 55 | world.physicsScene.DetailLog("{0},BS6DofConstraint,createFrame,wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}", |
56 | BSScene.DetailLogZero, world.worldID, | 56 | BSScene.DetailLogZero, world.worldID, |
57 | obj1.ID, obj1.ptr.ToString("X"), obj2.ID, obj2.ptr.ToString("X")); | 57 | obj1.ID, obj1.AddrString, obj2.ID, obj2.AddrString); |
58 | } | 58 | } |
59 | 59 | ||
60 | public BSConstraint6Dof(BulletWorld world, BulletBody obj1, BulletBody obj2, | 60 | public BSConstraint6Dof(BulletWorld world, BulletBody obj1, BulletBody obj2, |
@@ -68,9 +68,9 @@ public sealed class BSConstraint6Dof : BSConstraint | |||
68 | { | 68 | { |
69 | world.physicsScene.DetailLog("{0},BS6DOFConstraint,badBodyPtr,wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}", | 69 | world.physicsScene.DetailLog("{0},BS6DOFConstraint,badBodyPtr,wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}", |
70 | BSScene.DetailLogZero, world.worldID, | 70 | BSScene.DetailLogZero, world.worldID, |
71 | obj1.ID, obj1.ptr.ToString("X"), obj2.ID, obj2.ptr.ToString("X")); | 71 | obj1.ID, obj1.AddrString, obj2.ID, obj2.AddrString); |
72 | world.physicsScene.Logger.ErrorFormat("{0} Attempt to build 6DOF constraint with missing bodies: wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}", | 72 | world.physicsScene.Logger.ErrorFormat("{0} Attempt to build 6DOF constraint with missing bodies: wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}", |
73 | LogHeader, world.worldID, obj1.ID, obj1.ptr.ToString("X"), obj2.ID, obj2.ptr.ToString("X")); | 73 | LogHeader, world.worldID, obj1.ID, obj1.AddrString, obj2.ID, obj2.AddrString); |
74 | m_enabled = false; | 74 | m_enabled = false; |
75 | } | 75 | } |
76 | else | 76 | else |
@@ -79,8 +79,8 @@ public sealed class BSConstraint6Dof : BSConstraint | |||
79 | joinPoint, | 79 | joinPoint, |
80 | useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies); | 80 | useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies); |
81 | PhysicsScene.DetailLog("{0},BS6DofConstraint,createMidPoint,wID={1}, csrt={2}, rID={3}, rBody={4}, cID={5}, cBody={6}", | 81 | PhysicsScene.DetailLog("{0},BS6DofConstraint,createMidPoint,wID={1}, csrt={2}, rID={3}, rBody={4}, cID={5}, cBody={6}", |
82 | BSScene.DetailLogZero, world.worldID, m_constraint.ptr.ToString("X"), | 82 | BSScene.DetailLogZero, world.worldID, m_constraint.AddrString, |
83 | obj1.ID, obj1.ptr.ToString("X"), obj2.ID, obj2.ptr.ToString("X")); | 83 | obj1.ID, obj1.AddrString, obj2.ID, obj2.AddrString); |
84 | if (!m_constraint.HasPhysicalConstraint) | 84 | if (!m_constraint.HasPhysicalConstraint) |
85 | { | 85 | { |
86 | world.physicsScene.Logger.ErrorFormat("{0} Failed creation of 6Dof constraint. rootID={1}, childID={2}", | 86 | world.physicsScene.Logger.ErrorFormat("{0} Failed creation of 6Dof constraint. rootID={1}, childID={2}", |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 3c99ca7..143c60c 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -196,7 +196,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
196 | bool ret = false; | 196 | bool ret = false; |
197 | 197 | ||
198 | DetailLog("{0},BSLinksetCompound.RemoveBodyDependencies,refreshIfChild,rID={1},rBody={2},isRoot={3}", | 198 | DetailLog("{0},BSLinksetCompound.RemoveBodyDependencies,refreshIfChild,rID={1},rBody={2},isRoot={3}", |
199 | child.LocalID, LinksetRoot.LocalID, LinksetRoot.PhysBody.ptr.ToString("X"), IsRoot(child)); | 199 | child.LocalID, LinksetRoot.LocalID, LinksetRoot.PhysBody.AddrString, IsRoot(child)); |
200 | 200 | ||
201 | if (!IsRoot(child)) | 201 | if (!IsRoot(child)) |
202 | { | 202 | { |
@@ -280,8 +280,8 @@ public sealed class BSLinksetCompound : BSLinkset | |||
280 | { | 280 | { |
281 | DetailLog("{0},BSLinksetCompound.RemoveChildFromLinkset,call,rID={1},rBody={2},cID={3},cBody={4}", | 281 | DetailLog("{0},BSLinksetCompound.RemoveChildFromLinkset,call,rID={1},rBody={2},cID={3},cBody={4}", |
282 | child.LocalID, | 282 | child.LocalID, |
283 | LinksetRoot.LocalID, LinksetRoot.PhysBody.ptr.ToString("X"), | 283 | LinksetRoot.LocalID, LinksetRoot.PhysBody.AddrString, |
284 | child.LocalID, child.PhysBody.ptr.ToString("X")); | 284 | child.LocalID, child.PhysBody.AddrString); |
285 | 285 | ||
286 | // Cause the child's body to be rebuilt and thus restored to normal operation | 286 | // Cause the child's body to be rebuilt and thus restored to normal operation |
287 | RecomputeChildWorldPosition(child, false); | 287 | RecomputeChildWorldPosition(child, false); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs index 86c29c7..629bc72 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs | |||
@@ -98,7 +98,7 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
98 | bool ret = false; | 98 | bool ret = false; |
99 | 99 | ||
100 | DetailLog("{0},BSLinksetConstraint.RemoveBodyDependencies,removeChildrenForRoot,rID={1},rBody={2}", | 100 | DetailLog("{0},BSLinksetConstraint.RemoveBodyDependencies,removeChildrenForRoot,rID={1},rBody={2}", |
101 | child.LocalID, LinksetRoot.LocalID, LinksetRoot.PhysBody.ptr.ToString("X")); | 101 | child.LocalID, LinksetRoot.LocalID, LinksetRoot.PhysBody.AddrString); |
102 | 102 | ||
103 | lock (m_linksetActivityLock) | 103 | lock (m_linksetActivityLock) |
104 | { | 104 | { |
@@ -147,8 +147,8 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
147 | 147 | ||
148 | DetailLog("{0},BSLinksetConstraints.RemoveChildFromLinkset,call,rID={1},rBody={2},cID={3},cBody={4}", | 148 | DetailLog("{0},BSLinksetConstraints.RemoveChildFromLinkset,call,rID={1},rBody={2},cID={3},cBody={4}", |
149 | childx.LocalID, | 149 | childx.LocalID, |
150 | rootx.LocalID, rootx.PhysBody.ptr.ToString("X"), | 150 | rootx.LocalID, rootx.PhysBody.AddrString, |
151 | childx.LocalID, childx.PhysBody.ptr.ToString("X")); | 151 | childx.LocalID, childx.PhysBody.AddrString); |
152 | 152 | ||
153 | PhysicsScene.TaintedObject("BSLinksetConstraints.RemoveChildFromLinkset", delegate() | 153 | PhysicsScene.TaintedObject("BSLinksetConstraints.RemoveChildFromLinkset", delegate() |
154 | { | 154 | { |
@@ -187,8 +187,8 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
187 | 187 | ||
188 | DetailLog("{0},BSLinksetConstraint.BuildConstraint,taint,root={1},rBody={2},child={3},cBody={4},rLoc={5},cLoc={6},midLoc={7}", | 188 | DetailLog("{0},BSLinksetConstraint.BuildConstraint,taint,root={1},rBody={2},child={3},cBody={4},rLoc={5},cLoc={6},midLoc={7}", |
189 | rootPrim.LocalID, | 189 | rootPrim.LocalID, |
190 | rootPrim.LocalID, rootPrim.PhysBody.ptr.ToString("X"), | 190 | rootPrim.LocalID, rootPrim.PhysBody.AddrString, |
191 | childPrim.LocalID, childPrim.PhysBody.ptr.ToString("X"), | 191 | childPrim.LocalID, childPrim.PhysBody.AddrString, |
192 | rootPrim.Position, childPrim.Position, midPoint); | 192 | rootPrim.Position, childPrim.Position, midPoint); |
193 | 193 | ||
194 | // create a constraint that allows no freedom of movement between the two objects | 194 | // create a constraint that allows no freedom of movement between the two objects |
@@ -252,8 +252,8 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
252 | bool ret = false; | 252 | bool ret = false; |
253 | DetailLog("{0},BSLinksetConstraint.PhysicallyUnlinkAChildFromRoot,taint,root={1},rBody={2},child={3},cBody={4}", | 253 | DetailLog("{0},BSLinksetConstraint.PhysicallyUnlinkAChildFromRoot,taint,root={1},rBody={2},child={3},cBody={4}", |
254 | rootPrim.LocalID, | 254 | rootPrim.LocalID, |
255 | rootPrim.LocalID, rootPrim.PhysBody.ptr.ToString("X"), | 255 | rootPrim.LocalID, rootPrim.PhysBody.AddrString, |
256 | childPrim.LocalID, childPrim.PhysBody.ptr.ToString("X")); | 256 | childPrim.LocalID, childPrim.PhysBody.AddrString); |
257 | 257 | ||
258 | // Find the constraint for this link and get rid of it from the overall collection and from my list | 258 | // Find the constraint for this link and get rid of it from the overall collection and from my list |
259 | if (PhysicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.PhysBody, childPrim.PhysBody)) | 259 | if (PhysicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.PhysBody, childPrim.PhysBody)) |
@@ -290,7 +290,7 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
290 | // BulletSimAPI.SetCollisionFilterMask2(LinksetRoot.BSBody.ptr, | 290 | // BulletSimAPI.SetCollisionFilterMask2(LinksetRoot.BSBody.ptr, |
291 | // (uint)CollisionFilterGroups.LinksetFilter, (uint)CollisionFilterGroups.LinksetMask); | 291 | // (uint)CollisionFilterGroups.LinksetFilter, (uint)CollisionFilterGroups.LinksetMask); |
292 | DetailLog("{0},BSLinksetConstraint.RecomputeLinksetConstraints,set,rBody={1},linksetMass={2}", | 292 | DetailLog("{0},BSLinksetConstraint.RecomputeLinksetConstraints,set,rBody={1},linksetMass={2}", |
293 | LinksetRoot.LocalID, LinksetRoot.PhysBody.ptr.ToString("X"), linksetMass); | 293 | LinksetRoot.LocalID, LinksetRoot.PhysBody.AddrString, linksetMass); |
294 | 294 | ||
295 | foreach (BSPhysObject child in m_children) | 295 | foreach (BSPhysObject child in m_children) |
296 | { | 296 | { |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 6f819d8..d59e455 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -259,7 +259,7 @@ public sealed class BSShapeCollection : IDisposable | |||
259 | { | 259 | { |
260 | // Native shapes are not tracked and are released immediately | 260 | // Native shapes are not tracked and are released immediately |
261 | if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceShape,deleteNativeShape,ptr={1},taintTime={2}", | 261 | if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceShape,deleteNativeShape,ptr={1},taintTime={2}", |
262 | BSScene.DetailLogZero, shape.ptr.ToString("X"), inTaintTime); | 262 | BSScene.DetailLogZero, shape.AddrString, inTaintTime); |
263 | if (shapeCallback != null) shapeCallback(shape); | 263 | if (shapeCallback != null) shapeCallback(shape); |
264 | PhysicsScene.PE.DeleteCollisionShape(PhysicsScene.World, shape); | 264 | PhysicsScene.PE.DeleteCollisionShape(PhysicsScene.World, shape); |
265 | } | 265 | } |
@@ -336,9 +336,9 @@ public sealed class BSShapeCollection : IDisposable | |||
336 | { | 336 | { |
337 | // Failed the sanity check!! | 337 | // Failed the sanity check!! |
338 | PhysicsScene.Logger.ErrorFormat("{0} Attempt to free a compound shape that is not compound!! type={1}, ptr={2}", | 338 | PhysicsScene.Logger.ErrorFormat("{0} Attempt to free a compound shape that is not compound!! type={1}, ptr={2}", |
339 | LogHeader, shape.type, shape.ptr.ToString("X")); | 339 | LogHeader, shape.type, shape.AddrString); |
340 | if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceCompound,notACompoundShape,type={1},ptr={2}", | 340 | if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceCompound,notACompoundShape,type={1},ptr={2}", |
341 | BSScene.DetailLogZero, shape.type, shape.ptr.ToString("X")); | 341 | BSScene.DetailLogZero, shape.type, shape.AddrString); |
342 | return; | 342 | return; |
343 | } | 343 | } |
344 | 344 | ||
@@ -400,7 +400,7 @@ public sealed class BSShapeCollection : IDisposable | |||
400 | else | 400 | else |
401 | { | 401 | { |
402 | PhysicsScene.Logger.ErrorFormat("{0} Could not decypher shape type. Region={1}, addr={2}", | 402 | PhysicsScene.Logger.ErrorFormat("{0} Could not decypher shape type. Region={1}, addr={2}", |
403 | LogHeader, PhysicsScene.RegionName, cShape.ToString("X")); | 403 | LogHeader, PhysicsScene.RegionName, shapeInfo.AddrString); |
404 | } | 404 | } |
405 | } | 405 | } |
406 | 406 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index cdaa869..423e700 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | |||
@@ -91,11 +91,17 @@ public abstract class BSShape | |||
91 | // All shapes have a static call to get a reference to the physical shape | 91 | // All shapes have a static call to get a reference to the physical shape |
92 | // protected abstract static BSShape GetReference(); | 92 | // protected abstract static BSShape GetReference(); |
93 | 93 | ||
94 | // Returns a string for debugging that uniquily identifies the memory used by this instance | ||
95 | public string AddrString | ||
96 | { | ||
97 | get { return ptr.ToString("X"); } | ||
98 | } | ||
99 | |||
94 | public override string ToString() | 100 | public override string ToString() |
95 | { | 101 | { |
96 | StringBuilder buff = new StringBuilder(); | 102 | StringBuilder buff = new StringBuilder(); |
97 | buff.Append("<p="); | 103 | buff.Append("<p="); |
98 | buff.Append(ptr.ToString("X")); | 104 | buff.Append(AddrString); |
99 | buff.Append(",s="); | 105 | buff.Append(",s="); |
100 | buff.Append(type.ToString()); | 106 | buff.Append(type.ToString()); |
101 | buff.Append(",k="); | 107 | buff.Append(",k="); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs index cd5d170..c10d75e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs | |||
@@ -82,13 +82,22 @@ public class BulletBody | |||
82 | BulletSimData.CollisionTypeMasks[collisionType].mask); | 82 | BulletSimData.CollisionTypeMasks[collisionType].mask); |
83 | } | 83 | } |
84 | 84 | ||
85 | // Used for log messages for a unique display of the memory/object allocated to this instance | ||
86 | public string AddrString | ||
87 | { | ||
88 | get | ||
89 | { | ||
90 | return ptr.ToString("X"); | ||
91 | } | ||
92 | } | ||
93 | |||
85 | public override string ToString() | 94 | public override string ToString() |
86 | { | 95 | { |
87 | StringBuilder buff = new StringBuilder(); | 96 | StringBuilder buff = new StringBuilder(); |
88 | buff.Append("<id="); | 97 | buff.Append("<id="); |
89 | buff.Append(ID.ToString()); | 98 | buff.Append(ID.ToString()); |
90 | buff.Append(",p="); | 99 | buff.Append(",p="); |
91 | buff.Append(ptr.ToString("X")); | 100 | buff.Append(AddrString); |
92 | buff.Append(",c="); | 101 | buff.Append(",c="); |
93 | buff.Append(collisionType); | 102 | buff.Append(collisionType); |
94 | buff.Append(">"); | 103 | buff.Append(">"); |
@@ -124,11 +133,20 @@ public class BulletShape | |||
124 | } | 133 | } |
125 | public bool HasPhysicalShape { get { return ptr != IntPtr.Zero; } } | 134 | public bool HasPhysicalShape { get { return ptr != IntPtr.Zero; } } |
126 | 135 | ||
136 | // Used for log messages for a unique display of the memory/object allocated to this instance | ||
137 | public string AddrString | ||
138 | { | ||
139 | get | ||
140 | { | ||
141 | return ptr.ToString("X"); | ||
142 | } | ||
143 | } | ||
144 | |||
127 | public override string ToString() | 145 | public override string ToString() |
128 | { | 146 | { |
129 | StringBuilder buff = new StringBuilder(); | 147 | StringBuilder buff = new StringBuilder(); |
130 | buff.Append("<p="); | 148 | buff.Append("<p="); |
131 | buff.Append(ptr.ToString("X")); | 149 | buff.Append(AddrString); |
132 | buff.Append(",s="); | 150 | buff.Append(",s="); |
133 | buff.Append(type.ToString()); | 151 | buff.Append(type.ToString()); |
134 | buff.Append(",k="); | 152 | buff.Append(",k="); |
@@ -154,6 +172,15 @@ public class BulletConstraint | |||
154 | ptr = IntPtr.Zero; | 172 | ptr = IntPtr.Zero; |
155 | } | 173 | } |
156 | public bool HasPhysicalConstraint { get { return ptr != IntPtr.Zero; } } | 174 | public bool HasPhysicalConstraint { get { return ptr != IntPtr.Zero; } } |
175 | |||
176 | // Used for log messages for a unique display of the memory/object allocated to this instance | ||
177 | public string AddrString | ||
178 | { | ||
179 | get | ||
180 | { | ||
181 | return ptr.ToString("X"); | ||
182 | } | ||
183 | } | ||
157 | } | 184 | } |
158 | 185 | ||
159 | // An allocated HeightMapThing which holds various heightmap info. | 186 | // An allocated HeightMapThing which holds various heightmap info. |