diff options
author | Robert Adams | 2013-02-07 21:57:31 -0800 |
---|---|---|
committer | Robert Adams | 2013-02-08 16:29:29 -0800 |
commit | 1b203601f43662541526369f540dd04f5b485be6 (patch) | |
tree | 418bae04970c59ed4ab7653686843bc2e916b730 /OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |
parent | BulletSim: reclass BSPrim into layers so linkset and physical world displacem... (diff) | |
download | opensim-SC-1b203601f43662541526369f540dd04f5b485be6.zip opensim-SC-1b203601f43662541526369f540dd04f5b485be6.tar.gz opensim-SC-1b203601f43662541526369f540dd04f5b485be6.tar.bz2 opensim-SC-1b203601f43662541526369f540dd04f5b485be6.tar.xz |
BulletSim: include the linkage to the layered prim implementation. Separate layers for physical (vs simulator) location displacement and linksets.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 0c4db40..36bae9b 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -52,7 +52,7 @@ sealed class BSLinksetCompoundInfo : BSLinksetInfo | |||
52 | OffsetRot = r; | 52 | OffsetRot = r; |
53 | } | 53 | } |
54 | // 'centerDisplacement' is the distance from the root the the center-of-mass (Bullet 'zero' of the shape) | 54 | // 'centerDisplacement' is the distance from the root the the center-of-mass (Bullet 'zero' of the shape) |
55 | public BSLinksetCompoundInfo(int indx, BSPhysObject root, BSPhysObject child, OMV.Vector3 centerDisplacement) | 55 | public BSLinksetCompoundInfo(int indx, BSPrimLinkable root, BSPrimLinkable child, OMV.Vector3 centerDisplacement) |
56 | { | 56 | { |
57 | // Each child position and rotation is given relative to the center-of-mass. | 57 | // Each child position and rotation is given relative to the center-of-mass. |
58 | OMV.Quaternion invRootOrientation = OMV.Quaternion.Inverse(root.RawOrientation); | 58 | OMV.Quaternion invRootOrientation = OMV.Quaternion.Inverse(root.RawOrientation); |
@@ -93,12 +93,12 @@ public sealed class BSLinksetCompound : BSLinkset | |||
93 | { | 93 | { |
94 | private static string LogHeader = "[BULLETSIM LINKSET COMPOUND]"; | 94 | private static string LogHeader = "[BULLETSIM LINKSET COMPOUND]"; |
95 | 95 | ||
96 | public BSLinksetCompound(BSScene scene, BSPhysObject parent) : base(scene, parent) | 96 | public BSLinksetCompound(BSScene scene, BSPrimLinkable parent) : base(scene, parent) |
97 | { | 97 | { |
98 | } | 98 | } |
99 | 99 | ||
100 | // For compound implimented linksets, if there are children, use compound shape for the root. | 100 | // For compound implimented linksets, if there are children, use compound shape for the root. |
101 | public override BSPhysicsShapeType PreferredPhysicalShape(BSPhysObject requestor) | 101 | public override BSPhysicsShapeType PreferredPhysicalShape(BSPrimLinkable requestor) |
102 | { | 102 | { |
103 | // Returning 'unknown' means we don't have a preference. | 103 | // Returning 'unknown' means we don't have a preference. |
104 | BSPhysicsShapeType ret = BSPhysicsShapeType.SHAPE_UNKNOWN; | 104 | BSPhysicsShapeType ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
@@ -112,7 +112,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
112 | 112 | ||
113 | // When physical properties are changed the linkset needs to recalculate | 113 | // When physical properties are changed the linkset needs to recalculate |
114 | // its internal properties. | 114 | // its internal properties. |
115 | public override void Refresh(BSPhysObject requestor) | 115 | public override void Refresh(BSPrimLinkable requestor) |
116 | { | 116 | { |
117 | base.Refresh(requestor); | 117 | base.Refresh(requestor); |
118 | 118 | ||
@@ -121,7 +121,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
121 | } | 121 | } |
122 | 122 | ||
123 | // Schedule a refresh to happen after all the other taint processing. | 123 | // Schedule a refresh to happen after all the other taint processing. |
124 | private void ScheduleRebuild(BSPhysObject requestor) | 124 | private void ScheduleRebuild(BSPrimLinkable requestor) |
125 | { | 125 | { |
126 | DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1},hasChildren={2},actuallyScheduling={3}", | 126 | DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1},hasChildren={2},actuallyScheduling={3}", |
127 | requestor.LocalID, Rebuilding, HasAnyChildren, (!Rebuilding && HasAnyChildren)); | 127 | requestor.LocalID, Rebuilding, HasAnyChildren, (!Rebuilding && HasAnyChildren)); |
@@ -143,7 +143,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
143 | // has not yet been fully constructed. | 143 | // has not yet been fully constructed. |
144 | // Return 'true' if any properties updated on the passed object. | 144 | // Return 'true' if any properties updated on the passed object. |
145 | // Called at taint-time! | 145 | // Called at taint-time! |
146 | public override bool MakeDynamic(BSPhysObject child) | 146 | public override bool MakeDynamic(BSPrimLinkable child) |
147 | { | 147 | { |
148 | bool ret = false; | 148 | bool ret = false; |
149 | DetailLog("{0},BSLinksetCompound.MakeDynamic,call,IsRoot={1}", child.LocalID, IsRoot(child)); | 149 | DetailLog("{0},BSLinksetCompound.MakeDynamic,call,IsRoot={1}", child.LocalID, IsRoot(child)); |
@@ -173,7 +173,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
173 | // This doesn't normally happen -- OpenSim removes the objects from the physical | 173 | // This doesn't normally happen -- OpenSim removes the objects from the physical |
174 | // world if it is a static linkset. | 174 | // world if it is a static linkset. |
175 | // Called at taint-time! | 175 | // Called at taint-time! |
176 | public override bool MakeStatic(BSPhysObject child) | 176 | public override bool MakeStatic(BSPrimLinkable child) |
177 | { | 177 | { |
178 | bool ret = false; | 178 | bool ret = false; |
179 | DetailLog("{0},BSLinksetCompound.MakeStatic,call,IsRoot={1}", child.LocalID, IsRoot(child)); | 179 | DetailLog("{0},BSLinksetCompound.MakeStatic,call,IsRoot={1}", child.LocalID, IsRoot(child)); |
@@ -197,7 +197,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
197 | 197 | ||
198 | // 'physicalUpdate' is true if these changes came directly from the physics engine. Don't need to rebuild then. | 198 | // 'physicalUpdate' is true if these changes came directly from the physics engine. Don't need to rebuild then. |
199 | // Called at taint-time. | 199 | // Called at taint-time. |
200 | public override void UpdateProperties(UpdatedProperties whichUpdated, BSPhysObject updated) | 200 | public override void UpdateProperties(UpdatedProperties whichUpdated, BSPrimLinkable updated) |
201 | { | 201 | { |
202 | // The user moving a child around requires the rebuilding of the linkset compound shape | 202 | // The user moving a child around requires the rebuilding of the linkset compound shape |
203 | // One problem is this happens when a border is crossed -- the simulator implementation | 203 | // One problem is this happens when a border is crossed -- the simulator implementation |
@@ -222,7 +222,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
222 | if (lsi != null) | 222 | if (lsi != null) |
223 | { | 223 | { |
224 | // Since the child moved or rotationed, it needs a new relative position within the linkset | 224 | // Since the child moved or rotationed, it needs a new relative position within the linkset |
225 | BSLinksetCompoundInfo newLsi = new BSLinksetCompoundInfo(lsi.Index, LinksetRoot, updated, LinksetRoot.PositionDisplacement); | 225 | BSLinksetCompoundInfo newLsi = new BSLinksetCompoundInfo(lsi.Index, LinksetRoot, updated, OMV.Vector3.Zero); |
226 | updated.LinksetInfo = newLsi; | 226 | updated.LinksetInfo = newLsi; |
227 | 227 | ||
228 | // Find the physical instance of the child | 228 | // Find the physical instance of the child |
@@ -291,7 +291,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
291 | // Since we don't keep in world relationships, do nothing unless it's a child changing. | 291 | // Since we don't keep in world relationships, do nothing unless it's a child changing. |
292 | // Returns 'true' of something was actually removed and would need restoring | 292 | // Returns 'true' of something was actually removed and would need restoring |
293 | // Called at taint-time!! | 293 | // Called at taint-time!! |
294 | public override bool RemoveBodyDependencies(BSPrim child) | 294 | public override bool RemoveBodyDependencies(BSPrimLinkable child) |
295 | { | 295 | { |
296 | bool ret = false; | 296 | bool ret = false; |
297 | 297 | ||
@@ -316,7 +316,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
316 | // When the linkset is built, the child shape is added to the compound shape relative to the | 316 | // When the linkset is built, the child shape is added to the compound shape relative to the |
317 | // root shape. The linkset then moves around but this does not move the actual child | 317 | // root shape. The linkset then moves around but this does not move the actual child |
318 | // prim. The child prim's location must be recomputed based on the location of the root shape. | 318 | // prim. The child prim's location must be recomputed based on the location of the root shape. |
319 | private void RecomputeChildWorldPosition(BSPhysObject child, bool inTaintTime) | 319 | private void RecomputeChildWorldPosition(BSPrimLinkable child, bool inTaintTime) |
320 | { | 320 | { |
321 | // For the moment (20130201), disable this computation (converting the child physical addr back to | 321 | // For the moment (20130201), disable this computation (converting the child physical addr back to |
322 | // a region address) until we have a good handle on center-of-mass offsets and what the physics | 322 | // a region address) until we have a good handle on center-of-mass offsets and what the physics |
@@ -361,7 +361,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
361 | 361 | ||
362 | // Add a new child to the linkset. | 362 | // Add a new child to the linkset. |
363 | // Called while LinkActivity is locked. | 363 | // Called while LinkActivity is locked. |
364 | protected override void AddChildToLinkset(BSPhysObject child) | 364 | protected override void AddChildToLinkset(BSPrimLinkable child) |
365 | { | 365 | { |
366 | if (!HasChild(child)) | 366 | if (!HasChild(child)) |
367 | { | 367 | { |
@@ -377,7 +377,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
377 | 377 | ||
378 | // Remove the specified child from the linkset. | 378 | // Remove the specified child from the linkset. |
379 | // Safe to call even if the child is not really in the linkset. | 379 | // Safe to call even if the child is not really in the linkset. |
380 | protected override void RemoveChildFromLinkset(BSPhysObject child) | 380 | protected override void RemoveChildFromLinkset(BSPrimLinkable child) |
381 | { | 381 | { |
382 | if (m_children.Remove(child)) | 382 | if (m_children.Remove(child)) |
383 | { | 383 | { |
@@ -429,7 +429,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
429 | if (disableCOM) // DEBUG DEBUG | 429 | if (disableCOM) // DEBUG DEBUG |
430 | { // DEBUG DEBUG | 430 | { // DEBUG DEBUG |
431 | centerOfMass = LinksetRoot.RawPosition; // DEBUG DEBUG | 431 | centerOfMass = LinksetRoot.RawPosition; // DEBUG DEBUG |
432 | LinksetRoot.PositionDisplacement = OMV.Vector3.Zero; | 432 | // LinksetRoot.PositionDisplacement = OMV.Vector3.Zero; |
433 | } // DEBUG DEBUG | 433 | } // DEBUG DEBUG |
434 | else | 434 | else |
435 | { | 435 | { |
@@ -438,7 +438,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
438 | centerDisplacement = LinksetRoot.RawPosition - centerOfMass; | 438 | centerDisplacement = LinksetRoot.RawPosition - centerOfMass; |
439 | 439 | ||
440 | // Since we're displacing the center of the shape, we need to move the body in the world | 440 | // Since we're displacing the center of the shape, we need to move the body in the world |
441 | LinksetRoot.PositionDisplacement = centerDisplacement; | 441 | // LinksetRoot.PositionDisplacement = centerDisplacement; |
442 | 442 | ||
443 | // This causes the root prim position to be set properly based on the new PositionDisplacement | 443 | // This causes the root prim position to be set properly based on the new PositionDisplacement |
444 | LinksetRoot.ForcePosition = LinksetRoot.RawPosition; | 444 | LinksetRoot.ForcePosition = LinksetRoot.RawPosition; |
@@ -453,7 +453,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
453 | 453 | ||
454 | // Add a shape for each of the other children in the linkset | 454 | // Add a shape for each of the other children in the linkset |
455 | int memberIndex = 1; | 455 | int memberIndex = 1; |
456 | ForEachMember(delegate(BSPhysObject cPrim) | 456 | ForEachMember(delegate(BSPrimLinkable cPrim) |
457 | { | 457 | { |
458 | if (!IsRoot(cPrim)) | 458 | if (!IsRoot(cPrim)) |
459 | { | 459 | { |