mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 19:36:07 +08:00
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:
@@ -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]
|
||||
|
||||
@@ -150,6 +150,7 @@ namespace OpenSim.Region.PhysicsModule.BulletS
|
||||
public BSAPIXNA(string paramName, BSScene physScene)
|
||||
{
|
||||
PhysicsScene = physScene;
|
||||
BulletEngineVersion = "XNA";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -349,7 +349,7 @@ namespace OpenSim.Region.PhysicsModule.BulletS
|
||||
public abstract void Shutdown(BulletWorld sim);
|
||||
|
||||
public abstract bool PushUpdate(BulletBody obj);
|
||||
|
||||
|
||||
// =====================================================================================
|
||||
// Mesh, hull, shape and body creation helper routines
|
||||
public abstract BulletShape CreateMeshShape(BulletWorld world,
|
||||
|
||||
@@ -237,6 +237,11 @@ namespace OpenSim.Region.PhysicsModule.BulletS
|
||||
public static float PID_D { get; private set; } // derivative
|
||||
public static float PID_P { get; private set; } // proportional
|
||||
|
||||
// The reported version from the underylying DLL/SO could be the legacy value
|
||||
// If the legacy value, this other value is returned
|
||||
public static string VersionLegacyValue { get; private set; }
|
||||
public static string VersionLegacyReplacement { get; private set; }
|
||||
|
||||
public static float DebugNumber { get; private set; } // A console setable number used for debugging
|
||||
|
||||
// Various constants that come from that other virtual world that shall not be named.
|
||||
@@ -849,6 +854,11 @@ namespace OpenSim.Region.PhysicsModule.BulletS
|
||||
0f,
|
||||
(s) => { return 0f; },
|
||||
(s,v) => { BSParam.ResetConstraintSolverTainted(s, v); } ),
|
||||
|
||||
new ParameterDefn<string>("VersionLegacyValue", "Version string returned by legacy BulletSim binaries",
|
||||
"v0003" ),
|
||||
new ParameterDefn<string>("VersionLegacyReplacement", "Value used to replace legacy version number",
|
||||
"1.0,2.84" ),
|
||||
};
|
||||
|
||||
// Convert a boolean to our numeric true and false values
|
||||
|
||||
@@ -55,8 +55,6 @@ namespace OpenSim.Region.PhysicsModule.BulletS
|
||||
// The name of the region we're working for.
|
||||
public string RegionName { get; private set; }
|
||||
|
||||
public string BulletSimVersion = "?";
|
||||
|
||||
// The handle to the underlying managed or unmanaged version of Bullet being used.
|
||||
public string BulletEngineName { get; private set; }
|
||||
public BSAPITemplate PE;
|
||||
@@ -213,11 +211,6 @@ namespace OpenSim.Region.PhysicsModule.BulletS
|
||||
get { return "BulletSim"; }
|
||||
}
|
||||
|
||||
public string Version
|
||||
{
|
||||
get { return "1.0"; }
|
||||
}
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
get { return null; }
|
||||
@@ -255,10 +248,8 @@ namespace OpenSim.Region.PhysicsModule.BulletS
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
EngineType = Name;
|
||||
RegionName = scene.RegionInfo.RegionName;
|
||||
PhysicsSceneName = EngineType + "/" + RegionName;
|
||||
EngineName = Name + " " + Version;
|
||||
PhysicsSceneName = Name + "/" + RegionName;
|
||||
|
||||
scene.RegisterModuleInterface<PhysicsScene>(this);
|
||||
Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ);
|
||||
@@ -268,6 +259,15 @@ namespace OpenSim.Region.PhysicsModule.BulletS
|
||||
(scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[scene.RegionInfo.RegionSizeX * scene.RegionInfo.RegionSizeY]),
|
||||
(float)scene.RegionInfo.RegionSettings.WaterHeight);
|
||||
|
||||
EngineName = Name + " " + PE.BulletEngineVersion;
|
||||
EngineType = Name;
|
||||
// the above usually sets:
|
||||
// EngineType = "BulletSim"
|
||||
// EngineName = "BulletSim 1.1,3.25" with the version being "BulletsimWrapperVersion,BulletPhysicsEngineVersion"
|
||||
// "EngineName" is returned by the LSL function "osGetPhysicsEngineName"
|
||||
// "EngineType" is returned by the LSL function "osGetPhysicsEngineType"
|
||||
// Note that there is also "BulletEngineName" which comes from the parameter files and
|
||||
// specifies which Bullet DLL to load.
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
|
||||
Reference in New Issue
Block a user