vh: Update physics parameter get/set to string based from old float

value based.
0.7.5-pf-bulletsim
Robert Adams 2013-05-09 22:16:32 -07:00
parent 43f3459c3a
commit d48c9b433a
3 changed files with 62 additions and 19 deletions

View File

@ -146,7 +146,7 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters
{ {
foreach (PhysParameterEntry ppe in physScene.GetParameterList()) foreach (PhysParameterEntry ppe in physScene.GetParameterList())
{ {
float val = 0.0f; string val = string.Empty;
if (physScene.GetPhysicsParameter(ppe.name, out val)) if (physScene.GetPhysicsParameter(ppe.name, out val))
{ {
WriteOut(" {0}/{1} = {2}", scene.RegionInfo.RegionName, ppe.name, val); WriteOut(" {0}/{1} = {2}", scene.RegionInfo.RegionName, ppe.name, val);
@ -159,7 +159,7 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters
} }
else else
{ {
float val = 0.0f; string val = string.Empty;
if (physScene.GetPhysicsParameter(parm, out val)) if (physScene.GetPhysicsParameter(parm, out val))
{ {
WriteOut(" {0}/{1} = {2}", scene.RegionInfo.RegionName, parm, val); WriteOut(" {0}/{1} = {2}", scene.RegionInfo.RegionName, parm, val);
@ -185,21 +185,12 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters
return; return;
} }
string parm = "xxx"; string parm = "xxx";
float val = 0f; string valparm = String.Empty;
uint localID = (uint)PhysParameterEntry.APPLY_TO_NONE; // set default value uint localID = (uint)PhysParameterEntry.APPLY_TO_NONE; // set default value
try try
{ {
parm = cmdparms[2]; parm = cmdparms[2];
string valparm = cmdparms[3].ToLower(); valparm = cmdparms[3].ToLower();
if (valparm == "true")
val = PhysParameterEntry.NUMERIC_TRUE;
else
{
if (valparm == "false")
val = PhysParameterEntry.NUMERIC_FALSE;
else
val = float.Parse(valparm, Culture.NumberFormatInfo);
}
if (cmdparms.Length > 4) if (cmdparms.Length > 4)
{ {
if (cmdparms[4].ToLower() == "all") if (cmdparms[4].ToLower() == "all")
@ -224,7 +215,7 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters
IPhysicsParameters physScene = scene.PhysicsScene as IPhysicsParameters; IPhysicsParameters physScene = scene.PhysicsScene as IPhysicsParameters;
if (physScene != null) if (physScene != null)
{ {
if (!physScene.SetPhysicsParameter(parm, val, localID)) if (!physScene.SetPhysicsParameter(parm, valparm, localID))
{ {
WriteError("Failed set of parameter '{0}' for region '{1}'", parm, scene.RegionInfo.RegionName); WriteError("Failed set of parameter '{0}' for region '{1}'", parm, scene.RegionInfo.RegionName);
} }

View File

@ -60,14 +60,14 @@ namespace OpenSim.Region.Physics.Manager
// Set parameter on a specific or all instances. // Set parameter on a specific or all instances.
// Return 'false' if not able to set the parameter. // Return 'false' if not able to set the parameter.
bool SetPhysicsParameter(string parm, float value, uint localID); bool SetPhysicsParameter(string parm, string value, uint localID);
// Get parameter. // Get parameter.
// Return 'false' if not able to get the parameter. // Return 'false' if not able to get the parameter.
bool GetPhysicsParameter(string parm, out float value); bool GetPhysicsParameter(string parm, out string value);
// Get parameter from a particular object // Get parameter from a particular object
// TODO: // TODO:
// bool GetPhysicsParameter(string parm, out float value, uint localID); // bool GetPhysicsParameter(string parm, out string value, uint localID);
} }
} }

View File

@ -43,6 +43,35 @@ namespace OpenSim.Region.Physics.Manager
public delegate void JointDeactivated(PhysicsJoint joint); public delegate void JointDeactivated(PhysicsJoint joint);
public delegate void JointErrorMessage(PhysicsJoint joint, string message); // this refers to an "error message due to a problem", not "amount of joint constraint violation" public delegate void JointErrorMessage(PhysicsJoint joint, string message); // this refers to an "error message due to a problem", not "amount of joint constraint violation"
public enum RayFilterFlags : ushort
{
// the flags
water = 0x01,
land = 0x02,
agent = 0x04,
nonphysical = 0x08,
physical = 0x10,
phantom = 0x20,
volumedtc = 0x40,
// ray cast colision control (may only work for meshs)
ContactsUnImportant = 0x2000,
BackFaceCull = 0x4000,
ClosestHit = 0x8000,
// some combinations
LSLPhantom = phantom | volumedtc,
PrimsNonPhantom = nonphysical | physical,
PrimsNonPhantomAgents = nonphysical | physical | agent,
AllPrims = nonphysical | phantom | volumedtc | physical,
AllButLand = agent | nonphysical | physical | phantom | volumedtc,
ClosestAndBackCull = ClosestHit | BackFaceCull,
All = 0x3f
}
public delegate void RequestAssetDelegate(UUID assetID, AssetReceivedDelegate callback); public delegate void RequestAssetDelegate(UUID assetID, AssetReceivedDelegate callback);
public delegate void AssetReceivedDelegate(AssetBase asset); public delegate void AssetReceivedDelegate(AssetBase asset);
@ -62,13 +91,20 @@ namespace OpenSim.Region.Physics.Manager
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// Name of this scene. Useful in debug messages to distinguish one OdeScene instance from another. /// A unique identifying string for this instance of the physics engine.
/// Useful in debug messages to distinguish one OdeScene instance from another.
/// Usually set to include the region name that the physics engine is acting for.
/// </summary> /// </summary>
public string Name { get; protected set; } public string Name { get; protected set; }
/// <summary>
/// A string identifying the family of this physics engine. Most common values returned
/// are "OpenDynamicsEngine" and "BulletSim" but others are possible.
/// </summary>
public string EngineType { get; protected set; }
// The only thing that should register for this event is the SceneGraph // The only thing that should register for this event is the SceneGraph
// Anything else could cause problems. // Anything else could cause problems.
public event physicsCrash OnPhysicsCrash; public event physicsCrash OnPhysicsCrash;
public static PhysicsScene Null public static PhysicsScene Null
@ -130,6 +166,12 @@ namespace OpenSim.Region.Physics.Manager
public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical, uint localid); Vector3 size, Quaternion rotation, bool isPhysical, uint localid);
public virtual PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapetype, uint localid)
{
return AddPrimShape(primName, pbs, position, size, rotation, isPhysical, localid);
}
public virtual float TimeDilation public virtual float TimeDilation
{ {
get { return 1.0f; } get { return 1.0f; }
@ -279,5 +321,15 @@ namespace OpenSim.Region.Physics.Manager
{ {
return new List<ContactResult>(); return new List<ContactResult>();
} }
public virtual object RaycastWorld(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter)
{
return null;
}
public virtual bool SupportsRaycastWorldFiltered()
{
return false;
}
} }
} }