BulletSim: uplevel FixedShapeKey out of ShapeData structure (since it is getting simplified out of existance someday) and update all the references to same.
parent
d6db0d5740
commit
65e55ada87
|
@ -409,7 +409,7 @@ public sealed class BSShapeCollection : IDisposable
|
||||||
{
|
{
|
||||||
// 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, PhysicsShapeType.SHAPE_AVATAR,
|
ret = GetReferenceToNativeShape(prim, PhysicsShapeType.SHAPE_AVATAR,
|
||||||
ShapeData.FixedShapeKey.KEY_CAPSULE, shapeCallback);
|
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;
|
||||||
haveShape = true;
|
haveShape = true;
|
||||||
|
@ -464,7 +464,7 @@ public sealed class BSShapeCollection : IDisposable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ret = GetReferenceToNativeShape(prim, PhysicsShapeType.SHAPE_SPHERE,
|
ret = GetReferenceToNativeShape(prim, PhysicsShapeType.SHAPE_SPHERE,
|
||||||
ShapeData.FixedShapeKey.KEY_SPHERE, shapeCallback);
|
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);
|
||||||
}
|
}
|
||||||
|
@ -478,7 +478,7 @@ public sealed class BSShapeCollection : IDisposable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ret = GetReferenceToNativeShape( prim, PhysicsShapeType.SHAPE_BOX,
|
ret = GetReferenceToNativeShape( prim, PhysicsShapeType.SHAPE_BOX,
|
||||||
ShapeData.FixedShapeKey.KEY_BOX, shapeCallback);
|
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,
|
||||||
PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey,
|
PhysicsShapeType shapeType, FixedShapeKey shapeKey,
|
||||||
ShapeDestructionCallback shapeCallback)
|
ShapeDestructionCallback shapeCallback)
|
||||||
{
|
{
|
||||||
// release any previous shape
|
// release any previous shape
|
||||||
|
@ -539,7 +539,7 @@ public sealed class BSShapeCollection : IDisposable
|
||||||
}
|
}
|
||||||
|
|
||||||
private BulletShape BuildPhysicalNativeShape(BSPhysObject prim, PhysicsShapeType shapeType,
|
private BulletShape BuildPhysicalNativeShape(BSPhysObject prim, PhysicsShapeType shapeType,
|
||||||
ShapeData.FixedShapeKey shapeKey)
|
FixedShapeKey shapeKey)
|
||||||
{
|
{
|
||||||
BulletShape newShape;
|
BulletShape newShape;
|
||||||
// Need to make sure the passed shape information is for the native type.
|
// Need to make sure the passed shape information is for the native type.
|
||||||
|
@ -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, PhysicsShapeType.SHAPE_BOX, ShapeData.FixedShapeKey.KEY_BOX);
|
BuildPhysicalNativeShape(prim, PhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_BOX);
|
||||||
|
|
||||||
return fillinShape;
|
return fillinShape;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ public abstract class BSShape
|
||||||
{
|
{
|
||||||
// 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, PhysicsShapeType.SHAPE_AVATAR,
|
ret = BSShapeNative.GetReference(physicsScene, prim, PhysicsShapeType.SHAPE_AVATAR,
|
||||||
ShapeData.FixedShapeKey.KEY_CAPSULE);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,14 +123,14 @@ public class BSShapeNative : BSShape
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
public static BSShape GetReference(BSScene physicsScene, BSPhysObject prim,
|
public static BSShape GetReference(BSScene physicsScene, BSPhysObject prim,
|
||||||
PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey)
|
PhysicsShapeType shapeType, 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,
|
||||||
PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey)
|
PhysicsShapeType shapeType, FixedShapeKey shapeKey)
|
||||||
{
|
{
|
||||||
ShapeData nativeShapeData = new ShapeData();
|
ShapeData nativeShapeData = new ShapeData();
|
||||||
nativeShapeData.Type = shapeType;
|
nativeShapeData.Type = shapeType;
|
||||||
|
|
|
@ -89,7 +89,7 @@ public struct BulletShape
|
||||||
{
|
{
|
||||||
ptr = xx;
|
ptr = xx;
|
||||||
type=PhysicsShapeType.SHAPE_UNKNOWN;
|
type=PhysicsShapeType.SHAPE_UNKNOWN;
|
||||||
shapeKey = 0;
|
shapeKey = (System.UInt64)FixedShapeKey.KEY_NONE;
|
||||||
isNativeShape = false;
|
isNativeShape = false;
|
||||||
}
|
}
|
||||||
public BulletShape(IntPtr xx, PhysicsShapeType typ)
|
public BulletShape(IntPtr xx, PhysicsShapeType typ)
|
||||||
|
@ -194,6 +194,18 @@ public enum PhysicsShapeType
|
||||||
SHAPE_COMPOUND = 22,
|
SHAPE_COMPOUND = 22,
|
||||||
SHAPE_HEIGHTMAP = 23,
|
SHAPE_HEIGHTMAP = 23,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// The native shapes have predefined shape hash keys
|
||||||
|
public enum FixedShapeKey : ulong
|
||||||
|
{
|
||||||
|
KEY_NONE = 0,
|
||||||
|
KEY_BOX = 1,
|
||||||
|
KEY_SPHERE = 2,
|
||||||
|
KEY_CONE = 3,
|
||||||
|
KEY_CYLINDER = 4,
|
||||||
|
KEY_CAPSULE = 5,
|
||||||
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct ShapeData
|
public struct ShapeData
|
||||||
{
|
{
|
||||||
|
@ -217,16 +229,6 @@ public struct ShapeData
|
||||||
// note that bools are passed as floats since bool size changes by language and architecture
|
// note that bools are passed as floats since bool size changes by language and architecture
|
||||||
public const float numericTrue = 1f;
|
public const float numericTrue = 1f;
|
||||||
public const float numericFalse = 0f;
|
public const float numericFalse = 0f;
|
||||||
|
|
||||||
// The native shapes have predefined shape hash keys
|
|
||||||
public enum FixedShapeKey : ulong
|
|
||||||
{
|
|
||||||
KEY_BOX = 1,
|
|
||||||
KEY_SPHERE = 2,
|
|
||||||
KEY_CONE = 3,
|
|
||||||
KEY_CYLINDER = 4,
|
|
||||||
KEY_CAPSULE = 5,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct SweepHit
|
public struct SweepHit
|
||||||
|
|
Loading…
Reference in New Issue