diff options
Diffstat (limited to 'OpenSim/Region')
-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 81edc12..867d2ab 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 | { |
@@ -560,9 +572,21 @@ public class BSShapeHull : BSShape | |||
560 | } | 572 | } |
561 | public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim) | 573 | public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim) |
562 | { | 574 | { |
563 | // Another reference to this shape is just counted. | 575 | BSShape ret = null; |
564 | IncrementReference(); | 576 | // If the underlying shape is native, the actual shape has not been build (waiting for asset) |
565 | return this; | 577 | // and we must create a copy of the native shape since they are never shared. |
578 | if (physShapeInfo.HasPhysicalShape && physShapeInfo.isNativeShape) | ||
579 | { | ||
580 | // TODO: decide when the native shapes should be freed. Check in Dereference? | ||
581 | ret = BSShapeNative.GetReference(pPhysicsScene, pPrim, BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX); | ||
582 | } | ||
583 | else | ||
584 | { | ||
585 | // Another reference to this shape is just counted. | ||
586 | IncrementReference(); | ||
587 | ret = this; | ||
588 | } | ||
589 | return ret; | ||
566 | } | 590 | } |
567 | public override void Dereference(BSScene physicsScene) | 591 | public override void Dereference(BSScene physicsScene) |
568 | { | 592 | { |
@@ -1075,12 +1099,23 @@ public class BSShapeGImpact : BSShape | |||
1075 | (w, iC, i, vC, v) => physicsScene.PE.CreateGImpactShape(w, iC, i, vC, v) ); | 1099 | (w, iC, i, vC, v) => physicsScene.PE.CreateGImpactShape(w, iC, i, vC, v) ); |
1076 | } | 1100 | } |
1077 | 1101 | ||
1078 | public override BSShape GetReference(BSScene physicsScene, BSPhysObject prim) | 1102 | public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim) |
1079 | { | 1103 | { |
1080 | // Calling this reference means we want another handle to an existing shape | 1104 | BSShape ret = null; |
1081 | // (usually linksets) so return this copy. | 1105 | // If the underlying shape is native, the actual shape has not been build (waiting for asset) |
1082 | IncrementReference(); | 1106 | // and we must create a copy of the native shape since they are never shared. |
1083 | return this; | 1107 | if (physShapeInfo.HasPhysicalShape && physShapeInfo.isNativeShape) |
1108 | { | ||
1109 | // TODO: decide when the native shapes should be freed. Check in Dereference? | ||
1110 | ret = BSShapeNative.GetReference(pPhysicsScene, pPrim, BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX); | ||
1111 | } | ||
1112 | else | ||
1113 | { | ||
1114 | // Another reference to this shape is just counted. | ||
1115 | IncrementReference(); | ||
1116 | ret = this; | ||
1117 | } | ||
1118 | return ret; | ||
1084 | } | 1119 | } |
1085 | // Dereferencing a compound shape releases the hold on all the child shapes. | 1120 | // Dereferencing a compound shape releases the hold on all the child shapes. |
1086 | public override void Dereference(BSScene physicsScene) | 1121 | public override void Dereference(BSScene physicsScene) |