BulletSim: uplevel PhysicsShapeType out of ShapeData structure (since it is getting simplified out of existance someday) and update all the references to that enum.
							parent
							
								
									4d29488216
								
							
						
					
					
						commit
						d6db0d5740
					
				|  | @ -203,9 +203,9 @@ public sealed class BSCharacter : BSPhysObject | ||||||
|         set { BaseShape = value; } |         set { BaseShape = value; } | ||||||
|     } |     } | ||||||
|     // I want the physics engine to make an avatar capsule |     // I want the physics engine to make an avatar capsule | ||||||
|     public override ShapeData.PhysicsShapeType PreferredPhysicalShape |     public override PhysicsShapeType PreferredPhysicalShape | ||||||
|     { |     { | ||||||
|         get {return ShapeData.PhysicsShapeType.SHAPE_AVATAR; } |         get {return PhysicsShapeType.SHAPE_AVATAR; } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public override bool Grabbed { |     public override bool Grabbed { | ||||||
|  |  | ||||||
|  | @ -82,9 +82,9 @@ public abstract class BSLinkset | ||||||
| 
 | 
 | ||||||
|     // Some linksets have a preferred physical shape. |     // Some linksets have a preferred physical shape. | ||||||
|     // Returns SHAPE_UNKNOWN if there is no preference. Causes the correct shape to be selected. |     // Returns SHAPE_UNKNOWN if there is no preference. Causes the correct shape to be selected. | ||||||
|     public virtual ShapeData.PhysicsShapeType PreferredPhysicalShape(BSPhysObject requestor) |     public virtual PhysicsShapeType PreferredPhysicalShape(BSPhysObject requestor) | ||||||
|     { |     { | ||||||
|         return ShapeData.PhysicsShapeType.SHAPE_UNKNOWN; |         return PhysicsShapeType.SHAPE_UNKNOWN; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // Linksets move around the children so the linkset might need to compute the child position |     // Linksets move around the children so the linkset might need to compute the child position | ||||||
|  |  | ||||||
|  | @ -42,12 +42,12 @@ public sealed class BSLinksetCompound : BSLinkset | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // For compound implimented linksets, if there are children, use compound shape for the root. |     // For compound implimented linksets, if there are children, use compound shape for the root. | ||||||
|     public override ShapeData.PhysicsShapeType PreferredPhysicalShape(BSPhysObject requestor) |     public override PhysicsShapeType PreferredPhysicalShape(BSPhysObject requestor) | ||||||
|     {  |     {  | ||||||
|         ShapeData.PhysicsShapeType ret = ShapeData.PhysicsShapeType.SHAPE_UNKNOWN; |         PhysicsShapeType ret = PhysicsShapeType.SHAPE_UNKNOWN; | ||||||
|         if (IsRoot(requestor) && HasAnyChildren) |         if (IsRoot(requestor) && HasAnyChildren) | ||||||
|         { |         { | ||||||
|             ret = ShapeData.PhysicsShapeType.SHAPE_COMPOUND; |             ret = PhysicsShapeType.SHAPE_COMPOUND; | ||||||
|         } |         } | ||||||
|         // DetailLog("{0},BSLinksetCompound.PreferredPhysicalShape,call,shape={1}", LinksetRoot.LocalID, ret); |         // DetailLog("{0},BSLinksetCompound.PreferredPhysicalShape,call,shape={1}", LinksetRoot.LocalID, ret); | ||||||
|         return ret; |         return ret; | ||||||
|  |  | ||||||
|  | @ -94,9 +94,9 @@ public abstract class BSPhysObject : PhysicsActor | ||||||
|     public PrimitiveBaseShape BaseShape { get; protected set; } |     public PrimitiveBaseShape BaseShape { get; protected set; } | ||||||
|     // Some types of objects have preferred physical representations. |     // Some types of objects have preferred physical representations. | ||||||
|     // Returns SHAPE_UNKNOWN if there is no preference. |     // Returns SHAPE_UNKNOWN if there is no preference. | ||||||
|     public virtual ShapeData.PhysicsShapeType PreferredPhysicalShape |     public virtual PhysicsShapeType PreferredPhysicalShape | ||||||
|     { |     { | ||||||
|         get { return ShapeData.PhysicsShapeType.SHAPE_UNKNOWN; } |         get { return PhysicsShapeType.SHAPE_UNKNOWN; } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // When the physical properties are updated, an EntityProperty holds the update values. |     // When the physical properties are updated, an EntityProperty holds the update values. | ||||||
|  |  | ||||||
|  | @ -169,7 +169,7 @@ public sealed class BSPrim : BSPhysObject | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     // Whatever the linkset wants is what I want. |     // Whatever the linkset wants is what I want. | ||||||
|     public override ShapeData.PhysicsShapeType PreferredPhysicalShape |     public override PhysicsShapeType PreferredPhysicalShape | ||||||
|         { get { return Linkset.PreferredPhysicalShape(this); } } |         { get { return Linkset.PreferredPhysicalShape(this); } } | ||||||
| 
 | 
 | ||||||
|     public override bool ForceBodyShapeRebuild(bool inTaintTime) |     public override bool ForceBodyShapeRebuild(bool inTaintTime) | ||||||
|  |  | ||||||
|  | @ -178,7 +178,7 @@ public sealed class BSShapeCollection : IDisposable | ||||||
|         bool ret = false; |         bool ret = false; | ||||||
|         switch (shape.type) |         switch (shape.type) | ||||||
|         { |         { | ||||||
|             case ShapeData.PhysicsShapeType.SHAPE_MESH: |             case PhysicsShapeType.SHAPE_MESH: | ||||||
|                 MeshDesc meshDesc; |                 MeshDesc meshDesc; | ||||||
|                 if (Meshes.TryGetValue(shape.shapeKey, out meshDesc)) |                 if (Meshes.TryGetValue(shape.shapeKey, out meshDesc)) | ||||||
|                 { |                 { | ||||||
|  | @ -201,7 +201,7 @@ public sealed class BSShapeCollection : IDisposable | ||||||
|                 meshDesc.lastReferenced = System.DateTime.Now; |                 meshDesc.lastReferenced = System.DateTime.Now; | ||||||
|                 Meshes[shape.shapeKey] = meshDesc; |                 Meshes[shape.shapeKey] = meshDesc; | ||||||
|                 break; |                 break; | ||||||
|             case ShapeData.PhysicsShapeType.SHAPE_HULL: |             case PhysicsShapeType.SHAPE_HULL: | ||||||
|                 HullDesc hullDesc; |                 HullDesc hullDesc; | ||||||
|                 if (Hulls.TryGetValue(shape.shapeKey, out hullDesc)) |                 if (Hulls.TryGetValue(shape.shapeKey, out hullDesc)) | ||||||
|                 { |                 { | ||||||
|  | @ -224,7 +224,7 @@ public sealed class BSShapeCollection : IDisposable | ||||||
|                 hullDesc.lastReferenced = System.DateTime.Now; |                 hullDesc.lastReferenced = System.DateTime.Now; | ||||||
|                 Hulls[shape.shapeKey] = hullDesc; |                 Hulls[shape.shapeKey] = hullDesc; | ||||||
|                 break; |                 break; | ||||||
|             case ShapeData.PhysicsShapeType.SHAPE_UNKNOWN: |             case PhysicsShapeType.SHAPE_UNKNOWN: | ||||||
|                 break; |                 break; | ||||||
|             default: |             default: | ||||||
|                 // Native shapes are not tracked and they don't go into any list |                 // Native shapes are not tracked and they don't go into any list | ||||||
|  | @ -255,16 +255,16 @@ public sealed class BSShapeCollection : IDisposable | ||||||
|                 { |                 { | ||||||
|                     switch (shape.type) |                     switch (shape.type) | ||||||
|                     { |                     { | ||||||
|                         case ShapeData.PhysicsShapeType.SHAPE_HULL: |                         case PhysicsShapeType.SHAPE_HULL: | ||||||
|                             DereferenceHull(shape, shapeCallback); |                             DereferenceHull(shape, shapeCallback); | ||||||
|                             break; |                             break; | ||||||
|                         case ShapeData.PhysicsShapeType.SHAPE_MESH: |                         case PhysicsShapeType.SHAPE_MESH: | ||||||
|                             DereferenceMesh(shape, shapeCallback); |                             DereferenceMesh(shape, shapeCallback); | ||||||
|                             break; |                             break; | ||||||
|                         case ShapeData.PhysicsShapeType.SHAPE_COMPOUND: |                         case PhysicsShapeType.SHAPE_COMPOUND: | ||||||
|                             DereferenceCompound(shape, shapeCallback); |                             DereferenceCompound(shape, shapeCallback); | ||||||
|                             break; |                             break; | ||||||
|                         case ShapeData.PhysicsShapeType.SHAPE_UNKNOWN: |                         case PhysicsShapeType.SHAPE_UNKNOWN: | ||||||
|                             break; |                             break; | ||||||
|                         default: |                         default: | ||||||
|                             break; |                             break; | ||||||
|  | @ -352,28 +352,28 @@ public sealed class BSShapeCollection : IDisposable | ||||||
|         BulletShape shapeInfo = new BulletShape(cShape); |         BulletShape shapeInfo = new BulletShape(cShape); | ||||||
|         if (TryGetMeshByPtr(cShape, out meshDesc)) |         if (TryGetMeshByPtr(cShape, out meshDesc)) | ||||||
|         { |         { | ||||||
|             shapeInfo.type = ShapeData.PhysicsShapeType.SHAPE_MESH; |             shapeInfo.type = PhysicsShapeType.SHAPE_MESH; | ||||||
|             shapeInfo.shapeKey = meshDesc.shapeKey; |             shapeInfo.shapeKey = meshDesc.shapeKey; | ||||||
|         } |         } | ||||||
|         else |         else | ||||||
|         { |         { | ||||||
|             if (TryGetHullByPtr(cShape, out hullDesc)) |             if (TryGetHullByPtr(cShape, out hullDesc)) | ||||||
|             { |             { | ||||||
|                 shapeInfo.type = ShapeData.PhysicsShapeType.SHAPE_HULL; |                 shapeInfo.type = PhysicsShapeType.SHAPE_HULL; | ||||||
|                 shapeInfo.shapeKey = hullDesc.shapeKey; |                 shapeInfo.shapeKey = hullDesc.shapeKey; | ||||||
|             } |             } | ||||||
|             else |             else | ||||||
|             { |             { | ||||||
|                 if (BulletSimAPI.IsCompound2(cShape)) |                 if (BulletSimAPI.IsCompound2(cShape)) | ||||||
|                 { |                 { | ||||||
|                     shapeInfo.type = ShapeData.PhysicsShapeType.SHAPE_COMPOUND; |                     shapeInfo.type = PhysicsShapeType.SHAPE_COMPOUND; | ||||||
|                 } |                 } | ||||||
|                 else |                 else | ||||||
|                 { |                 { | ||||||
|                     if (BulletSimAPI.IsNativeShape2(cShape)) |                     if (BulletSimAPI.IsNativeShape2(cShape)) | ||||||
|                     { |                     { | ||||||
|                         shapeInfo.isNativeShape = true; |                         shapeInfo.isNativeShape = true; | ||||||
|                         shapeInfo.type = ShapeData.PhysicsShapeType.SHAPE_BOX; // (technically, type doesn't matter) |                         shapeInfo.type = PhysicsShapeType.SHAPE_BOX; // (technically, type doesn't matter) | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  | @ -381,7 +381,7 @@ public sealed class BSShapeCollection : IDisposable | ||||||
| 
 | 
 | ||||||
|         DetailLog("{0},BSShapeCollection.DereferenceAnonCollisionShape,shape={1}", BSScene.DetailLogZero, shapeInfo); |         DetailLog("{0},BSShapeCollection.DereferenceAnonCollisionShape,shape={1}", BSScene.DetailLogZero, shapeInfo); | ||||||
| 
 | 
 | ||||||
|         if (shapeInfo.type != ShapeData.PhysicsShapeType.SHAPE_UNKNOWN) |         if (shapeInfo.type != PhysicsShapeType.SHAPE_UNKNOWN) | ||||||
|         { |         { | ||||||
|             DereferenceShape(shapeInfo, true, null); |             DereferenceShape(shapeInfo, true, null); | ||||||
|         } |         } | ||||||
|  | @ -405,10 +405,10 @@ public sealed class BSShapeCollection : IDisposable | ||||||
|         bool ret = false; |         bool ret = false; | ||||||
|         bool haveShape = false; |         bool haveShape = false; | ||||||
| 
 | 
 | ||||||
|         if (!haveShape && prim.PreferredPhysicalShape == ShapeData.PhysicsShapeType.SHAPE_AVATAR) |         if (!haveShape && prim.PreferredPhysicalShape == PhysicsShapeType.SHAPE_AVATAR) | ||||||
|         { |         { | ||||||
|             // an avatar capsule is close to a native shape (it is not shared) |             // an avatar capsule is close to a native shape (it is not shared) | ||||||
|             ret = GetReferenceToNativeShape(prim, ShapeData.PhysicsShapeType.SHAPE_AVATAR, |             ret = GetReferenceToNativeShape(prim, PhysicsShapeType.SHAPE_AVATAR, | ||||||
|                             ShapeData.FixedShapeKey.KEY_CAPSULE, shapeCallback); |                             ShapeData.FixedShapeKey.KEY_CAPSULE, shapeCallback); | ||||||
|             DetailLog("{0},BSShapeCollection.CreateGeom,avatarCapsule,shape={1}", prim.LocalID, prim.PhysShape); |             DetailLog("{0},BSShapeCollection.CreateGeom,avatarCapsule,shape={1}", prim.LocalID, prim.PhysShape); | ||||||
|             ret = true; |             ret = true; | ||||||
|  | @ -417,7 +417,7 @@ public sealed class BSShapeCollection : IDisposable | ||||||
| 
 | 
 | ||||||
|         // Compound shapes are handled special as they are rebuilt from scratch. |         // Compound shapes are handled special as they are rebuilt from scratch. | ||||||
|         // This isn't too great a hardship since most of the child shapes will already been created. |         // This isn't too great a hardship since most of the child shapes will already been created. | ||||||
|         if (!haveShape && prim.PreferredPhysicalShape == ShapeData.PhysicsShapeType.SHAPE_COMPOUND) |         if (!haveShape && prim.PreferredPhysicalShape == PhysicsShapeType.SHAPE_COMPOUND) | ||||||
|         { |         { | ||||||
|             ret = GetReferenceToCompoundShape(prim, shapeCallback); |             ret = GetReferenceToCompoundShape(prim, shapeCallback); | ||||||
|             DetailLog("{0},BSShapeCollection.CreateGeom,compoundShape,shape={1}", prim.LocalID, prim.PhysShape); |             DetailLog("{0},BSShapeCollection.CreateGeom,compoundShape,shape={1}", prim.LocalID, prim.PhysShape); | ||||||
|  | @ -460,10 +460,10 @@ public sealed class BSShapeCollection : IDisposable | ||||||
|                 haveShape = true; |                 haveShape = true; | ||||||
|                 if (forceRebuild |                 if (forceRebuild | ||||||
|                         || prim.Scale != prim.Size |                         || prim.Scale != prim.Size | ||||||
|                         || prim.PhysShape.type != ShapeData.PhysicsShapeType.SHAPE_SPHERE |                         || prim.PhysShape.type != PhysicsShapeType.SHAPE_SPHERE | ||||||
|                         ) |                         ) | ||||||
|                 { |                 { | ||||||
|                     ret = GetReferenceToNativeShape(prim, ShapeData.PhysicsShapeType.SHAPE_SPHERE, |                     ret = GetReferenceToNativeShape(prim, PhysicsShapeType.SHAPE_SPHERE, | ||||||
|                                             ShapeData.FixedShapeKey.KEY_SPHERE, shapeCallback); |                                             ShapeData.FixedShapeKey.KEY_SPHERE, shapeCallback); | ||||||
|                     DetailLog("{0},BSShapeCollection.CreateGeom,sphere,force={1},shape={2}", |                     DetailLog("{0},BSShapeCollection.CreateGeom,sphere,force={1},shape={2}", | ||||||
|                                         prim.LocalID, forceRebuild, prim.PhysShape); |                                         prim.LocalID, forceRebuild, prim.PhysShape); | ||||||
|  | @ -474,10 +474,10 @@ public sealed class BSShapeCollection : IDisposable | ||||||
|                 haveShape = true; |                 haveShape = true; | ||||||
|                 if (forceRebuild |                 if (forceRebuild | ||||||
|                         || prim.Scale != prim.Size |                         || prim.Scale != prim.Size | ||||||
|                         || prim.PhysShape.type != ShapeData.PhysicsShapeType.SHAPE_BOX |                         || prim.PhysShape.type != PhysicsShapeType.SHAPE_BOX | ||||||
|                         ) |                         ) | ||||||
|                 { |                 { | ||||||
|                     ret = GetReferenceToNativeShape( prim, ShapeData.PhysicsShapeType.SHAPE_BOX, |                     ret = GetReferenceToNativeShape( prim, PhysicsShapeType.SHAPE_BOX, | ||||||
|                                             ShapeData.FixedShapeKey.KEY_BOX, shapeCallback); |                                             ShapeData.FixedShapeKey.KEY_BOX, shapeCallback); | ||||||
|                     DetailLog("{0},BSShapeCollection.CreateGeom,box,force={1},shape={2}", |                     DetailLog("{0},BSShapeCollection.CreateGeom,box,force={1},shape={2}", | ||||||
|                                         prim.LocalID, forceRebuild, prim.PhysShape); |                                         prim.LocalID, forceRebuild, prim.PhysShape); | ||||||
|  | @ -519,7 +519,7 @@ public sealed class BSShapeCollection : IDisposable | ||||||
|     // Creates a native shape and assignes it to prim.BSShape. |     // Creates a native shape and assignes it to prim.BSShape. | ||||||
|     // "Native" shapes are never shared. they are created here and destroyed in DereferenceShape(). |     // "Native" shapes are never shared. they are created here and destroyed in DereferenceShape(). | ||||||
|     private bool GetReferenceToNativeShape(BSPhysObject prim, |     private bool GetReferenceToNativeShape(BSPhysObject prim, | ||||||
|                             ShapeData.PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey, |                             PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey, | ||||||
|                             ShapeDestructionCallback shapeCallback) |                             ShapeDestructionCallback shapeCallback) | ||||||
|     { |     { | ||||||
|         // release any previous shape |         // release any previous shape | ||||||
|  | @ -538,7 +538,7 @@ public sealed class BSShapeCollection : IDisposable | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private BulletShape BuildPhysicalNativeShape(BSPhysObject prim, ShapeData.PhysicsShapeType shapeType, |     private BulletShape BuildPhysicalNativeShape(BSPhysObject prim, PhysicsShapeType shapeType, | ||||||
|                                     ShapeData.FixedShapeKey shapeKey) |                                     ShapeData.FixedShapeKey shapeKey) | ||||||
|     { |     { | ||||||
|         BulletShape newShape; |         BulletShape newShape; | ||||||
|  | @ -551,7 +551,7 @@ public sealed class BSShapeCollection : IDisposable | ||||||
|         nativeShapeData.MeshKey = (ulong)shapeKey; |         nativeShapeData.MeshKey = (ulong)shapeKey; | ||||||
|         nativeShapeData.HullKey = (ulong)shapeKey; |         nativeShapeData.HullKey = (ulong)shapeKey; | ||||||
| 
 | 
 | ||||||
|         if (shapeType == ShapeData.PhysicsShapeType.SHAPE_AVATAR) |         if (shapeType == PhysicsShapeType.SHAPE_AVATAR) | ||||||
|         { |         { | ||||||
|             newShape = new BulletShape( |             newShape = new BulletShape( | ||||||
|                         BulletSimAPI.BuildCapsuleShape2(PhysicsScene.World.ptr, 1f, 1f, prim.Scale) |                         BulletSimAPI.BuildCapsuleShape2(PhysicsScene.World.ptr, 1f, 1f, prim.Scale) | ||||||
|  | @ -585,7 +585,7 @@ public sealed class BSShapeCollection : IDisposable | ||||||
|         System.UInt64 newMeshKey = ComputeShapeKey(prim.Size, prim.BaseShape, out lod); |         System.UInt64 newMeshKey = ComputeShapeKey(prim.Size, prim.BaseShape, out lod); | ||||||
| 
 | 
 | ||||||
|         // if this new shape is the same as last time, don't recreate the mesh |         // if this new shape is the same as last time, don't recreate the mesh | ||||||
|         if (newMeshKey == prim.PhysShape.shapeKey && prim.PhysShape.type == ShapeData.PhysicsShapeType.SHAPE_MESH) |         if (newMeshKey == prim.PhysShape.shapeKey && prim.PhysShape.type == PhysicsShapeType.SHAPE_MESH) | ||||||
|             return false; |             return false; | ||||||
| 
 | 
 | ||||||
|         DetailLog("{0},BSShapeCollection.GetReferenceToMesh,create,oldKey={1},newKey={2}", |         DetailLog("{0},BSShapeCollection.GetReferenceToMesh,create,oldKey={1},newKey={2}", | ||||||
|  | @ -643,7 +643,7 @@ public sealed class BSShapeCollection : IDisposable | ||||||
|                                     indices.GetLength(0), indices, vertices.Count, verticesAsFloats); |                                     indices.GetLength(0), indices, vertices.Count, verticesAsFloats); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         BulletShape newShape = new BulletShape(meshPtr, ShapeData.PhysicsShapeType.SHAPE_MESH); |         BulletShape newShape = new BulletShape(meshPtr, PhysicsShapeType.SHAPE_MESH); | ||||||
|         newShape.shapeKey = newMeshKey; |         newShape.shapeKey = newMeshKey; | ||||||
| 
 | 
 | ||||||
|         return newShape; |         return newShape; | ||||||
|  | @ -659,7 +659,7 @@ public sealed class BSShapeCollection : IDisposable | ||||||
|         System.UInt64 newHullKey = ComputeShapeKey(prim.Size, prim.BaseShape, out lod); |         System.UInt64 newHullKey = ComputeShapeKey(prim.Size, prim.BaseShape, out lod); | ||||||
| 
 | 
 | ||||||
|         // if the hull hasn't changed, don't rebuild it |         // if the hull hasn't changed, don't rebuild it | ||||||
|         if (newHullKey == prim.PhysShape.shapeKey && prim.PhysShape.type == ShapeData.PhysicsShapeType.SHAPE_HULL) |         if (newHullKey == prim.PhysShape.shapeKey && prim.PhysShape.type == PhysicsShapeType.SHAPE_HULL) | ||||||
|             return false; |             return false; | ||||||
| 
 | 
 | ||||||
|         DetailLog("{0},BSShapeCollection.GetReferenceToHull,create,oldKey={1},newKey={2}", |         DetailLog("{0},BSShapeCollection.GetReferenceToHull,create,oldKey={1},newKey={2}", | ||||||
|  | @ -780,7 +780,7 @@ public sealed class BSShapeCollection : IDisposable | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         BulletShape newShape = new BulletShape(hullPtr, ShapeData.PhysicsShapeType.SHAPE_HULL); |         BulletShape newShape = new BulletShape(hullPtr, PhysicsShapeType.SHAPE_HULL); | ||||||
|         newShape.shapeKey = newHullKey; |         newShape.shapeKey = newHullKey; | ||||||
| 
 | 
 | ||||||
|         return newShape;        // 'true' means a new shape has been added to this prim |         return newShape;        // 'true' means a new shape has been added to this prim | ||||||
|  | @ -803,7 +803,7 @@ public sealed class BSShapeCollection : IDisposable | ||||||
|         // DereferenceShape(prim.PhysShape, true, shapeCallback); |         // DereferenceShape(prim.PhysShape, true, shapeCallback); | ||||||
| 
 | 
 | ||||||
|         BulletShape cShape = new BulletShape( |         BulletShape cShape = new BulletShape( | ||||||
|             BulletSimAPI.CreateCompoundShape2(PhysicsScene.World.ptr, false), ShapeData.PhysicsShapeType.SHAPE_COMPOUND); |             BulletSimAPI.CreateCompoundShape2(PhysicsScene.World.ptr, false), PhysicsShapeType.SHAPE_COMPOUND); | ||||||
| 
 | 
 | ||||||
|         // Create the shape for the root prim and add it to the compound shape. Cannot be a native shape. |         // Create the shape for the root prim and add it to the compound shape. Cannot be a native shape. | ||||||
|         CreateGeomMeshOrHull(prim, shapeCallback); |         CreateGeomMeshOrHull(prim, shapeCallback); | ||||||
|  | @ -894,7 +894,7 @@ public sealed class BSShapeCollection : IDisposable | ||||||
| 
 | 
 | ||||||
|         // While we figure out the real problem, stick a simple native shape on the object. |         // While we figure out the real problem, stick a simple native shape on the object. | ||||||
|         BulletShape fillinShape = |         BulletShape fillinShape = | ||||||
|             BuildPhysicalNativeShape(prim, ShapeData.PhysicsShapeType.SHAPE_BOX, ShapeData.FixedShapeKey.KEY_BOX); |             BuildPhysicalNativeShape(prim, PhysicsShapeType.SHAPE_BOX, ShapeData.FixedShapeKey.KEY_BOX); | ||||||
| 
 | 
 | ||||||
|         return fillinShape; |         return fillinShape; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -35,7 +35,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | ||||||
| public abstract class BSShape | public abstract class BSShape | ||||||
| { | { | ||||||
|     public IntPtr ptr { get; set; } |     public IntPtr ptr { get; set; } | ||||||
|     public ShapeData.PhysicsShapeType type { get; set; } |     public PhysicsShapeType type { get; set; } | ||||||
|     public System.UInt64 key { get; set; } |     public System.UInt64 key { get; set; } | ||||||
|     public int referenceCount { get; set; } |     public int referenceCount { get; set; } | ||||||
|     public DateTime lastReferenced { get; set; } |     public DateTime lastReferenced { get; set; } | ||||||
|  | @ -43,7 +43,7 @@ public abstract class BSShape | ||||||
|     public BSShape() |     public BSShape() | ||||||
|     { |     { | ||||||
|         ptr = IntPtr.Zero; |         ptr = IntPtr.Zero; | ||||||
|         type = ShapeData.PhysicsShapeType.SHAPE_UNKNOWN; |         type = PhysicsShapeType.SHAPE_UNKNOWN; | ||||||
|         key = 0; |         key = 0; | ||||||
|         referenceCount = 0; |         referenceCount = 0; | ||||||
|         lastReferenced = DateTime.Now; |         lastReferenced = DateTime.Now; | ||||||
|  | @ -54,17 +54,17 @@ public abstract class BSShape | ||||||
|     { |     { | ||||||
|         BSShape ret = null; |         BSShape ret = null; | ||||||
| 
 | 
 | ||||||
|         if (prim.PreferredPhysicalShape == ShapeData.PhysicsShapeType.SHAPE_AVATAR) |         if (prim.PreferredPhysicalShape == PhysicsShapeType.SHAPE_AVATAR) | ||||||
|         { |         { | ||||||
|             // an avatar capsule is close to a native shape (it is not shared) |             // an avatar capsule is close to a native shape (it is not shared) | ||||||
|             ret = BSShapeNative.GetReference(physicsScene, prim, ShapeData.PhysicsShapeType.SHAPE_AVATAR, |             ret = BSShapeNative.GetReference(physicsScene, prim, PhysicsShapeType.SHAPE_AVATAR, | ||||||
|                                         ShapeData.FixedShapeKey.KEY_CAPSULE); |                                         ShapeData.FixedShapeKey.KEY_CAPSULE); | ||||||
|             physicsScene.DetailLog("{0},BSShape.GetShapeReference,avatarCapsule,shape={1}", prim.LocalID, ret); |             physicsScene.DetailLog("{0},BSShape.GetShapeReference,avatarCapsule,shape={1}", prim.LocalID, ret); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         // Compound shapes are handled special as they are rebuilt from scratch. |         // Compound shapes are handled special as they are rebuilt from scratch. | ||||||
|         // This isn't too great a hardship since most of the child shapes will already been created. |         // This isn't too great a hardship since most of the child shapes will already been created. | ||||||
|         if (ret == null  && prim.PreferredPhysicalShape == ShapeData.PhysicsShapeType.SHAPE_COMPOUND) |         if (ret == null  && prim.PreferredPhysicalShape == PhysicsShapeType.SHAPE_COMPOUND) | ||||||
|         { |         { | ||||||
|             // Getting a reference to a compound shape gets you the compound shape with the root prim shape added |             // Getting a reference to a compound shape gets you the compound shape with the root prim shape added | ||||||
|             ret = BSShapeCompound.GetReference(prim); |             ret = BSShapeCompound.GetReference(prim); | ||||||
|  | @ -123,14 +123,14 @@ public class BSShapeNative : BSShape | ||||||
|     { |     { | ||||||
|     } |     } | ||||||
|     public static BSShape GetReference(BSScene physicsScene, BSPhysObject prim,  |     public static BSShape GetReference(BSScene physicsScene, BSPhysObject prim,  | ||||||
|                     ShapeData.PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey)  |                     PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey)  | ||||||
|     { |     { | ||||||
|         // Native shapes are not shared and are always built anew. |         // Native shapes are not shared and are always built anew. | ||||||
|         return new BSShapeNative(physicsScene, prim, shapeType, shapeKey); |         return new BSShapeNative(physicsScene, prim, shapeType, shapeKey); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private BSShapeNative(BSScene physicsScene, BSPhysObject prim, |     private BSShapeNative(BSScene physicsScene, BSPhysObject prim, | ||||||
|                     ShapeData.PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey) |                     PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey) | ||||||
|     { |     { | ||||||
|         ShapeData nativeShapeData = new ShapeData(); |         ShapeData nativeShapeData = new ShapeData(); | ||||||
|         nativeShapeData.Type = shapeType; |         nativeShapeData.Type = shapeType; | ||||||
|  | @ -141,7 +141,7 @@ public class BSShapeNative : BSShape | ||||||
|         nativeShapeData.HullKey = (ulong)shapeKey; |         nativeShapeData.HullKey = (ulong)shapeKey; | ||||||
| 
 | 
 | ||||||
|         |         | ||||||
|         if (shapeType == ShapeData.PhysicsShapeType.SHAPE_AVATAR) |         if (shapeType == PhysicsShapeType.SHAPE_AVATAR) | ||||||
|         { |         { | ||||||
|             ptr = BulletSimAPI.BuildCapsuleShape2(physicsScene.World.ptr, 1f, 1f, prim.Scale); |             ptr = BulletSimAPI.BuildCapsuleShape2(physicsScene.World.ptr, 1f, 1f, prim.Scale); | ||||||
|             physicsScene.DetailLog("{0},BSShapeCollection.BuiletPhysicalNativeShape,capsule,scale={1}", prim.LocalID, prim.Scale); |             physicsScene.DetailLog("{0},BSShapeCollection.BuiletPhysicalNativeShape,capsule,scale={1}", prim.LocalID, prim.Scale); | ||||||
|  |  | ||||||
|  | @ -109,7 +109,7 @@ public sealed class BSTerrainManager | ||||||
|         // The ground plane is here to catch things that are trying to drop to negative infinity |         // The ground plane is here to catch things that are trying to drop to negative infinity | ||||||
|         BulletShape groundPlaneShape = new BulletShape( |         BulletShape groundPlaneShape = new BulletShape( | ||||||
|                     BulletSimAPI.CreateGroundPlaneShape2(BSScene.GROUNDPLANE_ID, 1f, TERRAIN_COLLISION_MARGIN), |                     BulletSimAPI.CreateGroundPlaneShape2(BSScene.GROUNDPLANE_ID, 1f, TERRAIN_COLLISION_MARGIN), | ||||||
|                     ShapeData.PhysicsShapeType.SHAPE_GROUNDPLANE); |                     PhysicsShapeType.SHAPE_GROUNDPLANE); | ||||||
|         m_groundPlane = new BulletBody(BSScene.GROUNDPLANE_ID, |         m_groundPlane = new BulletBody(BSScene.GROUNDPLANE_ID, | ||||||
|                         BulletSimAPI.CreateBodyWithDefaultMotionState2(groundPlaneShape.ptr, BSScene.GROUNDPLANE_ID, |                         BulletSimAPI.CreateBodyWithDefaultMotionState2(groundPlaneShape.ptr, BSScene.GROUNDPLANE_ID, | ||||||
|                                                             Vector3.Zero, Quaternion.Identity)); |                                                             Vector3.Zero, Quaternion.Identity)); | ||||||
|  | @ -299,7 +299,7 @@ public sealed class BSTerrainManager | ||||||
| 
 | 
 | ||||||
|                     // Create the terrain shape from the mapInfo |                     // Create the terrain shape from the mapInfo | ||||||
|                     mapInfo.terrainShape = new BulletShape(BulletSimAPI.CreateTerrainShape2(mapInfo.Ptr), |                     mapInfo.terrainShape = new BulletShape(BulletSimAPI.CreateTerrainShape2(mapInfo.Ptr), | ||||||
|                                 ShapeData.PhysicsShapeType.SHAPE_TERRAIN); |                                 PhysicsShapeType.SHAPE_TERRAIN); | ||||||
| 
 | 
 | ||||||
|                     // The terrain object initial position is at the center of the object |                     // The terrain object initial position is at the center of the object | ||||||
|                     Vector3 centerPos; |                     Vector3 centerPos; | ||||||
|  |  | ||||||
|  | @ -88,11 +88,11 @@ public struct BulletShape | ||||||
|     public BulletShape(IntPtr xx) |     public BulletShape(IntPtr xx) | ||||||
|     { |     { | ||||||
|         ptr = xx; |         ptr = xx; | ||||||
|         type=ShapeData.PhysicsShapeType.SHAPE_UNKNOWN; |         type=PhysicsShapeType.SHAPE_UNKNOWN; | ||||||
|         shapeKey = 0; |         shapeKey = 0; | ||||||
|         isNativeShape = false; |         isNativeShape = false; | ||||||
|     } |     } | ||||||
|     public BulletShape(IntPtr xx, ShapeData.PhysicsShapeType typ) |     public BulletShape(IntPtr xx, PhysicsShapeType typ) | ||||||
|     { |     { | ||||||
|         ptr = xx; |         ptr = xx; | ||||||
|         type = typ; |         type = typ; | ||||||
|  | @ -100,7 +100,7 @@ public struct BulletShape | ||||||
|         isNativeShape = false; |         isNativeShape = false; | ||||||
|     } |     } | ||||||
|     public IntPtr ptr; |     public IntPtr ptr; | ||||||
|     public ShapeData.PhysicsShapeType type; |     public PhysicsShapeType type; | ||||||
|     public System.UInt64 shapeKey; |     public System.UInt64 shapeKey; | ||||||
|     public bool isNativeShape; |     public bool isNativeShape; | ||||||
|     public override string ToString() |     public override string ToString() | ||||||
|  | @ -178,11 +178,8 @@ public struct ConvexHull | ||||||
| 	int VertexCount; | 	int VertexCount; | ||||||
| 	Vector3[] Vertices; | 	Vector3[] Vertices; | ||||||
| } | } | ||||||
| [StructLayout(LayoutKind.Sequential)] | public enum PhysicsShapeType | ||||||
| public struct ShapeData |  | ||||||
| { | { | ||||||
|     public enum PhysicsShapeType |  | ||||||
|     { |  | ||||||
| 	SHAPE_UNKNOWN   = 0, | 	SHAPE_UNKNOWN   = 0, | ||||||
| 	SHAPE_AVATAR    = 1, | 	SHAPE_AVATAR    = 1, | ||||||
| 	SHAPE_BOX       = 2, | 	SHAPE_BOX       = 2, | ||||||
|  | @ -195,7 +192,11 @@ public struct ShapeData | ||||||
| 	SHAPE_GROUNDPLANE  = 20, | 	SHAPE_GROUNDPLANE  = 20, | ||||||
| 	SHAPE_TERRAIN   = 21, | 	SHAPE_TERRAIN   = 21, | ||||||
| 	SHAPE_COMPOUND  = 22, | 	SHAPE_COMPOUND  = 22, | ||||||
|     }; | 	SHAPE_HEIGHTMAP = 23, | ||||||
|  | }; | ||||||
|  | [StructLayout(LayoutKind.Sequential)] | ||||||
|  | public struct ShapeData | ||||||
|  | { | ||||||
|     public uint ID; |     public uint ID; | ||||||
|     public PhysicsShapeType Type; |     public PhysicsShapeType Type; | ||||||
|     public Vector3 Position; |     public Vector3 Position; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Robert Adams
						Robert Adams