aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
diff options
context:
space:
mode:
authorRobert Adams2013-04-28 21:50:47 -0700
committerRobert Adams2013-04-29 07:38:55 -0700
commitad1787770ed02f71feaa002ab689467e187803bb (patch)
tree08026c7b0b160ae9b16c2876894852f8a729bbb4 /OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
parentBulletSim: first cut at new linksetCompound shape building. (diff)
downloadopensim-SC-ad1787770ed02f71feaa002ab689467e187803bb.zip
opensim-SC-ad1787770ed02f71feaa002ab689467e187803bb.tar.gz
opensim-SC-ad1787770ed02f71feaa002ab689467e187803bb.tar.bz2
opensim-SC-ad1787770ed02f71feaa002ab689467e187803bb.tar.xz
BulletSim: rename variable 'PhysicsScene' to be either 'PhysScene' or 'm_physicsScene' to match coding conventions and reduce confusion.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs34
1 files changed, 17 insertions, 17 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index be01808..01ada3f 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -121,7 +121,7 @@ public sealed class BSLinksetCompound : BSLinkset
121 // If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding. 121 // If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding.
122 if (!Rebuilding && HasAnyChildren) 122 if (!Rebuilding && HasAnyChildren)
123 { 123 {
124 PhysicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate() 124 m_physicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate()
125 { 125 {
126 if (HasAnyChildren) 126 if (HasAnyChildren)
127 RecomputeLinksetCompound(); 127 RecomputeLinksetCompound();
@@ -147,10 +147,10 @@ public sealed class BSLinksetCompound : BSLinkset
147 { 147 {
148 // The origional prims are removed from the world as the shape of the root compound 148 // The origional prims are removed from the world as the shape of the root compound
149 // shape takes over. 149 // shape takes over.
150 PhysicsScene.PE.AddToCollisionFlags(child.PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE); 150 m_physicsScene.PE.AddToCollisionFlags(child.PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE);
151 PhysicsScene.PE.ForceActivationState(child.PhysBody, ActivationState.DISABLE_SIMULATION); 151 m_physicsScene.PE.ForceActivationState(child.PhysBody, ActivationState.DISABLE_SIMULATION);
152 // We don't want collisions from the old linkset children. 152 // We don't want collisions from the old linkset children.
153 PhysicsScene.PE.RemoveFromCollisionFlags(child.PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 153 m_physicsScene.PE.RemoveFromCollisionFlags(child.PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
154 154
155 child.PhysBody.collisionType = CollisionType.LinksetChild; 155 child.PhysBody.collisionType = CollisionType.LinksetChild;
156 156
@@ -175,12 +175,12 @@ public sealed class BSLinksetCompound : BSLinkset
175 else 175 else
176 { 176 {
177 // The non-physical children can come back to life. 177 // The non-physical children can come back to life.
178 PhysicsScene.PE.RemoveFromCollisionFlags(child.PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE); 178 m_physicsScene.PE.RemoveFromCollisionFlags(child.PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE);
179 179
180 child.PhysBody.collisionType = CollisionType.LinksetChild; 180 child.PhysBody.collisionType = CollisionType.LinksetChild;
181 181
182 // Don't force activation so setting of DISABLE_SIMULATION can stay if used. 182 // Don't force activation so setting of DISABLE_SIMULATION can stay if used.
183 PhysicsScene.PE.Activate(child.PhysBody, false); 183 m_physicsScene.PE.Activate(child.PhysBody, false);
184 ret = true; 184 ret = true;
185 } 185 }
186 return ret; 186 return ret;
@@ -196,7 +196,7 @@ public sealed class BSLinksetCompound : BSLinkset
196 // but it also means all the child positions get updated. 196 // but it also means all the child positions get updated.
197 // What would cause an unnecessary rebuild so we make sure the linkset is in a 197 // What would cause an unnecessary rebuild so we make sure the linkset is in a
198 // region before bothering to do a rebuild. 198 // region before bothering to do a rebuild.
199 if (!IsRoot(updated) && PhysicsScene.TerrainManager.IsWithinKnownTerrain(LinksetRoot.RawPosition)) 199 if (!IsRoot(updated) && m_physicsScene.TerrainManager.IsWithinKnownTerrain(LinksetRoot.RawPosition))
200 { 200 {
201 // If a child of the linkset is updating only the position or rotation, that can be done 201 // If a child of the linkset is updating only the position or rotation, that can be done
202 // without rebuilding the linkset. 202 // without rebuilding the linkset.
@@ -209,21 +209,21 @@ public sealed class BSLinksetCompound : BSLinkset
209 if ((whichUpdated & ~(UpdatedProperties.Position | UpdatedProperties.Orientation)) == 0) 209 if ((whichUpdated & ~(UpdatedProperties.Position | UpdatedProperties.Orientation)) == 0)
210 { 210 {
211 // Find the physical instance of the child 211 // Find the physical instance of the child
212 if (LinksetRoot.PhysShape.HasPhysicalShape && PhysicsScene.PE.IsCompound(LinksetRoot.PhysShape.physShapeInfo)) 212 if (LinksetRoot.PhysShape.HasPhysicalShape && m_physicsScene.PE.IsCompound(LinksetRoot.PhysShape.physShapeInfo))
213 { 213 {
214 // It is possible that the linkset is still under construction and the child is not yet 214 // It is possible that the linkset is still under construction and the child is not yet
215 // inserted into the compound shape. A rebuild of the linkset in a pre-step action will 215 // inserted into the compound shape. A rebuild of the linkset in a pre-step action will
216 // build the whole thing with the new position or rotation. 216 // build the whole thing with the new position or rotation.
217 // The index must be checked because Bullet references the child array but does no validity 217 // The index must be checked because Bullet references the child array but does no validity
218 // checking of the child index passed. 218 // checking of the child index passed.
219 int numLinksetChildren = PhysicsScene.PE.GetNumberOfCompoundChildren(LinksetRoot.PhysShape.physShapeInfo); 219 int numLinksetChildren = m_physicsScene.PE.GetNumberOfCompoundChildren(LinksetRoot.PhysShape.physShapeInfo);
220 if (updated.LinksetChildIndex < numLinksetChildren) 220 if (updated.LinksetChildIndex < numLinksetChildren)
221 { 221 {
222 BulletShape linksetChildShape = PhysicsScene.PE.GetChildShapeFromCompoundShapeIndex(LinksetRoot.PhysShape.physShapeInfo, updated.LinksetChildIndex); 222 BulletShape linksetChildShape = m_physicsScene.PE.GetChildShapeFromCompoundShapeIndex(LinksetRoot.PhysShape.physShapeInfo, updated.LinksetChildIndex);
223 if (linksetChildShape.HasPhysicalShape) 223 if (linksetChildShape.HasPhysicalShape)
224 { 224 {
225 // Found the child shape within the compound shape 225 // Found the child shape within the compound shape
226 PhysicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape.physShapeInfo, updated.LinksetChildIndex, 226 m_physicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape.physShapeInfo, updated.LinksetChildIndex,
227 updated.RawPosition - LinksetRoot.RawPosition, 227 updated.RawPosition - LinksetRoot.RawPosition,
228 updated.RawOrientation * OMV.Quaternion.Inverse(LinksetRoot.RawOrientation), 228 updated.RawOrientation * OMV.Quaternion.Inverse(LinksetRoot.RawOrientation),
229 true /* shouldRecalculateLocalAabb */); 229 true /* shouldRecalculateLocalAabb */);
@@ -401,9 +401,9 @@ public sealed class BSLinksetCompound : BSLinkset
401 // Here we build the compound shape made up of all the children. 401 // Here we build the compound shape made up of all the children.
402 402
403 // Free up any shape we'd previously built. 403 // Free up any shape we'd previously built.
404 LinksetShape.Dereference(PhysicsScene); 404 LinksetShape.Dereference(m_physicsScene);
405 405
406 LinksetShape = BSShapeCompound.GetReference(PhysicsScene, LinksetRoot); 406 LinksetShape = BSShapeCompound.GetReference(m_physicsScene, LinksetRoot);
407 407
408 // The center of mass for the linkset is the geometric center of the group. 408 // The center of mass for the linkset is the geometric center of the group.
409 // Compute a displacement for each component so it is relative to the center-of-mass. 409 // Compute a displacement for each component so it is relative to the center-of-mass.
@@ -435,7 +435,7 @@ public sealed class BSLinksetCompound : BSLinkset
435 childShape.IncrementReference(); 435 childShape.IncrementReference();
436 OMV.Vector3 offsetPos = (cPrim.RawPosition - LinksetRoot.RawPosition) * invRootOrientation - centerDisplacement; 436 OMV.Vector3 offsetPos = (cPrim.RawPosition - LinksetRoot.RawPosition) * invRootOrientation - centerDisplacement;
437 OMV.Quaternion offsetRot = cPrim.RawOrientation * invRootOrientation; 437 OMV.Quaternion offsetRot = cPrim.RawOrientation * invRootOrientation;
438 PhysicsScene.PE.AddChildShapeToCompoundShape(LinksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot); 438 m_physicsScene.PE.AddChildShapeToCompoundShape(LinksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot);
439 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},rShape={2},cShape={3},offPos={4},offRot={5}", 439 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},rShape={2},cShape={3},offPos={4},offRot={5}",
440 LinksetRoot.LocalID, memberIndex, LinksetRoot.PhysShape, cPrim.PhysShape, offsetPos, offsetRot); 440 LinksetRoot.LocalID, memberIndex, LinksetRoot.PhysShape, cPrim.PhysShape, offsetPos, offsetRot);
441 441
@@ -446,14 +446,14 @@ public sealed class BSLinksetCompound : BSLinkset
446 446
447 // Sneak the built compound shape in as the shape of the root prim. 447 // Sneak the built compound shape in as the shape of the root prim.
448 // Note this doesn't touch the root prim's PhysShape so be sure the manage the difference. 448 // Note this doesn't touch the root prim's PhysShape so be sure the manage the difference.
449 PhysicsScene.PE.SetCollisionShape(PhysicsScene.World, LinksetRoot.PhysBody, LinksetShape.physShapeInfo); 449 m_physicsScene.PE.SetCollisionShape(m_physicsScene.World, LinksetRoot.PhysBody, LinksetShape.physShapeInfo);
450 450
451 // With all of the linkset packed into the root prim, it has the mass of everyone. 451 // With all of the linkset packed into the root prim, it has the mass of everyone.
452 LinksetMass = ComputeLinksetMass(); 452 LinksetMass = ComputeLinksetMass();
453 LinksetRoot.UpdatePhysicalMassProperties(LinksetMass, true); 453 LinksetRoot.UpdatePhysicalMassProperties(LinksetMass, true);
454 454
455 // Enable the physical position updator to return the position and rotation of the root shape 455 // Enable the physical position updator to return the position and rotation of the root shape
456 PhysicsScene.PE.AddToCollisionFlags(LinksetRoot.PhysBody, CollisionFlags.BS_RETURN_ROOT_COMPOUND_SHAPE); 456 m_physicsScene.PE.AddToCollisionFlags(LinksetRoot.PhysBody, CollisionFlags.BS_RETURN_ROOT_COMPOUND_SHAPE);
457 } 457 }
458 finally 458 finally
459 { 459 {
@@ -461,7 +461,7 @@ public sealed class BSLinksetCompound : BSLinkset
461 } 461 }
462 462
463 // See that the Aabb surrounds the new shape 463 // See that the Aabb surrounds the new shape
464 PhysicsScene.PE.RecalculateCompoundShapeLocalAabb(LinksetRoot.PhysShape.physShapeInfo); 464 m_physicsScene.PE.RecalculateCompoundShapeLocalAabb(LinksetRoot.PhysShape.physShapeInfo);
465 } 465 }
466} 466}
467} \ No newline at end of file 467} \ No newline at end of file