BulletSim: osGetPhysicsEngineName() returns wrapper and engine version information

New BulletSim config parameters for setting defaults if legacy format is needed.
This commit is contained in:
Robert Adams
2023-05-26 01:47:56 +00:00
parent 0b81b066f3
commit c90858576c
5 changed files with 44 additions and 14 deletions

View File

@@ -170,10 +170,26 @@ namespace OpenSim.Region.PhysicsModule.BulletS
m_DebugLogCallbackHandle = new BSAPICPP.DebugLogCallback(BulletLogger);
}
// Get the version of the DLL
// TODO: this doesn't work yet. Something wrong with marshaling the returned string.
// BulletEngineVersion = BulletSimAPI.GetVersion2();
// Get the version of the Physics Engine
BulletEngineVersion = "";
try
{
BulletEngineVersion = Marshal.PtrToStringAnsi(BSAPICPP.GetVersion2());
BSScene.m_log.DebugFormat("{0}: Initialize: GetVersionInfo returned {1}", BSScene.LogHeader, BulletEngineVersion);
string legacyValue = BSParam.VersionLegacyValue;
if (BulletEngineVersion.Equals(legacyValue))
{
// The old version of BulletSim returned a static string for the version.
// Convert that old static string into what is probably the correct version information.
BulletEngineVersion = BSParam.VersionLegacyReplacement;
BSScene.m_log.DebugFormat("{0}: Initialize: BulletSim version converted from legacy {1} to {2}",
BSScene.LogHeader, legacyValue, BulletEngineVersion);
}
}
catch (Exception e) {
BSScene.m_log.DebugFormat("{0}: Initialize: Could not fetch Bullet version info. Exception: {1}", BSScene.LogHeader, e);
}
// Call the unmanaged code with the buffers and other information
return new BulletWorldUnman(0, PhysicsScene, BSAPICPP.Initialize2(maxPosition, m_paramsHandle.AddrOfPinnedObject(),
@@ -1498,6 +1514,9 @@ namespace OpenSim.Region.PhysicsModule.BulletS
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value);
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern IntPtr GetVersion2();
// =====================================================================================
// Mesh, hull, shape and body creation helper routines
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]