BulletSim: add parameter to have Bullet output performance statistics
every so many frames. Default to off.0.7.5-pf-bulletsim
parent
b14b65ea95
commit
aa236b2020
|
@ -970,7 +970,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
||||||
p.linkConstraintERP = o[0].XlinkConstraintERP;
|
p.linkConstraintERP = o[0].XlinkConstraintERP;
|
||||||
p.linkConstraintCFM = o[0].XlinkConstraintCFM;
|
p.linkConstraintCFM = o[0].XlinkConstraintCFM;
|
||||||
p.linkConstraintSolverIterations = o[0].XlinkConstraintSolverIterations;
|
p.linkConstraintSolverIterations = o[0].XlinkConstraintSolverIterations;
|
||||||
p.physicsLoggingFrames = o[0].physicsLoggingFrames;
|
p.physicsLoggingFrames = o[0].XphysicsLoggingFrames;
|
||||||
DefaultCollisionConstructionInfo ccci = new DefaultCollisionConstructionInfo();
|
DefaultCollisionConstructionInfo ccci = new DefaultCollisionConstructionInfo();
|
||||||
|
|
||||||
DefaultCollisionConfiguration cci = new DefaultCollisionConfiguration();
|
DefaultCollisionConfiguration cci = new DefaultCollisionConfiguration();
|
||||||
|
|
|
@ -198,7 +198,7 @@ public struct ConfigurationParameters
|
||||||
public float XlinkConstraintCFM;
|
public float XlinkConstraintCFM;
|
||||||
public float XlinkConstraintSolverIterations;
|
public float XlinkConstraintSolverIterations;
|
||||||
|
|
||||||
public float physicsLoggingFrames;
|
public float XphysicsLoggingFrames;
|
||||||
|
|
||||||
public const float numericTrue = 1f;
|
public const float numericTrue = 1f;
|
||||||
public const float numericFalse = 0f;
|
public const float numericFalse = 0f;
|
||||||
|
@ -415,7 +415,7 @@ public abstract void SetForceUpdateAllAabbs(BulletWorld world, bool force);
|
||||||
|
|
||||||
// =====================================================================================
|
// =====================================================================================
|
||||||
// btDynamicsWorld entries
|
// btDynamicsWorld entries
|
||||||
// public abstract bool AddObjectToWorld(BulletWorld world, BulletBody obj, Vector3 pos, Quaternion rot);
|
// public abstract bool AddObjectToWorld(BulletWorld world, BulletBody obj, Vector3 pos, Quaternion rot);
|
||||||
public abstract bool AddObjectToWorld(BulletWorld world, BulletBody obj);
|
public abstract bool AddObjectToWorld(BulletWorld world, BulletBody obj);
|
||||||
|
|
||||||
public abstract bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj);
|
public abstract bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj);
|
||||||
|
|
|
@ -492,11 +492,11 @@ public static class BSParam
|
||||||
(s) => { return LinkConstraintSolverIterations; },
|
(s) => { return LinkConstraintSolverIterations; },
|
||||||
(s,p,l,v) => { LinkConstraintSolverIterations = v; } ),
|
(s,p,l,v) => { LinkConstraintSolverIterations = v; } ),
|
||||||
|
|
||||||
new ParameterDefn("LogPhysicsStatisticsFrames", "Frames between outputting detailed phys stats. (0 is off)",
|
new ParameterDefn("PhysicsMetricFrames", "Frames between outputting detailed phys metrics. (0 is off)",
|
||||||
0f,
|
0f,
|
||||||
(s,cf,p,v) => { s.UnmanagedParams[0].physicsLoggingFrames = cf.GetInt(p, (int)v); },
|
(s,cf,p,v) => { s.PhysicsMetricDumpFrames = cf.GetFloat(p, (int)v); },
|
||||||
(s) => { return (float)s.UnmanagedParams[0].physicsLoggingFrames; },
|
(s) => { return (float)s.PhysicsMetricDumpFrames; },
|
||||||
(s,p,l,v) => { s.UnmanagedParams[0].physicsLoggingFrames = (int)v; } ),
|
(s,p,l,v) => { s.PhysicsMetricDumpFrames = (int)v; } ),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Convert a boolean to our numeric true and false values
|
// Convert a boolean to our numeric true and false values
|
||||||
|
|
|
@ -161,6 +161,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
private int m_physicsLoggingFileMinutes;
|
private int m_physicsLoggingFileMinutes;
|
||||||
private bool m_physicsLoggingDoFlush;
|
private bool m_physicsLoggingDoFlush;
|
||||||
private bool m_physicsPhysicalDumpEnabled;
|
private bool m_physicsPhysicalDumpEnabled;
|
||||||
|
public float PhysicsMetricDumpFrames { get; set; }
|
||||||
// 'true' of the vehicle code is to log lots of details
|
// 'true' of the vehicle code is to log lots of details
|
||||||
public bool VehicleLoggingEnabled { get; private set; }
|
public bool VehicleLoggingEnabled { get; private set; }
|
||||||
public bool VehiclePhysicalLoggingEnabled { get; private set; }
|
public bool VehiclePhysicalLoggingEnabled { get; private set; }
|
||||||
|
@ -526,6 +527,9 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
collidersCount = 0;
|
collidersCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((m_simulationStep % PhysicsMetricDumpFrames) == 0)
|
||||||
|
PE.DumpPhysicsStatistics(World);
|
||||||
|
|
||||||
// Get a value for 'now' so all the collision and update routines don't have to get their own.
|
// Get a value for 'now' so all the collision and update routines don't have to get their own.
|
||||||
SimulationNowTime = Util.EnvironmentTickCount();
|
SimulationNowTime = Util.EnvironmentTickCount();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue