diff options
author | Robert Adams | 2011-08-26 15:51:21 -0700 |
---|---|---|
committer | Mic Bowman | 2011-08-26 15:51:21 -0700 |
commit | 21708b832b1d6679d5f6de27eb3bd0b920ef0fa7 (patch) | |
tree | dba3bb4565adfdd1aaad9720c002f1f1ca3ce990 /OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |
parent | Merge branch 'master' into bulletsim (diff) | |
download | opensim-SC_OLD-21708b832b1d6679d5f6de27eb3bd0b920ef0fa7.zip opensim-SC_OLD-21708b832b1d6679d5f6de27eb3bd0b920ef0fa7.tar.gz opensim-SC_OLD-21708b832b1d6679d5f6de27eb3bd0b920ef0fa7.tar.bz2 opensim-SC_OLD-21708b832b1d6679d5f6de27eb3bd0b920ef0fa7.tar.xz |
BulletSim: add mesh representation. Use meshes for static objects and switch to hulls for physical objects.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 518be09..e91455a 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -37,7 +37,6 @@ using OpenMetaverse; | |||
37 | using OpenSim.Region.Framework; | 37 | using OpenSim.Region.Framework; |
38 | 38 | ||
39 | // TODOs for BulletSim (for BSScene, BSPrim, BSCharacter and BulletSim) | 39 | // TODOs for BulletSim (for BSScene, BSPrim, BSCharacter and BulletSim) |
40 | // Parameterize BulletSim. Pass a structure of parameters to the C++ code. Capsule size, friction, ... | ||
41 | // Adjust character capsule size when height is adjusted (ScenePresence.SetHeight) | 40 | // Adjust character capsule size when height is adjusted (ScenePresence.SetHeight) |
42 | // Test sculpties | 41 | // Test sculpties |
43 | // Compute physics FPS reasonably | 42 | // Compute physics FPS reasonably |
@@ -52,8 +51,6 @@ using OpenSim.Region.Framework; | |||
52 | // Implement the genCollisions feature in BulletSim::SetObjectProperties (don't pass up unneeded collisions) | 51 | // Implement the genCollisions feature in BulletSim::SetObjectProperties (don't pass up unneeded collisions) |
53 | // Implement LockAngularMotion | 52 | // Implement LockAngularMotion |
54 | // Decide if clearing forces is the right thing to do when setting position (BulletSim::SetObjectTranslation) | 53 | // Decide if clearing forces is the right thing to do when setting position (BulletSim::SetObjectTranslation) |
55 | // Built Galton board (lots of MoveTo's) and some slats were not positioned correctly (mistakes scattered) | ||
56 | // No mistakes with ODE. Shape creation race condition? | ||
57 | // Does NeedsMeshing() really need to exclude all the different shapes? | 54 | // Does NeedsMeshing() really need to exclude all the different shapes? |
58 | // | 55 | // |
59 | namespace OpenSim.Region.Physics.BulletSPlugin | 56 | namespace OpenSim.Region.Physics.BulletSPlugin |
@@ -81,6 +78,11 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
81 | { | 78 | { |
82 | get { return m_meshLOD; } | 79 | get { return m_meshLOD; } |
83 | } | 80 | } |
81 | private int m_sculptLOD; | ||
82 | public int SculptLOD | ||
83 | { | ||
84 | get { return m_sculptLOD; } | ||
85 | } | ||
84 | 86 | ||
85 | private int m_maxSubSteps; | 87 | private int m_maxSubSteps; |
86 | private float m_fixedTimeStep; | 88 | private float m_fixedTimeStep; |
@@ -187,7 +189,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
187 | _meshSculptedPrim = true; // mesh sculpted prims | 189 | _meshSculptedPrim = true; // mesh sculpted prims |
188 | _forceSimplePrimMeshing = false; // use complex meshing if called for | 190 | _forceSimplePrimMeshing = false; // use complex meshing if called for |
189 | 191 | ||
190 | m_meshLOD = 32; | 192 | m_meshLOD = 8; |
193 | m_sculptLOD = 32; | ||
191 | 194 | ||
192 | m_maxSubSteps = 10; | 195 | m_maxSubSteps = 10; |
193 | m_fixedTimeStep = 1f / 60f; | 196 | m_fixedTimeStep = 1f / 60f; |
@@ -229,6 +232,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
229 | _forceSimplePrimMeshing = pConfig.GetBoolean("ForceSimplePrimMeshing", _forceSimplePrimMeshing); | 232 | _forceSimplePrimMeshing = pConfig.GetBoolean("ForceSimplePrimMeshing", _forceSimplePrimMeshing); |
230 | 233 | ||
231 | m_meshLOD = pConfig.GetInt("MeshLevelOfDetail", m_meshLOD); | 234 | m_meshLOD = pConfig.GetInt("MeshLevelOfDetail", m_meshLOD); |
235 | m_sculptLOD = pConfig.GetInt("SculptLevelOfDetail", m_sculptLOD); | ||
232 | 236 | ||
233 | m_maxSubSteps = pConfig.GetInt("MaxSubSteps", m_maxSubSteps); | 237 | m_maxSubSteps = pConfig.GetInt("MaxSubSteps", m_maxSubSteps); |
234 | m_fixedTimeStep = pConfig.GetFloat("FixedTimeStep", m_fixedTimeStep); | 238 | m_fixedTimeStep = pConfig.GetFloat("FixedTimeStep", m_fixedTimeStep); |
@@ -489,10 +493,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
489 | // can use an internal representation for the prim | 493 | // can use an internal representation for the prim |
490 | if (!_forceSimplePrimMeshing) | 494 | if (!_forceSimplePrimMeshing) |
491 | { | 495 | { |
492 | // m_log.DebugFormat("{0}: NeedsMeshing: simple mesh: profshape={1}, curve={2}", LogHeader, pbs.ProfileShape, pbs.PathCurve); | ||
493 | if ((pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight) | 496 | if ((pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight) |
494 | || (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1 | 497 | || (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1 |
495 | && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z)) | 498 | && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z)) |
496 | { | 499 | { |
497 | 500 | ||
498 | if (pbs.ProfileBegin == 0 && pbs.ProfileEnd == 0 | 501 | if (pbs.ProfileBegin == 0 && pbs.ProfileEnd == 0 |
@@ -663,7 +666,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
663 | #region Runtime settable parameters | 666 | #region Runtime settable parameters |
664 | public static PhysParameterEntry[] SettableParameters = new PhysParameterEntry[] | 667 | public static PhysParameterEntry[] SettableParameters = new PhysParameterEntry[] |
665 | { | 668 | { |
666 | new PhysParameterEntry("MeshLOD", "Level of detail to render meshes (Power of two. Default 32)"), | 669 | new PhysParameterEntry("MeshLOD", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)"), |
670 | new PhysParameterEntry("SculptLOD", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)"), | ||
667 | new PhysParameterEntry("MaxSubStep", "In simulation step, maximum number of substeps"), | 671 | new PhysParameterEntry("MaxSubStep", "In simulation step, maximum number of substeps"), |
668 | new PhysParameterEntry("FixedTimeStep", "In simulation step, seconds of one substep (1/60)"), | 672 | new PhysParameterEntry("FixedTimeStep", "In simulation step, seconds of one substep (1/60)"), |
669 | new PhysParameterEntry("MaxObjectMass", "Maximum object mass (10000.01)"), | 673 | new PhysParameterEntry("MaxObjectMass", "Maximum object mass (10000.01)"), |
@@ -712,6 +716,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
712 | switch (lparm) | 716 | switch (lparm) |
713 | { | 717 | { |
714 | case "meshlod": m_meshLOD = (int)val; break; | 718 | case "meshlod": m_meshLOD = (int)val; break; |
719 | case "sculptlod": m_sculptLOD = (int)val; break; | ||
715 | case "maxsubstep": m_maxSubSteps = (int)val; break; | 720 | case "maxsubstep": m_maxSubSteps = (int)val; break; |
716 | case "fixedtimestep": m_fixedTimeStep = val; break; | 721 | case "fixedtimestep": m_fixedTimeStep = val; break; |
717 | case "maxobjectmass": m_maximumObjectMass = val; break; | 722 | case "maxobjectmass": m_maximumObjectMass = val; break; |
@@ -812,6 +817,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
812 | switch (parm.ToLower()) | 817 | switch (parm.ToLower()) |
813 | { | 818 | { |
814 | case "meshlod": val = (float)m_meshLOD; break; | 819 | case "meshlod": val = (float)m_meshLOD; break; |
820 | case "sculptlod": val = (float)m_sculptLOD; break; | ||
815 | case "maxsubstep": val = (float)m_maxSubSteps; break; | 821 | case "maxsubstep": val = (float)m_maxSubSteps; break; |
816 | case "fixedtimestep": val = m_fixedTimeStep; break; | 822 | case "fixedtimestep": val = m_fixedTimeStep; break; |
817 | case "maxobjectmass": val = m_maximumObjectMass; break; | 823 | case "maxobjectmass": val = m_maximumObjectMass; break; |