aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs14
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs14
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs54
-rw-r--r--bin/OpenSimDefaults.ini3
4 files changed, 37 insertions, 48 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
index 1b3ba3f..a075995 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
@@ -265,7 +265,6 @@ public class BSLinkset
265 BSPrim childx = child; 265 BSPrim childx = child;
266 m_physicsScene.TaintedObject("AddChildToLinkset", delegate() 266 m_physicsScene.TaintedObject("AddChildToLinkset", delegate()
267 { 267 {
268 // DebugLog("{0}: AddChildToLinkset: adding child {1} to {2}", LogHeader, child.LocalID, m_linksetRoot.LocalID);
269 // DetailLog("{0},AddChildToLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID); 268 // DetailLog("{0},AddChildToLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID);
270 PhysicallyLinkAChildToRoot(rootx, childx); // build the physical binding between me and the child 269 PhysicallyLinkAChildToRoot(rootx, childx); // build the physical binding between me and the child
271 }); 270 });
@@ -294,7 +293,6 @@ public class BSLinkset
294 BSPrim childx = child; 293 BSPrim childx = child;
295 m_physicsScene.TaintedObject("RemoveChildFromLinkset", delegate() 294 m_physicsScene.TaintedObject("RemoveChildFromLinkset", delegate()
296 { 295 {
297 // DebugLog("{0}: RemoveChildFromLinkset: Removing constraint to {1}", LogHeader, child.LocalID);
298 // DetailLog("{0},RemoveChildFromLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID); 296 // DetailLog("{0},RemoveChildFromLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID);
299 297
300 PhysicallyUnlinkAChildFromRoot(rootx, childx); 298 PhysicallyUnlinkAChildFromRoot(rootx, childx);
@@ -326,7 +324,6 @@ public class BSLinkset
326 324
327 // create a constraint that allows no freedom of movement between the two objects 325 // create a constraint that allows no freedom of movement between the two objects
328 // http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818 326 // http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818
329 // DebugLog("{0}: CreateLinkset: Adding a constraint between root prim {1} and child prim {2}", LogHeader, LocalID, childPrim.LocalID);
330 DetailLog("{0},PhysicallyLinkAChildToRoot,taint,root={1},child={2},rLoc={3},cLoc={4},midLoc={5}", 327 DetailLog("{0},PhysicallyLinkAChildToRoot,taint,root={1},child={2},rLoc={3},cLoc={4},midLoc={5}",
331 rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID, rootPrim.Position, childPrim.Position, midPoint); 328 rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID, rootPrim.Position, childPrim.Position, midPoint);
332 BS6DofConstraint constrain = new BS6DofConstraint( 329 BS6DofConstraint constrain = new BS6DofConstraint(
@@ -350,7 +347,6 @@ public class BSLinkset
350 347
351 // create a constraint that allows no freedom of movement between the two objects 348 // create a constraint that allows no freedom of movement between the two objects
352 // http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818 349 // http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818
353 // DebugLog("{0}: CreateLinkset: Adding a constraint between root prim {1} and child prim {2}", LogHeader, LocalID, childPrim.LocalID);
354 DetailLog("{0},PhysicallyLinkAChildToRoot,taint,root={1},child={2}", rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID); 350 DetailLog("{0},PhysicallyLinkAChildToRoot,taint,root={1},child={2}", rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID);
355 BS6DofConstraint constrain = new BS6DofConstraint( 351 BS6DofConstraint constrain = new BS6DofConstraint(
356 PhysicsScene.World, rootPrim.Body, childPrim.Body, 352 PhysicsScene.World, rootPrim.Body, childPrim.Body,
@@ -389,8 +385,6 @@ public class BSLinkset
389 // Called at taint time! 385 // Called at taint time!
390 private void PhysicallyUnlinkAChildFromRoot(BSPrim rootPrim, BSPrim childPrim) 386 private void PhysicallyUnlinkAChildFromRoot(BSPrim rootPrim, BSPrim childPrim)
391 { 387 {
392 // DebugLog("{0}: PhysicallyUnlinkAChildFromRoot: RemoveConstraint between root prim {1} and child prim {2}",
393 // LogHeader, rootPrim.LocalID, childPrim.LocalID);
394 DetailLog("{0},PhysicallyUnlinkAChildFromRoot,taint,root={1},child={2}", rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID); 388 DetailLog("{0},PhysicallyUnlinkAChildFromRoot,taint,root={1},child={2}", rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID);
395 389
396 // Find the constraint for this link and get rid of it from the overall collection and from my list 390 // Find the constraint for this link and get rid of it from the overall collection and from my list
@@ -404,20 +398,12 @@ public class BSLinkset
404 // Called at taint time! 398 // Called at taint time!
405 private void PhysicallyUnlinkAllChildrenFromRoot(BSPrim rootPrim) 399 private void PhysicallyUnlinkAllChildrenFromRoot(BSPrim rootPrim)
406 { 400 {
407 // DebugLog("{0}: PhysicallyUnlinkAllChildren:", LogHeader);
408 DetailLog("{0},PhysicallyUnlinkAllChildren,taint", rootPrim.LocalID); 401 DetailLog("{0},PhysicallyUnlinkAllChildren,taint", rootPrim.LocalID);
409 402
410 m_physicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.Body); 403 m_physicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.Body);
411 } 404 }
412 405
413 // Invoke the detailed logger and output something if it's enabled. 406 // Invoke the detailed logger and output something if it's enabled.
414 private void DebugLog(string msg, params Object[] args)
415 {
416 if (m_physicsScene.ShouldDebugLog)
417 m_physicsScene.Logger.DebugFormat(msg, args);
418 }
419
420 // Invoke the detailed logger and output something if it's enabled.
421 private void DetailLog(string msg, params Object[] args) 407 private void DetailLog(string msg, params Object[] args)
422 { 408 {
423 m_physicsScene.PhysicsLogging.Write(msg, args); 409 m_physicsScene.PhysicsLogging.Write(msg, args);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index b918f84..48cd89b 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -42,8 +42,6 @@ public sealed class BSPrim : PhysicsActor
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43 private static readonly string LogHeader = "[BULLETS PRIM]"; 43 private static readonly string LogHeader = "[BULLETS PRIM]";
44 44
45 private void DebugLog(string mm, params Object[] xx) { if (_scene.ShouldDebugLog) m_log.DebugFormat(mm, xx); }
46
47 private IMesh _mesh; 45 private IMesh _mesh;
48 private PrimitiveBaseShape _pbs; 46 private PrimitiveBaseShape _pbs;
49 private ShapeData.PhysicsShapeType _shapeType; 47 private ShapeData.PhysicsShapeType _shapeType;
@@ -232,7 +230,6 @@ public sealed class BSPrim : PhysicsActor
232 BSPrim parent = obj as BSPrim; 230 BSPrim parent = obj as BSPrim;
233 if (parent != null) 231 if (parent != null)
234 { 232 {
235 DebugLog("{0}: link {1}/{2} to {3}", LogHeader, _avName, _localID, parent.LocalID);
236 BSPrim parentBefore = _linkset.LinksetRoot; 233 BSPrim parentBefore = _linkset.LinksetRoot;
237 int childrenBefore = _linkset.NumberOfChildren; 234 int childrenBefore = _linkset.NumberOfChildren;
238 235
@@ -248,8 +245,6 @@ public sealed class BSPrim : PhysicsActor
248 public override void delink() { 245 public override void delink() {
249 // TODO: decide if this parent checking needs to happen at taint time 246 // TODO: decide if this parent checking needs to happen at taint time
250 // Race condition here: if link() and delink() in same simulation tick, the delink will not happen 247 // Race condition here: if link() and delink() in same simulation tick, the delink will not happen
251 DebugLog("{0}: delink {1}/{2}. Parent={3}", LogHeader, _avName, _localID,
252 _linkset.LinksetRoot._avName+"/"+_linkset.LinksetRoot.LocalID.ToString());
253 248
254 BSPrim parentBefore = _linkset.LinksetRoot; 249 BSPrim parentBefore = _linkset.LinksetRoot;
255 int childrenBefore = _linkset.NumberOfChildren; 250 int childrenBefore = _linkset.NumberOfChildren;
@@ -1042,7 +1037,14 @@ public sealed class BSPrim : PhysicsActor
1042 // No locking here because this is done when we know physics is not simulating 1037 // No locking here because this is done when we know physics is not simulating
1043 private void CreateGeomMesh() 1038 private void CreateGeomMesh()
1044 { 1039 {
1045 float lod = _pbs.SculptEntry ? _scene.SculptLOD : _scene.MeshLOD; 1040 // level of detail based on size and type of the object
1041 float lod = _scene.MeshLOD;
1042 if (_pbs.SculptEntry)
1043 lod = _scene.SculptLOD;
1044 float maxAxis = Math.Max(_size.X, Math.Max(_size.Y, _size.Z));
1045 if (maxAxis > _scene.MeshMegaPrimThreshold)
1046 lod = _scene.MeshMegaPrimLOD;
1047
1046 ulong newMeshKey = (ulong)_pbs.GetMeshKey(_size, lod); 1048 ulong newMeshKey = (ulong)_pbs.GetMeshKey(_size, lod);
1047 // m_log.DebugFormat("{0}: CreateGeomMesh: lID={1}, oldKey={2}, newKey={3}", LogHeader, _localID, _meshKey, newMeshKey); 1049 // m_log.DebugFormat("{0}: CreateGeomMesh: lID={1}, oldKey={2}, newKey={3}", LogHeader, _localID, _meshKey, newMeshKey);
1048 1050
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 0a0e27e..d901ff0 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -73,8 +73,6 @@ 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); }
77
78 public string BulletSimVersion = "?"; 76 public string BulletSimVersion = "?";
79 77
80 private Dictionary<uint, BSCharacter> m_avatars = new Dictionary<uint, BSCharacter>(); 78 private Dictionary<uint, BSCharacter> m_avatars = new Dictionary<uint, BSCharacter>();
@@ -101,16 +99,11 @@ public class BSScene : PhysicsScene, IPhysicsParameters
101 private int m_detailedStatsStep = 0; 99 private int m_detailedStatsStep = 0;
102 100
103 public IMesher mesher; 101 public IMesher mesher;
104 private float m_meshLOD; 102 // Level of Detail values kept as float because that's what the Meshmerizer wants
105 public float MeshLOD 103 public float MeshLOD { get; private set; }
106 { 104 public float MeshMegaPrimLOD { get; private set; }
107 get { return m_meshLOD; } 105 public float MeshMegaPrimThreshold { get; private set; }
108 } 106 public float SculptLOD { get; private set; }
109 private float m_sculptLOD;
110 public float SculptLOD
111 {
112 get { return m_sculptLOD; }
113 }
114 107
115 private BulletSim m_worldSim; 108 private BulletSim m_worldSim;
116 public BulletSim World 109 public BulletSim World
@@ -185,8 +178,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
185 ConfigurationParameters[] m_params; 178 ConfigurationParameters[] m_params;
186 GCHandle m_paramsHandle; 179 GCHandle m_paramsHandle;
187 180
188 public bool ShouldDebugLog { get; private set; } 181 // Handle to the callback used by the unmanaged code to call into the managed code.
189 182 // Used for debug logging.
183 // Need to store the handle in a persistant variable so it won't be freed.
190 private BulletSimAPI.DebugLogCallback m_DebugLogCallbackHandle; 184 private BulletSimAPI.DebugLogCallback m_DebugLogCallbackHandle;
191 185
192 // Sometimes you just have to log everything. 186 // Sometimes you just have to log everything.
@@ -905,16 +899,26 @@ public class BSScene : PhysicsScene, IPhysicsParameters
905 (s) => { return s.NumericBool(s._forceSimplePrimMeshing); }, 899 (s) => { return s.NumericBool(s._forceSimplePrimMeshing); },
906 (s,p,l,v) => { s._forceSimplePrimMeshing = s.BoolNumeric(v); } ), 900 (s,p,l,v) => { s._forceSimplePrimMeshing = s.BoolNumeric(v); } ),
907 901
908 new ParameterDefn("MeshLOD", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", 902 new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)",
909 8f, 903 8f,
910 (s,cf,p,v) => { s.m_meshLOD = cf.GetInt(p, (int)v); }, 904 (s,cf,p,v) => { s.MeshLOD = (float)cf.GetInt(p, (int)v); },
911 (s) => { return (float)s.m_meshLOD; }, 905 (s) => { return s.MeshLOD; },
912 (s,p,l,v) => { s.m_meshLOD = (int)v; } ), 906 (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)", 907 new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters",
908 16f,
909 (s,cf,p,v) => { s.MeshMegaPrimLOD = (float)cf.GetInt(p, (int)v); },
910 (s) => { return s.MeshMegaPrimLOD; },
911 (s,p,l,v) => { s.MeshMegaPrimLOD = v; } ),
912 new ParameterDefn("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD",
913 10f,
914 (s,cf,p,v) => { s.MeshMegaPrimThreshold = (float)cf.GetInt(p, (int)v); },
915 (s) => { return s.MeshMegaPrimThreshold; },
916 (s,p,l,v) => { s.MeshMegaPrimThreshold = v; } ),
917 new ParameterDefn("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)",
914 32f, 918 32f,
915 (s,cf,p,v) => { s.m_sculptLOD = cf.GetInt(p, (int)v); }, 919 (s,cf,p,v) => { s.SculptLOD = (float)cf.GetInt(p, (int)v); },
916 (s) => { return (float)s.m_sculptLOD; }, 920 (s) => { return s.SculptLOD; },
917 (s,p,l,v) => { s.m_sculptLOD = (int)v; } ), 921 (s,p,l,v) => { s.SculptLOD = v; } ),
918 922
919 new ParameterDefn("MaxSubStep", "In simulation step, maximum number of substeps", 923 new ParameterDefn("MaxSubStep", "In simulation step, maximum number of substeps",
920 10f, 924 10f,
@@ -1145,12 +1149,6 @@ public class BSScene : PhysicsScene, IPhysicsParameters
1145 (s,cf,p,v) => { s.m_detailedStatsStep = cf.GetInt(p, (int)v); }, 1149 (s,cf,p,v) => { s.m_detailedStatsStep = cf.GetInt(p, (int)v); },
1146 (s) => { return (float)s.m_detailedStatsStep; }, 1150 (s) => { return (float)s.m_detailedStatsStep; },
1147 (s,p,l,v) => { s.m_detailedStatsStep = (int)v; } ), 1151 (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 }; 1152 };
1155 1153
1156 // Convert a boolean to our numeric true and false values 1154 // Convert a boolean to our numeric true and false values
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index 96f1386..b2fca0c 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -931,6 +931,9 @@
931 931
932 ; level of detail for physical meshes. 32,16,8 or 4 with 32 being full detail 932 ; level of detail for physical meshes. 32,16,8 or 4 with 32 being full detail
933 MeshLevelOfDetail = 8 933 MeshLevelOfDetail = 8
934 ; if mesh size is > threshold meters, we need to add more detail because people will notice
935 MeshLevelOfDetailMegaPrimThreshold = 10
936 MeshLevelOfDetailMegaPrim = 16
934 ; number^2 non-physical level of detail of the sculpt texture. 32x32 - 1024 verticies 937 ; number^2 non-physical level of detail of the sculpt texture. 32x32 - 1024 verticies
935 SculptLevelOfDetail = 32 938 SculptLevelOfDetail = 32
936 939