BulletSim: parameterize selection of linkset implementation
parent
b0eccd5044
commit
1dc23b2b97
|
@ -36,21 +36,29 @@ public abstract class BSLinkset
|
||||||
{
|
{
|
||||||
// private static string LogHeader = "[BULLETSIM LINKSET]";
|
// private static string LogHeader = "[BULLETSIM LINKSET]";
|
||||||
|
|
||||||
|
public enum LinksetImplementation
|
||||||
|
{
|
||||||
|
Constraint = 0, // linkset tied together with constraints
|
||||||
|
Compound = 1, // linkset tied together as a compound object
|
||||||
|
Manual = 2 // linkset tied together manually (code moves all the pieces)
|
||||||
|
}
|
||||||
// Create the correct type of linkset for this child
|
// Create the correct type of linkset for this child
|
||||||
public static BSLinkset Factory(BSScene physScene, BSPhysObject parent)
|
public static BSLinkset Factory(BSScene physScene, BSPhysObject parent)
|
||||||
{
|
{
|
||||||
BSLinkset ret = null;
|
BSLinkset ret = null;
|
||||||
/*
|
|
||||||
if (parent.IsPhysical)
|
|
||||||
ret = new BSLinksetConstraints(physScene, parent);
|
|
||||||
else
|
|
||||||
ret = new BSLinksetManual(physScene, parent);
|
|
||||||
*/
|
|
||||||
|
|
||||||
// at the moment, there is only one
|
|
||||||
// ret = new BSLinksetConstraints(physScene, parent);
|
|
||||||
ret = new BSLinksetCompound(physScene, parent);
|
|
||||||
|
|
||||||
|
switch ((int)physScene.Params.linksetImplementation)
|
||||||
|
{
|
||||||
|
case (int)LinksetImplementation.Compound:
|
||||||
|
ret = new BSLinksetCompound(physScene, parent);
|
||||||
|
break;
|
||||||
|
case (int)LinksetImplementation.Manual:
|
||||||
|
// ret = new BSLinksetManual(physScene, parent);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ret = new BSLinksetConstraints(physScene, parent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1214,6 +1214,11 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
(s) => { return s.m_params[0].numberOfSolverIterations; },
|
(s) => { return s.m_params[0].numberOfSolverIterations; },
|
||||||
(s,p,l,v) => { s.m_params[0].numberOfSolverIterations = v; } ),
|
(s,p,l,v) => { s.m_params[0].numberOfSolverIterations = v; } ),
|
||||||
|
|
||||||
|
new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound)",
|
||||||
|
(float)BSLinkset.LinksetImplementation.Constraint,
|
||||||
|
(s,cf,p,v) => { s.m_params[0].linksetImplementation = cf.GetFloat(p,v); },
|
||||||
|
(s) => { return s.m_params[0].linksetImplementation; },
|
||||||
|
(s,p,l,v) => { s.m_params[0].linksetImplementation = v; } ),
|
||||||
new ParameterDefn("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.",
|
new ParameterDefn("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.",
|
||||||
ConfigurationParameters.numericFalse,
|
ConfigurationParameters.numericFalse,
|
||||||
(s,cf,p,v) => { s.m_params[0].linkConstraintUseFrameOffset = s.NumericBool(cf.GetBoolean(p, s.BoolNumeric(v))); },
|
(s,cf,p,v) => { s.m_params[0].linkConstraintUseFrameOffset = s.NumericBool(cf.GetBoolean(p, s.BoolNumeric(v))); },
|
||||||
|
|
|
@ -300,6 +300,7 @@ public struct ConfigurationParameters
|
||||||
public float shouldEnableFrictionCaching;
|
public float shouldEnableFrictionCaching;
|
||||||
public float numberOfSolverIterations;
|
public float numberOfSolverIterations;
|
||||||
|
|
||||||
|
public float linksetImplementation;
|
||||||
public float linkConstraintUseFrameOffset;
|
public float linkConstraintUseFrameOffset;
|
||||||
public float linkConstraintEnableTransMotor;
|
public float linkConstraintEnableTransMotor;
|
||||||
public float linkConstraintTransMotorMaxVel;
|
public float linkConstraintTransMotorMaxVel;
|
||||||
|
|
Loading…
Reference in New Issue