BulletSim: set linkset type to be prim specific rather than a simulator

wide default. This allows individual prims to differ in the
underlying linkset implementation.
cpu-performance
Robert Adams 2013-06-30 13:48:27 -07:00
parent 23516717e4
commit 425d2a2a97
3 changed files with 8 additions and 15 deletions

View File

@ -33,14 +33,6 @@ using OMV = OpenMetaverse;
namespace OpenSim.Region.Physics.BulletSPlugin namespace OpenSim.Region.Physics.BulletSPlugin
{ {
// A BSPrim can get individual information about its linkedness attached
// to it through an instance of a subclass of LinksetInfo.
// Each type of linkset will define the information needed for its type.
public abstract class BSLinksetInfo
{
public virtual void Clear() { }
}
public abstract class BSLinkset public abstract class BSLinkset
{ {
// private static string LogHeader = "[BULLETSIM LINKSET]"; // private static string LogHeader = "[BULLETSIM LINKSET]";
@ -56,15 +48,15 @@ public abstract class BSLinkset
{ {
BSLinkset ret = null; BSLinkset ret = null;
switch ((int)BSParam.LinksetImplementation) switch (parent.LinksetType)
{ {
case (int)LinksetImplementation.Constraint: case LinksetImplementation.Constraint:
ret = new BSLinksetConstraints(physScene, parent); ret = new BSLinksetConstraints(physScene, parent);
break; break;
case (int)LinksetImplementation.Compound: case LinksetImplementation.Compound:
ret = new BSLinksetCompound(physScene, parent); ret = new BSLinksetCompound(physScene, parent);
break; break;
case (int)LinksetImplementation.Manual: case LinksetImplementation.Manual:
// ret = new BSLinksetManual(physScene, parent); // ret = new BSLinksetManual(physScene, parent);
break; break;
default: default:

View File

@ -238,7 +238,6 @@ public sealed class BSLinksetCompound : BSLinkset
// there will already be a rebuild scheduled. // there will already be a rebuild scheduled.
DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild.schedulingRebuild,whichUpdated={1}", DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild.schedulingRebuild,whichUpdated={1}",
updated.LocalID, whichUpdated); updated.LocalID, whichUpdated);
updated.LinksetInfo = null; // setting to 'null' causes relative position to be recomputed.
ScheduleRebuild(updated); ScheduleRebuild(updated);
} }
} }
@ -294,7 +293,6 @@ public sealed class BSLinksetCompound : BSLinkset
child.LocalID, child.PhysBody.AddrString); child.LocalID, child.PhysBody.AddrString);
// Cause the child's body to be rebuilt and thus restored to normal operation // Cause the child's body to be rebuilt and thus restored to normal operation
child.LinksetInfo = null;
child.ForceBodyShapeRebuild(false); child.ForceBodyShapeRebuild(false);
if (!HasAnyChildren) if (!HasAnyChildren)

View File

@ -41,12 +41,15 @@ public class BSPrimLinkable : BSPrimDisplaced
// The index of this child prim. // The index of this child prim.
public int LinksetChildIndex { get; set; } public int LinksetChildIndex { get; set; }
public BSLinksetInfo LinksetInfo { get; set; } public BSLinkset.LinksetImplementation LinksetType { get; set; }
public BSPrimLinkable(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size, public BSPrimLinkable(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(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical) : base(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical)
{ {
// Default linkset implementation for this prim
LinksetType = (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation;
Linkset = BSLinkset.Factory(PhysScene, this); Linkset = BSLinkset.Factory(PhysScene, this);
PhysScene.TaintedObject("BSPrimLinksetCompound.Refresh", delegate() PhysScene.TaintedObject("BSPrimLinksetCompound.Refresh", delegate()