aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorRobert Adams2012-11-20 11:30:22 -0800
committerRobert Adams2012-11-21 16:42:58 -0800
commit65e55ada87e110b65f3d69eb0a4f2402fb1f3ece (patch)
tree8f041eed368dde662ee818b6dcbb4875db08aecd /OpenSim/Region/Physics
parentBulletSim: uplevel PhysicsShapeType out of ShapeData structure (since it is g... (diff)
downloadopensim-SC-65e55ada87e110b65f3d69eb0a4f2402fb1f3ece.zip
opensim-SC-65e55ada87e110b65f3d69eb0a4f2402fb1f3ece.tar.gz
opensim-SC-65e55ada87e110b65f3d69eb0a4f2402fb1f3ece.tar.bz2
opensim-SC-65e55ada87e110b65f3d69eb0a4f2402fb1f3ece.tar.xz
BulletSim: uplevel FixedShapeKey out of ShapeData structure (since it is getting simplified out of existance someday) and update all the references to same.
Diffstat (limited to 'OpenSim/Region/Physics')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs12
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapes.cs6
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs24
3 files changed, 22 insertions, 20 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index 746a52e..0232618 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -409,7 +409,7 @@ public sealed class BSShapeCollection : IDisposable
409 { 409 {
410 // an avatar capsule is close to a native shape (it is not shared) 410 // an avatar capsule is close to a native shape (it is not shared)
411 ret = GetReferenceToNativeShape(prim, PhysicsShapeType.SHAPE_AVATAR, 411 ret = GetReferenceToNativeShape(prim, PhysicsShapeType.SHAPE_AVATAR,
412 ShapeData.FixedShapeKey.KEY_CAPSULE, shapeCallback); 412 FixedShapeKey.KEY_CAPSULE, shapeCallback);
413 DetailLog("{0},BSShapeCollection.CreateGeom,avatarCapsule,shape={1}", prim.LocalID, prim.PhysShape); 413 DetailLog("{0},BSShapeCollection.CreateGeom,avatarCapsule,shape={1}", prim.LocalID, prim.PhysShape);
414 ret = true; 414 ret = true;
415 haveShape = true; 415 haveShape = true;
@@ -464,7 +464,7 @@ public sealed class BSShapeCollection : IDisposable
464 ) 464 )
465 { 465 {
466 ret = GetReferenceToNativeShape(prim, PhysicsShapeType.SHAPE_SPHERE, 466 ret = GetReferenceToNativeShape(prim, PhysicsShapeType.SHAPE_SPHERE,
467 ShapeData.FixedShapeKey.KEY_SPHERE, shapeCallback); 467 FixedShapeKey.KEY_SPHERE, shapeCallback);
468 DetailLog("{0},BSShapeCollection.CreateGeom,sphere,force={1},shape={2}", 468 DetailLog("{0},BSShapeCollection.CreateGeom,sphere,force={1},shape={2}",
469 prim.LocalID, forceRebuild, prim.PhysShape); 469 prim.LocalID, forceRebuild, prim.PhysShape);
470 } 470 }
@@ -478,7 +478,7 @@ public sealed class BSShapeCollection : IDisposable
478 ) 478 )
479 { 479 {
480 ret = GetReferenceToNativeShape( prim, PhysicsShapeType.SHAPE_BOX, 480 ret = GetReferenceToNativeShape( prim, PhysicsShapeType.SHAPE_BOX,
481 ShapeData.FixedShapeKey.KEY_BOX, shapeCallback); 481 FixedShapeKey.KEY_BOX, shapeCallback);
482 DetailLog("{0},BSShapeCollection.CreateGeom,box,force={1},shape={2}", 482 DetailLog("{0},BSShapeCollection.CreateGeom,box,force={1},shape={2}",
483 prim.LocalID, forceRebuild, prim.PhysShape); 483 prim.LocalID, forceRebuild, prim.PhysShape);
484 } 484 }
@@ -519,7 +519,7 @@ public sealed class BSShapeCollection : IDisposable
519 // Creates a native shape and assignes it to prim.BSShape. 519 // Creates a native shape and assignes it to prim.BSShape.
520 // "Native" shapes are never shared. they are created here and destroyed in DereferenceShape(). 520 // "Native" shapes are never shared. they are created here and destroyed in DereferenceShape().
521 private bool GetReferenceToNativeShape(BSPhysObject prim, 521 private bool GetReferenceToNativeShape(BSPhysObject prim,
522 PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey, 522 PhysicsShapeType shapeType, FixedShapeKey shapeKey,
523 ShapeDestructionCallback shapeCallback) 523 ShapeDestructionCallback shapeCallback)
524 { 524 {
525 // release any previous shape 525 // release any previous shape
@@ -539,7 +539,7 @@ public sealed class BSShapeCollection : IDisposable
539 } 539 }
540 540
541 private BulletShape BuildPhysicalNativeShape(BSPhysObject prim, PhysicsShapeType shapeType, 541 private BulletShape BuildPhysicalNativeShape(BSPhysObject prim, PhysicsShapeType shapeType,
542 ShapeData.FixedShapeKey shapeKey) 542 FixedShapeKey shapeKey)
543 { 543 {
544 BulletShape newShape; 544 BulletShape newShape;
545 // Need to make sure the passed shape information is for the native type. 545 // Need to make sure the passed shape information is for the native type.
@@ -894,7 +894,7 @@ public sealed class BSShapeCollection : IDisposable
894 894
895 // While we figure out the real problem, stick a simple native shape on the object. 895 // While we figure out the real problem, stick a simple native shape on the object.
896 BulletShape fillinShape = 896 BulletShape fillinShape =
897 BuildPhysicalNativeShape(prim, PhysicsShapeType.SHAPE_BOX, ShapeData.FixedShapeKey.KEY_BOX); 897 BuildPhysicalNativeShape(prim, PhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX);
898 898
899 return fillinShape; 899 return fillinShape;
900 } 900 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
index 2896805..71b5074 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
@@ -58,7 +58,7 @@ public abstract class BSShape
58 { 58 {
59 // an avatar capsule is close to a native shape (it is not shared) 59 // an avatar capsule is close to a native shape (it is not shared)
60 ret = BSShapeNative.GetReference(physicsScene, prim, PhysicsShapeType.SHAPE_AVATAR, 60 ret = BSShapeNative.GetReference(physicsScene, prim, PhysicsShapeType.SHAPE_AVATAR,
61 ShapeData.FixedShapeKey.KEY_CAPSULE); 61 FixedShapeKey.KEY_CAPSULE);
62 physicsScene.DetailLog("{0},BSShape.GetShapeReference,avatarCapsule,shape={1}", prim.LocalID, ret); 62 physicsScene.DetailLog("{0},BSShape.GetShapeReference,avatarCapsule,shape={1}", prim.LocalID, ret);
63 } 63 }
64 64
@@ -123,14 +123,14 @@ public class BSShapeNative : BSShape
123 { 123 {
124 } 124 }
125 public static BSShape GetReference(BSScene physicsScene, BSPhysObject prim, 125 public static BSShape GetReference(BSScene physicsScene, BSPhysObject prim,
126 PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey) 126 PhysicsShapeType shapeType, FixedShapeKey shapeKey)
127 { 127 {
128 // Native shapes are not shared and are always built anew. 128 // Native shapes are not shared and are always built anew.
129 return new BSShapeNative(physicsScene, prim, shapeType, shapeKey); 129 return new BSShapeNative(physicsScene, prim, shapeType, shapeKey);
130 } 130 }
131 131
132 private BSShapeNative(BSScene physicsScene, BSPhysObject prim, 132 private BSShapeNative(BSScene physicsScene, BSPhysObject prim,
133 PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey) 133 PhysicsShapeType shapeType, FixedShapeKey shapeKey)
134 { 134 {
135 ShapeData nativeShapeData = new ShapeData(); 135 ShapeData nativeShapeData = new ShapeData();
136 nativeShapeData.Type = shapeType; 136 nativeShapeData.Type = shapeType;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index bb63b0a..75e7f99 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -89,7 +89,7 @@ public struct BulletShape
89 { 89 {
90 ptr = xx; 90 ptr = xx;
91 type=PhysicsShapeType.SHAPE_UNKNOWN; 91 type=PhysicsShapeType.SHAPE_UNKNOWN;
92 shapeKey = 0; 92 shapeKey = (System.UInt64)FixedShapeKey.KEY_NONE;
93 isNativeShape = false; 93 isNativeShape = false;
94 } 94 }
95 public BulletShape(IntPtr xx, PhysicsShapeType typ) 95 public BulletShape(IntPtr xx, PhysicsShapeType typ)
@@ -194,6 +194,18 @@ public enum PhysicsShapeType
194 SHAPE_COMPOUND = 22, 194 SHAPE_COMPOUND = 22,
195 SHAPE_HEIGHTMAP = 23, 195 SHAPE_HEIGHTMAP = 23,
196}; 196};
197
198// The native shapes have predefined shape hash keys
199public enum FixedShapeKey : ulong
200{
201 KEY_NONE = 0,
202 KEY_BOX = 1,
203 KEY_SPHERE = 2,
204 KEY_CONE = 3,
205 KEY_CYLINDER = 4,
206 KEY_CAPSULE = 5,
207}
208
197[StructLayout(LayoutKind.Sequential)] 209[StructLayout(LayoutKind.Sequential)]
198public struct ShapeData 210public struct ShapeData
199{ 211{
@@ -217,16 +229,6 @@ public struct ShapeData
217 // note that bools are passed as floats since bool size changes by language and architecture 229 // note that bools are passed as floats since bool size changes by language and architecture
218 public const float numericTrue = 1f; 230 public const float numericTrue = 1f;
219 public const float numericFalse = 0f; 231 public const float numericFalse = 0f;
220
221 // The native shapes have predefined shape hash keys
222 public enum FixedShapeKey : ulong
223 {
224 KEY_BOX = 1,
225 KEY_SPHERE = 2,
226 KEY_CONE = 3,
227 KEY_CYLINDER = 4,
228 KEY_CAPSULE = 5,
229 }
230} 232}
231[StructLayout(LayoutKind.Sequential)] 233[StructLayout(LayoutKind.Sequential)]
232public struct SweepHit 234public struct SweepHit