diff options
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index 96cd55e..c75eb9b 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | |||
@@ -91,11 +91,17 @@ public abstract class BSShape | |||
91 | // All shapes have a static call to get a reference to the physical shape | 91 | // All shapes have a static call to get a reference to the physical shape |
92 | // protected abstract static BSShape GetReference(); | 92 | // protected abstract static BSShape GetReference(); |
93 | 93 | ||
94 | // Returns a string for debugging that uniquily identifies the memory used by this instance | ||
95 | public string AddrString | ||
96 | { | ||
97 | get { return ptr.ToString("X"); } | ||
98 | } | ||
99 | |||
94 | public override string ToString() | 100 | public override string ToString() |
95 | { | 101 | { |
96 | StringBuilder buff = new StringBuilder(); | 102 | StringBuilder buff = new StringBuilder(); |
97 | buff.Append("<p="); | 103 | buff.Append("<p="); |
98 | buff.Append(ptr.ToString("X")); | 104 | buff.Append(AddrString); |
99 | buff.Append(",s="); | 105 | buff.Append(",s="); |
100 | buff.Append(type.ToString()); | 106 | buff.Append(type.ToString()); |
101 | buff.Append(",k="); | 107 | buff.Append(",k="); |
@@ -126,7 +132,8 @@ public class BSShapeNative : BSShape | |||
126 | BSPhysicsShapeType shapeType, FixedShapeKey shapeKey) | 132 | BSPhysicsShapeType shapeType, FixedShapeKey shapeKey) |
127 | { | 133 | { |
128 | // Native shapes are not shared and are always built anew. | 134 | // Native shapes are not shared and are always built anew. |
129 | return new BSShapeNative(physicsScene, prim, shapeType, shapeKey); | 135 | //return new BSShapeNative(physicsScene, prim, shapeType, shapeKey); |
136 | return null; | ||
130 | } | 137 | } |
131 | 138 | ||
132 | private BSShapeNative(BSScene physicsScene, BSPhysObject prim, | 139 | private BSShapeNative(BSScene physicsScene, BSPhysObject prim, |
@@ -141,14 +148,15 @@ public class BSShapeNative : BSShape | |||
141 | nativeShapeData.HullKey = (ulong)shapeKey; | 148 | nativeShapeData.HullKey = (ulong)shapeKey; |
142 | 149 | ||
143 | 150 | ||
151 | /* | ||
144 | if (shapeType == BSPhysicsShapeType.SHAPE_CAPSULE) | 152 | if (shapeType == BSPhysicsShapeType.SHAPE_CAPSULE) |
145 | { | 153 | { |
146 | ptr = BulletSimAPI.BuildCapsuleShape2(physicsScene.World.ptr, 1f, 1f, prim.Scale); | 154 | ptr = PhysicsScene.PE.BuildCapsuleShape(physicsScene.World, 1f, 1f, prim.Scale); |
147 | physicsScene.DetailLog("{0},BSShapeCollection.BuiletPhysicalNativeShape,capsule,scale={1}", prim.LocalID, prim.Scale); | 155 | physicsScene.DetailLog("{0},BSShapeCollection.BuiletPhysicalNativeShape,capsule,scale={1}", prim.LocalID, prim.Scale); |
148 | } | 156 | } |
149 | else | 157 | else |
150 | { | 158 | { |
151 | ptr = BulletSimAPI.BuildNativeShape2(physicsScene.World.ptr, nativeShapeData); | 159 | ptr = PhysicsScene.PE.BuildNativeShape(physicsScene.World, nativeShapeData); |
152 | } | 160 | } |
153 | if (ptr == IntPtr.Zero) | 161 | if (ptr == IntPtr.Zero) |
154 | { | 162 | { |
@@ -157,15 +165,18 @@ public class BSShapeNative : BSShape | |||
157 | } | 165 | } |
158 | type = shapeType; | 166 | type = shapeType; |
159 | key = (UInt64)shapeKey; | 167 | key = (UInt64)shapeKey; |
168 | */ | ||
160 | } | 169 | } |
161 | // Make this reference to the physical shape go away since native shapes are not shared. | 170 | // Make this reference to the physical shape go away since native shapes are not shared. |
162 | public override void Dereference(BSScene physicsScene) | 171 | public override void Dereference(BSScene physicsScene) |
163 | { | 172 | { |
173 | /* | ||
164 | // Native shapes are not tracked and are released immediately | 174 | // Native shapes are not tracked and are released immediately |
165 | physicsScene.DetailLog("{0},BSShapeCollection.DereferenceShape,deleteNativeShape,shape={1}", BSScene.DetailLogZero, this); | 175 | physicsScene.DetailLog("{0},BSShapeCollection.DereferenceShape,deleteNativeShape,shape={1}", BSScene.DetailLogZero, this); |
166 | BulletSimAPI.DeleteCollisionShape2(physicsScene.World.ptr, ptr); | 176 | PhysicsScene.PE.DeleteCollisionShape(physicsScene.World, this); |
167 | ptr = IntPtr.Zero; | 177 | ptr = IntPtr.Zero; |
168 | // Garbage collection will free up this instance. | 178 | // Garbage collection will free up this instance. |
179 | */ | ||
169 | } | 180 | } |
170 | } | 181 | } |
171 | 182 | ||
@@ -205,4 +216,17 @@ public class BSShapeCompound : BSShape | |||
205 | } | 216 | } |
206 | public override void Dereference(BSScene physicsScene) { } | 217 | public override void Dereference(BSScene physicsScene) { } |
207 | } | 218 | } |
219 | |||
220 | public class BSShapeAvatar : BSShape | ||
221 | { | ||
222 | private static string LogHeader = "[BULLETSIM SHAPE AVATAR]"; | ||
223 | public BSShapeAvatar() : base() | ||
224 | { | ||
225 | } | ||
226 | public static BSShape GetReference(BSPhysObject prim) | ||
227 | { | ||
228 | return new BSShapeNull(); | ||
229 | } | ||
230 | public override void Dereference(BSScene physicsScene) { } | ||
231 | } | ||
208 | } | 232 | } |