From e9de7e7107f4a52a944a06e20db0f29d0d6d37d3 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 25 Jan 2012 14:40:38 -0800 Subject: Update BulletSim.dll with some interface changes and tuning (see opensim-libs). Change BSScene to use new interface. --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 33 ++++++++++++++++++---- .../Region/Physics/BulletSPlugin/BulletSimAPI.cs | 4 +++ 2 files changed, 31 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 7704002..e9a849c 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -72,6 +72,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters private bool m_initialized = false; + private int m_detailedStatsStep = 0; + public IMesher mesher; private float m_meshLOD; public float MeshLOD @@ -192,6 +194,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters m_meshLOD = 8f; m_sculptLOD = 32f; + m_detailedStatsStep = 0; // disabled + m_maxSubSteps = 10; m_fixedTimeStep = 1f / 60f; m_maxCollisionsPerFrame = 2048; @@ -209,8 +213,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters parms.deactivationTime = 0.2f; parms.linearSleepingThreshold = 0.8f; parms.angularSleepingThreshold = 1.0f; - parms.ccdMotionThreshold = 0.5f; // set to zero to disable - parms.ccdSweptSphereRadius = 0.2f; + parms.ccdMotionThreshold = 0.0f; // set to zero to disable + parms.ccdSweptSphereRadius = 0.0f; + parms.contactProcessingThreshold = 0.1f; parms.terrainFriction = 0.5f; parms.terrainHitFraction = 0.8f; @@ -231,6 +236,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters _meshSculptedPrim = pConfig.GetBoolean("MeshSculptedPrim", _meshSculptedPrim); _forceSimplePrimMeshing = pConfig.GetBoolean("ForceSimplePrimMeshing", _forceSimplePrimMeshing); + m_detailedStatsStep = pConfig.GetInt("DetailedStatsStep", m_detailedStatsStep); m_meshLOD = pConfig.GetFloat("MeshLevelOfDetail", m_meshLOD); m_sculptLOD = pConfig.GetFloat("SculptLevelOfDetail", m_sculptLOD); @@ -253,6 +259,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters parms.angularSleepingThreshold = pConfig.GetFloat("AngularSleepingThreshold", parms.angularSleepingThreshold); parms.ccdMotionThreshold = pConfig.GetFloat("CcdMotionThreshold", parms.ccdMotionThreshold); parms.ccdSweptSphereRadius = pConfig.GetFloat("CcdSweptSphereRadius", parms.ccdSweptSphereRadius); + parms.contactProcessingThreshold = pConfig.GetFloat("ContactProcessingThreshold", parms.contactProcessingThreshold); parms.terrainFriction = pConfig.GetFloat("TerrainFriction", parms.terrainFriction); parms.terrainHitFraction = pConfig.GetFloat("TerrainHitFraction", parms.terrainHitFraction); @@ -398,6 +405,14 @@ public class BSScene : PhysicsScene, IPhysicsParameters } } + if (m_detailedStatsStep > 0) + { + if ((m_simulationStep % m_detailedStatsStep) == 0) + { + BulletSimAPI.DumpBulletStatistics(); + } + } + // TODO: FIX THIS: fps calculation wrong. This calculation always returns about 1 in normal operation. return timeStep / (numSubSteps * m_fixedTimeStep) * 1000f; } @@ -671,6 +686,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters new PhysParameterEntry("MaxSubStep", "In simulation step, maximum number of substeps"), new PhysParameterEntry("FixedTimeStep", "In simulation step, seconds of one substep (1/60)"), new PhysParameterEntry("MaxObjectMass", "Maximum object mass (10000.01)"), + new PhysParameterEntry("DetailedStats", "Frames between outputting detailed phys stats. Zero is off"), new PhysParameterEntry("DefaultFriction", "Friction factor used on new objects"), new PhysParameterEntry("DefaultDensity", "Density for new objects" ), @@ -685,6 +701,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters new PhysParameterEntry("AngularSleepingThreshold", "Seconds to measure angular movement before considering static" ), // new PhysParameterEntry("CcdMotionThreshold", "" ), // new PhysParameterEntry("CcdSweptSphereRadius", "" ), + new PhysParameterEntry("ContactProcessingThreshold", "Distance between contacts before doing collision check" ), new PhysParameterEntry("TerrainFriction", "Factor to reduce movement against terrain surface" ), new PhysParameterEntry("TerrainHitFraction", "Distance to measure hit collisions" ), @@ -715,6 +732,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters string lparm = parm.ToLower(); switch (lparm) { + case "detailedstats": m_detailedStatsStep = (int)val; break; case "meshlod": m_meshLOD = (int)val; break; case "sculptlod": m_sculptLOD = (int)val; break; case "maxsubstep": m_maxSubSteps = (int)val; break; @@ -725,7 +743,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "defaultdensity": m_params[0].defaultDensity = val; break; case "defaultrestitution": m_params[0].defaultRestitution = val; break; case "collisionmargin": m_params[0].collisionMargin = val; break; - case "gravity": m_params[0].gravity = val; TaintedUpdateParameter(lparm, PhysParameterEntry.APPLY_TO_NONE, val); break; + case "gravity": m_params[0].gravity = val; TaintedUpdateParameter(lparm, PhysParameterEntry.APPLY_TO_NONE, val); break; case "lineardamping": UpdateParameterPrims(ref m_params[0].linearDamping, lparm, localID, val); break; case "angulardamping": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break; @@ -734,6 +752,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "angularsleepingthreshold": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break; case "ccdmotionthreshold": UpdateParameterPrims(ref m_params[0].ccdMotionThreshold, lparm, localID, val); break; case "ccdsweptsphereradius": UpdateParameterPrims(ref m_params[0].ccdSweptSphereRadius, lparm, localID, val); break; + case "contactprocessingthreshold": UpdateParameterPrims(ref m_params[0].contactProcessingThreshold, lparm, localID, val); break; // set a terrain physical feature and cause terrain to be recalculated case "terrainfriction": m_params[0].terrainFriction = val; TaintedUpdateParameter("terrain", 0, val); break; @@ -741,10 +760,10 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "terrainrestitution": m_params[0].terrainRestitution = val; TaintedUpdateParameter("terrain", 0, val); break; // set an avatar physical feature and cause avatar(s) to be recalculated case "avatarfriction": UpdateParameterAvatars(ref m_params[0].avatarFriction, "avatar", localID, val); break; - case "avatardensity": UpdateParameterAvatars(ref m_params[0].avatarDensity, "avatar", localID, val); break; + case "avatardensity": UpdateParameterAvatars(ref m_params[0].avatarDensity, "avatar", localID, val); break; case "avatarrestitution": UpdateParameterAvatars(ref m_params[0].avatarRestitution, "avatar", localID, val); break; - case "avatarcapsuleradius": UpdateParameterAvatars(ref m_params[0].avatarCapsuleRadius, "avatar", localID, val); break; - case "avatarcapsuleheight": UpdateParameterAvatars(ref m_params[0].avatarCapsuleHeight, "avatar", localID, val); break; + case "avatarcapsuleradius": UpdateParameterAvatars(ref m_params[0].avatarCapsuleRadius, "avatar", localID, val); break; + case "avatarcapsuleheight": UpdateParameterAvatars(ref m_params[0].avatarCapsuleHeight, "avatar", localID, val); break; default: ret = false; break; } @@ -816,6 +835,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters bool ret = true; switch (parm.ToLower()) { + case "detailedstats": val = (int)m_detailedStatsStep; break; case "meshlod": val = (float)m_meshLOD; break; case "sculptlod": val = (float)m_sculptLOD; break; case "maxsubstep": val = (float)m_maxSubSteps; break; @@ -835,6 +855,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "angularsleepingthreshold": val = m_params[0].angularDamping; break; case "ccdmotionthreshold": val = m_params[0].ccdMotionThreshold; break; case "ccdsweptsphereradius": val = m_params[0].ccdSweptSphereRadius; break; + case "contactprocessingthreshold": val = m_params[0].contactProcessingThreshold; break; case "terrainfriction": val = m_params[0].terrainFriction; break; case "terrainhitfraction": val = m_params[0].terrainHitFraction; break; diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs index a610c8d..d12bd7d 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs @@ -122,6 +122,7 @@ public struct ConfigurationParameters public float angularSleepingThreshold; public float ccdMotionThreshold; public float ccdSweptSphereRadius; + public float contactProcessingThreshold; public float terrainFriction; public float terrainHitFraction; @@ -248,6 +249,9 @@ public static extern RaycastHit RayTest(uint worldID, uint id, Vector3 from, Vec [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] public static extern Vector3 RecoverFromPenetration(uint worldID, uint id); +[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] +public static extern void DumpBulletStatistics(); + // Log a debug message [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg); -- cgit v1.1 From d0536256635008bdeb1a5ded1b06c5f84f02975e Mon Sep 17 00:00:00 2001 From: nebadon Date: Wed, 25 Jan 2012 15:59:07 -0700 Subject: Update save oar and save iar help responses to reflect new -h|--home switches which replace -p|--profile ie: "save oar --home=http://hg.osgrid.org:80 region.oar" --- OpenSim/Region/Application/OpenSim.cs | 4 ++-- .../CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 832d93c..8683476 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -291,10 +291,10 @@ namespace OpenSim m_console.Commands.AddCommand("region", false, "save oar", //"save oar [-v|--version=] [-p|--profile=] []", - "save oar [-p|--profile=] [--noassets] [--perm=] []", + "save oar [-h|--home=] [--noassets] [--perm=] []", "Save a region's data to an OAR archive.", // "-v|--version= generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine - "-p|--profile= adds the url of the profile service to the saved user information." + Environment.NewLine + "-h|--home= adds the url of the profile service to the saved user information." + Environment.NewLine + "--noassets stops assets being saved to the OAR." + Environment.NewLine + "--perm stops objects with insufficient permissions from being saved to the OAR." + Environment.NewLine + " can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer" + Environment.NewLine diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index e0b02aa..150d913 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -122,12 +122,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver scene.AddCommand( this, "save iar", - "save iar [--p|-profile=] [--noassets] [] [--v|-verbose]", + "save iar [-h|--home=] [--noassets] [] [--v|-verbose]", "Save user inventory archive (IAR).", " is the user's first name." + Environment.NewLine + " is the user's last name." + Environment.NewLine + " is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine - + "-p|--profile= adds the url of the profile service to the saved user information." + Environment.NewLine + + "-h|--home= adds the url of the profile service to the saved user information." + Environment.NewLine + "-c|--creators preserves information about foreign creators." + Environment.NewLine + "-v|--verbose extra debug messages." + Environment.NewLine + "--noassets stops assets being saved to the IAR." -- cgit v1.1