diff options
author | Robert Adams | 2012-11-20 11:24:25 -0800 |
---|---|---|
committer | Robert Adams | 2012-11-21 16:42:50 -0800 |
commit | d6db0d5740dae03174f65846556f2f06d573b5c4 (patch) | |
tree | 84d3377c6b9e9350ccb6edc64609cb61b9d86c97 | |
parent | BulletSim: change PositionSanityCheck to apply a force to correct position co... (diff) | |
download | opensim-SC_OLD-d6db0d5740dae03174f65846556f2f06d573b5c4.zip opensim-SC_OLD-d6db0d5740dae03174f65846556f2f06d573b5c4.tar.gz opensim-SC_OLD-d6db0d5740dae03174f65846556f2f06d573b5c4.tar.bz2 opensim-SC_OLD-d6db0d5740dae03174f65846556f2f06d573b5c4.tar.xz |
BulletSim: uplevel PhysicsShapeType out of ShapeData structure (since it is getting simplified out of existance someday) and update all the references to that enum.
9 files changed, 67 insertions, 66 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index fa1a23f..92ff804 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -203,9 +203,9 @@ public sealed class BSCharacter : BSPhysObject | |||
203 | set { BaseShape = value; } | 203 | set { BaseShape = value; } |
204 | } | 204 | } |
205 | // I want the physics engine to make an avatar capsule | 205 | // I want the physics engine to make an avatar capsule |
206 | public override ShapeData.PhysicsShapeType PreferredPhysicalShape | 206 | public override PhysicsShapeType PreferredPhysicalShape |
207 | { | 207 | { |
208 | get {return ShapeData.PhysicsShapeType.SHAPE_AVATAR; } | 208 | get {return PhysicsShapeType.SHAPE_AVATAR; } |
209 | } | 209 | } |
210 | 210 | ||
211 | public override bool Grabbed { | 211 | public override bool Grabbed { |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs index 436e043..4ee047b 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 ShapeData.PhysicsShapeType PreferredPhysicalShape(BSPhysObject requestor) | 85 | public virtual PhysicsShapeType PreferredPhysicalShape(BSPhysObject requestor) |
86 | { | 86 | { |
87 | return ShapeData.PhysicsShapeType.SHAPE_UNKNOWN; | 87 | return PhysicsShapeType.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 3238c85..cb37840 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 ShapeData.PhysicsShapeType PreferredPhysicalShape(BSPhysObject requestor) | 45 | public override PhysicsShapeType PreferredPhysicalShape(BSPhysObject requestor) |
46 | { | 46 | { |
47 | ShapeData.PhysicsShapeType ret = ShapeData.PhysicsShapeType.SHAPE_UNKNOWN; | 47 | PhysicsShapeType ret = PhysicsShapeType.SHAPE_UNKNOWN; |
48 | if (IsRoot(requestor) && HasAnyChildren) | 48 | if (IsRoot(requestor) && HasAnyChildren) |
49 | { | 49 | { |
50 | ret = ShapeData.PhysicsShapeType.SHAPE_COMPOUND; | 50 | ret = PhysicsShapeType.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 991e5b1..e68b167 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 ShapeData.PhysicsShapeType PreferredPhysicalShape | 97 | public virtual PhysicsShapeType PreferredPhysicalShape |
98 | { | 98 | { |
99 | get { return ShapeData.PhysicsShapeType.SHAPE_UNKNOWN; } | 99 | get { return PhysicsShapeType.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 b1b5846..2657e4b 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -169,7 +169,7 @@ public sealed class BSPrim : BSPhysObject | |||
169 | } | 169 | } |
170 | } | 170 | } |
171 | // Whatever the linkset wants is what I want. | 171 | // Whatever the linkset wants is what I want. |
172 | public override ShapeData.PhysicsShapeType PreferredPhysicalShape | 172 | public override PhysicsShapeType PreferredPhysicalShape |
173 | { get { return Linkset.PreferredPhysicalShape(this); } } | 173 | { get { return Linkset.PreferredPhysicalShape(this); } } |
174 | 174 | ||
175 | public override bool ForceBodyShapeRebuild(bool inTaintTime) | 175 | public override bool ForceBodyShapeRebuild(bool inTaintTime) |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 7ef6429..746a52e 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 ShapeData.PhysicsShapeType.SHAPE_MESH: | 181 | case PhysicsShapeType.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 ShapeData.PhysicsShapeType.SHAPE_HULL: | 204 | case PhysicsShapeType.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 ShapeData.PhysicsShapeType.SHAPE_UNKNOWN: | 227 | case PhysicsShapeType.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 ShapeData.PhysicsShapeType.SHAPE_HULL: | 258 | case PhysicsShapeType.SHAPE_HULL: |
259 | DereferenceHull(shape, shapeCallback); | 259 | DereferenceHull(shape, shapeCallback); |
260 | break; | 260 | break; |
261 | case ShapeData.PhysicsShapeType.SHAPE_MESH: | 261 | case PhysicsShapeType.SHAPE_MESH: |
262 | DereferenceMesh(shape, shapeCallback); | 262 | DereferenceMesh(shape, shapeCallback); |
263 | break; | 263 | break; |
264 | case ShapeData.PhysicsShapeType.SHAPE_COMPOUND: | 264 | case PhysicsShapeType.SHAPE_COMPOUND: |
265 | DereferenceCompound(shape, shapeCallback); | 265 | DereferenceCompound(shape, shapeCallback); |
266 | break; | 266 | break; |
267 | case ShapeData.PhysicsShapeType.SHAPE_UNKNOWN: | 267 | case PhysicsShapeType.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 = ShapeData.PhysicsShapeType.SHAPE_MESH; | 355 | shapeInfo.type = PhysicsShapeType.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 = ShapeData.PhysicsShapeType.SHAPE_HULL; | 362 | shapeInfo.type = PhysicsShapeType.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 = ShapeData.PhysicsShapeType.SHAPE_COMPOUND; | 369 | shapeInfo.type = PhysicsShapeType.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 = ShapeData.PhysicsShapeType.SHAPE_BOX; // (technically, type doesn't matter) | 376 | shapeInfo.type = PhysicsShapeType.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 != ShapeData.PhysicsShapeType.SHAPE_UNKNOWN) | 384 | if (shapeInfo.type != PhysicsShapeType.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 == ShapeData.PhysicsShapeType.SHAPE_AVATAR) | 408 | if (!haveShape && prim.PreferredPhysicalShape == PhysicsShapeType.SHAPE_AVATAR) |
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, ShapeData.PhysicsShapeType.SHAPE_AVATAR, | 411 | ret = GetReferenceToNativeShape(prim, PhysicsShapeType.SHAPE_AVATAR, |
412 | ShapeData.FixedShapeKey.KEY_CAPSULE, shapeCallback); | 412 | ShapeData.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 == ShapeData.PhysicsShapeType.SHAPE_COMPOUND) | 420 | if (!haveShape && prim.PreferredPhysicalShape == PhysicsShapeType.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 != ShapeData.PhysicsShapeType.SHAPE_SPHERE | 463 | || prim.PhysShape.type != PhysicsShapeType.SHAPE_SPHERE |
464 | ) | 464 | ) |
465 | { | 465 | { |
466 | ret = GetReferenceToNativeShape(prim, ShapeData.PhysicsShapeType.SHAPE_SPHERE, | 466 | ret = GetReferenceToNativeShape(prim, PhysicsShapeType.SHAPE_SPHERE, |
467 | ShapeData.FixedShapeKey.KEY_SPHERE, shapeCallback); | 467 | ShapeData.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 != ShapeData.PhysicsShapeType.SHAPE_BOX | 477 | || prim.PhysShape.type != PhysicsShapeType.SHAPE_BOX |
478 | ) | 478 | ) |
479 | { | 479 | { |
480 | ret = GetReferenceToNativeShape( prim, ShapeData.PhysicsShapeType.SHAPE_BOX, | 480 | ret = GetReferenceToNativeShape( prim, PhysicsShapeType.SHAPE_BOX, |
481 | ShapeData.FixedShapeKey.KEY_BOX, shapeCallback); | 481 | ShapeData.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 | ShapeData.PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey, | 522 | PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey, |
523 | ShapeDestructionCallback shapeCallback) | 523 | ShapeDestructionCallback shapeCallback) |
524 | { | 524 | { |
525 | // release any previous shape | 525 | // release any previous shape |
@@ -538,7 +538,7 @@ public sealed class BSShapeCollection : IDisposable | |||
538 | return true; | 538 | return true; |
539 | } | 539 | } |
540 | 540 | ||
541 | private BulletShape BuildPhysicalNativeShape(BSPhysObject prim, ShapeData.PhysicsShapeType shapeType, | 541 | private BulletShape BuildPhysicalNativeShape(BSPhysObject prim, PhysicsShapeType shapeType, |
542 | ShapeData.FixedShapeKey shapeKey) | 542 | ShapeData.FixedShapeKey shapeKey) |
543 | { | 543 | { |
544 | BulletShape newShape; | 544 | BulletShape newShape; |
@@ -551,7 +551,7 @@ public sealed class BSShapeCollection : IDisposable | |||
551 | nativeShapeData.MeshKey = (ulong)shapeKey; | 551 | nativeShapeData.MeshKey = (ulong)shapeKey; |
552 | nativeShapeData.HullKey = (ulong)shapeKey; | 552 | nativeShapeData.HullKey = (ulong)shapeKey; |
553 | 553 | ||
554 | if (shapeType == ShapeData.PhysicsShapeType.SHAPE_AVATAR) | 554 | if (shapeType == PhysicsShapeType.SHAPE_AVATAR) |
555 | { | 555 | { |
556 | newShape = new BulletShape( | 556 | newShape = new BulletShape( |
557 | BulletSimAPI.BuildCapsuleShape2(PhysicsScene.World.ptr, 1f, 1f, prim.Scale) | 557 | BulletSimAPI.BuildCapsuleShape2(PhysicsScene.World.ptr, 1f, 1f, prim.Scale) |
@@ -585,7 +585,7 @@ public sealed class BSShapeCollection : IDisposable | |||
585 | System.UInt64 newMeshKey = ComputeShapeKey(prim.Size, prim.BaseShape, out lod); | 585 | System.UInt64 newMeshKey = ComputeShapeKey(prim.Size, prim.BaseShape, out lod); |
586 | 586 | ||
587 | // if this new shape is the same as last time, don't recreate the mesh | 587 | // if this new shape is the same as last time, don't recreate the mesh |
588 | if (newMeshKey == prim.PhysShape.shapeKey && prim.PhysShape.type == ShapeData.PhysicsShapeType.SHAPE_MESH) | 588 | if (newMeshKey == prim.PhysShape.shapeKey && prim.PhysShape.type == PhysicsShapeType.SHAPE_MESH) |
589 | return false; | 589 | return false; |
590 | 590 | ||
591 | DetailLog("{0},BSShapeCollection.GetReferenceToMesh,create,oldKey={1},newKey={2}", | 591 | DetailLog("{0},BSShapeCollection.GetReferenceToMesh,create,oldKey={1},newKey={2}", |
@@ -643,7 +643,7 @@ public sealed class BSShapeCollection : IDisposable | |||
643 | indices.GetLength(0), indices, vertices.Count, verticesAsFloats); | 643 | indices.GetLength(0), indices, vertices.Count, verticesAsFloats); |
644 | } | 644 | } |
645 | } | 645 | } |
646 | BulletShape newShape = new BulletShape(meshPtr, ShapeData.PhysicsShapeType.SHAPE_MESH); | 646 | BulletShape newShape = new BulletShape(meshPtr, PhysicsShapeType.SHAPE_MESH); |
647 | newShape.shapeKey = newMeshKey; | 647 | newShape.shapeKey = newMeshKey; |
648 | 648 | ||
649 | return newShape; | 649 | return newShape; |
@@ -659,7 +659,7 @@ public sealed class BSShapeCollection : IDisposable | |||
659 | System.UInt64 newHullKey = ComputeShapeKey(prim.Size, prim.BaseShape, out lod); | 659 | System.UInt64 newHullKey = ComputeShapeKey(prim.Size, prim.BaseShape, out lod); |
660 | 660 | ||
661 | // if the hull hasn't changed, don't rebuild it | 661 | // if the hull hasn't changed, don't rebuild it |
662 | if (newHullKey == prim.PhysShape.shapeKey && prim.PhysShape.type == ShapeData.PhysicsShapeType.SHAPE_HULL) | 662 | if (newHullKey == prim.PhysShape.shapeKey && prim.PhysShape.type == PhysicsShapeType.SHAPE_HULL) |
663 | return false; | 663 | return false; |
664 | 664 | ||
665 | DetailLog("{0},BSShapeCollection.GetReferenceToHull,create,oldKey={1},newKey={2}", | 665 | DetailLog("{0},BSShapeCollection.GetReferenceToHull,create,oldKey={1},newKey={2}", |
@@ -780,7 +780,7 @@ public sealed class BSShapeCollection : IDisposable | |||
780 | } | 780 | } |
781 | } | 781 | } |
782 | 782 | ||
783 | BulletShape newShape = new BulletShape(hullPtr, ShapeData.PhysicsShapeType.SHAPE_HULL); | 783 | BulletShape newShape = new BulletShape(hullPtr, PhysicsShapeType.SHAPE_HULL); |
784 | newShape.shapeKey = newHullKey; | 784 | newShape.shapeKey = newHullKey; |
785 | 785 | ||
786 | return newShape; // 'true' means a new shape has been added to this prim | 786 | return newShape; // 'true' means a new shape has been added to this prim |
@@ -803,7 +803,7 @@ public sealed class BSShapeCollection : IDisposable | |||
803 | // DereferenceShape(prim.PhysShape, true, shapeCallback); | 803 | // DereferenceShape(prim.PhysShape, true, shapeCallback); |
804 | 804 | ||
805 | BulletShape cShape = new BulletShape( | 805 | BulletShape cShape = new BulletShape( |
806 | BulletSimAPI.CreateCompoundShape2(PhysicsScene.World.ptr, false), ShapeData.PhysicsShapeType.SHAPE_COMPOUND); | 806 | BulletSimAPI.CreateCompoundShape2(PhysicsScene.World.ptr, false), PhysicsShapeType.SHAPE_COMPOUND); |
807 | 807 | ||
808 | // Create the shape for the root prim and add it to the compound shape. Cannot be a native shape. | 808 | // Create the shape for the root prim and add it to the compound shape. Cannot be a native shape. |
809 | CreateGeomMeshOrHull(prim, shapeCallback); | 809 | CreateGeomMeshOrHull(prim, shapeCallback); |
@@ -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, ShapeData.PhysicsShapeType.SHAPE_BOX, ShapeData.FixedShapeKey.KEY_BOX); | 897 | BuildPhysicalNativeShape(prim, PhysicsShapeType.SHAPE_BOX, ShapeData.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 d59a486..2896805 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 ShapeData.PhysicsShapeType type { get; set; } | 38 | public PhysicsShapeType 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 = ShapeData.PhysicsShapeType.SHAPE_UNKNOWN; | 46 | type = PhysicsShapeType.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 == ShapeData.PhysicsShapeType.SHAPE_AVATAR) | 57 | if (prim.PreferredPhysicalShape == PhysicsShapeType.SHAPE_AVATAR) |
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, ShapeData.PhysicsShapeType.SHAPE_AVATAR, | 60 | ret = BSShapeNative.GetReference(physicsScene, prim, PhysicsShapeType.SHAPE_AVATAR, |
61 | ShapeData.FixedShapeKey.KEY_CAPSULE); | 61 | ShapeData.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 == ShapeData.PhysicsShapeType.SHAPE_COMPOUND) | 67 | if (ret == null && prim.PreferredPhysicalShape == PhysicsShapeType.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 | ShapeData.PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey) | 126 | PhysicsShapeType shapeType, ShapeData.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 | ShapeData.PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey) | 133 | PhysicsShapeType shapeType, ShapeData.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 == ShapeData.PhysicsShapeType.SHAPE_AVATAR) | 144 | if (shapeType == PhysicsShapeType.SHAPE_AVATAR) |
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/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs index 7c34af2..cc28e4d 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs | |||
@@ -109,7 +109,7 @@ public sealed class BSTerrainManager | |||
109 | // The ground plane is here to catch things that are trying to drop to negative infinity | 109 | // The ground plane is here to catch things that are trying to drop to negative infinity |
110 | BulletShape groundPlaneShape = new BulletShape( | 110 | BulletShape groundPlaneShape = new BulletShape( |
111 | BulletSimAPI.CreateGroundPlaneShape2(BSScene.GROUNDPLANE_ID, 1f, TERRAIN_COLLISION_MARGIN), | 111 | BulletSimAPI.CreateGroundPlaneShape2(BSScene.GROUNDPLANE_ID, 1f, TERRAIN_COLLISION_MARGIN), |
112 | ShapeData.PhysicsShapeType.SHAPE_GROUNDPLANE); | 112 | PhysicsShapeType.SHAPE_GROUNDPLANE); |
113 | m_groundPlane = new BulletBody(BSScene.GROUNDPLANE_ID, | 113 | m_groundPlane = new BulletBody(BSScene.GROUNDPLANE_ID, |
114 | BulletSimAPI.CreateBodyWithDefaultMotionState2(groundPlaneShape.ptr, BSScene.GROUNDPLANE_ID, | 114 | BulletSimAPI.CreateBodyWithDefaultMotionState2(groundPlaneShape.ptr, BSScene.GROUNDPLANE_ID, |
115 | Vector3.Zero, Quaternion.Identity)); | 115 | Vector3.Zero, Quaternion.Identity)); |
@@ -299,7 +299,7 @@ public sealed class BSTerrainManager | |||
299 | 299 | ||
300 | // Create the terrain shape from the mapInfo | 300 | // Create the terrain shape from the mapInfo |
301 | mapInfo.terrainShape = new BulletShape(BulletSimAPI.CreateTerrainShape2(mapInfo.Ptr), | 301 | mapInfo.terrainShape = new BulletShape(BulletSimAPI.CreateTerrainShape2(mapInfo.Ptr), |
302 | ShapeData.PhysicsShapeType.SHAPE_TERRAIN); | 302 | PhysicsShapeType.SHAPE_TERRAIN); |
303 | 303 | ||
304 | // The terrain object initial position is at the center of the object | 304 | // The terrain object initial position is at the center of the object |
305 | Vector3 centerPos; | 305 | Vector3 centerPos; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs index 28fae13..bb63b0a 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=ShapeData.PhysicsShapeType.SHAPE_UNKNOWN; | 91 | type=PhysicsShapeType.SHAPE_UNKNOWN; |
92 | shapeKey = 0; | 92 | shapeKey = 0; |
93 | isNativeShape = false; | 93 | isNativeShape = false; |
94 | } | 94 | } |
95 | public BulletShape(IntPtr xx, ShapeData.PhysicsShapeType typ) | 95 | public BulletShape(IntPtr xx, PhysicsShapeType 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 ShapeData.PhysicsShapeType type; | 103 | public PhysicsShapeType 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,24 +178,25 @@ public struct ConvexHull | |||
178 | int VertexCount; | 178 | int VertexCount; |
179 | Vector3[] Vertices; | 179 | Vector3[] Vertices; |
180 | } | 180 | } |
181 | public enum PhysicsShapeType | ||
182 | { | ||
183 | SHAPE_UNKNOWN = 0, | ||
184 | SHAPE_AVATAR = 1, | ||
185 | SHAPE_BOX = 2, | ||
186 | SHAPE_CONE = 3, | ||
187 | SHAPE_CYLINDER = 4, | ||
188 | SHAPE_SPHERE = 5, | ||
189 | SHAPE_MESH = 6, | ||
190 | SHAPE_HULL = 7, | ||
191 | // following defined by BulletSim | ||
192 | SHAPE_GROUNDPLANE = 20, | ||
193 | SHAPE_TERRAIN = 21, | ||
194 | SHAPE_COMPOUND = 22, | ||
195 | SHAPE_HEIGHTMAP = 23, | ||
196 | }; | ||
181 | [StructLayout(LayoutKind.Sequential)] | 197 | [StructLayout(LayoutKind.Sequential)] |
182 | public struct ShapeData | 198 | public struct ShapeData |
183 | { | 199 | { |
184 | public enum PhysicsShapeType | ||
185 | { | ||
186 | SHAPE_UNKNOWN = 0, | ||
187 | SHAPE_AVATAR = 1, | ||
188 | SHAPE_BOX = 2, | ||
189 | SHAPE_CONE = 3, | ||
190 | SHAPE_CYLINDER = 4, | ||
191 | SHAPE_SPHERE = 5, | ||
192 | SHAPE_MESH = 6, | ||
193 | SHAPE_HULL = 7, | ||
194 | // following defined by BulletSim | ||
195 | SHAPE_GROUNDPLANE = 20, | ||
196 | SHAPE_TERRAIN = 21, | ||
197 | SHAPE_COMPOUND = 22, | ||
198 | }; | ||
199 | public uint ID; | 200 | public uint ID; |
200 | public PhysicsShapeType Type; | 201 | public PhysicsShapeType Type; |
201 | public Vector3 Position; | 202 | public Vector3 Position; |