aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs68
1 files changed, 37 insertions, 31 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 0a0e27e..56924aa 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -73,7 +73,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters
73 private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 73 private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
74 private static readonly string LogHeader = "[BULLETS SCENE]"; 74 private static readonly string LogHeader = "[BULLETS SCENE]";
75 75
76 public void DebugLog(string mm, params Object[] xx) { if (ShouldDebugLog) m_log.DebugFormat(mm, xx); } 76 // The name of the region we're working for.
77 public string RegionName { get; private set; }
77 78
78 public string BulletSimVersion = "?"; 79 public string BulletSimVersion = "?";
79 80
@@ -101,16 +102,11 @@ public class BSScene : PhysicsScene, IPhysicsParameters
101 private int m_detailedStatsStep = 0; 102 private int m_detailedStatsStep = 0;
102 103
103 public IMesher mesher; 104 public IMesher mesher;
104 private float m_meshLOD; 105 // Level of Detail values kept as float because that's what the Meshmerizer wants
105 public float MeshLOD 106 public float MeshLOD { get; private set; }
106 { 107 public float MeshMegaPrimLOD { get; private set; }
107 get { return m_meshLOD; } 108 public float MeshMegaPrimThreshold { get; private set; }
108 } 109 public float SculptLOD { get; private set; }
109 private float m_sculptLOD;
110 public float SculptLOD
111 {
112 get { return m_sculptLOD; }
113 }
114 110
115 private BulletSim m_worldSim; 111 private BulletSim m_worldSim;
116 public BulletSim World 112 public BulletSim World
@@ -185,8 +181,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
185 ConfigurationParameters[] m_params; 181 ConfigurationParameters[] m_params;
186 GCHandle m_paramsHandle; 182 GCHandle m_paramsHandle;
187 183
188 public bool ShouldDebugLog { get; private set; } 184 // Handle to the callback used by the unmanaged code to call into the managed code.
189 185 // Used for debug logging.
186 // Need to store the handle in a persistant variable so it won't be freed.
190 private BulletSimAPI.DebugLogCallback m_DebugLogCallbackHandle; 187 private BulletSimAPI.DebugLogCallback m_DebugLogCallbackHandle;
191 188
192 // Sometimes you just have to log everything. 189 // Sometimes you just have to log everything.
@@ -202,6 +199,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters
202 public BSScene(string identifier) 199 public BSScene(string identifier)
203 { 200 {
204 m_initialized = false; 201 m_initialized = false;
202 // we are passed the name of the region we're working for.
203 RegionName = identifier;
205 } 204 }
206 205
207 public override void Initialise(IMesher meshmerizer, IConfigSource config) 206 public override void Initialise(IMesher meshmerizer, IConfigSource config)
@@ -287,10 +286,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters
287 // Very detailed logging for physics debugging 286 // Very detailed logging for physics debugging
288 m_physicsLoggingEnabled = pConfig.GetBoolean("PhysicsLoggingEnabled", false); 287 m_physicsLoggingEnabled = pConfig.GetBoolean("PhysicsLoggingEnabled", false);
289 m_physicsLoggingDir = pConfig.GetString("PhysicsLoggingDir", "."); 288 m_physicsLoggingDir = pConfig.GetString("PhysicsLoggingDir", ".");
290 m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-"); 289 m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-%REGIONNAME%-");
291 m_physicsLoggingFileMinutes = pConfig.GetInt("PhysicsLoggingFileMinutes", 5); 290 m_physicsLoggingFileMinutes = pConfig.GetInt("PhysicsLoggingFileMinutes", 5);
292 // Very detailed logging for vehicle debugging 291 // Very detailed logging for vehicle debugging
293 m_vehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false); 292 m_vehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false);
293
294 // Do any replacements in the parameters
295 m_physicsLoggingPrefix = m_physicsLoggingPrefix.Replace("%REGIONNAME%", RegionName);
294 } 296 }
295 } 297 }
296 } 298 }
@@ -368,7 +370,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
368 BSPrim bsprim = prim as BSPrim; 370 BSPrim bsprim = prim as BSPrim;
369 if (bsprim != null) 371 if (bsprim != null)
370 { 372 {
371 // DetailLog("{0},RemovePrim,call", bsprim.LocalID); 373 DetailLog("{0},RemovePrim,call", bsprim.LocalID);
372 // m_log.DebugFormat("{0}: RemovePrim. id={1}/{2}", LogHeader, bsprim.Name, bsprim.LocalID); 374 // m_log.DebugFormat("{0}: RemovePrim. id={1}/{2}", LogHeader, bsprim.Name, bsprim.LocalID);
373 try 375 try
374 { 376 {
@@ -394,7 +396,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
394 396
395 if (!m_initialized) return null; 397 if (!m_initialized) return null;
396 398
397 // DetailLog("{0},AddPrimShape,call", localID); 399 DetailLog("{0},AddPrimShape,call", localID);
398 400
399 BSPrim prim = new BSPrim(localID, primName, this, position, size, rotation, pbs, isPhysical); 401 BSPrim prim = new BSPrim(localID, primName, this, position, size, rotation, pbs, isPhysical);
400 lock (m_prims) m_prims.Add(localID, prim); 402 lock (m_prims) m_prims.Add(localID, prim);
@@ -540,7 +542,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
540 else if (m_avatars.ContainsKey(collidingWith)) 542 else if (m_avatars.ContainsKey(collidingWith))
541 type = ActorTypes.Agent; 543 type = ActorTypes.Agent;
542 544
543 DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith); 545 // DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith);
544 546
545 BSPrim prim; 547 BSPrim prim;
546 if (m_prims.TryGetValue(localID, out prim)) { 548 if (m_prims.TryGetValue(localID, out prim)) {
@@ -905,16 +907,26 @@ public class BSScene : PhysicsScene, IPhysicsParameters
905 (s) => { return s.NumericBool(s._forceSimplePrimMeshing); }, 907 (s) => { return s.NumericBool(s._forceSimplePrimMeshing); },
906 (s,p,l,v) => { s._forceSimplePrimMeshing = s.BoolNumeric(v); } ), 908 (s,p,l,v) => { s._forceSimplePrimMeshing = s.BoolNumeric(v); } ),
907 909
908 new ParameterDefn("MeshLOD", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", 910 new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)",
909 8f, 911 8f,
910 (s,cf,p,v) => { s.m_meshLOD = cf.GetInt(p, (int)v); }, 912 (s,cf,p,v) => { s.MeshLOD = (float)cf.GetInt(p, (int)v); },
911 (s) => { return (float)s.m_meshLOD; }, 913 (s) => { return s.MeshLOD; },
912 (s,p,l,v) => { s.m_meshLOD = (int)v; } ), 914 (s,p,l,v) => { s.MeshLOD = v; } ),
913 new ParameterDefn("SculptLOD", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)", 915 new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters",
916 16f,
917 (s,cf,p,v) => { s.MeshMegaPrimLOD = (float)cf.GetInt(p, (int)v); },
918 (s) => { return s.MeshMegaPrimLOD; },
919 (s,p,l,v) => { s.MeshMegaPrimLOD = v; } ),
920 new ParameterDefn("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD",
921 10f,
922 (s,cf,p,v) => { s.MeshMegaPrimThreshold = (float)cf.GetInt(p, (int)v); },
923 (s) => { return s.MeshMegaPrimThreshold; },
924 (s,p,l,v) => { s.MeshMegaPrimThreshold = v; } ),
925 new ParameterDefn("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)",
914 32f, 926 32f,
915 (s,cf,p,v) => { s.m_sculptLOD = cf.GetInt(p, (int)v); }, 927 (s,cf,p,v) => { s.SculptLOD = (float)cf.GetInt(p, (int)v); },
916 (s) => { return (float)s.m_sculptLOD; }, 928 (s) => { return s.SculptLOD; },
917 (s,p,l,v) => { s.m_sculptLOD = (int)v; } ), 929 (s,p,l,v) => { s.SculptLOD = v; } ),
918 930
919 new ParameterDefn("MaxSubStep", "In simulation step, maximum number of substeps", 931 new ParameterDefn("MaxSubStep", "In simulation step, maximum number of substeps",
920 10f, 932 10f,
@@ -1145,12 +1157,6 @@ public class BSScene : PhysicsScene, IPhysicsParameters
1145 (s,cf,p,v) => { s.m_detailedStatsStep = cf.GetInt(p, (int)v); }, 1157 (s,cf,p,v) => { s.m_detailedStatsStep = cf.GetInt(p, (int)v); },
1146 (s) => { return (float)s.m_detailedStatsStep; }, 1158 (s) => { return (float)s.m_detailedStatsStep; },
1147 (s,p,l,v) => { s.m_detailedStatsStep = (int)v; } ), 1159 (s,p,l,v) => { s.m_detailedStatsStep = (int)v; } ),
1148 new ParameterDefn("ShouldDebugLog", "Enables detailed DEBUG log statements",
1149 ConfigurationParameters.numericFalse,
1150 (s,cf,p,v) => { s.ShouldDebugLog = cf.GetBoolean(p, s.BoolNumeric(v)); },
1151 (s) => { return s.NumericBool(s.ShouldDebugLog); },
1152 (s,p,l,v) => { s.ShouldDebugLog = s.BoolNumeric(v); } ),
1153
1154 }; 1160 };
1155 1161
1156 // Convert a boolean to our numeric true and false values 1162 // Convert a boolean to our numeric true and false values