aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs86
1 files changed, 30 insertions, 56 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
index 681d21e..662dd68 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
@@ -33,17 +33,23 @@ namespace OpenSim.Region.Physics.BulletSPlugin
33{ 33{
34// Classes to allow some type checking for the API 34// Classes to allow some type checking for the API
35// These hold pointers to allocated objects in the unmanaged space. 35// These hold pointers to allocated objects in the unmanaged space.
36// These classes are subclassed by the various physical implementations of
37// objects. In particular, there is a version for physical instances in
38// unmanaged memory ("unman") and one for in managed memory ("XNA").
39
40// Currently, the instances of these classes are a reference to a
41// physical representation and this has no releationship to other
42// instances. Someday, refarb the usage of these classes so each instance
43// refers to a particular physical instance and this class controls reference
44// counts and such. This should be done along with adding BSShapes.
36 45
37// The physics engine controller class created at initialization
38public class BulletWorld 46public class BulletWorld
39{ 47{
40 public BulletWorld(uint worldId, BSScene bss, IntPtr xx) 48 public BulletWorld(uint worldId, BSScene bss)
41 { 49 {
42 ptr = xx;
43 worldID = worldId; 50 worldID = worldId;
44 physicsScene = bss; 51 physicsScene = bss;
45 } 52 }
46 public IntPtr ptr;
47 public uint worldID; 53 public uint worldID;
48 // The scene is only in here so very low level routines have a handle to print debug/error messages 54 // The scene is only in here so very low level routines have a handle to print debug/error messages
49 public BSScene physicsScene; 55 public BSScene physicsScene;
@@ -52,27 +58,19 @@ public class BulletWorld
52// An allocated Bullet btRigidBody 58// An allocated Bullet btRigidBody
53public class BulletBody 59public class BulletBody
54{ 60{
55 public BulletBody(uint id) : this(id, IntPtr.Zero) 61 public BulletBody(uint id)
56 {
57 }
58 public BulletBody(uint id, IntPtr xx)
59 { 62 {
60 ID = id; 63 ID = id;
61 ptr = xx;
62 collisionType = CollisionType.Static; 64 collisionType = CollisionType.Static;
63 } 65 }
64 public IntPtr ptr;
65 public uint ID; 66 public uint ID;
66 public CollisionType collisionType; 67 public CollisionType collisionType;
67 68
68 public void Clear() 69 public virtual void Clear() { }
69 { 70 public virtual bool HasPhysicalBody { get { return false; } }
70 ptr = IntPtr.Zero;
71 }
72 public bool HasPhysicalBody { get { return ptr != IntPtr.Zero; } }
73 71
74 // Apply the specificed collision mask into the physical world 72 // Apply the specificed collision mask into the physical world
75 public bool ApplyCollisionMask(BSScene physicsScene) 73 public virtual bool ApplyCollisionMask(BSScene physicsScene)
76 { 74 {
77 // Should assert the body has been added to the physical world. 75 // Should assert the body has been added to the physical world.
78 // (The collision masks are stored in the collision proxy cache which only exists for 76 // (The collision masks are stored in the collision proxy cache which only exists for
@@ -83,12 +81,9 @@ public class BulletBody
83 } 81 }
84 82
85 // Used for log messages for a unique display of the memory/object allocated to this instance 83 // Used for log messages for a unique display of the memory/object allocated to this instance
86 public string AddrString 84 public virtual string AddrString
87 { 85 {
88 get 86 get { return "unknown"; }
89 {
90 return ptr.ToString("X");
91 }
92 } 87 }
93 88
94 public override string ToString() 89 public override string ToString()
@@ -108,38 +103,26 @@ public class BulletBody
108public class BulletShape 103public class BulletShape
109{ 104{
110 public BulletShape() 105 public BulletShape()
111 : this(IntPtr.Zero, BSPhysicsShapeType.SHAPE_UNKNOWN)
112 {
113 }
114 public BulletShape(IntPtr xx)
115 : this(xx, BSPhysicsShapeType.SHAPE_UNKNOWN)
116 { 106 {
117 } 107 type = BSPhysicsShapeType.SHAPE_UNKNOWN;
118 public BulletShape(IntPtr xx, BSPhysicsShapeType typ)
119 {
120 ptr = xx;
121 type = typ;
122 shapeKey = (System.UInt64)FixedShapeKey.KEY_NONE; 108 shapeKey = (System.UInt64)FixedShapeKey.KEY_NONE;
123 isNativeShape = false; 109 isNativeShape = false;
124 } 110 }
125 public IntPtr ptr;
126 public BSPhysicsShapeType type; 111 public BSPhysicsShapeType type;
127 public System.UInt64 shapeKey; 112 public System.UInt64 shapeKey;
128 public bool isNativeShape; 113 public bool isNativeShape;
129 114
130 public void Clear() 115 public virtual void Clear() { }
131 { 116 public virtual bool HasPhysicalShape { get { return false; } }
132 ptr = IntPtr.Zero; 117 // Make another reference to this physical object.
133 } 118 public virtual BulletShape Clone() { return new BulletShape(); }
134 public bool HasPhysicalShape { get { return ptr != IntPtr.Zero; } } 119 // Return 'true' if this and other refer to the same physical object
120 public virtual bool ReferenceSame(BulletShape xx) { return false; }
135 121
136 // Used for log messages for a unique display of the memory/object allocated to this instance 122 // Used for log messages for a unique display of the memory/object allocated to this instance
137 public string AddrString 123 public virtual string AddrString
138 { 124 {
139 get 125 get { return "unknown"; }
140 {
141 return ptr.ToString("X");
142 }
143 } 126 }
144 127
145 public override string ToString() 128 public override string ToString()
@@ -161,25 +144,16 @@ public class BulletShape
161// An allocated Bullet btConstraint 144// An allocated Bullet btConstraint
162public class BulletConstraint 145public class BulletConstraint
163{ 146{
164 public BulletConstraint(IntPtr xx) 147 public BulletConstraint()
165 {
166 ptr = xx;
167 }
168 public IntPtr ptr;
169
170 public void Clear()
171 { 148 {
172 ptr = IntPtr.Zero;
173 } 149 }
174 public bool HasPhysicalConstraint { get { return ptr != IntPtr.Zero; } } 150 public virtual void Clear() { }
151 public virtual bool HasPhysicalConstraint { get { return false; } }
175 152
176 // Used for log messages for a unique display of the memory/object allocated to this instance 153 // Used for log messages for a unique display of the memory/object allocated to this instance
177 public string AddrString 154 public virtual string AddrString
178 { 155 {
179 get 156 get { return "unknown"; }
180 {
181 return ptr.ToString("X");
182 }
183 } 157 }
184} 158}
185 159