diff options
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | 57 |
1 files changed, 46 insertions, 11 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index 395dbe3..326fc9e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | |||
@@ -389,9 +389,21 @@ public class BSShapeMesh : BSShape | |||
389 | } | 389 | } |
390 | public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim) | 390 | public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim) |
391 | { | 391 | { |
392 | // Another reference to this shape is just counted. | 392 | BSShape ret = null; |
393 | IncrementReference(); | 393 | // If the underlying shape is native, the actual shape has not been build (waiting for asset) |
394 | return this; | 394 | // and we must create a copy of the native shape since they are never shared. |
395 | if (physShapeInfo.HasPhysicalShape && physShapeInfo.isNativeShape) | ||
396 | { | ||
397 | // TODO: decide when the native shapes should be freed. Check in Dereference? | ||
398 | ret = BSShapeNative.GetReference(pPhysicsScene, pPrim, BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX); | ||
399 | } | ||
400 | else | ||
401 | { | ||
402 | // Another reference to this shape is just counted. | ||
403 | IncrementReference(); | ||
404 | ret = this; | ||
405 | } | ||
406 | return ret; | ||
395 | } | 407 | } |
396 | public override void Dereference(BSScene physicsScene) | 408 | public override void Dereference(BSScene physicsScene) |
397 | { | 409 | { |
@@ -562,9 +574,21 @@ public class BSShapeHull : BSShape | |||
562 | } | 574 | } |
563 | public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim) | 575 | public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim) |
564 | { | 576 | { |
565 | // Another reference to this shape is just counted. | 577 | BSShape ret = null; |
566 | IncrementReference(); | 578 | // If the underlying shape is native, the actual shape has not been build (waiting for asset) |
567 | return this; | 579 | // and we must create a copy of the native shape since they are never shared. |
580 | if (physShapeInfo.HasPhysicalShape && physShapeInfo.isNativeShape) | ||
581 | { | ||
582 | // TODO: decide when the native shapes should be freed. Check in Dereference? | ||
583 | ret = BSShapeNative.GetReference(pPhysicsScene, pPrim, BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX); | ||
584 | } | ||
585 | else | ||
586 | { | ||
587 | // Another reference to this shape is just counted. | ||
588 | IncrementReference(); | ||
589 | ret = this; | ||
590 | } | ||
591 | return ret; | ||
568 | } | 592 | } |
569 | public override void Dereference(BSScene physicsScene) | 593 | public override void Dereference(BSScene physicsScene) |
570 | { | 594 | { |
@@ -1077,12 +1101,23 @@ public class BSShapeGImpact : BSShape | |||
1077 | (w, iC, i, vC, v) => physicsScene.PE.CreateGImpactShape(w, iC, i, vC, v) ); | 1101 | (w, iC, i, vC, v) => physicsScene.PE.CreateGImpactShape(w, iC, i, vC, v) ); |
1078 | } | 1102 | } |
1079 | 1103 | ||
1080 | public override BSShape GetReference(BSScene physicsScene, BSPhysObject prim) | 1104 | public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim) |
1081 | { | 1105 | { |
1082 | // Calling this reference means we want another handle to an existing shape | 1106 | BSShape ret = null; |
1083 | // (usually linksets) so return this copy. | 1107 | // If the underlying shape is native, the actual shape has not been build (waiting for asset) |
1084 | IncrementReference(); | 1108 | // and we must create a copy of the native shape since they are never shared. |
1085 | return this; | 1109 | if (physShapeInfo.HasPhysicalShape && physShapeInfo.isNativeShape) |
1110 | { | ||
1111 | // TODO: decide when the native shapes should be freed. Check in Dereference? | ||
1112 | ret = BSShapeNative.GetReference(pPhysicsScene, pPrim, BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX); | ||
1113 | } | ||
1114 | else | ||
1115 | { | ||
1116 | // Another reference to this shape is just counted. | ||
1117 | IncrementReference(); | ||
1118 | ret = this; | ||
1119 | } | ||
1120 | return ret; | ||
1086 | } | 1121 | } |
1087 | // Dereferencing a compound shape releases the hold on all the child shapes. | 1122 | // Dereferencing a compound shape releases the hold on all the child shapes. |
1088 | public override void Dereference(BSScene physicsScene) | 1123 | public override void Dereference(BSScene physicsScene) |