diff options
author | Melanie | 2012-11-22 14:45:41 +0000 |
---|---|---|
committer | Melanie | 2012-11-22 14:45:41 +0000 |
commit | 3b2caa63b0ba890555990a88821ee37daa2607b4 (patch) | |
tree | a1f3c176b4b80330d34bbd6ac18811c5d7299081 /OpenSim/Region/Physics/BulletSPlugin | |
parent | Factor out command script code. (diff) | |
download | opensim-SC_OLD-3b2caa63b0ba890555990a88821ee37daa2607b4.zip opensim-SC_OLD-3b2caa63b0ba890555990a88821ee37daa2607b4.tar.gz opensim-SC_OLD-3b2caa63b0ba890555990a88821ee37daa2607b4.tar.bz2 opensim-SC_OLD-3b2caa63b0ba890555990a88821ee37daa2607b4.tar.xz |
Rename BulletSim's PhysicsShapeType to BSPhysicsShapeType because it
conflicts with PhysicsShape type defined in later libOMV
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin')
11 files changed, 54 insertions, 54 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index e2aa41e..4c195e1 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -208,9 +208,9 @@ public sealed class BSCharacter : BSPhysObject | |||
208 | set { BaseShape = value; } | 208 | set { BaseShape = value; } |
209 | } | 209 | } |
210 | // I want the physics engine to make an avatar capsule | 210 | // I want the physics engine to make an avatar capsule |
211 | public override PhysicsShapeType PreferredPhysicalShape | 211 | public override BSPhysicsShapeType PreferredPhysicalShape |
212 | { | 212 | { |
213 | get {return PhysicsShapeType.SHAPE_CAPSULE; } | 213 | get {return BSPhysicsShapeType.SHAPE_CAPSULE; } |
214 | } | 214 | } |
215 | 215 | ||
216 | public override bool Grabbed { | 216 | public override bool Grabbed { |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs index 4ee047b..0df4310 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | |||
@@ -82,9 +82,9 @@ public abstract class BSLinkset | |||
82 | 82 | ||
83 | // Some linksets have a preferred physical shape. | 83 | // Some linksets have a preferred physical shape. |
84 | // Returns SHAPE_UNKNOWN if there is no preference. Causes the correct shape to be selected. | 84 | // Returns SHAPE_UNKNOWN if there is no preference. Causes the correct shape to be selected. |
85 | public virtual PhysicsShapeType PreferredPhysicalShape(BSPhysObject requestor) | 85 | public virtual BSPhysicsShapeType PreferredPhysicalShape(BSPhysObject requestor) |
86 | { | 86 | { |
87 | return PhysicsShapeType.SHAPE_UNKNOWN; | 87 | return BSPhysicsShapeType.SHAPE_UNKNOWN; |
88 | } | 88 | } |
89 | 89 | ||
90 | // Linksets move around the children so the linkset might need to compute the child position | 90 | // Linksets move around the children so the linkset might need to compute the child position |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index cb37840..b9c2cf9 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -42,12 +42,12 @@ public sealed class BSLinksetCompound : BSLinkset | |||
42 | } | 42 | } |
43 | 43 | ||
44 | // For compound implimented linksets, if there are children, use compound shape for the root. | 44 | // For compound implimented linksets, if there are children, use compound shape for the root. |
45 | public override PhysicsShapeType PreferredPhysicalShape(BSPhysObject requestor) | 45 | public override BSPhysicsShapeType PreferredPhysicalShape(BSPhysObject requestor) |
46 | { | 46 | { |
47 | PhysicsShapeType ret = PhysicsShapeType.SHAPE_UNKNOWN; | 47 | BSPhysicsShapeType ret = BSPhysicsShapeType.SHAPE_UNKNOWN; |
48 | if (IsRoot(requestor) && HasAnyChildren) | 48 | if (IsRoot(requestor) && HasAnyChildren) |
49 | { | 49 | { |
50 | ret = PhysicsShapeType.SHAPE_COMPOUND; | 50 | ret = BSPhysicsShapeType.SHAPE_COMPOUND; |
51 | } | 51 | } |
52 | // DetailLog("{0},BSLinksetCompound.PreferredPhysicalShape,call,shape={1}", LinksetRoot.LocalID, ret); | 52 | // DetailLog("{0},BSLinksetCompound.PreferredPhysicalShape,call,shape={1}", LinksetRoot.LocalID, ret); |
53 | return ret; | 53 | return ret; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index e68b167..f6a890e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | |||
@@ -94,9 +94,9 @@ public abstract class BSPhysObject : PhysicsActor | |||
94 | public PrimitiveBaseShape BaseShape { get; protected set; } | 94 | public PrimitiveBaseShape BaseShape { get; protected set; } |
95 | // Some types of objects have preferred physical representations. | 95 | // Some types of objects have preferred physical representations. |
96 | // Returns SHAPE_UNKNOWN if there is no preference. | 96 | // Returns SHAPE_UNKNOWN if there is no preference. |
97 | public virtual PhysicsShapeType PreferredPhysicalShape | 97 | public virtual BSPhysicsShapeType PreferredPhysicalShape |
98 | { | 98 | { |
99 | get { return PhysicsShapeType.SHAPE_UNKNOWN; } | 99 | get { return BSPhysicsShapeType.SHAPE_UNKNOWN; } |
100 | } | 100 | } |
101 | 101 | ||
102 | // When the physical properties are updated, an EntityProperty holds the update values. | 102 | // When the physical properties are updated, an EntityProperty holds the update values. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 5d16bbf..2b3fa25 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -171,7 +171,7 @@ public sealed class BSPrim : BSPhysObject | |||
171 | } | 171 | } |
172 | } | 172 | } |
173 | // Whatever the linkset wants is what I want. | 173 | // Whatever the linkset wants is what I want. |
174 | public override PhysicsShapeType PreferredPhysicalShape | 174 | public override BSPhysicsShapeType PreferredPhysicalShape |
175 | { get { return Linkset.PreferredPhysicalShape(this); } } | 175 | { get { return Linkset.PreferredPhysicalShape(this); } } |
176 | 176 | ||
177 | public override bool ForceBodyShapeRebuild(bool inTaintTime) | 177 | public override bool ForceBodyShapeRebuild(bool inTaintTime) |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 869735c..892c34b 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -178,7 +178,7 @@ public sealed class BSShapeCollection : IDisposable | |||
178 | bool ret = false; | 178 | bool ret = false; |
179 | switch (shape.type) | 179 | switch (shape.type) |
180 | { | 180 | { |
181 | case PhysicsShapeType.SHAPE_MESH: | 181 | case BSPhysicsShapeType.SHAPE_MESH: |
182 | MeshDesc meshDesc; | 182 | MeshDesc meshDesc; |
183 | if (Meshes.TryGetValue(shape.shapeKey, out meshDesc)) | 183 | if (Meshes.TryGetValue(shape.shapeKey, out meshDesc)) |
184 | { | 184 | { |
@@ -201,7 +201,7 @@ public sealed class BSShapeCollection : IDisposable | |||
201 | meshDesc.lastReferenced = System.DateTime.Now; | 201 | meshDesc.lastReferenced = System.DateTime.Now; |
202 | Meshes[shape.shapeKey] = meshDesc; | 202 | Meshes[shape.shapeKey] = meshDesc; |
203 | break; | 203 | break; |
204 | case PhysicsShapeType.SHAPE_HULL: | 204 | case BSPhysicsShapeType.SHAPE_HULL: |
205 | HullDesc hullDesc; | 205 | HullDesc hullDesc; |
206 | if (Hulls.TryGetValue(shape.shapeKey, out hullDesc)) | 206 | if (Hulls.TryGetValue(shape.shapeKey, out hullDesc)) |
207 | { | 207 | { |
@@ -224,7 +224,7 @@ public sealed class BSShapeCollection : IDisposable | |||
224 | hullDesc.lastReferenced = System.DateTime.Now; | 224 | hullDesc.lastReferenced = System.DateTime.Now; |
225 | Hulls[shape.shapeKey] = hullDesc; | 225 | Hulls[shape.shapeKey] = hullDesc; |
226 | break; | 226 | break; |
227 | case PhysicsShapeType.SHAPE_UNKNOWN: | 227 | case BSPhysicsShapeType.SHAPE_UNKNOWN: |
228 | break; | 228 | break; |
229 | default: | 229 | default: |
230 | // Native shapes are not tracked and they don't go into any list | 230 | // Native shapes are not tracked and they don't go into any list |
@@ -255,16 +255,16 @@ public sealed class BSShapeCollection : IDisposable | |||
255 | { | 255 | { |
256 | switch (shape.type) | 256 | switch (shape.type) |
257 | { | 257 | { |
258 | case PhysicsShapeType.SHAPE_HULL: | 258 | case BSPhysicsShapeType.SHAPE_HULL: |
259 | DereferenceHull(shape, shapeCallback); | 259 | DereferenceHull(shape, shapeCallback); |
260 | break; | 260 | break; |
261 | case PhysicsShapeType.SHAPE_MESH: | 261 | case BSPhysicsShapeType.SHAPE_MESH: |
262 | DereferenceMesh(shape, shapeCallback); | 262 | DereferenceMesh(shape, shapeCallback); |
263 | break; | 263 | break; |
264 | case PhysicsShapeType.SHAPE_COMPOUND: | 264 | case BSPhysicsShapeType.SHAPE_COMPOUND: |
265 | DereferenceCompound(shape, shapeCallback); | 265 | DereferenceCompound(shape, shapeCallback); |
266 | break; | 266 | break; |
267 | case PhysicsShapeType.SHAPE_UNKNOWN: | 267 | case BSPhysicsShapeType.SHAPE_UNKNOWN: |
268 | break; | 268 | break; |
269 | default: | 269 | default: |
270 | break; | 270 | break; |
@@ -352,28 +352,28 @@ public sealed class BSShapeCollection : IDisposable | |||
352 | BulletShape shapeInfo = new BulletShape(cShape); | 352 | BulletShape shapeInfo = new BulletShape(cShape); |
353 | if (TryGetMeshByPtr(cShape, out meshDesc)) | 353 | if (TryGetMeshByPtr(cShape, out meshDesc)) |
354 | { | 354 | { |
355 | shapeInfo.type = PhysicsShapeType.SHAPE_MESH; | 355 | shapeInfo.type = BSPhysicsShapeType.SHAPE_MESH; |
356 | shapeInfo.shapeKey = meshDesc.shapeKey; | 356 | shapeInfo.shapeKey = meshDesc.shapeKey; |
357 | } | 357 | } |
358 | else | 358 | else |
359 | { | 359 | { |
360 | if (TryGetHullByPtr(cShape, out hullDesc)) | 360 | if (TryGetHullByPtr(cShape, out hullDesc)) |
361 | { | 361 | { |
362 | shapeInfo.type = PhysicsShapeType.SHAPE_HULL; | 362 | shapeInfo.type = BSPhysicsShapeType.SHAPE_HULL; |
363 | shapeInfo.shapeKey = hullDesc.shapeKey; | 363 | shapeInfo.shapeKey = hullDesc.shapeKey; |
364 | } | 364 | } |
365 | else | 365 | else |
366 | { | 366 | { |
367 | if (BulletSimAPI.IsCompound2(cShape)) | 367 | if (BulletSimAPI.IsCompound2(cShape)) |
368 | { | 368 | { |
369 | shapeInfo.type = PhysicsShapeType.SHAPE_COMPOUND; | 369 | shapeInfo.type = BSPhysicsShapeType.SHAPE_COMPOUND; |
370 | } | 370 | } |
371 | else | 371 | else |
372 | { | 372 | { |
373 | if (BulletSimAPI.IsNativeShape2(cShape)) | 373 | if (BulletSimAPI.IsNativeShape2(cShape)) |
374 | { | 374 | { |
375 | shapeInfo.isNativeShape = true; | 375 | shapeInfo.isNativeShape = true; |
376 | shapeInfo.type = PhysicsShapeType.SHAPE_BOX; // (technically, type doesn't matter) | 376 | shapeInfo.type = BSPhysicsShapeType.SHAPE_BOX; // (technically, type doesn't matter) |
377 | } | 377 | } |
378 | } | 378 | } |
379 | } | 379 | } |
@@ -381,7 +381,7 @@ public sealed class BSShapeCollection : IDisposable | |||
381 | 381 | ||
382 | DetailLog("{0},BSShapeCollection.DereferenceAnonCollisionShape,shape={1}", BSScene.DetailLogZero, shapeInfo); | 382 | DetailLog("{0},BSShapeCollection.DereferenceAnonCollisionShape,shape={1}", BSScene.DetailLogZero, shapeInfo); |
383 | 383 | ||
384 | if (shapeInfo.type != PhysicsShapeType.SHAPE_UNKNOWN) | 384 | if (shapeInfo.type != BSPhysicsShapeType.SHAPE_UNKNOWN) |
385 | { | 385 | { |
386 | DereferenceShape(shapeInfo, true, null); | 386 | DereferenceShape(shapeInfo, true, null); |
387 | } | 387 | } |
@@ -405,10 +405,10 @@ public sealed class BSShapeCollection : IDisposable | |||
405 | bool ret = false; | 405 | bool ret = false; |
406 | bool haveShape = false; | 406 | bool haveShape = false; |
407 | 407 | ||
408 | if (!haveShape && prim.PreferredPhysicalShape == PhysicsShapeType.SHAPE_CAPSULE) | 408 | if (!haveShape && prim.PreferredPhysicalShape == BSPhysicsShapeType.SHAPE_CAPSULE) |
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_CAPSULE, | 411 | ret = GetReferenceToNativeShape(prim, BSPhysicsShapeType.SHAPE_CAPSULE, |
412 | 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; |
@@ -417,7 +417,7 @@ public sealed class BSShapeCollection : IDisposable | |||
417 | 417 | ||
418 | // Compound shapes are handled special as they are rebuilt from scratch. | 418 | // Compound shapes are handled special as they are rebuilt from scratch. |
419 | // This isn't too great a hardship since most of the child shapes will already been created. | 419 | // This isn't too great a hardship since most of the child shapes will already been created. |
420 | if (!haveShape && prim.PreferredPhysicalShape == PhysicsShapeType.SHAPE_COMPOUND) | 420 | if (!haveShape && prim.PreferredPhysicalShape == BSPhysicsShapeType.SHAPE_COMPOUND) |
421 | { | 421 | { |
422 | ret = GetReferenceToCompoundShape(prim, shapeCallback); | 422 | ret = GetReferenceToCompoundShape(prim, shapeCallback); |
423 | DetailLog("{0},BSShapeCollection.CreateGeom,compoundShape,shape={1}", prim.LocalID, prim.PhysShape); | 423 | DetailLog("{0},BSShapeCollection.CreateGeom,compoundShape,shape={1}", prim.LocalID, prim.PhysShape); |
@@ -460,10 +460,10 @@ public sealed class BSShapeCollection : IDisposable | |||
460 | haveShape = true; | 460 | haveShape = true; |
461 | if (forceRebuild | 461 | if (forceRebuild |
462 | || prim.Scale != prim.Size | 462 | || prim.Scale != prim.Size |
463 | || prim.PhysShape.type != PhysicsShapeType.SHAPE_SPHERE | 463 | || prim.PhysShape.type != BSPhysicsShapeType.SHAPE_SPHERE |
464 | ) | 464 | ) |
465 | { | 465 | { |
466 | ret = GetReferenceToNativeShape(prim, PhysicsShapeType.SHAPE_SPHERE, | 466 | ret = GetReferenceToNativeShape(prim, BSPhysicsShapeType.SHAPE_SPHERE, |
467 | 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); |
@@ -474,10 +474,10 @@ public sealed class BSShapeCollection : IDisposable | |||
474 | haveShape = true; | 474 | haveShape = true; |
475 | if (forceRebuild | 475 | if (forceRebuild |
476 | || prim.Scale != prim.Size | 476 | || prim.Scale != prim.Size |
477 | || prim.PhysShape.type != PhysicsShapeType.SHAPE_BOX | 477 | || prim.PhysShape.type != BSPhysicsShapeType.SHAPE_BOX |
478 | ) | 478 | ) |
479 | { | 479 | { |
480 | ret = GetReferenceToNativeShape( prim, PhysicsShapeType.SHAPE_BOX, | 480 | ret = GetReferenceToNativeShape( prim, BSPhysicsShapeType.SHAPE_BOX, |
481 | 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); |
@@ -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, FixedShapeKey shapeKey, | 522 | BSPhysicsShapeType shapeType, FixedShapeKey shapeKey, |
523 | ShapeDestructionCallback shapeCallback) | 523 | ShapeDestructionCallback shapeCallback) |
524 | { | 524 | { |
525 | // release any previous shape | 525 | // release any previous shape |
@@ -535,7 +535,7 @@ public sealed class BSShapeCollection : IDisposable | |||
535 | return true; | 535 | return true; |
536 | } | 536 | } |
537 | 537 | ||
538 | private BulletShape BuildPhysicalNativeShape(BSPhysObject prim, PhysicsShapeType shapeType, | 538 | private BulletShape BuildPhysicalNativeShape(BSPhysObject prim, BSPhysicsShapeType shapeType, |
539 | FixedShapeKey shapeKey) | 539 | FixedShapeKey shapeKey) |
540 | { | 540 | { |
541 | BulletShape newShape; | 541 | BulletShape newShape; |
@@ -548,7 +548,7 @@ public sealed class BSShapeCollection : IDisposable | |||
548 | nativeShapeData.MeshKey = (ulong)shapeKey; | 548 | nativeShapeData.MeshKey = (ulong)shapeKey; |
549 | nativeShapeData.HullKey = (ulong)shapeKey; | 549 | nativeShapeData.HullKey = (ulong)shapeKey; |
550 | 550 | ||
551 | if (shapeType == PhysicsShapeType.SHAPE_CAPSULE) | 551 | if (shapeType == BSPhysicsShapeType.SHAPE_CAPSULE) |
552 | { | 552 | { |
553 | // The proper scale has been calculated in the prim. | 553 | // The proper scale has been calculated in the prim. |
554 | newShape = new BulletShape( | 554 | newShape = new BulletShape( |
@@ -586,7 +586,7 @@ public sealed class BSShapeCollection : IDisposable | |||
586 | System.UInt64 newMeshKey = ComputeShapeKey(prim.Size, prim.BaseShape, out lod); | 586 | System.UInt64 newMeshKey = ComputeShapeKey(prim.Size, prim.BaseShape, out lod); |
587 | 587 | ||
588 | // if this new shape is the same as last time, don't recreate the mesh | 588 | // if this new shape is the same as last time, don't recreate the mesh |
589 | if (newMeshKey == prim.PhysShape.shapeKey && prim.PhysShape.type == PhysicsShapeType.SHAPE_MESH) | 589 | if (newMeshKey == prim.PhysShape.shapeKey && prim.PhysShape.type == BSPhysicsShapeType.SHAPE_MESH) |
590 | return false; | 590 | return false; |
591 | 591 | ||
592 | DetailLog("{0},BSShapeCollection.GetReferenceToMesh,create,oldKey={1},newKey={2}", | 592 | DetailLog("{0},BSShapeCollection.GetReferenceToMesh,create,oldKey={1},newKey={2}", |
@@ -644,7 +644,7 @@ public sealed class BSShapeCollection : IDisposable | |||
644 | indices.GetLength(0), indices, vertices.Count, verticesAsFloats); | 644 | indices.GetLength(0), indices, vertices.Count, verticesAsFloats); |
645 | } | 645 | } |
646 | } | 646 | } |
647 | BulletShape newShape = new BulletShape(meshPtr, PhysicsShapeType.SHAPE_MESH); | 647 | BulletShape newShape = new BulletShape(meshPtr, BSPhysicsShapeType.SHAPE_MESH); |
648 | newShape.shapeKey = newMeshKey; | 648 | newShape.shapeKey = newMeshKey; |
649 | 649 | ||
650 | return newShape; | 650 | return newShape; |
@@ -660,7 +660,7 @@ public sealed class BSShapeCollection : IDisposable | |||
660 | System.UInt64 newHullKey = ComputeShapeKey(prim.Size, prim.BaseShape, out lod); | 660 | System.UInt64 newHullKey = ComputeShapeKey(prim.Size, prim.BaseShape, out lod); |
661 | 661 | ||
662 | // if the hull hasn't changed, don't rebuild it | 662 | // if the hull hasn't changed, don't rebuild it |
663 | if (newHullKey == prim.PhysShape.shapeKey && prim.PhysShape.type == PhysicsShapeType.SHAPE_HULL) | 663 | if (newHullKey == prim.PhysShape.shapeKey && prim.PhysShape.type == BSPhysicsShapeType.SHAPE_HULL) |
664 | return false; | 664 | return false; |
665 | 665 | ||
666 | DetailLog("{0},BSShapeCollection.GetReferenceToHull,create,oldKey={1},newKey={2}", | 666 | DetailLog("{0},BSShapeCollection.GetReferenceToHull,create,oldKey={1},newKey={2}", |
@@ -781,7 +781,7 @@ public sealed class BSShapeCollection : IDisposable | |||
781 | } | 781 | } |
782 | } | 782 | } |
783 | 783 | ||
784 | BulletShape newShape = new BulletShape(hullPtr, PhysicsShapeType.SHAPE_HULL); | 784 | BulletShape newShape = new BulletShape(hullPtr, BSPhysicsShapeType.SHAPE_HULL); |
785 | newShape.shapeKey = newHullKey; | 785 | newShape.shapeKey = newHullKey; |
786 | 786 | ||
787 | return newShape; // 'true' means a new shape has been added to this prim | 787 | return newShape; // 'true' means a new shape has been added to this prim |
@@ -804,7 +804,7 @@ public sealed class BSShapeCollection : IDisposable | |||
804 | // DereferenceShape(prim.PhysShape, true, shapeCallback); | 804 | // DereferenceShape(prim.PhysShape, true, shapeCallback); |
805 | 805 | ||
806 | BulletShape cShape = new BulletShape( | 806 | BulletShape cShape = new BulletShape( |
807 | BulletSimAPI.CreateCompoundShape2(PhysicsScene.World.ptr, false), PhysicsShapeType.SHAPE_COMPOUND); | 807 | BulletSimAPI.CreateCompoundShape2(PhysicsScene.World.ptr, false), BSPhysicsShapeType.SHAPE_COMPOUND); |
808 | 808 | ||
809 | // Create the shape for the root prim and add it to the compound shape. Cannot be a native shape. | 809 | // Create the shape for the root prim and add it to the compound shape. Cannot be a native shape. |
810 | CreateGeomMeshOrHull(prim, shapeCallback); | 810 | CreateGeomMeshOrHull(prim, shapeCallback); |
@@ -895,7 +895,7 @@ public sealed class BSShapeCollection : IDisposable | |||
895 | 895 | ||
896 | // While we figure out the real problem, stick a simple native shape on the object. | 896 | // While we figure out the real problem, stick a simple native shape on the object. |
897 | BulletShape fillinShape = | 897 | BulletShape fillinShape = |
898 | BuildPhysicalNativeShape(prim, PhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX); | 898 | BuildPhysicalNativeShape(prim, BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX); |
899 | 899 | ||
900 | return fillinShape; | 900 | return fillinShape; |
901 | } | 901 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index f2e62d9..96cd55e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | |||
@@ -35,7 +35,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
35 | public abstract class BSShape | 35 | public abstract class BSShape |
36 | { | 36 | { |
37 | public IntPtr ptr { get; set; } | 37 | public IntPtr ptr { get; set; } |
38 | public PhysicsShapeType type { get; set; } | 38 | public BSPhysicsShapeType type { get; set; } |
39 | public System.UInt64 key { get; set; } | 39 | public System.UInt64 key { get; set; } |
40 | public int referenceCount { get; set; } | 40 | public int referenceCount { get; set; } |
41 | public DateTime lastReferenced { get; set; } | 41 | public DateTime lastReferenced { get; set; } |
@@ -43,7 +43,7 @@ public abstract class BSShape | |||
43 | public BSShape() | 43 | public BSShape() |
44 | { | 44 | { |
45 | ptr = IntPtr.Zero; | 45 | ptr = IntPtr.Zero; |
46 | type = PhysicsShapeType.SHAPE_UNKNOWN; | 46 | type = BSPhysicsShapeType.SHAPE_UNKNOWN; |
47 | key = 0; | 47 | key = 0; |
48 | referenceCount = 0; | 48 | referenceCount = 0; |
49 | lastReferenced = DateTime.Now; | 49 | lastReferenced = DateTime.Now; |
@@ -54,17 +54,17 @@ public abstract class BSShape | |||
54 | { | 54 | { |
55 | BSShape ret = null; | 55 | BSShape ret = null; |
56 | 56 | ||
57 | if (prim.PreferredPhysicalShape == PhysicsShapeType.SHAPE_CAPSULE) | 57 | if (prim.PreferredPhysicalShape == BSPhysicsShapeType.SHAPE_CAPSULE) |
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_CAPSULE, | 60 | ret = BSShapeNative.GetReference(physicsScene, prim, BSPhysicsShapeType.SHAPE_CAPSULE, |
61 | 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 | ||
65 | // Compound shapes are handled special as they are rebuilt from scratch. | 65 | // Compound shapes are handled special as they are rebuilt from scratch. |
66 | // This isn't too great a hardship since most of the child shapes will already been created. | 66 | // This isn't too great a hardship since most of the child shapes will already been created. |
67 | if (ret == null && prim.PreferredPhysicalShape == PhysicsShapeType.SHAPE_COMPOUND) | 67 | if (ret == null && prim.PreferredPhysicalShape == BSPhysicsShapeType.SHAPE_COMPOUND) |
68 | { | 68 | { |
69 | // Getting a reference to a compound shape gets you the compound shape with the root prim shape added | 69 | // Getting a reference to a compound shape gets you the compound shape with the root prim shape added |
70 | ret = BSShapeCompound.GetReference(prim); | 70 | ret = BSShapeCompound.GetReference(prim); |
@@ -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, FixedShapeKey shapeKey) | 126 | BSPhysicsShapeType 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, FixedShapeKey shapeKey) | 133 | BSPhysicsShapeType shapeType, FixedShapeKey shapeKey) |
134 | { | 134 | { |
135 | ShapeData nativeShapeData = new ShapeData(); | 135 | ShapeData nativeShapeData = new ShapeData(); |
136 | nativeShapeData.Type = shapeType; | 136 | nativeShapeData.Type = shapeType; |
@@ -141,7 +141,7 @@ public class BSShapeNative : BSShape | |||
141 | nativeShapeData.HullKey = (ulong)shapeKey; | 141 | nativeShapeData.HullKey = (ulong)shapeKey; |
142 | 142 | ||
143 | 143 | ||
144 | if (shapeType == PhysicsShapeType.SHAPE_CAPSULE) | 144 | if (shapeType == BSPhysicsShapeType.SHAPE_CAPSULE) |
145 | { | 145 | { |
146 | ptr = BulletSimAPI.BuildCapsuleShape2(physicsScene.World.ptr, 1f, 1f, prim.Scale); | 146 | ptr = BulletSimAPI.BuildCapsuleShape2(physicsScene.World.ptr, 1f, 1f, prim.Scale); |
147 | physicsScene.DetailLog("{0},BSShapeCollection.BuiletPhysicalNativeShape,capsule,scale={1}", prim.LocalID, prim.Scale); | 147 | physicsScene.DetailLog("{0},BSShapeCollection.BuiletPhysicalNativeShape,capsule,scale={1}", prim.LocalID, prim.Scale); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs index 8fc36d1..3ca756c 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs | |||
@@ -97,7 +97,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys | |||
97 | 97 | ||
98 | // Create the terrain shape from the mapInfo | 98 | // Create the terrain shape from the mapInfo |
99 | m_mapInfo.terrainShape = new BulletShape(BulletSimAPI.CreateTerrainShape2(m_mapInfo.Ptr), | 99 | m_mapInfo.terrainShape = new BulletShape(BulletSimAPI.CreateTerrainShape2(m_mapInfo.Ptr), |
100 | PhysicsShapeType.SHAPE_TERRAIN); | 100 | BSPhysicsShapeType.SHAPE_TERRAIN); |
101 | 101 | ||
102 | // The terrain object initial position is at the center of the object | 102 | // The terrain object initial position is at the center of the object |
103 | Vector3 centerPos; | 103 | Vector3 centerPos; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs index 71fca33..23fcfd3 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs | |||
@@ -130,7 +130,7 @@ public sealed class BSTerrainManager | |||
130 | // The ground plane is here to catch things that are trying to drop to negative infinity | 130 | // The ground plane is here to catch things that are trying to drop to negative infinity |
131 | BulletShape groundPlaneShape = new BulletShape( | 131 | BulletShape groundPlaneShape = new BulletShape( |
132 | BulletSimAPI.CreateGroundPlaneShape2(BSScene.GROUNDPLANE_ID, 1f, TERRAIN_COLLISION_MARGIN), | 132 | BulletSimAPI.CreateGroundPlaneShape2(BSScene.GROUNDPLANE_ID, 1f, TERRAIN_COLLISION_MARGIN), |
133 | PhysicsShapeType.SHAPE_GROUNDPLANE); | 133 | BSPhysicsShapeType.SHAPE_GROUNDPLANE); |
134 | m_groundPlane = new BulletBody(BSScene.GROUNDPLANE_ID, | 134 | m_groundPlane = new BulletBody(BSScene.GROUNDPLANE_ID, |
135 | BulletSimAPI.CreateBodyWithDefaultMotionState2(groundPlaneShape.ptr, BSScene.GROUNDPLANE_ID, | 135 | BulletSimAPI.CreateBodyWithDefaultMotionState2(groundPlaneShape.ptr, BSScene.GROUNDPLANE_ID, |
136 | Vector3.Zero, Quaternion.Identity)); | 136 | Vector3.Zero, Quaternion.Identity)); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs index 3279b6f..dca7150 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs | |||
@@ -91,7 +91,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys | |||
91 | 91 | ||
92 | m_terrainShape = new BulletShape(BulletSimAPI.CreateMeshShape2(PhysicsScene.World.ptr, | 92 | m_terrainShape = new BulletShape(BulletSimAPI.CreateMeshShape2(PhysicsScene.World.ptr, |
93 | indicesCount, indices, verticesCount, vertices), | 93 | indicesCount, indices, verticesCount, vertices), |
94 | PhysicsShapeType.SHAPE_MESH); | 94 | BSPhysicsShapeType.SHAPE_MESH); |
95 | if (m_terrainShape.ptr == IntPtr.Zero) | 95 | if (m_terrainShape.ptr == IntPtr.Zero) |
96 | { | 96 | { |
97 | // DISASTER!! | 97 | // DISASTER!! |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs index 4647c2d..e60a760 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | |||
@@ -88,11 +88,11 @@ public struct BulletShape | |||
88 | public BulletShape(IntPtr xx) | 88 | public BulletShape(IntPtr xx) |
89 | { | 89 | { |
90 | ptr = xx; | 90 | ptr = xx; |
91 | type=PhysicsShapeType.SHAPE_UNKNOWN; | 91 | type=BSPhysicsShapeType.SHAPE_UNKNOWN; |
92 | shapeKey = (System.UInt64)FixedShapeKey.KEY_NONE; | 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, BSPhysicsShapeType typ) |
96 | { | 96 | { |
97 | ptr = xx; | 97 | ptr = xx; |
98 | type = typ; | 98 | type = typ; |
@@ -100,7 +100,7 @@ public struct BulletShape | |||
100 | isNativeShape = false; | 100 | isNativeShape = false; |
101 | } | 101 | } |
102 | public IntPtr ptr; | 102 | public IntPtr ptr; |
103 | public PhysicsShapeType type; | 103 | public BSPhysicsShapeType type; |
104 | public System.UInt64 shapeKey; | 104 | public System.UInt64 shapeKey; |
105 | public bool isNativeShape; | 105 | public bool isNativeShape; |
106 | public override string ToString() | 106 | public override string ToString() |
@@ -178,7 +178,7 @@ public struct ConvexHull | |||
178 | int VertexCount; | 178 | int VertexCount; |
179 | Vector3[] Vertices; | 179 | Vector3[] Vertices; |
180 | } | 180 | } |
181 | public enum PhysicsShapeType | 181 | public enum BSPhysicsShapeType |
182 | { | 182 | { |
183 | SHAPE_UNKNOWN = 0, | 183 | SHAPE_UNKNOWN = 0, |
184 | SHAPE_CAPSULE = 1, | 184 | SHAPE_CAPSULE = 1, |
@@ -210,7 +210,7 @@ public enum FixedShapeKey : ulong | |||
210 | public struct ShapeData | 210 | public struct ShapeData |
211 | { | 211 | { |
212 | public uint ID; | 212 | public uint ID; |
213 | public PhysicsShapeType Type; | 213 | public BSPhysicsShapeType Type; |
214 | public Vector3 Position; | 214 | public Vector3 Position; |
215 | public Quaternion Rotation; | 215 | public Quaternion Rotation; |
216 | public Vector3 Velocity; | 216 | public Vector3 Velocity; |