aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
diff options
context:
space:
mode:
authorRobert Adams2013-02-16 22:14:38 -0800
committerRobert Adams2013-02-17 20:13:48 -0800
commit885b45b112607e3edf12838cf01cfefa6da884ae (patch)
treebd328e463e7d7da8bc1430f1d21e77b928868d4f /OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
parent* Fix walking to <NaN, NaN, NaN> via autopilot. (diff)
downloadopensim-SC_OLD-885b45b112607e3edf12838cf01cfefa6da884ae.zip
opensim-SC_OLD-885b45b112607e3edf12838cf01cfefa6da884ae.tar.gz
opensim-SC_OLD-885b45b112607e3edf12838cf01cfefa6da884ae.tar.bz2
opensim-SC_OLD-885b45b112607e3edf12838cf01cfefa6da884ae.tar.xz
BulletSim: rework parameter setting for different types of values
(like vectors or quaternions).
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs54
1 files changed, 15 insertions, 39 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 05722b8..e6aefd5 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -161,7 +161,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
161 private int m_physicsLoggingFileMinutes; 161 private int m_physicsLoggingFileMinutes;
162 private bool m_physicsLoggingDoFlush; 162 private bool m_physicsLoggingDoFlush;
163 private bool m_physicsPhysicalDumpEnabled; 163 private bool m_physicsPhysicalDumpEnabled;
164 public float PhysicsMetricDumpFrames { get; set; } 164 public int PhysicsMetricDumpFrames { get; set; }
165 // 'true' of the vehicle code is to log lots of details 165 // 'true' of the vehicle code is to log lots of details
166 public bool VehicleLoggingEnabled { get; private set; } 166 public bool VehicleLoggingEnabled { get; private set; }
167 public bool VehiclePhysicalLoggingEnabled { get; private set; } 167 public bool VehiclePhysicalLoggingEnabled { get; private set; }
@@ -542,7 +542,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
542 collidersCount = 0; 542 collidersCount = 0;
543 } 543 }
544 544
545 if ((m_simulationStep % PhysicsMetricDumpFrames) == 0) 545 if (PhysicsMetricDumpFrames != 0 && ((m_simulationStep % PhysicsMetricDumpFrames) == 0))
546 PE.DumpPhysicsStatistics(World); 546 PE.DumpPhysicsStatistics(World);
547 547
548 // Get a value for 'now' so all the collision and update routines don't have to get their own. 548 // Get a value for 'now' so all the collision and update routines don't have to get their own.
@@ -880,38 +880,14 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
880 { 880 {
881 bool ret = false; 881 bool ret = false;
882 882
883 float valf = 0f; 883 BSParam.ParameterDefnBase theParam;
884 if (val.ToLower() == "true")
885 {
886 valf = PhysParameterEntry.NUMERIC_TRUE;
887 }
888 else
889 {
890 if (val.ToLower() == "false")
891 {
892 valf = PhysParameterEntry.NUMERIC_FALSE;
893 }
894 else
895 {
896 try
897 {
898 valf = float.Parse(val);
899 }
900 catch
901 {
902 valf = 0f;
903 }
904 }
905 }
906
907 BSParam.ParameterDefn theParam;
908 if (BSParam.TryGetParameter(parm, out theParam)) 884 if (BSParam.TryGetParameter(parm, out theParam))
909 { 885 {
910 // Set the value in the C# code 886 // Set the value in the C# code
911 theParam.setter(this, parm, localID, valf); 887 theParam.SetValue(this, val);
912 888
913 // Optionally set the parameter in the unmanaged code 889 // Optionally set the parameter in the unmanaged code
914 if (theParam.onObject != null) 890 if (theParam.HasSetOnObject)
915 { 891 {
916 // update all the localIDs specified 892 // update all the localIDs specified
917 // If the local ID is APPLY_TO_NONE, just change the default value 893 // If the local ID is APPLY_TO_NONE, just change the default value
@@ -923,16 +899,16 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
923 case PhysParameterEntry.APPLY_TO_NONE: 899 case PhysParameterEntry.APPLY_TO_NONE:
924 // This will cause a call into the physical world if some operation is specified (SetOnObject). 900 // This will cause a call into the physical world if some operation is specified (SetOnObject).
925 objectIDs.Add(TERRAIN_ID); 901 objectIDs.Add(TERRAIN_ID);
926 TaintedUpdateParameter(parm, objectIDs, valf); 902 TaintedUpdateParameter(parm, objectIDs, val);
927 break; 903 break;
928 case PhysParameterEntry.APPLY_TO_ALL: 904 case PhysParameterEntry.APPLY_TO_ALL:
929 lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys); 905 lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys);
930 TaintedUpdateParameter(parm, objectIDs, valf); 906 TaintedUpdateParameter(parm, objectIDs, val);
931 break; 907 break;
932 default: 908 default:
933 // setting only one localID 909 // setting only one localID
934 objectIDs.Add(localID); 910 objectIDs.Add(localID);
935 TaintedUpdateParameter(parm, objectIDs, valf); 911 TaintedUpdateParameter(parm, objectIDs, val);
936 break; 912 break;
937 } 913 }
938 } 914 }
@@ -943,22 +919,22 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
943 } 919 }
944 920
945 // schedule the actual updating of the paramter to when the phys engine is not busy 921 // schedule the actual updating of the paramter to when the phys engine is not busy
946 private void TaintedUpdateParameter(string parm, List<uint> lIDs, float val) 922 private void TaintedUpdateParameter(string parm, List<uint> lIDs, string val)
947 { 923 {
948 float xval = val; 924 string xval = val;
949 List<uint> xlIDs = lIDs; 925 List<uint> xlIDs = lIDs;
950 string xparm = parm; 926 string xparm = parm;
951 TaintedObject("BSScene.UpdateParameterSet", delegate() { 927 TaintedObject("BSScene.UpdateParameterSet", delegate() {
952 BSParam.ParameterDefn thisParam; 928 BSParam.ParameterDefnBase thisParam;
953 if (BSParam.TryGetParameter(xparm, out thisParam)) 929 if (BSParam.TryGetParameter(xparm, out thisParam))
954 { 930 {
955 if (thisParam.onObject != null) 931 if (thisParam.HasSetOnObject)
956 { 932 {
957 foreach (uint lID in xlIDs) 933 foreach (uint lID in xlIDs)
958 { 934 {
959 BSPhysObject theObject = null; 935 BSPhysObject theObject = null;
960 if (PhysObjects.TryGetValue(lID, out theObject)) 936 if (PhysObjects.TryGetValue(lID, out theObject))
961 thisParam.onObject(this, theObject, xval); 937 thisParam.SetOnObject(this, theObject);
962 } 938 }
963 } 939 }
964 } 940 }
@@ -971,10 +947,10 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
971 { 947 {
972 string val = String.Empty; 948 string val = String.Empty;
973 bool ret = false; 949 bool ret = false;
974 BSParam.ParameterDefn theParam; 950 BSParam.ParameterDefnBase theParam;
975 if (BSParam.TryGetParameter(parm, out theParam)) 951 if (BSParam.TryGetParameter(parm, out theParam))
976 { 952 {
977 val = theParam.getter(this).ToString(); 953 val = theParam.GetValue(this);
978 ret = true; 954 ret = true;
979 } 955 }
980 value = val; 956 value = val;