BulletSim: Use base class constructors for initialization of BSShape and other classes.

connector_plugin
Robert Adams 2012-11-18 22:58:36 -08:00
parent 22be36be69
commit 6c961d8add
4 changed files with 214 additions and 216 deletions

View File

@ -47,7 +47,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin
*/ */
public abstract class BSPhysObject : PhysicsActor public abstract class BSPhysObject : PhysicsActor
{ {
protected void BaseInitialize(BSScene parentScene, uint localID, string name, string typeName) protected BSPhysObject()
{
}
protected BSPhysObject(BSScene parentScene, uint localID, string name, string typeName)
{ {
PhysicsScene = parentScene; PhysicsScene = parentScene;
LocalID = localID; LocalID = localID;

View File

@ -88,9 +88,9 @@ public sealed class BSPrim : BSPhysObject
public BSPrim(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size, public BSPrim(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size,
OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical) OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
: base(parent_scene, localID, primName, "BSPrim")
{ {
// m_log.DebugFormat("{0}: BSPrim creation of {1}, id={2}", LogHeader, primName, localID); // m_log.DebugFormat("{0}: BSPrim creation of {1}, id={2}", LogHeader, primName, localID);
base.BaseInitialize(parent_scene, localID, primName, "BSPrim");
_physicsActorType = (int)ActorTypes.Prim; _physicsActorType = (int)ActorTypes.Prim;
_position = pos; _position = pos;
_size = size; _size = size;

View File

@ -1,4 +1,4 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
@ -40,7 +40,7 @@ public abstract class BSShape
public int referenceCount { get; set; } public int referenceCount { get; set; }
public DateTime lastReferenced { get; set; } public DateTime lastReferenced { get; set; }
protected void Initialize() public BSShape()
{ {
ptr = IntPtr.Zero; ptr = IntPtr.Zero;
type = ShapeData.PhysicsShapeType.SHAPE_UNKNOWN; type = ShapeData.PhysicsShapeType.SHAPE_UNKNOWN;
@ -109,9 +109,8 @@ public abstract class BSShape
public class BSShapeNull : BSShape public class BSShapeNull : BSShape
{ {
public BSShapeNull() public BSShapeNull() : base()
{ {
base.Initialize();
} }
public static BSShape GetReference() { return new BSShapeNull(); } public static BSShape GetReference() { return new BSShapeNull(); }
public override void Dereference(BSScene physicsScene) { /* The magic of garbage collection will make this go away */ } public override void Dereference(BSScene physicsScene) { /* The magic of garbage collection will make this go away */ }
@ -120,9 +119,8 @@ public class BSShapeNull : BSShape
public class BSShapeNative : BSShape public class BSShapeNative : BSShape
{ {
private static string LogHeader = "[BULLETSIM SHAPE NATIVE]"; private static string LogHeader = "[BULLETSIM SHAPE NATIVE]";
public BSShapeNative() public BSShapeNative() : base()
{ {
base.Initialize();
} }
public static BSShape GetReference(BSScene physicsScene, BSPhysObject prim, public static BSShape GetReference(BSScene physicsScene, BSPhysObject prim,
ShapeData.PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey) ShapeData.PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey)
@ -176,9 +174,8 @@ public class BSShapeMesh : BSShape
private static string LogHeader = "[BULLETSIM SHAPE MESH]"; private static string LogHeader = "[BULLETSIM SHAPE MESH]";
private static Dictionary<System.UInt64, BSShapeMesh> Meshes = new Dictionary<System.UInt64, BSShapeMesh>(); private static Dictionary<System.UInt64, BSShapeMesh> Meshes = new Dictionary<System.UInt64, BSShapeMesh>();
public BSShapeMesh() public BSShapeMesh() : base()
{ {
base.Initialize();
} }
public static BSShape GetReference() { return new BSShapeNull(); } public static BSShape GetReference() { return new BSShapeNull(); }
public override void Dereference(BSScene physicsScene) { } public override void Dereference(BSScene physicsScene) { }
@ -189,9 +186,8 @@ public class BSShapeHull : BSShape
private static string LogHeader = "[BULLETSIM SHAPE HULL]"; private static string LogHeader = "[BULLETSIM SHAPE HULL]";
private static Dictionary<System.UInt64, BSShapeHull> Hulls = new Dictionary<System.UInt64, BSShapeHull>(); private static Dictionary<System.UInt64, BSShapeHull> Hulls = new Dictionary<System.UInt64, BSShapeHull>();
public BSShapeHull() public BSShapeHull() : base()
{ {
base.Initialize();
} }
public static BSShape GetReference() { return new BSShapeNull(); } public static BSShape GetReference() { return new BSShapeNull(); }
public override void Dereference(BSScene physicsScene) { } public override void Dereference(BSScene physicsScene) { }
@ -200,9 +196,8 @@ public class BSShapeHull : BSShape
public class BSShapeCompound : BSShape public class BSShapeCompound : BSShape
{ {
private static string LogHeader = "[BULLETSIM SHAPE COMPOUND]"; private static string LogHeader = "[BULLETSIM SHAPE COMPOUND]";
public BSShapeCompound() public BSShapeCompound() : base()
{ {
base.Initialize();
} }
public static BSShape GetReference(BSPhysObject prim) public static BSShape GetReference(BSPhysObject prim)
{ {