aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Meshing
diff options
context:
space:
mode:
authorRobert Adams2013-05-23 14:41:05 -0700
committerRobert Adams2013-05-23 14:41:05 -0700
commit0e002e369339719204f26c07157713bfc40fecca (patch)
tree20238dc170ce828ede19b71b53bc46b07057f73c /OpenSim/Region/Physics/Meshing
parentBulletSim: add locking around Meshmerizer use to eliminate possible race (diff)
downloadopensim-SC_OLD-0e002e369339719204f26c07157713bfc40fecca.zip
opensim-SC_OLD-0e002e369339719204f26c07157713bfc40fecca.tar.gz
opensim-SC_OLD-0e002e369339719204f26c07157713bfc40fecca.tar.bz2
opensim-SC_OLD-0e002e369339719204f26c07157713bfc40fecca.tar.xz
Add DEBUG level logging in Meshmerizer for mesh parsing. There is
a compile time variable to turn this logging off if it is too spammy.
Diffstat (limited to 'OpenSim/Region/Physics/Meshing')
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs27
1 files changed, 25 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index 79edc12..adc0dc9 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -64,6 +64,7 @@ namespace OpenSim.Region.Physics.Meshing
64 public class Meshmerizer : IMesher 64 public class Meshmerizer : IMesher
65 { 65 {
66 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 66 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
67 private static string LogHeader = "[MESH]";
67 68
68 // Setting baseDir to a path will enable the dumping of raw files 69 // Setting baseDir to a path will enable the dumping of raw files
69 // raw files can be imported by blender so a visual inspection of the results can be done 70 // raw files can be imported by blender so a visual inspection of the results can be done
@@ -72,6 +73,8 @@ namespace OpenSim.Region.Physics.Meshing
72#else 73#else
73 private const string baseDir = null; //"rawFiles"; 74 private const string baseDir = null; //"rawFiles";
74#endif 75#endif
76 // If 'true', lots of DEBUG logging of asset parsing details
77 private bool debugDetail = true;
75 78
76 private bool cacheSculptMaps = true; 79 private bool cacheSculptMaps = true;
77 private string decodedSculptMapPath = null; 80 private string decodedSculptMapPath = null;
@@ -357,13 +360,25 @@ namespace OpenSim.Region.Physics.Meshing
357 OSDMap physicsParms = null; 360 OSDMap physicsParms = null;
358 OSDMap map = (OSDMap)meshOsd; 361 OSDMap map = (OSDMap)meshOsd;
359 if (map.ContainsKey("physics_shape")) 362 if (map.ContainsKey("physics_shape"))
363 {
360 physicsParms = (OSDMap)map["physics_shape"]; // old asset format 364 physicsParms = (OSDMap)map["physics_shape"]; // old asset format
365 if (debugDetail) m_log.DebugFormat("{0} prim='{1}': using 'physics_shape' mesh data", LogHeader, primName);
366 }
361 else if (map.ContainsKey("physics_mesh")) 367 else if (map.ContainsKey("physics_mesh"))
368 {
362 physicsParms = (OSDMap)map["physics_mesh"]; // new asset format 369 physicsParms = (OSDMap)map["physics_mesh"]; // new asset format
370 if (debugDetail) m_log.DebugFormat("{0} prim='{1}':using 'physics_mesh' mesh data", LogHeader, primName);
371 }
363 else if (map.ContainsKey("medium_lod")) 372 else if (map.ContainsKey("medium_lod"))
373 {
364 physicsParms = (OSDMap)map["medium_lod"]; // if no physics mesh, try to fall back to medium LOD display mesh 374 physicsParms = (OSDMap)map["medium_lod"]; // if no physics mesh, try to fall back to medium LOD display mesh
375 if (debugDetail) m_log.DebugFormat("{0} prim='{1}':using 'medium_lod' mesh data", LogHeader, primName);
376 }
365 else if (map.ContainsKey("high_lod")) 377 else if (map.ContainsKey("high_lod"))
378 {
366 physicsParms = (OSDMap)map["high_lod"]; // if all else fails, use highest LOD display mesh and hope it works :) 379 physicsParms = (OSDMap)map["high_lod"]; // if all else fails, use highest LOD display mesh and hope it works :)
380 if (debugDetail) m_log.DebugFormat("{0} prim='{1}':using 'high_lod' mesh data", LogHeader, primName);
381 }
367 382
368 if (map.ContainsKey("physics_convex")) 383 if (map.ContainsKey("physics_convex"))
369 { // pull this out also in case physics engine can use it 384 { // pull this out also in case physics engine can use it
@@ -408,11 +423,16 @@ namespace OpenSim.Region.Physics.Meshing
408 } 423 }
409 424
410 mConvexHulls = hulls; 425 mConvexHulls = hulls;
426 if (debugDetail) m_log.DebugFormat("{0} prim='{1}': parsed hulls. nHulls={2}", LogHeader, primName, mConvexHulls.Count);
427 }
428 else
429 {
430 if (debugDetail) m_log.DebugFormat("{0} prim='{1}' has physics_convex but no HullList", LogHeader, primName);
411 } 431 }
412 } 432 }
413 catch (Exception e) 433 catch (Exception e)
414 { 434 {
415 m_log.WarnFormat("[MESH]: exception decoding convex block: {0}", e.Message); 435 m_log.WarnFormat("{0} exception decoding convex block: {1}", LogHeader, e);
416 } 436 }
417 } 437 }
418 438
@@ -438,7 +458,7 @@ namespace OpenSim.Region.Physics.Meshing
438 } 458 }
439 catch (Exception e) 459 catch (Exception e)
440 { 460 {
441 m_log.Error("[MESH]: exception decoding physical mesh: " + e.ToString()); 461 m_log.ErrorFormat("{0} prim='{1}': exception decoding physical mesh: {2}", LogHeader, primName, e);
442 return false; 462 return false;
443 } 463 }
444 464
@@ -455,6 +475,9 @@ namespace OpenSim.Region.Physics.Meshing
455 if (subMeshOsd is OSDMap) 475 if (subMeshOsd is OSDMap)
456 AddSubMesh(subMeshOsd as OSDMap, size, coords, faces); 476 AddSubMesh(subMeshOsd as OSDMap, size, coords, faces);
457 } 477 }
478 if (debugDetail)
479 m_log.DebugFormat("{0} {1}: mesh decoded. offset={2}, size={3}, nCoords={4}, nFaces={5}",
480 LogHeader, primName, physOffset, physSize, coords.Count, faces.Count);
458 } 481 }
459 } 482 }
460 483