diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 56 |
1 files changed, 50 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 4d89a88..385ed9e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -142,6 +142,14 @@ public static class BSParam | |||
142 | public static float VehicleAngularBankingTimescaleFudge { get; private set; } | 142 | public static float VehicleAngularBankingTimescaleFudge { get; private set; } |
143 | public static bool VehicleDebuggingEnabled { get; private set; } | 143 | public static bool VehicleDebuggingEnabled { get; private set; } |
144 | 144 | ||
145 | // Convex Hulls | ||
146 | public static int CSHullMaxDepthSplit { get; private set; } | ||
147 | public static int CSHullMaxDepthSplitForSimpleShapes { get; private set; } | ||
148 | public static float CSHullConcavityThresholdPercent { get; private set; } | ||
149 | public static float CSHullVolumeConservationThresholdPercent { get; private set; } | ||
150 | public static int CSHullMaxVertices { get; private set; } | ||
151 | public static float CSHullMaxSkinWidth { get; private set; } | ||
152 | |||
145 | // Linkset implementation parameters | 153 | // Linkset implementation parameters |
146 | public static float LinksetImplementation { get; private set; } | 154 | public static float LinksetImplementation { get; private set; } |
147 | public static bool LinkConstraintUseFrameOffset { get; private set; } | 155 | public static bool LinkConstraintUseFrameOffset { get; private set; } |
@@ -195,10 +203,10 @@ public static class BSParam | |||
195 | public delegate void PSetOnObject<T>(BSScene scene, BSPhysObject obj); | 203 | public delegate void PSetOnObject<T>(BSScene scene, BSPhysObject obj); |
196 | public sealed class ParameterDefn<T> : ParameterDefnBase | 204 | public sealed class ParameterDefn<T> : ParameterDefnBase |
197 | { | 205 | { |
198 | T defaultValue; | 206 | private T defaultValue; |
199 | PSetValue<T> setter; | 207 | private PSetValue<T> setter; |
200 | PGetValue<T> getter; | 208 | private PGetValue<T> getter; |
201 | PSetOnObject<T> objectSet; | 209 | private PSetOnObject<T> objectSet; |
202 | public ParameterDefn(string pName, string pDesc, T pDefault, PGetValue<T> pGetter, PSetValue<T> pSetter) | 210 | public ParameterDefn(string pName, string pDesc, T pDefault, PGetValue<T> pGetter, PSetValue<T> pSetter) |
203 | : base(pName, pDesc) | 211 | : base(pName, pDesc) |
204 | { | 212 | { |
@@ -215,13 +223,23 @@ public static class BSParam | |||
215 | getter = pGetter; | 223 | getter = pGetter; |
216 | objectSet = pObjSetter; | 224 | objectSet = pObjSetter; |
217 | } | 225 | } |
226 | /* Wish I could simplify using this definition but CLR doesn't store references so closure around delegates of references won't work | ||
227 | public ParameterDefn(string pName, string pDesc, T pDefault, ref T loc) | ||
228 | : base(pName, pDesc) | ||
229 | { | ||
230 | defaultValue = pDefault; | ||
231 | setter = (s, v) => { loc = v; }; | ||
232 | getter = (s) => { return loc; }; | ||
233 | objectSet = null; | ||
234 | } | ||
235 | */ | ||
218 | public override void AssignDefault(BSScene s) | 236 | public override void AssignDefault(BSScene s) |
219 | { | 237 | { |
220 | setter(s, defaultValue); | 238 | setter(s, defaultValue); |
221 | } | 239 | } |
222 | public override string GetValue(BSScene s) | 240 | public override string GetValue(BSScene s) |
223 | { | 241 | { |
224 | return String.Format("{0}", getter(s)); | 242 | return getter(s).ToString(); |
225 | } | 243 | } |
226 | public override void SetValue(BSScene s, string valAsString) | 244 | public override void SetValue(BSScene s, string valAsString) |
227 | { | 245 | { |
@@ -244,6 +262,7 @@ public static class BSParam | |||
244 | try | 262 | try |
245 | { | 263 | { |
246 | T setValue = (T)parser.Invoke(genericType, new Object[] { valAsString }); | 264 | T setValue = (T)parser.Invoke(genericType, new Object[] { valAsString }); |
265 | // Store the parsed value | ||
247 | setter(s, setValue); | 266 | setter(s, setValue); |
248 | // s.Logger.DebugFormat("{0} Parameter {1} = {2}", LogHeader, name, setValue); | 267 | // s.Logger.DebugFormat("{0} Parameter {1} = {2}", LogHeader, name, setValue); |
249 | } | 268 | } |
@@ -463,7 +482,7 @@ public static class BSParam | |||
463 | (s) => { return TerrainImplementation; }, | 482 | (s) => { return TerrainImplementation; }, |
464 | (s,v) => { TerrainImplementation = v; } ), | 483 | (s,v) => { TerrainImplementation = v; } ), |
465 | new ParameterDefn<int>("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" , | 484 | new ParameterDefn<int>("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" , |
466 | 3, | 485 | 2, |
467 | (s) => { return TerrainMeshMagnification; }, | 486 | (s) => { return TerrainMeshMagnification; }, |
468 | (s,v) => { TerrainMeshMagnification = v; } ), | 487 | (s,v) => { TerrainMeshMagnification = v; } ), |
469 | new ParameterDefn<float>("TerrainFriction", "Factor to reduce movement against terrain surface" , | 488 | new ParameterDefn<float>("TerrainFriction", "Factor to reduce movement against terrain surface" , |
@@ -623,6 +642,31 @@ public static class BSParam | |||
623 | (s) => { return GlobalContactBreakingThreshold; }, | 642 | (s) => { return GlobalContactBreakingThreshold; }, |
624 | (s,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ), | 643 | (s,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ), |
625 | 644 | ||
645 | new ParameterDefn<int>("CSHullMaxDepthSplit", "CS impl: max depth to split for hull. 1-10 but > 7 is iffy", | ||
646 | 7, | ||
647 | (s) => { return CSHullMaxDepthSplit; }, | ||
648 | (s,v) => { CSHullMaxDepthSplit = v; } ), | ||
649 | new ParameterDefn<int>("CSHullMaxDepthSplitForSimpleShapes", "CS impl: max depth setting for simple prim shapes", | ||
650 | 2, | ||
651 | (s) => { return CSHullMaxDepthSplitForSimpleShapes; }, | ||
652 | (s,v) => { CSHullMaxDepthSplitForSimpleShapes = v; } ), | ||
653 | new ParameterDefn<float>("CSHullConcavityThresholdPercent", "CS impl: concavity threshold percent (0-20)", | ||
654 | 5f, | ||
655 | (s) => { return CSHullConcavityThresholdPercent; }, | ||
656 | (s,v) => { CSHullConcavityThresholdPercent = v; } ), | ||
657 | new ParameterDefn<float>("CSHullVolumeConservationThresholdPercent", "percent volume conservation to collapse hulls (0-30)", | ||
658 | 5f, | ||
659 | (s) => { return CSHullVolumeConservationThresholdPercent; }, | ||
660 | (s,v) => { CSHullVolumeConservationThresholdPercent = v; } ), | ||
661 | new ParameterDefn<int>("CSHullMaxVertices", "CS impl: maximum number of vertices in output hulls. Keep < 50.", | ||
662 | 32, | ||
663 | (s) => { return CSHullMaxVertices; }, | ||
664 | (s,v) => { CSHullMaxVertices = v; } ), | ||
665 | new ParameterDefn<float>("CSHullMaxSkinWidth", "CS impl: skin width to apply to output hulls.", | ||
666 | 0, | ||
667 | (s) => { return CSHullMaxSkinWidth; }, | ||
668 | (s,v) => { CSHullMaxSkinWidth = v; } ), | ||
669 | |||
626 | new ParameterDefn<float>("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", | 670 | new ParameterDefn<float>("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", |
627 | (float)BSLinkset.LinksetImplementation.Compound, | 671 | (float)BSLinkset.LinksetImplementation.Compound, |
628 | (s) => { return LinksetImplementation; }, | 672 | (s) => { return LinksetImplementation; }, |