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
{
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;
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,
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);
base.BaseInitialize(parent_scene, localID, primName, "BSPrim");
_physicsActorType = (int)ActorTypes.Prim;
_position = pos;
_size = size;

View File

@ -683,7 +683,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
#region Taints
// Calls to the PhysicsActors can't directly call into the physics engine
// because it might be busy. We delay changes to a known time.
// because it might be busy. We delay changes to a known time.
// We rely on C#'s closure to save and restore the context for the delegate.
public void TaintedObject(String ident, TaintCallback callback)
{

View File

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