diff options
author | Robert Adams | 2012-07-12 11:29:45 -0700 |
---|---|---|
committer | Robert Adams | 2012-07-20 14:02:22 -0700 |
commit | f9913b6ef7e7f18075e1e42ed5e347ce2a8b8ef5 (patch) | |
tree | 4fd98992014819aaede4a53243ab35324b0f1fea /OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |
parent | As per opensim-dev mailing list discussion, extend llGetDetectedType() to ret... (diff) | |
download | opensim-SC_OLD-f9913b6ef7e7f18075e1e42ed5e347ce2a8b8ef5.zip opensim-SC_OLD-f9913b6ef7e7f18075e1e42ed5e347ce2a8b8ef5.tar.gz opensim-SC_OLD-f9913b6ef7e7f18075e1e42ed5e347ce2a8b8ef5.tar.bz2 opensim-SC_OLD-f9913b6ef7e7f18075e1e42ed5e347ce2a8b8ef5.tar.xz |
BulletSim: Add detailed and voluminous debug logging that is enabled
with an ini configuration parameter.
Correct computation of relative offsets of children in a linkset.
Remove a prim from any link relationship before deleting it.
Minor code flow cleanups.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 417cb5f..eb1d798 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -72,6 +72,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
72 | private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 72 | private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
73 | private static readonly string LogHeader = "[BULLETS SCENE]"; | 73 | private static readonly string LogHeader = "[BULLETS SCENE]"; |
74 | 74 | ||
75 | private void DebugLog(string mm, params Object[] xx) { if (shouldDebugLog) m_log.DebugFormat(mm, xx); } | ||
76 | |||
75 | public string BulletSimVersion = "?"; | 77 | public string BulletSimVersion = "?"; |
76 | 78 | ||
77 | private Dictionary<uint, BSCharacter> m_avatars = new Dictionary<uint, BSCharacter>(); | 79 | private Dictionary<uint, BSCharacter> m_avatars = new Dictionary<uint, BSCharacter>(); |
@@ -147,6 +149,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
147 | ConfigurationParameters[] m_params; | 149 | ConfigurationParameters[] m_params; |
148 | GCHandle m_paramsHandle; | 150 | GCHandle m_paramsHandle; |
149 | 151 | ||
152 | public bool shouldDebugLog { get; private set; } | ||
153 | |||
150 | private BulletSimAPI.DebugLogCallback m_DebugLogCallbackHandle; | 154 | private BulletSimAPI.DebugLogCallback m_DebugLogCallbackHandle; |
151 | 155 | ||
152 | public BSScene(string identifier) | 156 | public BSScene(string identifier) |
@@ -209,6 +213,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
209 | m_meshLOD = 8f; | 213 | m_meshLOD = 8f; |
210 | m_sculptLOD = 32f; | 214 | m_sculptLOD = 32f; |
211 | 215 | ||
216 | shouldDebugLog = false; | ||
212 | m_detailedStatsStep = 0; // disabled | 217 | m_detailedStatsStep = 0; // disabled |
213 | 218 | ||
214 | m_maxSubSteps = 10; | 219 | m_maxSubSteps = 10; |
@@ -261,7 +266,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
261 | _meshSculptedPrim = pConfig.GetBoolean("MeshSculptedPrim", _meshSculptedPrim); | 266 | _meshSculptedPrim = pConfig.GetBoolean("MeshSculptedPrim", _meshSculptedPrim); |
262 | _forceSimplePrimMeshing = pConfig.GetBoolean("ForceSimplePrimMeshing", _forceSimplePrimMeshing); | 267 | _forceSimplePrimMeshing = pConfig.GetBoolean("ForceSimplePrimMeshing", _forceSimplePrimMeshing); |
263 | 268 | ||
269 | shouldDebugLog = pConfig.GetBoolean("ShouldDebugLog", shouldDebugLog); | ||
264 | m_detailedStatsStep = pConfig.GetInt("DetailedStatsStep", m_detailedStatsStep); | 270 | m_detailedStatsStep = pConfig.GetInt("DetailedStatsStep", m_detailedStatsStep); |
271 | |||
265 | m_meshLOD = pConfig.GetFloat("MeshLevelOfDetail", m_meshLOD); | 272 | m_meshLOD = pConfig.GetFloat("MeshLevelOfDetail", m_meshLOD); |
266 | m_sculptLOD = pConfig.GetFloat("SculptLevelOfDetail", m_sculptLOD); | 273 | m_sculptLOD = pConfig.GetFloat("SculptLevelOfDetail", m_sculptLOD); |
267 | 274 | ||
@@ -347,34 +354,42 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
347 | public override void RemoveAvatar(PhysicsActor actor) | 354 | public override void RemoveAvatar(PhysicsActor actor) |
348 | { | 355 | { |
349 | // m_log.DebugFormat("{0}: RemoveAvatar", LogHeader); | 356 | // m_log.DebugFormat("{0}: RemoveAvatar", LogHeader); |
350 | if (actor is BSCharacter) | 357 | BSCharacter bsactor = actor as BSCharacter; |
351 | { | 358 | if (bsactor != null) |
352 | ((BSCharacter)actor).Destroy(); | ||
353 | } | ||
354 | try | ||
355 | { | 359 | { |
356 | lock (m_avatars) m_avatars.Remove(actor.LocalID); | 360 | try |
357 | } | 361 | { |
358 | catch (Exception e) | 362 | lock (m_avatars) m_avatars.Remove(actor.LocalID); |
359 | { | 363 | } |
360 | m_log.WarnFormat("{0}: Attempt to remove avatar that is not in physics scene: {1}", LogHeader, e); | 364 | catch (Exception e) |
365 | { | ||
366 | m_log.WarnFormat("{0}: Attempt to remove avatar that is not in physics scene: {1}", LogHeader, e); | ||
367 | } | ||
368 | bsactor.Destroy(); | ||
369 | // bsactor.dispose(); | ||
361 | } | 370 | } |
362 | } | 371 | } |
363 | 372 | ||
364 | public override void RemovePrim(PhysicsActor prim) | 373 | public override void RemovePrim(PhysicsActor prim) |
365 | { | 374 | { |
366 | // m_log.DebugFormat("{0}: RemovePrim", LogHeader); | 375 | BSPrim bsprim = prim as BSPrim; |
367 | if (prim is BSPrim) | 376 | if (bsprim != null) |
368 | { | ||
369 | ((BSPrim)prim).Destroy(); | ||
370 | } | ||
371 | try | ||
372 | { | 377 | { |
373 | lock (m_prims) m_prims.Remove(prim.LocalID); | 378 | m_log.DebugFormat("{0}: RemovePrim. id={1}/{2}", LogHeader, bsprim.Name, bsprim.LocalID); |
379 | try | ||
380 | { | ||
381 | lock (m_prims) m_prims.Remove(bsprim.LocalID); | ||
382 | } | ||
383 | catch (Exception e) | ||
384 | { | ||
385 | m_log.ErrorFormat("{0}: Attempt to remove prim that is not in physics scene: {1}", LogHeader, e); | ||
386 | } | ||
387 | bsprim.Destroy(); | ||
388 | // bsprim.dispose(); | ||
374 | } | 389 | } |
375 | catch (Exception e) | 390 | else |
376 | { | 391 | { |
377 | m_log.WarnFormat("{0}: Attempt to remove prim that is not in physics scene: {1}", LogHeader, e); | 392 | m_log.ErrorFormat("{0}: Attempt to remove prim that is not a BSPrim type.", LogHeader); |
378 | } | 393 | } |
379 | } | 394 | } |
380 | 395 | ||