diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 705 |
1 files changed, 348 insertions, 357 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 329169f..dc57b67 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -37,6 +37,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
37 | { | 37 | { |
38 | public static class BSParam | 38 | public static class BSParam |
39 | { | 39 | { |
40 | private static string LogHeader = "[BULLETSIM PARAMETERS]"; | ||
41 | |||
40 | // Level of Detail values kept as float because that's what the Meshmerizer wants | 42 | // Level of Detail values kept as float because that's what the Meshmerizer wants |
41 | public static float MeshLOD { get; private set; } | 43 | public static float MeshLOD { get; private set; } |
42 | public static float MeshCircularLOD { get; private set; } | 44 | public static float MeshCircularLOD { get; private set; } |
@@ -44,6 +46,8 @@ public static class BSParam | |||
44 | public static float MeshMegaPrimThreshold { get; private set; } | 46 | public static float MeshMegaPrimThreshold { get; private set; } |
45 | public static float SculptLOD { get; private set; } | 47 | public static float SculptLOD { get; private set; } |
46 | 48 | ||
49 | public static int CrossingFailuresBeforeOutOfBounds { get; private set; } | ||
50 | |||
47 | public static float MinimumObjectMass { get; private set; } | 51 | public static float MinimumObjectMass { get; private set; } |
48 | public static float MaximumObjectMass { get; private set; } | 52 | public static float MaximumObjectMass { get; private set; } |
49 | public static float MaxLinearVelocity { get; private set; } | 53 | public static float MaxLinearVelocity { get; private set; } |
@@ -71,24 +75,23 @@ public static class BSParam | |||
71 | public static float TerrainRestitution { get; private set; } | 75 | public static float TerrainRestitution { get; private set; } |
72 | public static float TerrainCollisionMargin { get; private set; } | 76 | public static float TerrainCollisionMargin { get; private set; } |
73 | 77 | ||
74 | public static float DefaultFriction; | 78 | public static float DefaultFriction { get; private set; } |
75 | public static float DefaultDensity; | 79 | public static float DefaultDensity { get; private set; } |
76 | public static float DefaultRestitution; | 80 | public static float DefaultRestitution { get; private set; } |
77 | public static float CollisionMargin; | 81 | public static float CollisionMargin { get; private set; } |
78 | public static float Gravity; | 82 | public static float Gravity { get; private set; } |
79 | 83 | ||
80 | // Physics Engine operation | 84 | // Physics Engine operation |
81 | public static float MaxPersistantManifoldPoolSize; | 85 | public static float MaxPersistantManifoldPoolSize { get; private set; } |
82 | public static float MaxCollisionAlgorithmPoolSize; | 86 | public static float MaxCollisionAlgorithmPoolSize { get; private set; } |
83 | public static float ShouldDisableContactPoolDynamicAllocation; | 87 | public static bool ShouldDisableContactPoolDynamicAllocation { get; private set; } |
84 | public static float ShouldForceUpdateAllAabbs; | 88 | public static bool ShouldForceUpdateAllAabbs { get; private set; } |
85 | public static float ShouldRandomizeSolverOrder; | 89 | public static bool ShouldRandomizeSolverOrder { get; private set; } |
86 | public static float ShouldSplitSimulationIslands; | 90 | public static bool ShouldSplitSimulationIslands { get; private set; } |
87 | public static float ShouldEnableFrictionCaching; | 91 | public static bool ShouldEnableFrictionCaching { get; private set; } |
88 | public static float NumberOfSolverIterations; | 92 | public static float NumberOfSolverIterations { get; private set; } |
89 | public static bool UseSingleSidedMeshes { get { return UseSingleSidedMeshesF != ConfigurationParameters.numericFalse; } } | 93 | public static bool UseSingleSidedMeshes { get; private set; } |
90 | public static float UseSingleSidedMeshesF; | 94 | public static float GlobalContactBreakingThreshold { get; private set; } |
91 | public static float GlobalContactBreakingThreshold; | ||
92 | 95 | ||
93 | // Avatar parameters | 96 | // Avatar parameters |
94 | public static float AvatarFriction { get; private set; } | 97 | public static float AvatarFriction { get; private set; } |
@@ -112,16 +115,15 @@ public static class BSParam | |||
112 | public static float VehicleAngularDamping { get; private set; } | 115 | public static float VehicleAngularDamping { get; private set; } |
113 | public static float VehicleFriction { get; private set; } | 116 | public static float VehicleFriction { get; private set; } |
114 | public static float VehicleRestitution { get; private set; } | 117 | public static float VehicleRestitution { get; private set; } |
115 | public static float VehicleLinearFactor { get; private set; } | 118 | public static Vector3 VehicleLinearFactor { get; private set; } |
116 | public static Vector3 VehicleLinearFactorV { get; private set; } | 119 | public static Vector3 VehicleAngularFactor { get; private set; } |
117 | public static float VehicleAngularFactor { get; private set; } | ||
118 | public static Vector3 VehicleAngularFactorV { get; private set; } | ||
119 | public static float VehicleGroundGravityFudge { get; private set; } | 120 | public static float VehicleGroundGravityFudge { get; private set; } |
120 | public static float VehicleDebuggingEnabled { get; private set; } | 121 | public static bool VehicleDebuggingEnabled { get; private set; } |
121 | 122 | ||
123 | // Linkset implementation parameters | ||
122 | public static float LinksetImplementation { get; private set; } | 124 | public static float LinksetImplementation { get; private set; } |
123 | public static float LinkConstraintUseFrameOffset { get; private set; } | 125 | public static bool LinkConstraintUseFrameOffset { get; private set; } |
124 | public static float LinkConstraintEnableTransMotor { get; private set; } | 126 | public static bool LinkConstraintEnableTransMotor { get; private set; } |
125 | public static float LinkConstraintTransMotorMaxVel { get; private set; } | 127 | public static float LinkConstraintTransMotorMaxVel { get; private set; } |
126 | public static float LinkConstraintTransMotorMaxForce { get; private set; } | 128 | public static float LinkConstraintTransMotorMaxForce { get; private set; } |
127 | public static float LinkConstraintERP { get; private set; } | 129 | public static float LinkConstraintERP { get; private set; } |
@@ -141,40 +143,106 @@ public static class BSParam | |||
141 | public const float MinRestitution = 0f; | 143 | public const float MinRestitution = 0f; |
142 | public const float MaxRestitution = 1f; | 144 | public const float MaxRestitution = 1f; |
143 | 145 | ||
144 | // =========================================================================== | 146 | // ===================================================================================== |
145 | public delegate void ParamUser(BSScene scene, IConfig conf, string paramName, float val); | 147 | // ===================================================================================== |
146 | public delegate float ParamGet(BSScene scene); | ||
147 | public delegate void ParamSet(BSScene scene, string paramName, uint localID, float val); | ||
148 | public delegate void SetOnObject(BSScene scene, BSPhysObject obj, float val); | ||
149 | 148 | ||
150 | public struct ParameterDefn | 149 | // Base parameter definition that gets and sets parameter values via a string |
150 | public abstract class ParameterDefnBase | ||
151 | { | 151 | { |
152 | public string name; // string name of the parameter | 152 | public string name; // string name of the parameter |
153 | public string desc; // a short description of what the parameter means | 153 | public string desc; // a short description of what the parameter means |
154 | public float defaultValue; // default value if not specified anywhere else | 154 | public ParameterDefnBase(string pName, string pDesc) |
155 | public ParamUser userParam; // get the value from the configuration file | 155 | { |
156 | public ParamGet getter; // return the current value stored for this parameter | 156 | name = pName; |
157 | public ParamSet setter; // set the current value for this parameter | 157 | desc = pDesc; |
158 | public SetOnObject onObject; // set the value on an object in the physical domain | 158 | } |
159 | public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s) | 159 | // Set the parameter value to the default |
160 | public abstract void AssignDefault(BSScene s); | ||
161 | // Get the value as a string | ||
162 | public abstract string GetValue(BSScene s); | ||
163 | // Set the value to this string value | ||
164 | public abstract void SetValue(BSScene s, string valAsString); | ||
165 | // set the value on a particular object (usually sets in physics engine) | ||
166 | public abstract void SetOnObject(BSScene s, BSPhysObject obj); | ||
167 | public abstract bool HasSetOnObject { get; } | ||
168 | } | ||
169 | |||
170 | // Specific parameter definition for a parameter of a specific type. | ||
171 | public delegate T PGetValue<T>(BSScene s); | ||
172 | public delegate void PSetValue<T>(BSScene s, T val); | ||
173 | public delegate void PSetOnObject<T>(BSScene scene, BSPhysObject obj); | ||
174 | public sealed class ParameterDefn<T> : ParameterDefnBase | ||
175 | { | ||
176 | T defaultValue; | ||
177 | PSetValue<T> setter; | ||
178 | PGetValue<T> getter; | ||
179 | PSetOnObject<T> objectSet; | ||
180 | public ParameterDefn(string pName, string pDesc, T pDefault, PGetValue<T> pGetter, PSetValue<T> pSetter) | ||
181 | : base(pName, pDesc) | ||
160 | { | 182 | { |
161 | name = n; | 183 | defaultValue = pDefault; |
162 | desc = d; | 184 | setter = pSetter; |
163 | defaultValue = v; | 185 | getter = pGetter; |
164 | userParam = u; | 186 | objectSet = null; |
165 | getter = g; | ||
166 | setter = s; | ||
167 | onObject = null; | ||
168 | } | 187 | } |
169 | public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s, SetOnObject o) | 188 | public ParameterDefn(string pName, string pDesc, T pDefault, PGetValue<T> pGetter, PSetValue<T> pSetter, PSetOnObject<T> pObjSetter) |
189 | : base(pName, pDesc) | ||
170 | { | 190 | { |
171 | name = n; | 191 | defaultValue = pDefault; |
172 | desc = d; | 192 | setter = pSetter; |
173 | defaultValue = v; | 193 | getter = pGetter; |
174 | userParam = u; | 194 | objectSet = pObjSetter; |
175 | getter = g; | 195 | } |
176 | setter = s; | 196 | public override void AssignDefault(BSScene s) |
177 | onObject = o; | 197 | { |
198 | setter(s, defaultValue); | ||
199 | } | ||
200 | public override string GetValue(BSScene s) | ||
201 | { | ||
202 | return String.Format("{0}", getter(s)); | ||
203 | } | ||
204 | public override void SetValue(BSScene s, string valAsString) | ||
205 | { | ||
206 | // Get the generic type of the setter | ||
207 | Type genericType = setter.GetType().GetGenericArguments()[0]; | ||
208 | // Find the 'Parse' method on that type | ||
209 | System.Reflection.MethodInfo parser = null; | ||
210 | try | ||
211 | { | ||
212 | parser = genericType.GetMethod("Parse", new Type[] { typeof(String) } ); | ||
213 | } | ||
214 | catch (Exception e) | ||
215 | { | ||
216 | s.Logger.ErrorFormat("{0} Exception getting parser for type '{1}': {2}", LogHeader, genericType, e); | ||
217 | parser = null; | ||
218 | } | ||
219 | if (parser != null) | ||
220 | { | ||
221 | // Parse the input string | ||
222 | try | ||
223 | { | ||
224 | T setValue = (T)parser.Invoke(genericType, new Object[] { valAsString }); | ||
225 | setter(s, setValue); | ||
226 | // s.Logger.DebugFormat("{0} Parameter {1} = {2}", LogHeader, name, setValue); | ||
227 | } | ||
228 | catch | ||
229 | { | ||
230 | s.Logger.ErrorFormat("{0} Failed parsing parameter value '{1}' as type '{2}'", LogHeader, valAsString, genericType); | ||
231 | } | ||
232 | } | ||
233 | else | ||
234 | { | ||
235 | s.Logger.ErrorFormat("{0} Could not find parameter parser for type '{1}'", LogHeader, genericType); | ||
236 | } | ||
237 | } | ||
238 | public override bool HasSetOnObject | ||
239 | { | ||
240 | get { return objectSet != null; } | ||
241 | } | ||
242 | public override void SetOnObject(BSScene s, BSPhysObject obj) | ||
243 | { | ||
244 | if (objectSet != null) | ||
245 | objectSet(s, obj); | ||
178 | } | 246 | } |
179 | } | 247 | } |
180 | 248 | ||
@@ -184,462 +252,380 @@ public static class BSParam | |||
184 | // location somewhere in the program and make an entry in this table with the | 252 | // location somewhere in the program and make an entry in this table with the |
185 | // getters and setters. | 253 | // getters and setters. |
186 | // It is easiest to find an existing definition and copy it. | 254 | // It is easiest to find an existing definition and copy it. |
187 | // Parameter values are floats. Booleans are converted to a floating value. | ||
188 | // | 255 | // |
189 | // A ParameterDefn() takes the following parameters: | 256 | // A ParameterDefn<T>() takes the following parameters: |
190 | // -- the text name of the parameter. This is used for console input and ini file. | 257 | // -- the text name of the parameter. This is used for console input and ini file. |
191 | // -- a short text description of the parameter. This shows up in the console listing. | 258 | // -- a short text description of the parameter. This shows up in the console listing. |
192 | // -- a default value (float) | 259 | // -- a default value |
193 | // -- a delegate for fetching the parameter from the ini file. | 260 | // -- a delegate for getting the value |
194 | // Should handle fetching the right type from the ini file and converting it. | 261 | // -- a delegate for setting the value |
195 | // -- a delegate for getting the value as a float | ||
196 | // -- a delegate for setting the value from a float | ||
197 | // -- an optional delegate to update the value in the world. Most often used to | 262 | // -- an optional delegate to update the value in the world. Most often used to |
198 | // push the new value to an in-world object. | 263 | // push the new value to an in-world object. |
199 | // | 264 | // |
200 | // The single letter parameters for the delegates are: | 265 | // The single letter parameters for the delegates are: |
201 | // s = BSScene | 266 | // s = BSScene |
202 | // o = BSPhysObject | 267 | // o = BSPhysObject |
203 | // p = string parameter name | ||
204 | // l = localID of referenced object | ||
205 | // v = value (float) | 268 | // v = value (float) |
206 | // cf = parameter configuration class (for fetching values from ini file) | 269 | private static ParameterDefnBase[] ParameterDefinitions = |
207 | private static ParameterDefn[] ParameterDefinitions = | ||
208 | { | 270 | { |
209 | new ParameterDefn("MeshSculptedPrim", "Whether to create meshes for sculpties", | 271 | new ParameterDefn<bool>("MeshSculptedPrim", "Whether to create meshes for sculpties", |
210 | ConfigurationParameters.numericTrue, | 272 | true, |
211 | (s,cf,p,v) => { ShouldMeshSculptedPrim = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, | 273 | (s) => { return ShouldMeshSculptedPrim; }, |
212 | (s) => { return BSParam.NumericBool(ShouldMeshSculptedPrim); }, | 274 | (s,v) => { ShouldMeshSculptedPrim = v; } ), |
213 | (s,p,l,v) => { ShouldMeshSculptedPrim = BSParam.BoolNumeric(v); } ), | 275 | new ParameterDefn<bool>("ForceSimplePrimMeshing", "If true, only use primitive meshes for objects", |
214 | new ParameterDefn("ForceSimplePrimMeshing", "If true, only use primitive meshes for objects", | 276 | false, |
215 | ConfigurationParameters.numericFalse, | 277 | (s) => { return ShouldForceSimplePrimMeshing; }, |
216 | (s,cf,p,v) => { ShouldForceSimplePrimMeshing = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, | 278 | (s,v) => { ShouldForceSimplePrimMeshing = v; } ), |
217 | (s) => { return BSParam.NumericBool(ShouldForceSimplePrimMeshing); }, | 279 | new ParameterDefn<bool>("UseHullsForPhysicalObjects", "If true, create hulls for physical objects", |
218 | (s,p,l,v) => { ShouldForceSimplePrimMeshing = BSParam.BoolNumeric(v); } ), | 280 | true, |
219 | new ParameterDefn("UseHullsForPhysicalObjects", "If true, create hulls for physical objects", | 281 | (s) => { return ShouldUseHullsForPhysicalObjects; }, |
220 | ConfigurationParameters.numericTrue, | 282 | (s,v) => { ShouldUseHullsForPhysicalObjects = v; } ), |
221 | (s,cf,p,v) => { ShouldUseHullsForPhysicalObjects = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, | 283 | new ParameterDefn<bool>("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes", |
222 | (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); }, | 284 | true, |
223 | (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), | 285 | (s) => { return ShouldRemoveZeroWidthTriangles; }, |
224 | new ParameterDefn("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes", | 286 | (s,v) => { ShouldRemoveZeroWidthTriangles = v; } ), |
225 | ConfigurationParameters.numericTrue, | 287 | |
226 | (s,cf,p,v) => { ShouldRemoveZeroWidthTriangles = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, | 288 | new ParameterDefn<int>("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions", |
227 | (s) => { return BSParam.NumericBool(ShouldRemoveZeroWidthTriangles); }, | 289 | 5, |
228 | (s,p,l,v) => { ShouldRemoveZeroWidthTriangles = BSParam.BoolNumeric(v); } ), | 290 | (s) => { return CrossingFailuresBeforeOutOfBounds; }, |
229 | 291 | (s,v) => { CrossingFailuresBeforeOutOfBounds = v; } ), | |
230 | new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", | 292 | |
293 | new ParameterDefn<float>("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", | ||
231 | 32f, | 294 | 32f, |
232 | (s,cf,p,v) => { MeshLOD = (float)cf.GetInt(p, (int)v); }, | ||
233 | (s) => { return MeshLOD; }, | 295 | (s) => { return MeshLOD; }, |
234 | (s,p,l,v) => { MeshLOD = v; } ), | 296 | (s,v) => { MeshLOD = v; } ), |
235 | new ParameterDefn("MeshLevelOfDetailCircular", "Level of detail for prims with circular cuts or shapes", | 297 | new ParameterDefn<float>("MeshLevelOfDetailCircular", "Level of detail for prims with circular cuts or shapes", |
236 | 32f, | 298 | 32f, |
237 | (s,cf,p,v) => { MeshCircularLOD = (float)cf.GetInt(p, (int)v); }, | ||
238 | (s) => { return MeshCircularLOD; }, | 299 | (s) => { return MeshCircularLOD; }, |
239 | (s,p,l,v) => { MeshCircularLOD = v; } ), | 300 | (s,v) => { MeshCircularLOD = v; } ), |
240 | new ParameterDefn("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD", | 301 | new ParameterDefn<float>("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD", |
241 | 10f, | 302 | 10f, |
242 | (s,cf,p,v) => { MeshMegaPrimThreshold = (float)cf.GetInt(p, (int)v); }, | ||
243 | (s) => { return MeshMegaPrimThreshold; }, | 303 | (s) => { return MeshMegaPrimThreshold; }, |
244 | (s,p,l,v) => { MeshMegaPrimThreshold = v; } ), | 304 | (s,v) => { MeshMegaPrimThreshold = v; } ), |
245 | new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters", | 305 | new ParameterDefn<float>("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters", |
246 | 32f, | 306 | 32f, |
247 | (s,cf,p,v) => { MeshMegaPrimLOD = (float)cf.GetInt(p, (int)v); }, | ||
248 | (s) => { return MeshMegaPrimLOD; }, | 307 | (s) => { return MeshMegaPrimLOD; }, |
249 | (s,p,l,v) => { MeshMegaPrimLOD = v; } ), | 308 | (s,v) => { MeshMegaPrimLOD = v; } ), |
250 | new ParameterDefn("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)", | 309 | new ParameterDefn<float>("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)", |
251 | 32f, | 310 | 32f, |
252 | (s,cf,p,v) => { SculptLOD = (float)cf.GetInt(p, (int)v); }, | ||
253 | (s) => { return SculptLOD; }, | 311 | (s) => { return SculptLOD; }, |
254 | (s,p,l,v) => { SculptLOD = v; } ), | 312 | (s,v) => { SculptLOD = v; } ), |
255 | 313 | ||
256 | new ParameterDefn("MaxSubStep", "In simulation step, maximum number of substeps", | 314 | new ParameterDefn<int>("MaxSubStep", "In simulation step, maximum number of substeps", |
257 | 10f, | 315 | 10, |
258 | (s,cf,p,v) => { s.m_maxSubSteps = cf.GetInt(p, (int)v); }, | 316 | (s) => { return s.m_maxSubSteps; }, |
259 | (s) => { return (float)s.m_maxSubSteps; }, | 317 | (s,v) => { s.m_maxSubSteps = (int)v; } ), |
260 | (s,p,l,v) => { s.m_maxSubSteps = (int)v; } ), | 318 | new ParameterDefn<float>("FixedTimeStep", "In simulation step, seconds of one substep (1/60)", |
261 | new ParameterDefn("FixedTimeStep", "In simulation step, seconds of one substep (1/60)", | ||
262 | 1f / 60f, | 319 | 1f / 60f, |
263 | (s,cf,p,v) => { s.m_fixedTimeStep = cf.GetFloat(p, v); }, | 320 | (s) => { return s.m_fixedTimeStep; }, |
264 | (s) => { return (float)s.m_fixedTimeStep; }, | 321 | (s,v) => { s.m_fixedTimeStep = v; } ), |
265 | (s,p,l,v) => { s.m_fixedTimeStep = v; } ), | 322 | new ParameterDefn<float>("NominalFrameRate", "The base frame rate we claim", |
266 | new ParameterDefn("NominalFrameRate", "The base frame rate we claim", | ||
267 | 55f, | 323 | 55f, |
268 | (s,cf,p,v) => { s.NominalFrameRate = cf.GetInt(p, (int)v); }, | 324 | (s) => { return s.NominalFrameRate; }, |
269 | (s) => { return (float)s.NominalFrameRate; }, | 325 | (s,v) => { s.NominalFrameRate = (int)v; } ), |
270 | (s,p,l,v) => { s.NominalFrameRate = (int)v; } ), | 326 | new ParameterDefn<int>("MaxCollisionsPerFrame", "Max collisions returned at end of each frame", |
271 | new ParameterDefn("MaxCollisionsPerFrame", "Max collisions returned at end of each frame", | 327 | 2048, |
272 | 2048f, | 328 | (s) => { return s.m_maxCollisionsPerFrame; }, |
273 | (s,cf,p,v) => { s.m_maxCollisionsPerFrame = cf.GetInt(p, (int)v); }, | 329 | (s,v) => { s.m_maxCollisionsPerFrame = (int)v; } ), |
274 | (s) => { return (float)s.m_maxCollisionsPerFrame; }, | 330 | new ParameterDefn<int>("MaxUpdatesPerFrame", "Max updates returned at end of each frame", |
275 | (s,p,l,v) => { s.m_maxCollisionsPerFrame = (int)v; } ), | 331 | 8000, |
276 | new ParameterDefn("MaxUpdatesPerFrame", "Max updates returned at end of each frame", | 332 | (s) => { return s.m_maxUpdatesPerFrame; }, |
277 | 8000f, | 333 | (s,v) => { s.m_maxUpdatesPerFrame = (int)v; } ), |
278 | (s,cf,p,v) => { s.m_maxUpdatesPerFrame = cf.GetInt(p, (int)v); }, | 334 | |
279 | (s) => { return (float)s.m_maxUpdatesPerFrame; }, | 335 | new ParameterDefn<float>("MinObjectMass", "Minimum object mass (0.0001)", |
280 | (s,p,l,v) => { s.m_maxUpdatesPerFrame = (int)v; } ), | ||
281 | |||
282 | new ParameterDefn("MinObjectMass", "Minimum object mass (0.0001)", | ||
283 | 0.0001f, | 336 | 0.0001f, |
284 | (s,cf,p,v) => { MinimumObjectMass = cf.GetFloat(p, v); }, | ||
285 | (s) => { return MinimumObjectMass; }, | 337 | (s) => { return MinimumObjectMass; }, |
286 | (s,p,l,v) => { MinimumObjectMass = v; } ), | 338 | (s,v) => { MinimumObjectMass = v; } ), |
287 | new ParameterDefn("MaxObjectMass", "Maximum object mass (10000.01)", | 339 | new ParameterDefn<float>("MaxObjectMass", "Maximum object mass (10000.01)", |
288 | 10000.01f, | 340 | 10000.01f, |
289 | (s,cf,p,v) => { MaximumObjectMass = cf.GetFloat(p, v); }, | ||
290 | (s) => { return MaximumObjectMass; }, | 341 | (s) => { return MaximumObjectMass; }, |
291 | (s,p,l,v) => { MaximumObjectMass = v; } ), | 342 | (s,v) => { MaximumObjectMass = v; } ), |
292 | new ParameterDefn("MaxLinearVelocity", "Maximum velocity magnitude that can be assigned to an object", | 343 | new ParameterDefn<float>("MaxLinearVelocity", "Maximum velocity magnitude that can be assigned to an object", |
293 | 1000.0f, | 344 | 1000.0f, |
294 | (s,cf,p,v) => { MaxLinearVelocity = cf.GetFloat(p, v); }, | ||
295 | (s) => { return MaxLinearVelocity; }, | 345 | (s) => { return MaxLinearVelocity; }, |
296 | (s,p,l,v) => { MaxLinearVelocity = v; } ), | 346 | (s,v) => { MaxLinearVelocity = v; } ), |
297 | new ParameterDefn("MaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to an object", | 347 | new ParameterDefn<float>("MaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to an object", |
298 | 1000.0f, | 348 | 1000.0f, |
299 | (s,cf,p,v) => { MaxAngularVelocity = cf.GetFloat(p, v); }, | ||
300 | (s) => { return MaxAngularVelocity; }, | 349 | (s) => { return MaxAngularVelocity; }, |
301 | (s,p,l,v) => { MaxAngularVelocity = v; } ), | 350 | (s,v) => { MaxAngularVelocity = v; } ), |
302 | // LL documentation says thie number should be 20f for llApplyImpulse and 200f for llRezObject | 351 | // LL documentation says thie number should be 20f for llApplyImpulse and 200f for llRezObject |
303 | new ParameterDefn("MaxAddForceMagnitude", "Maximum force that can be applied by llApplyImpulse (SL says 20f)", | 352 | new ParameterDefn<float>("MaxAddForceMagnitude", "Maximum force that can be applied by llApplyImpulse (SL says 20f)", |
304 | 20000.0f, | 353 | 20000.0f, |
305 | (s,cf,p,v) => { MaxAddForceMagnitude = cf.GetFloat(p, v); }, | ||
306 | (s) => { return MaxAddForceMagnitude; }, | 354 | (s) => { return MaxAddForceMagnitude; }, |
307 | (s,p,l,v) => { MaxAddForceMagnitude = v; } ), | 355 | (s,v) => { MaxAddForceMagnitude = v; } ), |
308 | // Density is passed around as 100kg/m3. This scales that to 1kg/m3. | 356 | // Density is passed around as 100kg/m3. This scales that to 1kg/m3. |
309 | new ParameterDefn("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", | 357 | new ParameterDefn<float>("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", |
310 | 0.01f, | 358 | 0.01f, |
311 | (s,cf,p,v) => { DensityScaleFactor = cf.GetFloat(p, v); }, | ||
312 | (s) => { return DensityScaleFactor; }, | 359 | (s) => { return DensityScaleFactor; }, |
313 | (s,p,l,v) => { DensityScaleFactor = v; } ), | 360 | (s,v) => { DensityScaleFactor = v; } ), |
314 | 361 | ||
315 | new ParameterDefn("PID_D", "Derivitive factor for motion smoothing", | 362 | new ParameterDefn<float>("PID_D", "Derivitive factor for motion smoothing", |
316 | 2200f, | 363 | 2200f, |
317 | (s,cf,p,v) => { PID_D = cf.GetFloat(p, v); }, | ||
318 | (s) => { return (float)PID_D; }, | 364 | (s) => { return (float)PID_D; }, |
319 | (s,p,l,v) => { PID_D = v; } ), | 365 | (s,v) => { PID_D = v; } ), |
320 | new ParameterDefn("PID_P", "Parameteric factor for motion smoothing", | 366 | new ParameterDefn<float>("PID_P", "Parameteric factor for motion smoothing", |
321 | 900f, | 367 | 900f, |
322 | (s,cf,p,v) => { PID_P = cf.GetFloat(p, v); }, | ||
323 | (s) => { return (float)PID_P; }, | 368 | (s) => { return (float)PID_P; }, |
324 | (s,p,l,v) => { PID_P = v; } ), | 369 | (s,v) => { PID_P = v; } ), |
325 | 370 | ||
326 | new ParameterDefn("DefaultFriction", "Friction factor used on new objects", | 371 | new ParameterDefn<float>("DefaultFriction", "Friction factor used on new objects", |
327 | 0.2f, | 372 | 0.2f, |
328 | (s,cf,p,v) => { DefaultFriction = cf.GetFloat(p, v); }, | ||
329 | (s) => { return DefaultFriction; }, | 373 | (s) => { return DefaultFriction; }, |
330 | (s,p,l,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ), | 374 | (s,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ), |
331 | new ParameterDefn("DefaultDensity", "Density for new objects" , | 375 | new ParameterDefn<float>("DefaultDensity", "Density for new objects" , |
332 | 10.000006836f, // Aluminum g/cm3 | 376 | 10.000006836f, // Aluminum g/cm3 |
333 | (s,cf,p,v) => { DefaultDensity = cf.GetFloat(p, v); }, | ||
334 | (s) => { return DefaultDensity; }, | 377 | (s) => { return DefaultDensity; }, |
335 | (s,p,l,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ), | 378 | (s,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ), |
336 | new ParameterDefn("DefaultRestitution", "Bouncyness of an object" , | 379 | new ParameterDefn<float>("DefaultRestitution", "Bouncyness of an object" , |
337 | 0f, | 380 | 0f, |
338 | (s,cf,p,v) => { DefaultRestitution = cf.GetFloat(p, v); }, | ||
339 | (s) => { return DefaultRestitution; }, | 381 | (s) => { return DefaultRestitution; }, |
340 | (s,p,l,v) => { DefaultRestitution = v; s.UnmanagedParams[0].defaultRestitution = v; } ), | 382 | (s,v) => { DefaultRestitution = v; s.UnmanagedParams[0].defaultRestitution = v; } ), |
341 | new ParameterDefn("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)", | 383 | new ParameterDefn<float>("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)", |
342 | 0.04f, | 384 | 0.04f, |
343 | (s,cf,p,v) => { CollisionMargin = cf.GetFloat(p, v); }, | ||
344 | (s) => { return CollisionMargin; }, | 385 | (s) => { return CollisionMargin; }, |
345 | (s,p,l,v) => { CollisionMargin = v; s.UnmanagedParams[0].collisionMargin = v; } ), | 386 | (s,v) => { CollisionMargin = v; s.UnmanagedParams[0].collisionMargin = v; } ), |
346 | new ParameterDefn("Gravity", "Vertical force of gravity (negative means down)", | 387 | new ParameterDefn<float>("Gravity", "Vertical force of gravity (negative means down)", |
347 | -9.80665f, | 388 | -9.80665f, |
348 | (s,cf,p,v) => { Gravity = cf.GetFloat(p, v); }, | ||
349 | (s) => { return Gravity; }, | 389 | (s) => { return Gravity; }, |
350 | (s,p,l,v) => { Gravity = v; s.UnmanagedParams[0].gravity = v; }, | 390 | (s,v) => { Gravity = v; s.UnmanagedParams[0].gravity = v; }, |
351 | (s,o,v) => { s.PE.SetGravity(o.PhysBody, new Vector3(0f,0f,v)); } ), | 391 | (s,o) => { s.PE.SetGravity(o.PhysBody, new Vector3(0f,0f,Gravity)); } ), |
352 | 392 | ||
353 | 393 | ||
354 | new ParameterDefn("LinearDamping", "Factor to damp linear movement per second (0.0 - 1.0)", | 394 | new ParameterDefn<float>("LinearDamping", "Factor to damp linear movement per second (0.0 - 1.0)", |
355 | 0f, | 395 | 0f, |
356 | (s,cf,p,v) => { LinearDamping = cf.GetFloat(p, v); }, | ||
357 | (s) => { return LinearDamping; }, | 396 | (s) => { return LinearDamping; }, |
358 | (s,p,l,v) => { LinearDamping = v; }, | 397 | (s,v) => { LinearDamping = v; }, |
359 | (s,o,v) => { s.PE.SetDamping(o.PhysBody, v, AngularDamping); } ), | 398 | (s,o) => { s.PE.SetDamping(o.PhysBody, LinearDamping, AngularDamping); } ), |
360 | new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", | 399 | new ParameterDefn<float>("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", |
361 | 0f, | 400 | 0f, |
362 | (s,cf,p,v) => { AngularDamping = cf.GetFloat(p, v); }, | ||
363 | (s) => { return AngularDamping; }, | 401 | (s) => { return AngularDamping; }, |
364 | (s,p,l,v) => { AngularDamping = v; }, | 402 | (s,v) => { AngularDamping = v; }, |
365 | (s,o,v) => { s.PE.SetDamping(o.PhysBody, LinearDamping, v); } ), | 403 | (s,o) => { s.PE.SetDamping(o.PhysBody, LinearDamping, AngularDamping); } ), |
366 | new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static", | 404 | new ParameterDefn<float>("DeactivationTime", "Seconds before considering an object potentially static", |
367 | 0.2f, | 405 | 0.2f, |
368 | (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); }, | ||
369 | (s) => { return DeactivationTime; }, | 406 | (s) => { return DeactivationTime; }, |
370 | (s,p,l,v) => { DeactivationTime = v; }, | 407 | (s,v) => { DeactivationTime = v; }, |
371 | (s,o,v) => { s.PE.SetDeactivationTime(o.PhysBody, v); } ), | 408 | (s,o) => { s.PE.SetDeactivationTime(o.PhysBody, DeactivationTime); } ), |
372 | new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", | 409 | new ParameterDefn<float>("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", |
373 | 0.8f, | 410 | 0.8f, |
374 | (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); }, | ||
375 | (s) => { return LinearSleepingThreshold; }, | 411 | (s) => { return LinearSleepingThreshold; }, |
376 | (s,p,l,v) => { LinearSleepingThreshold = v;}, | 412 | (s,v) => { LinearSleepingThreshold = v;}, |
377 | (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), | 413 | (s,o) => { s.PE.SetSleepingThresholds(o.PhysBody, LinearSleepingThreshold, AngularSleepingThreshold); } ), |
378 | new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", | 414 | new ParameterDefn<float>("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", |
379 | 1.0f, | 415 | 1.0f, |
380 | (s,cf,p,v) => { AngularSleepingThreshold = cf.GetFloat(p, v); }, | ||
381 | (s) => { return AngularSleepingThreshold; }, | 416 | (s) => { return AngularSleepingThreshold; }, |
382 | (s,p,l,v) => { AngularSleepingThreshold = v;}, | 417 | (s,v) => { AngularSleepingThreshold = v;}, |
383 | (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), | 418 | (s,o) => { s.PE.SetSleepingThresholds(o.PhysBody, LinearSleepingThreshold, AngularSleepingThreshold); } ), |
384 | new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , | 419 | new ParameterDefn<float>("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , |
385 | 0.0f, // set to zero to disable | 420 | 0.0f, // set to zero to disable |
386 | (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, | ||
387 | (s) => { return CcdMotionThreshold; }, | 421 | (s) => { return CcdMotionThreshold; }, |
388 | (s,p,l,v) => { CcdMotionThreshold = v;}, | 422 | (s,v) => { CcdMotionThreshold = v;}, |
389 | (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ), | 423 | (s,o) => { s.PE.SetCcdMotionThreshold(o.PhysBody, CcdMotionThreshold); } ), |
390 | new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , | 424 | new ParameterDefn<float>("CcdSweptSphereRadius", "Continuious collision detection test radius" , |
391 | 0.2f, | 425 | 0.2f, |
392 | (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, | ||
393 | (s) => { return CcdSweptSphereRadius; }, | 426 | (s) => { return CcdSweptSphereRadius; }, |
394 | (s,p,l,v) => { CcdSweptSphereRadius = v;}, | 427 | (s,v) => { CcdSweptSphereRadius = v;}, |
395 | (s,o,v) => { s.PE.SetCcdSweptSphereRadius(o.PhysBody, v); } ), | 428 | (s,o) => { s.PE.SetCcdSweptSphereRadius(o.PhysBody, CcdSweptSphereRadius); } ), |
396 | new ParameterDefn("ContactProcessingThreshold", "Distance above which contacts can be discarded (0 means no discard)" , | 429 | new ParameterDefn<float>("ContactProcessingThreshold", "Distance above which contacts can be discarded (0 means no discard)" , |
397 | 0.0f, | 430 | 0.0f, |
398 | (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); }, | ||
399 | (s) => { return ContactProcessingThreshold; }, | 431 | (s) => { return ContactProcessingThreshold; }, |
400 | (s,p,l,v) => { ContactProcessingThreshold = v;}, | 432 | (s,v) => { ContactProcessingThreshold = v;}, |
401 | (s,o,v) => { s.PE.SetContactProcessingThreshold(o.PhysBody, v); } ), | 433 | (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ), |
402 | 434 | ||
403 | new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", | 435 | new ParameterDefn<float>("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", |
404 | (float)BSTerrainPhys.TerrainImplementation.Mesh, | 436 | (float)BSTerrainPhys.TerrainImplementation.Mesh, |
405 | (s,cf,p,v) => { TerrainImplementation = cf.GetFloat(p,v); }, | ||
406 | (s) => { return TerrainImplementation; }, | 437 | (s) => { return TerrainImplementation; }, |
407 | (s,p,l,v) => { TerrainImplementation = v; } ), | 438 | (s,v) => { TerrainImplementation = v; } ), |
408 | new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , | 439 | new ParameterDefn<float>("TerrainFriction", "Factor to reduce movement against terrain surface" , |
409 | 0.3f, | 440 | 0.3f, |
410 | (s,cf,p,v) => { TerrainFriction = cf.GetFloat(p, v); }, | ||
411 | (s) => { return TerrainFriction; }, | 441 | (s) => { return TerrainFriction; }, |
412 | (s,p,l,v) => { TerrainFriction = v; /* TODO: set on real terrain */} ), | 442 | (s,v) => { TerrainFriction = v; /* TODO: set on real terrain */} ), |
413 | new ParameterDefn("TerrainHitFraction", "Distance to measure hit collisions" , | 443 | new ParameterDefn<float>("TerrainHitFraction", "Distance to measure hit collisions" , |
414 | 0.8f, | 444 | 0.8f, |
415 | (s,cf,p,v) => { TerrainHitFraction = cf.GetFloat(p, v); }, | ||
416 | (s) => { return TerrainHitFraction; }, | 445 | (s) => { return TerrainHitFraction; }, |
417 | (s,p,l,v) => { TerrainHitFraction = v; /* TODO: set on real terrain */ } ), | 446 | (s,v) => { TerrainHitFraction = v; /* TODO: set on real terrain */ } ), |
418 | new ParameterDefn("TerrainRestitution", "Bouncyness" , | 447 | new ParameterDefn<float>("TerrainRestitution", "Bouncyness" , |
419 | 0f, | 448 | 0f, |
420 | (s,cf,p,v) => { TerrainRestitution = cf.GetFloat(p, v); }, | ||
421 | (s) => { return TerrainRestitution; }, | 449 | (s) => { return TerrainRestitution; }, |
422 | (s,p,l,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ), | 450 | (s,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ), |
423 | new ParameterDefn("TerrainCollisionMargin", "Margin where collision checking starts" , | 451 | new ParameterDefn<float>("TerrainCollisionMargin", "Margin where collision checking starts" , |
424 | 0.08f, | 452 | 0.08f, |
425 | (s,cf,p,v) => { TerrainCollisionMargin = cf.GetFloat(p, v); }, | ||
426 | (s) => { return TerrainCollisionMargin; }, | 453 | (s) => { return TerrainCollisionMargin; }, |
427 | (s,p,l,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ), | 454 | (s,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ), |
428 | 455 | ||
429 | new ParameterDefn("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", | 456 | new ParameterDefn<float>("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", |
430 | 0.2f, | 457 | 0.2f, |
431 | (s,cf,p,v) => { AvatarFriction = cf.GetFloat(p, v); }, | ||
432 | (s) => { return AvatarFriction; }, | 458 | (s) => { return AvatarFriction; }, |
433 | (s,p,l,v) => { AvatarFriction = v; } ), | 459 | (s,v) => { AvatarFriction = v; } ), |
434 | new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", | 460 | new ParameterDefn<float>("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", |
435 | 0.95f, | 461 | 0.95f, |
436 | (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); }, | ||
437 | (s) => { return AvatarStandingFriction; }, | 462 | (s) => { return AvatarStandingFriction; }, |
438 | (s,p,l,v) => { AvatarStandingFriction = v; } ), | 463 | (s,v) => { AvatarStandingFriction = v; } ), |
439 | new ParameterDefn("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", | 464 | new ParameterDefn<float>("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", |
440 | 1.3f, | 465 | 1.3f, |
441 | (s,cf,p,v) => { AvatarAlwaysRunFactor = cf.GetFloat(p, v); }, | ||
442 | (s) => { return AvatarAlwaysRunFactor; }, | 466 | (s) => { return AvatarAlwaysRunFactor; }, |
443 | (s,p,l,v) => { AvatarAlwaysRunFactor = v; } ), | 467 | (s,v) => { AvatarAlwaysRunFactor = v; } ), |
444 | new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", | 468 | new ParameterDefn<float>("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", |
445 | 3.5f, | 469 | 3.5f, |
446 | (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); }, | ||
447 | (s) => { return AvatarDensity; }, | 470 | (s) => { return AvatarDensity; }, |
448 | (s,p,l,v) => { AvatarDensity = v; } ), | 471 | (s,v) => { AvatarDensity = v; } ), |
449 | new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", | 472 | new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", |
450 | 0f, | 473 | 0f, |
451 | (s,cf,p,v) => { AvatarRestitution = cf.GetFloat(p, v); }, | ||
452 | (s) => { return AvatarRestitution; }, | 474 | (s) => { return AvatarRestitution; }, |
453 | (s,p,l,v) => { AvatarRestitution = v; } ), | 475 | (s,v) => { AvatarRestitution = v; } ), |
454 | new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", | 476 | new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", |
455 | 0.6f, | 477 | 0.6f, |
456 | (s,cf,p,v) => { AvatarCapsuleWidth = cf.GetFloat(p, v); }, | ||
457 | (s) => { return AvatarCapsuleWidth; }, | 478 | (s) => { return AvatarCapsuleWidth; }, |
458 | (s,p,l,v) => { AvatarCapsuleWidth = v; } ), | 479 | (s,v) => { AvatarCapsuleWidth = v; } ), |
459 | new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", | 480 | new ParameterDefn<float>("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", |
460 | 0.45f, | 481 | 0.45f, |
461 | (s,cf,p,v) => { AvatarCapsuleDepth = cf.GetFloat(p, v); }, | ||
462 | (s) => { return AvatarCapsuleDepth; }, | 482 | (s) => { return AvatarCapsuleDepth; }, |
463 | (s,p,l,v) => { AvatarCapsuleDepth = v; } ), | 483 | (s,v) => { AvatarCapsuleDepth = v; } ), |
464 | new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", | 484 | new ParameterDefn<float>("AvatarCapsuleHeight", "Default height of space around avatar", |
465 | 1.5f, | 485 | 1.5f, |
466 | (s,cf,p,v) => { AvatarCapsuleHeight = cf.GetFloat(p, v); }, | ||
467 | (s) => { return AvatarCapsuleHeight; }, | 486 | (s) => { return AvatarCapsuleHeight; }, |
468 | (s,p,l,v) => { AvatarCapsuleHeight = v; } ), | 487 | (s,v) => { AvatarCapsuleHeight = v; } ), |
469 | new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", | 488 | new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", |
470 | 0.1f, | 489 | 0.1f, |
471 | (s,cf,p,v) => { AvatarContactProcessingThreshold = cf.GetFloat(p, v); }, | ||
472 | (s) => { return AvatarContactProcessingThreshold; }, | 490 | (s) => { return AvatarContactProcessingThreshold; }, |
473 | (s,p,l,v) => { AvatarContactProcessingThreshold = v; } ), | 491 | (s,v) => { AvatarContactProcessingThreshold = v; } ), |
474 | new ParameterDefn("AvatarStepHeight", "Height of a step obstacle to consider step correction", | 492 | new ParameterDefn<float>("AvatarStepHeight", "Height of a step obstacle to consider step correction", |
475 | 0.3f, | 493 | 0.3f, |
476 | (s,cf,p,v) => { AvatarStepHeight = cf.GetFloat(p, v); }, | ||
477 | (s) => { return AvatarStepHeight; }, | 494 | (s) => { return AvatarStepHeight; }, |
478 | (s,p,l,v) => { AvatarStepHeight = v; } ), | 495 | (s,v) => { AvatarStepHeight = v; } ), |
479 | new ParameterDefn("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", | 496 | new ParameterDefn<float>("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", |
480 | 0.6f, | 497 | 0.6f, |
481 | (s,cf,p,v) => { AvatarStepApproachFactor = cf.GetFloat(p, v); }, | ||
482 | (s) => { return AvatarStepApproachFactor; }, | 498 | (s) => { return AvatarStepApproachFactor; }, |
483 | (s,p,l,v) => { AvatarStepApproachFactor = v; } ), | 499 | (s,v) => { AvatarStepApproachFactor = v; } ), |
484 | new ParameterDefn("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", | 500 | new ParameterDefn<float>("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", |
485 | 2.0f, | 501 | 2.0f, |
486 | (s,cf,p,v) => { AvatarStepForceFactor = cf.GetFloat(p, v); }, | ||
487 | (s) => { return AvatarStepForceFactor; }, | 502 | (s) => { return AvatarStepForceFactor; }, |
488 | (s,p,l,v) => { AvatarStepForceFactor = v; } ), | 503 | (s,v) => { AvatarStepForceFactor = v; } ), |
489 | 504 | ||
490 | new ParameterDefn("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", | 505 | new ParameterDefn<float>("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", |
491 | 1000.0f, | 506 | 1000.0f, |
492 | (s,cf,p,v) => { VehicleMaxLinearVelocity = cf.GetFloat(p, v); }, | ||
493 | (s) => { return (float)VehicleMaxLinearVelocity; }, | 507 | (s) => { return (float)VehicleMaxLinearVelocity; }, |
494 | (s,p,l,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySq = v * v; } ), | 508 | (s,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySq = v * v; } ), |
495 | new ParameterDefn("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle", | 509 | new ParameterDefn<float>("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle", |
496 | 12.0f, | 510 | 12.0f, |
497 | (s,cf,p,v) => { VehicleMaxAngularVelocity = cf.GetFloat(p, v); }, | ||
498 | (s) => { return (float)VehicleMaxAngularVelocity; }, | 511 | (s) => { return (float)VehicleMaxAngularVelocity; }, |
499 | (s,p,l,v) => { VehicleMaxAngularVelocity = v; VehicleMaxAngularVelocitySq = v * v; } ), | 512 | (s,v) => { VehicleMaxAngularVelocity = v; VehicleMaxAngularVelocitySq = v * v; } ), |
500 | new ParameterDefn("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", | 513 | new ParameterDefn<float>("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", |
501 | 0.0f, | 514 | 0.0f, |
502 | (s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); }, | ||
503 | (s) => { return VehicleAngularDamping; }, | 515 | (s) => { return VehicleAngularDamping; }, |
504 | (s,p,l,v) => { VehicleAngularDamping = v; } ), | 516 | (s,v) => { VehicleAngularDamping = v; } ), |
505 | new ParameterDefn("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (0.0 - 1.0)", | 517 | new ParameterDefn<Vector3>("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (<0,0,0> to <1,1,1>)", |
506 | 1.0f, | 518 | new Vector3(1f, 1f, 1f), |
507 | (s,cf,p,v) => { VehicleLinearFactor = cf.GetFloat(p, v); }, | ||
508 | (s) => { return VehicleLinearFactor; }, | 519 | (s) => { return VehicleLinearFactor; }, |
509 | (s,p,l,v) => { VehicleLinearFactor = v; VehicleLinearFactorV = new Vector3(v, v, v); } ), | 520 | (s,v) => { VehicleLinearFactor = v; } ), |
510 | new ParameterDefn("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (0.0 - 1.0)", | 521 | new ParameterDefn<Vector3>("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (<0,0,0> to <1,1,1>)", |
511 | 1.0f, | 522 | new Vector3(1f, 1f, 1f), |
512 | (s,cf,p,v) => { VehicleAngularFactor = cf.GetFloat(p, v); }, | ||
513 | (s) => { return VehicleAngularFactor; }, | 523 | (s) => { return VehicleAngularFactor; }, |
514 | (s,p,l,v) => { VehicleAngularFactor = v; VehicleAngularFactorV = new Vector3(v, v, v); } ), | 524 | (s,v) => { VehicleAngularFactor = v; } ), |
515 | new ParameterDefn("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)", | 525 | new ParameterDefn<float>("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)", |
516 | 0.0f, | 526 | 0.0f, |
517 | (s,cf,p,v) => { VehicleFriction = cf.GetFloat(p, v); }, | ||
518 | (s) => { return VehicleFriction; }, | 527 | (s) => { return VehicleFriction; }, |
519 | (s,p,l,v) => { VehicleFriction = v; } ), | 528 | (s,v) => { VehicleFriction = v; } ), |
520 | new ParameterDefn("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", | 529 | new ParameterDefn<float>("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", |
521 | 0.0f, | 530 | 0.0f, |
522 | (s,cf,p,v) => { VehicleRestitution = cf.GetFloat(p, v); }, | ||
523 | (s) => { return VehicleRestitution; }, | 531 | (s) => { return VehicleRestitution; }, |
524 | (s,p,l,v) => { VehicleRestitution = v; } ), | 532 | (s,v) => { VehicleRestitution = v; } ), |
525 | new ParameterDefn("VehicleGroundGravityFudge", "Factor to multiple gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", | 533 | new ParameterDefn<float>("VehicleGroundGravityFudge", "Factor to multiple gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", |
526 | 0.2f, | 534 | 0.2f, |
527 | (s,cf,p,v) => { VehicleGroundGravityFudge = cf.GetFloat(p, v); }, | ||
528 | (s) => { return VehicleGroundGravityFudge; }, | 535 | (s) => { return VehicleGroundGravityFudge; }, |
529 | (s,p,l,v) => { VehicleGroundGravityFudge = v; } ), | 536 | (s,v) => { VehicleGroundGravityFudge = v; } ), |
530 | new ParameterDefn("VehicleDebuggingEnable", "Turn on/off vehicle debugging", | 537 | new ParameterDefn<bool>("VehicleDebuggingEnable", "Turn on/off vehicle debugging", |
531 | ConfigurationParameters.numericFalse, | 538 | false, |
532 | (s,cf,p,v) => { VehicleDebuggingEnabled = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | ||
533 | (s) => { return VehicleDebuggingEnabled; }, | 539 | (s) => { return VehicleDebuggingEnabled; }, |
534 | (s,p,l,v) => { VehicleDebuggingEnabled = v; } ), | 540 | (s,v) => { VehicleDebuggingEnabled = v; } ), |
535 | 541 | ||
536 | new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", | 542 | new ParameterDefn<float>("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", |
537 | 0f, | 543 | 0f, |
538 | (s,cf,p,v) => { MaxPersistantManifoldPoolSize = cf.GetFloat(p, v); }, | ||
539 | (s) => { return MaxPersistantManifoldPoolSize; }, | 544 | (s) => { return MaxPersistantManifoldPoolSize; }, |
540 | (s,p,l,v) => { MaxPersistantManifoldPoolSize = v; s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ), | 545 | (s,v) => { MaxPersistantManifoldPoolSize = v; s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ), |
541 | new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)", | 546 | new ParameterDefn<float>("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)", |
542 | 0f, | 547 | 0f, |
543 | (s,cf,p,v) => { MaxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); }, | ||
544 | (s) => { return MaxCollisionAlgorithmPoolSize; }, | 548 | (s) => { return MaxCollisionAlgorithmPoolSize; }, |
545 | (s,p,l,v) => { MaxCollisionAlgorithmPoolSize = v; s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ), | 549 | (s,v) => { MaxCollisionAlgorithmPoolSize = v; s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ), |
546 | new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", | 550 | new ParameterDefn<bool>("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", |
547 | ConfigurationParameters.numericFalse, | 551 | false, |
548 | (s,cf,p,v) => { ShouldDisableContactPoolDynamicAllocation = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | ||
549 | (s) => { return ShouldDisableContactPoolDynamicAllocation; }, | 552 | (s) => { return ShouldDisableContactPoolDynamicAllocation; }, |
550 | (s,p,l,v) => { ShouldDisableContactPoolDynamicAllocation = v; s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = v; } ), | 553 | (s,v) => { ShouldDisableContactPoolDynamicAllocation = v; |
551 | new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", | 554 | s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = NumericBool(v); } ), |
552 | ConfigurationParameters.numericFalse, | 555 | new ParameterDefn<bool>("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", |
553 | (s,cf,p,v) => { ShouldForceUpdateAllAabbs = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | 556 | false, |
554 | (s) => { return ShouldForceUpdateAllAabbs; }, | 557 | (s) => { return ShouldForceUpdateAllAabbs; }, |
555 | (s,p,l,v) => { ShouldForceUpdateAllAabbs = v; s.UnmanagedParams[0].shouldForceUpdateAllAabbs = v; } ), | 558 | (s,v) => { ShouldForceUpdateAllAabbs = v; s.UnmanagedParams[0].shouldForceUpdateAllAabbs = NumericBool(v); } ), |
556 | new ParameterDefn("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction", | 559 | new ParameterDefn<bool>("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction", |
557 | ConfigurationParameters.numericTrue, | 560 | true, |
558 | (s,cf,p,v) => { ShouldRandomizeSolverOrder = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | ||
559 | (s) => { return ShouldRandomizeSolverOrder; }, | 561 | (s) => { return ShouldRandomizeSolverOrder; }, |
560 | (s,p,l,v) => { ShouldRandomizeSolverOrder = v; s.UnmanagedParams[0].shouldRandomizeSolverOrder = v; } ), | 562 | (s,v) => { ShouldRandomizeSolverOrder = v; s.UnmanagedParams[0].shouldRandomizeSolverOrder = NumericBool(v); } ), |
561 | new ParameterDefn("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands", | 563 | new ParameterDefn<bool>("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands", |
562 | ConfigurationParameters.numericTrue, | 564 | true, |
563 | (s,cf,p,v) => { ShouldSplitSimulationIslands = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | ||
564 | (s) => { return ShouldSplitSimulationIslands; }, | 565 | (s) => { return ShouldSplitSimulationIslands; }, |
565 | (s,p,l,v) => { ShouldSplitSimulationIslands = v; s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), | 566 | (s,v) => { ShouldSplitSimulationIslands = v; s.UnmanagedParams[0].shouldSplitSimulationIslands = NumericBool(v); } ), |
566 | new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", | 567 | new ParameterDefn<bool>("ShouldEnableFrictionCaching", "Enable friction computation caching", |
567 | ConfigurationParameters.numericTrue, | 568 | true, |
568 | (s,cf,p,v) => { ShouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | ||
569 | (s) => { return ShouldEnableFrictionCaching; }, | 569 | (s) => { return ShouldEnableFrictionCaching; }, |
570 | (s,p,l,v) => { ShouldEnableFrictionCaching = v; s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), | 570 | (s,v) => { ShouldEnableFrictionCaching = v; s.UnmanagedParams[0].shouldEnableFrictionCaching = NumericBool(v); } ), |
571 | new ParameterDefn("NumberOfSolverIterations", "Number of internal iterations (0 means default)", | 571 | new ParameterDefn<float>("NumberOfSolverIterations", "Number of internal iterations (0 means default)", |
572 | 0f, // zero says use Bullet default | 572 | 0f, // zero says use Bullet default |
573 | (s,cf,p,v) => { NumberOfSolverIterations = cf.GetFloat(p, v); }, | ||
574 | (s) => { return NumberOfSolverIterations; }, | 573 | (s) => { return NumberOfSolverIterations; }, |
575 | (s,p,l,v) => { NumberOfSolverIterations = v; s.UnmanagedParams[0].numberOfSolverIterations = v; } ), | 574 | (s,v) => { NumberOfSolverIterations = v; s.UnmanagedParams[0].numberOfSolverIterations = v; } ), |
576 | new ParameterDefn("UseSingleSidedMeshes", "Whether to compute collisions based on single sided meshes.", | 575 | new ParameterDefn<bool>("UseSingleSidedMeshes", "Whether to compute collisions based on single sided meshes.", |
577 | ConfigurationParameters.numericTrue, | 576 | true, |
578 | (s,cf,p,v) => { UseSingleSidedMeshesF = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | 577 | (s) => { return UseSingleSidedMeshes; }, |
579 | (s) => { return UseSingleSidedMeshesF; }, | 578 | (s,v) => { UseSingleSidedMeshes = v; s.UnmanagedParams[0].useSingleSidedMeshes = NumericBool(v); } ), |
580 | (s,p,l,v) => { UseSingleSidedMeshesF = v; s.UnmanagedParams[0].useSingleSidedMeshes = v; } ), | 579 | new ParameterDefn<float>("GlobalContactBreakingThreshold", "Amount of shape radius before breaking a collision contact (0 says Bullet default (0.2))", |
581 | new ParameterDefn("GlobalContactBreakingThreshold", "Amount of shape radius before breaking a collision contact (0 says Bullet default (0.2))", | ||
582 | 0f, | 580 | 0f, |
583 | (s,cf,p,v) => { GlobalContactBreakingThreshold = cf.GetFloat(p, v); }, | ||
584 | (s) => { return GlobalContactBreakingThreshold; }, | 581 | (s) => { return GlobalContactBreakingThreshold; }, |
585 | (s,p,l,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ), | 582 | (s,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ), |
586 | 583 | ||
587 | new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", | 584 | new ParameterDefn<float>("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", |
588 | (float)BSLinkset.LinksetImplementation.Compound, | 585 | (float)BSLinkset.LinksetImplementation.Compound, |
589 | (s,cf,p,v) => { LinksetImplementation = cf.GetFloat(p,v); }, | ||
590 | (s) => { return LinksetImplementation; }, | 586 | (s) => { return LinksetImplementation; }, |
591 | (s,p,l,v) => { LinksetImplementation = v; } ), | 587 | (s,v) => { LinksetImplementation = v; } ), |
592 | new ParameterDefn("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.", | 588 | new ParameterDefn<bool>("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.", |
593 | ConfigurationParameters.numericFalse, | 589 | false, |
594 | (s,cf,p,v) => { LinkConstraintUseFrameOffset = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | ||
595 | (s) => { return LinkConstraintUseFrameOffset; }, | 590 | (s) => { return LinkConstraintUseFrameOffset; }, |
596 | (s,p,l,v) => { LinkConstraintUseFrameOffset = v; } ), | 591 | (s,v) => { LinkConstraintUseFrameOffset = v; } ), |
597 | new ParameterDefn("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints", | 592 | new ParameterDefn<bool>("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints", |
598 | ConfigurationParameters.numericTrue, | 593 | true, |
599 | (s,cf,p,v) => { LinkConstraintEnableTransMotor = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, | ||
600 | (s) => { return LinkConstraintEnableTransMotor; }, | 594 | (s) => { return LinkConstraintEnableTransMotor; }, |
601 | (s,p,l,v) => { LinkConstraintEnableTransMotor = v; } ), | 595 | (s,v) => { LinkConstraintEnableTransMotor = v; } ), |
602 | new ParameterDefn("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints", | 596 | new ParameterDefn<float>("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints", |
603 | 5.0f, | 597 | 5.0f, |
604 | (s,cf,p,v) => { LinkConstraintTransMotorMaxVel = cf.GetFloat(p, v); }, | ||
605 | (s) => { return LinkConstraintTransMotorMaxVel; }, | 598 | (s) => { return LinkConstraintTransMotorMaxVel; }, |
606 | (s,p,l,v) => { LinkConstraintTransMotorMaxVel = v; } ), | 599 | (s,v) => { LinkConstraintTransMotorMaxVel = v; } ), |
607 | new ParameterDefn("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints", | 600 | new ParameterDefn<float>("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints", |
608 | 0.1f, | 601 | 0.1f, |
609 | (s,cf,p,v) => { LinkConstraintTransMotorMaxForce = cf.GetFloat(p, v); }, | ||
610 | (s) => { return LinkConstraintTransMotorMaxForce; }, | 602 | (s) => { return LinkConstraintTransMotorMaxForce; }, |
611 | (s,p,l,v) => { LinkConstraintTransMotorMaxForce = v; } ), | 603 | (s,v) => { LinkConstraintTransMotorMaxForce = v; } ), |
612 | new ParameterDefn("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1", | 604 | new ParameterDefn<float>("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1", |
613 | 0.1f, | 605 | 0.1f, |
614 | (s,cf,p,v) => { LinkConstraintCFM = cf.GetFloat(p, v); }, | ||
615 | (s) => { return LinkConstraintCFM; }, | 606 | (s) => { return LinkConstraintCFM; }, |
616 | (s,p,l,v) => { LinkConstraintCFM = v; } ), | 607 | (s,v) => { LinkConstraintCFM = v; } ), |
617 | new ParameterDefn("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2", | 608 | new ParameterDefn<float>("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2", |
618 | 0.1f, | 609 | 0.1f, |
619 | (s,cf,p,v) => { LinkConstraintERP = cf.GetFloat(p, v); }, | ||
620 | (s) => { return LinkConstraintERP; }, | 610 | (s) => { return LinkConstraintERP; }, |
621 | (s,p,l,v) => { LinkConstraintERP = v; } ), | 611 | (s,v) => { LinkConstraintERP = v; } ), |
622 | new ParameterDefn("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)", | 612 | new ParameterDefn<float>("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)", |
623 | 40, | 613 | 40, |
624 | (s,cf,p,v) => { LinkConstraintSolverIterations = cf.GetFloat(p, v); }, | ||
625 | (s) => { return LinkConstraintSolverIterations; }, | 614 | (s) => { return LinkConstraintSolverIterations; }, |
626 | (s,p,l,v) => { LinkConstraintSolverIterations = v; } ), | 615 | (s,v) => { LinkConstraintSolverIterations = v; } ), |
627 | 616 | ||
628 | new ParameterDefn("PhysicsMetricFrames", "Frames between outputting detailed phys metrics. (0 is off)", | 617 | new ParameterDefn<int>("PhysicsMetricFrames", "Frames between outputting detailed phys metrics. (0 is off)", |
629 | 0f, | 618 | 0, |
630 | (s,cf,p,v) => { s.PhysicsMetricDumpFrames = cf.GetFloat(p, (int)v); }, | 619 | (s) => { return s.PhysicsMetricDumpFrames; }, |
631 | (s) => { return (float)s.PhysicsMetricDumpFrames; }, | 620 | (s,v) => { s.PhysicsMetricDumpFrames = v; } ), |
632 | (s,p,l,v) => { s.PhysicsMetricDumpFrames = (int)v; } ), | 621 | new ParameterDefn<float>("ResetBroadphasePool", "Setting this is any value resets the broadphase collision pool", |
633 | new ParameterDefn("ResetBroadphasePool", "Setting this is any value resets the broadphase collision pool", | ||
634 | 0f, | 622 | 0f, |
635 | (s,cf,p,v) => { ; }, | ||
636 | (s) => { return 0f; }, | 623 | (s) => { return 0f; }, |
637 | (s,p,l,v) => { BSParam.ResetBroadphasePoolTainted(s, v); } ), | 624 | (s,v) => { BSParam.ResetBroadphasePoolTainted(s, v); } ), |
638 | new ParameterDefn("ResetConstraintSolver", "Setting this is any value resets the constraint solver", | 625 | new ParameterDefn<float>("ResetConstraintSolver", "Setting this is any value resets the constraint solver", |
639 | 0f, | 626 | 0f, |
640 | (s,cf,p,v) => { ; }, | ||
641 | (s) => { return 0f; }, | 627 | (s) => { return 0f; }, |
642 | (s,p,l,v) => { BSParam.ResetConstraintSolverTainted(s, v); } ), | 628 | (s,v) => { BSParam.ResetConstraintSolverTainted(s, v); } ), |
643 | }; | 629 | }; |
644 | 630 | ||
645 | // Convert a boolean to our numeric true and false values | 631 | // Convert a boolean to our numeric true and false values |
@@ -658,13 +644,13 @@ public static class BSParam | |||
658 | // ParameterDefn structure. | 644 | // ParameterDefn structure. |
659 | // Case does not matter as names are compared after converting to lower case. | 645 | // Case does not matter as names are compared after converting to lower case. |
660 | // Returns 'false' if the parameter is not found. | 646 | // Returns 'false' if the parameter is not found. |
661 | internal static bool TryGetParameter(string paramName, out ParameterDefn defn) | 647 | internal static bool TryGetParameter(string paramName, out ParameterDefnBase defn) |
662 | { | 648 | { |
663 | bool ret = false; | 649 | bool ret = false; |
664 | ParameterDefn foundDefn = new ParameterDefn(); | 650 | ParameterDefnBase foundDefn = null; |
665 | string pName = paramName.ToLower(); | 651 | string pName = paramName.ToLower(); |
666 | 652 | ||
667 | foreach (ParameterDefn parm in ParameterDefinitions) | 653 | foreach (ParameterDefnBase parm in ParameterDefinitions) |
668 | { | 654 | { |
669 | if (pName == parm.name.ToLower()) | 655 | if (pName == parm.name.ToLower()) |
670 | { | 656 | { |
@@ -680,18 +666,18 @@ public static class BSParam | |||
680 | // Pass through the settable parameters and set the default values | 666 | // Pass through the settable parameters and set the default values |
681 | internal static void SetParameterDefaultValues(BSScene physicsScene) | 667 | internal static void SetParameterDefaultValues(BSScene physicsScene) |
682 | { | 668 | { |
683 | foreach (ParameterDefn parm in ParameterDefinitions) | 669 | foreach (ParameterDefnBase parm in ParameterDefinitions) |
684 | { | 670 | { |
685 | parm.setter(physicsScene, parm.name, PhysParameterEntry.APPLY_TO_NONE, parm.defaultValue); | 671 | parm.AssignDefault(physicsScene); |
686 | } | 672 | } |
687 | } | 673 | } |
688 | 674 | ||
689 | // Get user set values out of the ini file. | 675 | // Get user set values out of the ini file. |
690 | internal static void SetParameterConfigurationValues(BSScene physicsScene, IConfig cfg) | 676 | internal static void SetParameterConfigurationValues(BSScene physicsScene, IConfig cfg) |
691 | { | 677 | { |
692 | foreach (ParameterDefn parm in ParameterDefinitions) | 678 | foreach (ParameterDefnBase parm in ParameterDefinitions) |
693 | { | 679 | { |
694 | parm.userParam(physicsScene, cfg, parm.name, parm.defaultValue); | 680 | parm.SetValue(physicsScene, cfg.GetString(parm.name, parm.GetValue(physicsScene))); |
695 | } | 681 | } |
696 | } | 682 | } |
697 | 683 | ||
@@ -706,17 +692,21 @@ public static class BSParam | |||
706 | List<PhysParameterEntry> entries = new List<PhysParameterEntry>(); | 692 | List<PhysParameterEntry> entries = new List<PhysParameterEntry>(); |
707 | for (int ii = 0; ii < ParameterDefinitions.Length; ii++) | 693 | for (int ii = 0; ii < ParameterDefinitions.Length; ii++) |
708 | { | 694 | { |
709 | ParameterDefn pd = ParameterDefinitions[ii]; | 695 | ParameterDefnBase pd = ParameterDefinitions[ii]; |
710 | entries.Add(new PhysParameterEntry(pd.name, pd.desc)); | 696 | entries.Add(new PhysParameterEntry(pd.name, pd.desc)); |
711 | } | 697 | } |
712 | 698 | ||
713 | // make the list alphabetical for estetic reasons | 699 | // make the list alphabetical for ease of finding anything |
714 | entries.Sort((ppe1, ppe2) => { return ppe1.name.CompareTo(ppe2.name); }); | 700 | entries.Sort((ppe1, ppe2) => { return ppe1.name.CompareTo(ppe2.name); }); |
715 | 701 | ||
716 | SettableParameters = entries.ToArray(); | 702 | SettableParameters = entries.ToArray(); |
717 | } | 703 | } |
718 | } | 704 | } |
719 | 705 | ||
706 | // ===================================================================== | ||
707 | // ===================================================================== | ||
708 | // There are parameters that, when set, cause things to happen in the physics engine. | ||
709 | // This causes the broadphase collision cache to be cleared. | ||
720 | private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v) | 710 | private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v) |
721 | { | 711 | { |
722 | BSScene physScene = pPhysScene; | 712 | BSScene physScene = pPhysScene; |
@@ -726,6 +716,7 @@ public static class BSParam | |||
726 | }); | 716 | }); |
727 | } | 717 | } |
728 | 718 | ||
719 | // This causes the constraint solver cache to be cleared and reset. | ||
729 | private static void ResetConstraintSolverTainted(BSScene pPhysScene, float v) | 720 | private static void ResetConstraintSolverTainted(BSScene pPhysScene, float v) |
730 | { | 721 | { |
731 | BSScene physScene = pPhysScene; | 722 | BSScene physScene = pPhysScene; |