aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorMelanie2013-02-06 02:22:12 +0000
committerMelanie2013-02-06 02:22:12 +0000
commitf567ff9f51aebe522c210b5d34b26754de157c91 (patch)
treeeac712a0ba78ca92b3178e2d532307c4ed489b06 /OpenSim/Region/Physics
parentMerge branch 'master' into careminster (diff)
parentRemove unused ScriptEngineLoader and ScriptEngineInterface in OpenSim.Region.... (diff)
downloadopensim-SC_OLD-f567ff9f51aebe522c210b5d34b26754de157c91.zip
opensim-SC_OLD-f567ff9f51aebe522c210b5d34b26754de157c91.tar.gz
opensim-SC_OLD-f567ff9f51aebe522c210b5d34b26754de157c91.tar.bz2
opensim-SC_OLD-f567ff9f51aebe522c210b5d34b26754de157c91.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
Diffstat (limited to 'OpenSim/Region/Physics')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs70
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs38
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs2
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs155
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs58
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs62
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs13
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs4
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt5
-rw-r--r--OpenSim/Region/Physics/Manager/IMesher.cs1
-rw-r--r--OpenSim/Region/Physics/Meshing/Mesh.cs2
-rw-r--r--OpenSim/Region/Physics/UbitMeshing/Mesh.cs2
12 files changed, 230 insertions, 182 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
index 04e77b8..39e62dd 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
@@ -1088,7 +1088,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
1088 { 1088 {
1089 CollisionWorld.WorldData.ParamData p = new CollisionWorld.WorldData.ParamData(); 1089 CollisionWorld.WorldData.ParamData p = new CollisionWorld.WorldData.ParamData();
1090 1090
1091 p.angularDamping = o[0].XangularDamping; 1091 p.angularDamping = BSParam.AngularDamping;
1092 p.defaultFriction = o[0].defaultFriction; 1092 p.defaultFriction = o[0].defaultFriction;
1093 p.defaultFriction = o[0].defaultFriction; 1093 p.defaultFriction = o[0].defaultFriction;
1094 p.defaultDensity = o[0].defaultDensity; 1094 p.defaultDensity = o[0].defaultDensity;
@@ -1096,32 +1096,32 @@ private sealed class BulletConstraintXNA : BulletConstraint
1096 p.collisionMargin = o[0].collisionMargin; 1096 p.collisionMargin = o[0].collisionMargin;
1097 p.gravity = o[0].gravity; 1097 p.gravity = o[0].gravity;
1098 1098
1099 p.linearDamping = o[0].XlinearDamping; 1099 p.linearDamping = BSParam.LinearDamping;
1100 p.angularDamping = o[0].XangularDamping; 1100 p.angularDamping = BSParam.AngularDamping;
1101 p.deactivationTime = o[0].XdeactivationTime; 1101 p.deactivationTime = BSParam.DeactivationTime;
1102 p.linearSleepingThreshold = o[0].XlinearSleepingThreshold; 1102 p.linearSleepingThreshold = BSParam.LinearSleepingThreshold;
1103 p.angularSleepingThreshold = o[0].XangularSleepingThreshold; 1103 p.angularSleepingThreshold = BSParam.AngularSleepingThreshold;
1104 p.ccdMotionThreshold = o[0].XccdMotionThreshold; 1104 p.ccdMotionThreshold = BSParam.CcdMotionThreshold;
1105 p.ccdSweptSphereRadius = o[0].XccdSweptSphereRadius; 1105 p.ccdSweptSphereRadius = BSParam.CcdSweptSphereRadius;
1106 p.contactProcessingThreshold = o[0].XcontactProcessingThreshold; 1106 p.contactProcessingThreshold = BSParam.ContactProcessingThreshold;
1107 1107
1108 p.terrainImplementation = o[0].XterrainImplementation; 1108 p.terrainImplementation = BSParam.TerrainImplementation;
1109 p.terrainFriction = o[0].XterrainFriction; 1109 p.terrainFriction = BSParam.TerrainFriction;
1110 1110
1111 p.terrainHitFraction = o[0].XterrainHitFraction; 1111 p.terrainHitFraction = BSParam.TerrainHitFraction;
1112 p.terrainRestitution = o[0].XterrainRestitution; 1112 p.terrainRestitution = BSParam.TerrainRestitution;
1113 p.terrainCollisionMargin = o[0].XterrainCollisionMargin; 1113 p.terrainCollisionMargin = BSParam.TerrainCollisionMargin;
1114 1114
1115 p.avatarFriction = o[0].XavatarFriction; 1115 p.avatarFriction = BSParam.AvatarFriction;
1116 p.avatarStandingFriction = o[0].XavatarStandingFriction; 1116 p.avatarStandingFriction = BSParam.AvatarStandingFriction;
1117 p.avatarDensity = o[0].XavatarDensity; 1117 p.avatarDensity = BSParam.AvatarDensity;
1118 p.avatarRestitution = o[0].XavatarRestitution; 1118 p.avatarRestitution = BSParam.AvatarRestitution;
1119 p.avatarCapsuleWidth = o[0].XavatarCapsuleWidth; 1119 p.avatarCapsuleWidth = BSParam.AvatarCapsuleWidth;
1120 p.avatarCapsuleDepth = o[0].XavatarCapsuleDepth; 1120 p.avatarCapsuleDepth = BSParam.AvatarCapsuleDepth;
1121 p.avatarCapsuleHeight = o[0].XavatarCapsuleHeight; 1121 p.avatarCapsuleHeight = BSParam.AvatarCapsuleHeight;
1122 p.avatarContactProcessingThreshold = o[0].XavatarContactProcessingThreshold; 1122 p.avatarContactProcessingThreshold = BSParam.AvatarContactProcessingThreshold;
1123 1123
1124 p.vehicleAngularDamping = o[0].XvehicleAngularDamping; 1124 p.vehicleAngularDamping = BSParam.VehicleAngularDamping;
1125 1125
1126 p.maxPersistantManifoldPoolSize = o[0].maxPersistantManifoldPoolSize; 1126 p.maxPersistantManifoldPoolSize = o[0].maxPersistantManifoldPoolSize;
1127 p.maxCollisionAlgorithmPoolSize = o[0].maxCollisionAlgorithmPoolSize; 1127 p.maxCollisionAlgorithmPoolSize = o[0].maxCollisionAlgorithmPoolSize;
@@ -1132,15 +1132,15 @@ private sealed class BulletConstraintXNA : BulletConstraint
1132 p.shouldEnableFrictionCaching = o[0].shouldEnableFrictionCaching; 1132 p.shouldEnableFrictionCaching = o[0].shouldEnableFrictionCaching;
1133 p.numberOfSolverIterations = o[0].numberOfSolverIterations; 1133 p.numberOfSolverIterations = o[0].numberOfSolverIterations;
1134 1134
1135 p.linksetImplementation = o[0].XlinksetImplementation; 1135 p.linksetImplementation = BSParam.LinksetImplementation;
1136 p.linkConstraintUseFrameOffset = o[0].XlinkConstraintUseFrameOffset; 1136 p.linkConstraintUseFrameOffset = BSParam.LinkConstraintUseFrameOffset;
1137 p.linkConstraintEnableTransMotor = o[0].XlinkConstraintEnableTransMotor; 1137 p.linkConstraintEnableTransMotor = BSParam.LinkConstraintEnableTransMotor;
1138 p.linkConstraintTransMotorMaxVel = o[0].XlinkConstraintTransMotorMaxVel; 1138 p.linkConstraintTransMotorMaxVel = BSParam.LinkConstraintTransMotorMaxVel;
1139 p.linkConstraintTransMotorMaxForce = o[0].XlinkConstraintTransMotorMaxForce; 1139 p.linkConstraintTransMotorMaxForce = BSParam.LinkConstraintTransMotorMaxForce;
1140 p.linkConstraintERP = o[0].XlinkConstraintERP; 1140 p.linkConstraintERP = BSParam.LinkConstraintERP;
1141 p.linkConstraintCFM = o[0].XlinkConstraintCFM; 1141 p.linkConstraintCFM = BSParam.LinkConstraintCFM;
1142 p.linkConstraintSolverIterations = o[0].XlinkConstraintSolverIterations; 1142 p.linkConstraintSolverIterations = BSParam.LinkConstraintSolverIterations;
1143 p.physicsLoggingFrames = o[0].XphysicsLoggingFrames; 1143 p.physicsLoggingFrames = o[0].physicsLoggingFrames;
1144 DefaultCollisionConstructionInfo ccci = new DefaultCollisionConstructionInfo(); 1144 DefaultCollisionConstructionInfo ccci = new DefaultCollisionConstructionInfo();
1145 1145
1146 DefaultCollisionConfiguration cci = new DefaultCollisionConfiguration(); 1146 DefaultCollisionConfiguration cci = new DefaultCollisionConfiguration();
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
index abbd22c..5e06c1e 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
@@ -174,32 +174,6 @@ public struct ConfigurationParameters
174 public float collisionMargin; 174 public float collisionMargin;
175 public float gravity; 175 public float gravity;
176 176
177 public float XlinearDamping;
178 public float XangularDamping;
179 public float XdeactivationTime;
180 public float XlinearSleepingThreshold;
181 public float XangularSleepingThreshold;
182 public float XccdMotionThreshold;
183 public float XccdSweptSphereRadius;
184 public float XcontactProcessingThreshold;
185
186 public float XterrainImplementation;
187 public float XterrainFriction;
188 public float XterrainHitFraction;
189 public float XterrainRestitution;
190 public float XterrainCollisionMargin;
191
192 public float XavatarFriction;
193 public float XavatarStandingFriction;
194 public float XavatarDensity;
195 public float XavatarRestitution;
196 public float XavatarCapsuleWidth;
197 public float XavatarCapsuleDepth;
198 public float XavatarCapsuleHeight;
199 public float XavatarContactProcessingThreshold;
200
201 public float XvehicleAngularDamping;
202
203 public float maxPersistantManifoldPoolSize; 177 public float maxPersistantManifoldPoolSize;
204 public float maxCollisionAlgorithmPoolSize; 178 public float maxCollisionAlgorithmPoolSize;
205 public float shouldDisableContactPoolDynamicAllocation; 179 public float shouldDisableContactPoolDynamicAllocation;
@@ -208,17 +182,9 @@ public struct ConfigurationParameters
208 public float shouldSplitSimulationIslands; 182 public float shouldSplitSimulationIslands;
209 public float shouldEnableFrictionCaching; 183 public float shouldEnableFrictionCaching;
210 public float numberOfSolverIterations; 184 public float numberOfSolverIterations;
185 public float useSingleSidedMeshes;
211 186
212 public float XlinksetImplementation; 187 public float physicsLoggingFrames;
213 public float XlinkConstraintUseFrameOffset;
214 public float XlinkConstraintEnableTransMotor;
215 public float XlinkConstraintTransMotorMaxVel;
216 public float XlinkConstraintTransMotorMaxForce;
217 public float XlinkConstraintERP;
218 public float XlinkConstraintCFM;
219 public float XlinkConstraintSolverIterations;
220
221 public float XphysicsLoggingFrames;
222 188
223 public const float numericTrue = 1f; 189 public const float numericTrue = 1f;
224 public const float numericFalse = 0f; 190 public const float numericFalse = 0f;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 8ecf2ff..b51e9fd 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -1326,7 +1326,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1326 // If verticalError.Z is negative, the vehicle is upside down. Add additional push. 1326 // If verticalError.Z is negative, the vehicle is upside down. Add additional push.
1327 if (verticalError.Z < 0f) 1327 if (verticalError.Z < 0f)
1328 { 1328 {
1329 vertContributionV.X += PIOverFour; 1329 vertContributionV.X += Math.Sign(vertContributionV.X) * PIOverFour;
1330 // vertContribution.Y -= PIOverFour; 1330 // vertContribution.Y -= PIOverFour;
1331 } 1331 }
1332 1332
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 8c098b2..306928a 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -39,6 +39,7 @@ public static class BSParam
39{ 39{
40 // Level of Detail values kept as float because that's what the Meshmerizer wants 40 // Level of Detail values kept as float because that's what the Meshmerizer wants
41 public static float MeshLOD { get; private set; } 41 public static float MeshLOD { get; private set; }
42 public static float MeshCircularLOD { get; private set; }
42 public static float MeshMegaPrimLOD { get; private set; } 43 public static float MeshMegaPrimLOD { get; private set; }
43 public static float MeshMegaPrimThreshold { get; private set; } 44 public static float MeshMegaPrimThreshold { get; private set; }
44 public static float SculptLOD { get; private set; } 45 public static float SculptLOD { get; private set; }
@@ -61,6 +62,7 @@ public static class BSParam
61 public static bool ShouldMeshSculptedPrim { get; private set; } // cause scuplted prims to get meshed 62 public static bool ShouldMeshSculptedPrim { get; private set; } // cause scuplted prims to get meshed
62 public static bool ShouldForceSimplePrimMeshing { get; private set; } // if a cube or sphere, let Bullet do internal shapes 63 public static bool ShouldForceSimplePrimMeshing { get; private set; } // if a cube or sphere, let Bullet do internal shapes
63 public static bool ShouldUseHullsForPhysicalObjects { get; private set; } // 'true' if should create hulls for physical objects 64 public static bool ShouldUseHullsForPhysicalObjects { get; private set; } // 'true' if should create hulls for physical objects
65 public static bool ShouldRemoveZeroWidthTriangles { get; private set; }
64 66
65 public static float TerrainImplementation { get; private set; } 67 public static float TerrainImplementation { get; private set; }
66 public static float TerrainFriction { get; private set; } 68 public static float TerrainFriction { get; private set; }
@@ -68,6 +70,24 @@ public static class BSParam
68 public static float TerrainRestitution { get; private set; } 70 public static float TerrainRestitution { get; private set; }
69 public static float TerrainCollisionMargin { get; private set; } 71 public static float TerrainCollisionMargin { get; private set; }
70 72
73 public static float DefaultFriction;
74 public static float DefaultDensity;
75 public static float DefaultRestitution;
76 public static float CollisionMargin;
77 public static float Gravity;
78
79 // Physics Engine operation
80 public static float MaxPersistantManifoldPoolSize;
81 public static float MaxCollisionAlgorithmPoolSize;
82 public static float ShouldDisableContactPoolDynamicAllocation;
83 public static float ShouldForceUpdateAllAabbs;
84 public static float ShouldRandomizeSolverOrder;
85 public static float ShouldSplitSimulationIslands;
86 public static float ShouldEnableFrictionCaching;
87 public static float NumberOfSolverIterations;
88 public static bool UseSingleSidedMeshes { get { return UseSingleSidedMeshesF != ConfigurationParameters.numericFalse; } }
89 public static float UseSingleSidedMeshesF;
90
71 // Avatar parameters 91 // Avatar parameters
72 public static float AvatarFriction { get; private set; } 92 public static float AvatarFriction { get; private set; }
73 public static float AvatarStandingFriction { get; private set; } 93 public static float AvatarStandingFriction { get; private set; }
@@ -199,22 +219,32 @@ public static class BSParam
199 (s,cf,p,v) => { ShouldUseHullsForPhysicalObjects = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, 219 (s,cf,p,v) => { ShouldUseHullsForPhysicalObjects = cf.GetBoolean(p, BSParam.BoolNumeric(v)); },
200 (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); }, 220 (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); },
201 (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), 221 (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ),
222 new ParameterDefn("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes",
223 ConfigurationParameters.numericFalse,
224 (s,cf,p,v) => { ShouldRemoveZeroWidthTriangles = cf.GetBoolean(p, BSParam.BoolNumeric(v)); },
225 (s) => { return BSParam.NumericBool(ShouldRemoveZeroWidthTriangles); },
226 (s,p,l,v) => { ShouldRemoveZeroWidthTriangles = BSParam.BoolNumeric(v); } ),
202 227
203 new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", 228 new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)",
204 8f, 229 32f,
205 (s,cf,p,v) => { MeshLOD = (float)cf.GetInt(p, (int)v); }, 230 (s,cf,p,v) => { MeshLOD = (float)cf.GetInt(p, (int)v); },
206 (s) => { return MeshLOD; }, 231 (s) => { return MeshLOD; },
207 (s,p,l,v) => { MeshLOD = v; } ), 232 (s,p,l,v) => { MeshLOD = v; } ),
208 new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters", 233 new ParameterDefn("MeshLevelOfDetailCircular", "Level of detail for prims with circular cuts or shapes",
209 16f, 234 32f,
210 (s,cf,p,v) => { MeshMegaPrimLOD = (float)cf.GetInt(p, (int)v); }, 235 (s,cf,p,v) => { MeshCircularLOD = (float)cf.GetInt(p, (int)v); },
211 (s) => { return MeshMegaPrimLOD; }, 236 (s) => { return MeshCircularLOD; },
212 (s,p,l,v) => { MeshMegaPrimLOD = v; } ), 237 (s,p,l,v) => { MeshCircularLOD = v; } ),
213 new ParameterDefn("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD", 238 new ParameterDefn("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD",
214 10f, 239 10f,
215 (s,cf,p,v) => { MeshMegaPrimThreshold = (float)cf.GetInt(p, (int)v); }, 240 (s,cf,p,v) => { MeshMegaPrimThreshold = (float)cf.GetInt(p, (int)v); },
216 (s) => { return MeshMegaPrimThreshold; }, 241 (s) => { return MeshMegaPrimThreshold; },
217 (s,p,l,v) => { MeshMegaPrimThreshold = v; } ), 242 (s,p,l,v) => { MeshMegaPrimThreshold = v; } ),
243 new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters",
244 32f,
245 (s,cf,p,v) => { MeshMegaPrimLOD = (float)cf.GetInt(p, (int)v); },
246 (s) => { return MeshMegaPrimLOD; },
247 (s,p,l,v) => { MeshMegaPrimLOD = v; } ),
218 new ParameterDefn("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)", 248 new ParameterDefn("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)",
219 32f, 249 32f,
220 (s,cf,p,v) => { SculptLOD = (float)cf.GetInt(p, (int)v); }, 250 (s,cf,p,v) => { SculptLOD = (float)cf.GetInt(p, (int)v); },
@@ -287,29 +317,29 @@ public static class BSParam
287 317
288 new ParameterDefn("DefaultFriction", "Friction factor used on new objects", 318 new ParameterDefn("DefaultFriction", "Friction factor used on new objects",
289 0.2f, 319 0.2f,
290 (s,cf,p,v) => { s.UnmanagedParams[0].defaultFriction = cf.GetFloat(p, v); }, 320 (s,cf,p,v) => { DefaultFriction = cf.GetFloat(p, v); },
291 (s) => { return s.UnmanagedParams[0].defaultFriction; }, 321 (s) => { return DefaultFriction; },
292 (s,p,l,v) => { s.UnmanagedParams[0].defaultFriction = v; } ), 322 (s,p,l,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ),
293 new ParameterDefn("DefaultDensity", "Density for new objects" , 323 new ParameterDefn("DefaultDensity", "Density for new objects" ,
294 10.000006836f, // Aluminum g/cm3 324 10.000006836f, // Aluminum g/cm3
295 (s,cf,p,v) => { s.UnmanagedParams[0].defaultDensity = cf.GetFloat(p, v); }, 325 (s,cf,p,v) => { DefaultDensity = cf.GetFloat(p, v); },
296 (s) => { return s.UnmanagedParams[0].defaultDensity; }, 326 (s) => { return DefaultDensity; },
297 (s,p,l,v) => { s.UnmanagedParams[0].defaultDensity = v; } ), 327 (s,p,l,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ),
298 new ParameterDefn("DefaultRestitution", "Bouncyness of an object" , 328 new ParameterDefn("DefaultRestitution", "Bouncyness of an object" ,
299 0f, 329 0f,
300 (s,cf,p,v) => { s.UnmanagedParams[0].defaultRestitution = cf.GetFloat(p, v); }, 330 (s,cf,p,v) => { DefaultRestitution = cf.GetFloat(p, v); },
301 (s) => { return s.UnmanagedParams[0].defaultRestitution; }, 331 (s) => { return DefaultRestitution; },
302 (s,p,l,v) => { s.UnmanagedParams[0].defaultRestitution = v; } ), 332 (s,p,l,v) => { DefaultRestitution = v; s.UnmanagedParams[0].defaultRestitution = v; } ),
303 new ParameterDefn("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)", 333 new ParameterDefn("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)",
304 0.04f, 334 0.04f,
305 (s,cf,p,v) => { s.UnmanagedParams[0].collisionMargin = cf.GetFloat(p, v); }, 335 (s,cf,p,v) => { CollisionMargin = cf.GetFloat(p, v); },
306 (s) => { return s.UnmanagedParams[0].collisionMargin; }, 336 (s) => { return CollisionMargin; },
307 (s,p,l,v) => { s.UnmanagedParams[0].collisionMargin = v; } ), 337 (s,p,l,v) => { CollisionMargin = v; s.UnmanagedParams[0].collisionMargin = v; } ),
308 new ParameterDefn("Gravity", "Vertical force of gravity (negative means down)", 338 new ParameterDefn("Gravity", "Vertical force of gravity (negative means down)",
309 -9.80665f, 339 -9.80665f,
310 (s,cf,p,v) => { s.UnmanagedParams[0].gravity = cf.GetFloat(p, v); }, 340 (s,cf,p,v) => { Gravity = cf.GetFloat(p, v); },
311 (s) => { return s.UnmanagedParams[0].gravity; }, 341 (s) => { return Gravity; },
312 (s,p,l,v) => { s.UpdateParameterObject((x)=>{s.UnmanagedParams[0].gravity=x;}, p, PhysParameterEntry.APPLY_TO_NONE, v); }, 342 (s,p,l,v) => { Gravity = v; s.UnmanagedParams[0].gravity = v; },
313 (s,o,v) => { s.PE.SetGravity(o.PhysBody, new Vector3(0f,0f,v)); } ), 343 (s,o,v) => { s.PE.SetGravity(o.PhysBody, new Vector3(0f,0f,v)); } ),
314 344
315 345
@@ -317,49 +347,49 @@ public static class BSParam
317 0f, 347 0f,
318 (s,cf,p,v) => { LinearDamping = cf.GetFloat(p, v); }, 348 (s,cf,p,v) => { LinearDamping = cf.GetFloat(p, v); },
319 (s) => { return LinearDamping; }, 349 (s) => { return LinearDamping; },
320 (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearDamping=x;}, p, l, v); }, 350 (s,p,l,v) => { LinearDamping = v; },
321 (s,o,v) => { s.PE.SetDamping(o.PhysBody, v, AngularDamping); } ), 351 (s,o,v) => { s.PE.SetDamping(o.PhysBody, v, AngularDamping); } ),
322 new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", 352 new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)",
323 0f, 353 0f,
324 (s,cf,p,v) => { AngularDamping = cf.GetFloat(p, v); }, 354 (s,cf,p,v) => { AngularDamping = cf.GetFloat(p, v); },
325 (s) => { return AngularDamping; }, 355 (s) => { return AngularDamping; },
326 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularDamping=x;}, p, l, v); }, 356 (s,p,l,v) => { AngularDamping = v; },
327 (s,o,v) => { s.PE.SetDamping(o.PhysBody, LinearDamping, v); } ), 357 (s,o,v) => { s.PE.SetDamping(o.PhysBody, LinearDamping, v); } ),
328 new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static", 358 new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static",
329 0.2f, 359 0.2f,
330 (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); }, 360 (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); },
331 (s) => { return DeactivationTime; }, 361 (s) => { return DeactivationTime; },
332 (s,p,l,v) => { s.UpdateParameterObject((x)=>{DeactivationTime=x;}, p, l, v); }, 362 (s,p,l,v) => { DeactivationTime = v; },
333 (s,o,v) => { s.PE.SetDeactivationTime(o.PhysBody, v); } ), 363 (s,o,v) => { s.PE.SetDeactivationTime(o.PhysBody, v); } ),
334 new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", 364 new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static",
335 0.8f, 365 0.8f,
336 (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); }, 366 (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); },
337 (s) => { return LinearSleepingThreshold; }, 367 (s) => { return LinearSleepingThreshold; },
338 (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearSleepingThreshold=x;}, p, l, v); }, 368 (s,p,l,v) => { LinearSleepingThreshold = v;},
339 (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), 369 (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ),
340 new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", 370 new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static",
341 1.0f, 371 1.0f,
342 (s,cf,p,v) => { AngularSleepingThreshold = cf.GetFloat(p, v); }, 372 (s,cf,p,v) => { AngularSleepingThreshold = cf.GetFloat(p, v); },
343 (s) => { return AngularSleepingThreshold; }, 373 (s) => { return AngularSleepingThreshold; },
344 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularSleepingThreshold=x;}, p, l, v); }, 374 (s,p,l,v) => { AngularSleepingThreshold = v;},
345 (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), 375 (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ),
346 new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , 376 new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" ,
347 0.0f, // set to zero to disable 377 0.0f, // set to zero to disable
348 (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, 378 (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); },
349 (s) => { return CcdMotionThreshold; }, 379 (s) => { return CcdMotionThreshold; },
350 (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); }, 380 (s,p,l,v) => { CcdMotionThreshold = v;},
351 (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ), 381 (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ),
352 new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , 382 new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" ,
353 0.2f, 383 0.2f,
354 (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, 384 (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); },
355 (s) => { return CcdSweptSphereRadius; }, 385 (s) => { return CcdSweptSphereRadius; },
356 (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); }, 386 (s,p,l,v) => { CcdSweptSphereRadius = v;},
357 (s,o,v) => { s.PE.SetCcdSweptSphereRadius(o.PhysBody, v); } ), 387 (s,o,v) => { s.PE.SetCcdSweptSphereRadius(o.PhysBody, v); } ),
358 new ParameterDefn("ContactProcessingThreshold", "Distance above which contacts can be discarded (0 means no discard)" , 388 new ParameterDefn("ContactProcessingThreshold", "Distance above which contacts can be discarded (0 means no discard)" ,
359 0.0f, 389 0.0f,
360 (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); }, 390 (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); },
361 (s) => { return ContactProcessingThreshold; }, 391 (s) => { return ContactProcessingThreshold; },
362 (s,p,l,v) => { s.UpdateParameterObject((x)=>{ContactProcessingThreshold=x;}, p, l, v); }, 392 (s,p,l,v) => { ContactProcessingThreshold = v;},
363 (s,o,v) => { s.PE.SetContactProcessingThreshold(o.PhysBody, v); } ), 393 (s,o,v) => { s.PE.SetContactProcessingThreshold(o.PhysBody, v); } ),
364 394
365 new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", 395 new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)",
@@ -392,7 +422,7 @@ public static class BSParam
392 0.2f, 422 0.2f,
393 (s,cf,p,v) => { AvatarFriction = cf.GetFloat(p, v); }, 423 (s,cf,p,v) => { AvatarFriction = cf.GetFloat(p, v); },
394 (s) => { return AvatarFriction; }, 424 (s) => { return AvatarFriction; },
395 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarFriction=x;}, p, l, v); } ), 425 (s,p,l,v) => { AvatarFriction = v; } ),
396 new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", 426 new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.",
397 10.0f, 427 10.0f,
398 (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); }, 428 (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); },
@@ -407,32 +437,32 @@ public static class BSParam
407 3.5f, 437 3.5f,
408 (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); }, 438 (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); },
409 (s) => { return AvatarDensity; }, 439 (s) => { return AvatarDensity; },
410 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarDensity=x;}, p, l, v); } ), 440 (s,p,l,v) => { AvatarDensity = v; } ),
411 new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", 441 new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.",
412 0f, 442 0f,
413 (s,cf,p,v) => { AvatarRestitution = cf.GetFloat(p, v); }, 443 (s,cf,p,v) => { AvatarRestitution = cf.GetFloat(p, v); },
414 (s) => { return AvatarRestitution; }, 444 (s) => { return AvatarRestitution; },
415 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarRestitution=x;}, p, l, v); } ), 445 (s,p,l,v) => { AvatarRestitution = v; } ),
416 new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", 446 new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule",
417 0.6f, 447 0.6f,
418 (s,cf,p,v) => { AvatarCapsuleWidth = cf.GetFloat(p, v); }, 448 (s,cf,p,v) => { AvatarCapsuleWidth = cf.GetFloat(p, v); },
419 (s) => { return AvatarCapsuleWidth; }, 449 (s) => { return AvatarCapsuleWidth; },
420 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleWidth=x;}, p, l, v); } ), 450 (s,p,l,v) => { AvatarCapsuleWidth = v; } ),
421 new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", 451 new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule",
422 0.45f, 452 0.45f,
423 (s,cf,p,v) => { AvatarCapsuleDepth = cf.GetFloat(p, v); }, 453 (s,cf,p,v) => { AvatarCapsuleDepth = cf.GetFloat(p, v); },
424 (s) => { return AvatarCapsuleDepth; }, 454 (s) => { return AvatarCapsuleDepth; },
425 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleDepth=x;}, p, l, v); } ), 455 (s,p,l,v) => { AvatarCapsuleDepth = v; } ),
426 new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", 456 new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar",
427 1.5f, 457 1.5f,
428 (s,cf,p,v) => { AvatarCapsuleHeight = cf.GetFloat(p, v); }, 458 (s,cf,p,v) => { AvatarCapsuleHeight = cf.GetFloat(p, v); },
429 (s) => { return AvatarCapsuleHeight; }, 459 (s) => { return AvatarCapsuleHeight; },
430 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleHeight=x;}, p, l, v); } ), 460 (s,p,l,v) => { AvatarCapsuleHeight = v; } ),
431 new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 461 new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
432 0.1f, 462 0.1f,
433 (s,cf,p,v) => { AvatarContactProcessingThreshold = cf.GetFloat(p, v); }, 463 (s,cf,p,v) => { AvatarContactProcessingThreshold = cf.GetFloat(p, v); },
434 (s) => { return AvatarContactProcessingThreshold; }, 464 (s) => { return AvatarContactProcessingThreshold; },
435 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarContactProcessingThreshold=x;}, p, l, v); } ), 465 (s,p,l,v) => { AvatarContactProcessingThreshold = v; } ),
436 new ParameterDefn("AvatarStepHeight", "Height of a step obstacle to consider step correction", 466 new ParameterDefn("AvatarStepHeight", "Height of a step obstacle to consider step correction",
437 0.3f, 467 0.3f,
438 (s,cf,p,v) => { AvatarStepHeight = cf.GetFloat(p, v); }, 468 (s,cf,p,v) => { AvatarStepHeight = cf.GetFloat(p, v); },
@@ -497,44 +527,49 @@ public static class BSParam
497 527
498 new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", 528 new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)",
499 0f, 529 0f,
500 (s,cf,p,v) => { s.UnmanagedParams[0].maxPersistantManifoldPoolSize = cf.GetFloat(p, v); }, 530 (s,cf,p,v) => { MaxPersistantManifoldPoolSize = cf.GetFloat(p, v); },
501 (s) => { return s.UnmanagedParams[0].maxPersistantManifoldPoolSize; }, 531 (s) => { return MaxPersistantManifoldPoolSize; },
502 (s,p,l,v) => { s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ), 532 (s,p,l,v) => { MaxPersistantManifoldPoolSize = v; s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ),
503 new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)", 533 new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)",
504 0f, 534 0f,
505 (s,cf,p,v) => { s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); }, 535 (s,cf,p,v) => { MaxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); },
506 (s) => { return s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize; }, 536 (s) => { return MaxCollisionAlgorithmPoolSize; },
507 (s,p,l,v) => { s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ), 537 (s,p,l,v) => { MaxCollisionAlgorithmPoolSize = v; s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ),
508 new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", 538 new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count",
509 ConfigurationParameters.numericFalse, 539 ConfigurationParameters.numericFalse,
510 (s,cf,p,v) => { s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 540 (s,cf,p,v) => { ShouldDisableContactPoolDynamicAllocation = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
511 (s) => { return s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation; }, 541 (s) => { return ShouldDisableContactPoolDynamicAllocation; },
512 (s,p,l,v) => { s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = v; } ), 542 (s,p,l,v) => { ShouldDisableContactPoolDynamicAllocation = v; s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = v; } ),
513 new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", 543 new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step",
514 ConfigurationParameters.numericFalse, 544 ConfigurationParameters.numericFalse,
515 (s,cf,p,v) => { s.UnmanagedParams[0].shouldForceUpdateAllAabbs = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 545 (s,cf,p,v) => { ShouldForceUpdateAllAabbs = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
516 (s) => { return s.UnmanagedParams[0].shouldForceUpdateAllAabbs; }, 546 (s) => { return ShouldForceUpdateAllAabbs; },
517 (s,p,l,v) => { s.UnmanagedParams[0].shouldForceUpdateAllAabbs = v; } ), 547 (s,p,l,v) => { ShouldForceUpdateAllAabbs = v; s.UnmanagedParams[0].shouldForceUpdateAllAabbs = v; } ),
518 new ParameterDefn("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction", 548 new ParameterDefn("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction",
519 ConfigurationParameters.numericTrue, 549 ConfigurationParameters.numericTrue,
520 (s,cf,p,v) => { s.UnmanagedParams[0].shouldRandomizeSolverOrder = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 550 (s,cf,p,v) => { ShouldRandomizeSolverOrder = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
521 (s) => { return s.UnmanagedParams[0].shouldRandomizeSolverOrder; }, 551 (s) => { return ShouldRandomizeSolverOrder; },
522 (s,p,l,v) => { s.UnmanagedParams[0].shouldRandomizeSolverOrder = v; } ), 552 (s,p,l,v) => { ShouldRandomizeSolverOrder = v; s.UnmanagedParams[0].shouldRandomizeSolverOrder = v; } ),
523 new ParameterDefn("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands", 553 new ParameterDefn("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands",
524 ConfigurationParameters.numericTrue, 554 ConfigurationParameters.numericTrue,
525 (s,cf,p,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 555 (s,cf,p,v) => { ShouldSplitSimulationIslands = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
526 (s) => { return s.UnmanagedParams[0].shouldSplitSimulationIslands; }, 556 (s) => { return ShouldSplitSimulationIslands; },
527 (s,p,l,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), 557 (s,p,l,v) => { ShouldSplitSimulationIslands = v; s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ),
528 new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", 558 new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching",
529 ConfigurationParameters.numericTrue, 559 ConfigurationParameters.numericTrue,
530 (s,cf,p,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 560 (s,cf,p,v) => { ShouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
531 (s) => { return s.UnmanagedParams[0].shouldEnableFrictionCaching; }, 561 (s) => { return ShouldEnableFrictionCaching; },
532 (s,p,l,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), 562 (s,p,l,v) => { ShouldEnableFrictionCaching = v; s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ),
533 new ParameterDefn("NumberOfSolverIterations", "Number of internal iterations (0 means default)", 563 new ParameterDefn("NumberOfSolverIterations", "Number of internal iterations (0 means default)",
534 0f, // zero says use Bullet default 564 0f, // zero says use Bullet default
535 (s,cf,p,v) => { s.UnmanagedParams[0].numberOfSolverIterations = cf.GetFloat(p, v); }, 565 (s,cf,p,v) => { NumberOfSolverIterations = cf.GetFloat(p, v); },
536 (s) => { return s.UnmanagedParams[0].numberOfSolverIterations; }, 566 (s) => { return NumberOfSolverIterations; },
537 (s,p,l,v) => { s.UnmanagedParams[0].numberOfSolverIterations = v; } ), 567 (s,p,l,v) => { NumberOfSolverIterations = v; s.UnmanagedParams[0].numberOfSolverIterations = v; } ),
568 new ParameterDefn("UseSingleSidedMeshes", "Whether to compute collisions based on single sided meshes.",
569 ConfigurationParameters.numericTrue,
570 (s,cf,p,v) => { UseSingleSidedMeshesF = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
571 (s) => { return UseSingleSidedMeshesF; },
572 (s,p,l,v) => { UseSingleSidedMeshesF = v; s.UnmanagedParams[0].useSingleSidedMeshes = v; } ),
538 573
539 new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", 574 new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)",
540 (float)BSLinkset.LinksetImplementation.Compound, 575 (float)BSLinkset.LinksetImplementation.Compound,
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index a4690ba..6cd72f2 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -882,41 +882,41 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
882 BSParam.ParameterDefn theParam; 882 BSParam.ParameterDefn theParam;
883 if (BSParam.TryGetParameter(parm, out theParam)) 883 if (BSParam.TryGetParameter(parm, out theParam))
884 { 884 {
885 // Set the value in the C# code
885 theParam.setter(this, parm, localID, val); 886 theParam.setter(this, parm, localID, val);
887
888 // Optionally set the parameter in the unmanaged code
889 if (theParam.onObject != null)
890 {
891 // update all the localIDs specified
892 // If the local ID is APPLY_TO_NONE, just change the default value
893 // If the localID is APPLY_TO_ALL change the default value and apply the new value to all the lIDs
894 // If the localID is a specific object, apply the parameter change to only that object
895 List<uint> objectIDs = new List<uint>();
896 switch (localID)
897 {
898 case PhysParameterEntry.APPLY_TO_NONE:
899 // This will cause a call into the physical world if some operation is specified (SetOnObject).
900 objectIDs.Add(TERRAIN_ID);
901 TaintedUpdateParameter(parm, objectIDs, val);
902 break;
903 case PhysParameterEntry.APPLY_TO_ALL:
904 lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys);
905 TaintedUpdateParameter(parm, objectIDs, val);
906 break;
907 default:
908 // setting only one localID
909 objectIDs.Add(localID);
910 TaintedUpdateParameter(parm, objectIDs, val);
911 break;
912 }
913 }
914
886 ret = true; 915 ret = true;
887 } 916 }
888 return ret; 917 return ret;
889 } 918 }
890 919
891 // update all the localIDs specified
892 // If the local ID is APPLY_TO_NONE, just change the default value
893 // If the localID is APPLY_TO_ALL change the default value and apply the new value to all the lIDs
894 // If the localID is a specific object, apply the parameter change to only that object
895 internal delegate void AssignVal(float x);
896 internal void UpdateParameterObject(AssignVal setDefault, string parm, uint localID, float val)
897 {
898 List<uint> objectIDs = new List<uint>();
899 switch (localID)
900 {
901 case PhysParameterEntry.APPLY_TO_NONE:
902 setDefault(val); // setting only the default value
903 // This will cause a call into the physical world if some operation is specified (SetOnObject).
904 objectIDs.Add(TERRAIN_ID);
905 TaintedUpdateParameter(parm, objectIDs, val);
906 break;
907 case PhysParameterEntry.APPLY_TO_ALL:
908 setDefault(val); // setting ALL also sets the default value
909 lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys);
910 TaintedUpdateParameter(parm, objectIDs, val);
911 break;
912 default:
913 // setting only one localID
914 objectIDs.Add(localID);
915 TaintedUpdateParameter(parm, objectIDs, val);
916 break;
917 }
918 }
919
920 // schedule the actual updating of the paramter to when the phys engine is not busy 920 // schedule the actual updating of the paramter to when the phys engine is not busy
921 private void TaintedUpdateParameter(string parm, List<uint> lIDs, float val) 921 private void TaintedUpdateParameter(string parm, List<uint> lIDs, float val)
922 { 922 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index 37bccbc..07e34ab 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -602,8 +602,8 @@ public sealed class BSShapeCollection : IDisposable
602 if (newMeshKey == prim.PhysShape.shapeKey && prim.PhysShape.type == BSPhysicsShapeType.SHAPE_MESH) 602 if (newMeshKey == prim.PhysShape.shapeKey && prim.PhysShape.type == BSPhysicsShapeType.SHAPE_MESH)
603 return false; 603 return false;
604 604
605 if (DDetail) DetailLog("{0},BSShapeCollection.GetReferenceToMesh,create,oldKey={1},newKey={2}", 605 if (DDetail) DetailLog("{0},BSShapeCollection.GetReferenceToMesh,create,oldKey={1},newKey={2},size={3},lod={4}",
606 prim.LocalID, prim.PhysShape.shapeKey.ToString("X"), newMeshKey.ToString("X")); 606 prim.LocalID, prim.PhysShape.shapeKey.ToString("X"), newMeshKey.ToString("X"), prim.Size, lod);
607 607
608 // Since we're recreating new, get rid of the reference to the previous shape 608 // Since we're recreating new, get rid of the reference to the previous shape
609 DereferenceShape(prim.PhysShape, shapeCallback); 609 DereferenceShape(prim.PhysShape, shapeCallback);
@@ -622,7 +622,6 @@ public sealed class BSShapeCollection : IDisposable
622 private BulletShape CreatePhysicalMesh(string objName, System.UInt64 newMeshKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod) 622 private BulletShape CreatePhysicalMesh(string objName, System.UInt64 newMeshKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod)
623 { 623 {
624 BulletShape newShape = new BulletShape(); 624 BulletShape newShape = new BulletShape();
625 IMesh meshData = null;
626 625
627 MeshDesc meshDesc; 626 MeshDesc meshDesc;
628 if (Meshes.TryGetValue(newMeshKey, out meshDesc)) 627 if (Meshes.TryGetValue(newMeshKey, out meshDesc))
@@ -632,27 +631,55 @@ public sealed class BSShapeCollection : IDisposable
632 } 631 }
633 else 632 else
634 { 633 {
635 meshData = PhysicsScene.mesher.CreateMesh(objName, pbs, size, lod, true, false, false, false); 634 IMesh meshData = PhysicsScene.mesher.CreateMesh(objName, pbs, size, lod,
635 true,
636 false, // say it is not physical so a bounding box is not built
637 false, // do not cache the mesh and do not use previously built versions
638 false // It's NOT for ODE
639 );
636 640
637 if (meshData != null) 641 if (meshData != null)
638 { 642 {
643
639 int[] indices = meshData.getIndexListAsInt(); 644 int[] indices = meshData.getIndexListAsInt();
640 List<OMV.Vector3> vertices = meshData.getVertexList(); 645 int realIndicesIndex = indices.Length;
646 float[] verticesAsFloats = meshData.getVertexListAsFloat();
641 647
642 float[] verticesAsFloats = new float[vertices.Count * 3]; 648 if (BSParam.ShouldRemoveZeroWidthTriangles)
643 int vi = 0;
644 foreach (OMV.Vector3 vv in vertices)
645 { 649 {
646 verticesAsFloats[vi++] = vv.X; 650 // Remove degenerate triangles. These are triangles with two of the vertices
647 verticesAsFloats[vi++] = vv.Y; 651 // are the same. This is complicated by the problem that vertices are not
648 verticesAsFloats[vi++] = vv.Z; 652 // made unique in sculpties so we have to compare the values in the vertex.
653 realIndicesIndex = 0;
654 for (int tri = 0; tri < indices.Length; tri += 3)
655 {
656 int v1 = indices[tri + 0] * 3;
657 int v2 = indices[tri + 1] * 3;
658 int v3 = indices[tri + 2] * 3;
659 if (!((verticesAsFloats[v1 + 0] == verticesAsFloats[v2 + 0]
660 && verticesAsFloats[v1 + 1] == verticesAsFloats[v2 + 1]
661 && verticesAsFloats[v1 + 2] == verticesAsFloats[v2 + 2])
662 || (verticesAsFloats[v2 + 0] == verticesAsFloats[v3 + 0]
663 && verticesAsFloats[v2 + 1] == verticesAsFloats[v3 + 1]
664 && verticesAsFloats[v2 + 2] == verticesAsFloats[v3 + 2])
665 || (verticesAsFloats[v1 + 0] == verticesAsFloats[v3 + 0]
666 && verticesAsFloats[v1 + 1] == verticesAsFloats[v3 + 1]
667 && verticesAsFloats[v1 + 2] == verticesAsFloats[v3 + 2]))
668 )
669 {
670 // None of the vertices of the triangles are the same. This is a good triangle;
671 indices[realIndicesIndex + 0] = indices[tri + 0];
672 indices[realIndicesIndex + 1] = indices[tri + 1];
673 indices[realIndicesIndex + 2] = indices[tri + 2];
674 realIndicesIndex += 3;
675 }
676 }
649 } 677 }
650 678 DetailLog("{0},BSShapeCollection.CreatePhysicalMesh,origTri={1},realTri={2},numVerts={3}",
651 // m_log.DebugFormat("{0}: BSShapeCollection.CreatePhysicalMesh: calling CreateMesh. lid={1}, key={2}, indices={3}, vertices={4}", 679 BSScene.DetailLogZero, indices.Length / 3, realIndicesIndex / 3, verticesAsFloats.Length / 3);
652 // LogHeader, prim.LocalID, newMeshKey, indices.Length, vertices.Count);
653 680
654 newShape = PhysicsScene.PE.CreateMeshShape(PhysicsScene.World, 681 newShape = PhysicsScene.PE.CreateMeshShape(PhysicsScene.World,
655 indices.GetLength(0), indices, vertices.Count, verticesAsFloats); 682 realIndicesIndex, indices, verticesAsFloats.Length/3, verticesAsFloats);
656 } 683 }
657 } 684 }
658 newShape.shapeKey = newMeshKey; 685 newShape.shapeKey = newMeshKey;
@@ -831,6 +858,11 @@ public sealed class BSShapeCollection : IDisposable
831 { 858 {
832 // level of detail based on size and type of the object 859 // level of detail based on size and type of the object
833 float lod = BSParam.MeshLOD; 860 float lod = BSParam.MeshLOD;
861
862 // prims with curvy internal cuts need higher lod
863 if (pbs.HollowShape == HollowShape.Circle)
864 lod = BSParam.MeshCircularLOD;
865
834 if (pbs.SculptEntry) 866 if (pbs.SculptEntry)
835 lod = BSParam.SculptLOD; 867 lod = BSParam.SculptLOD;
836 868
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
index 8244f02..d7e800d 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
@@ -96,7 +96,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
96 { 96 {
97 // DISASTER!! 97 // DISASTER!!
98 PhysicsScene.DetailLog("{0},BSTerrainMesh.create,failedCreationOfShape", ID); 98 PhysicsScene.DetailLog("{0},BSTerrainMesh.create,failedCreationOfShape", ID);
99 physicsScene.Logger.ErrorFormat("{0} Failed creation of terrain mesh! base={1}", LogHeader, TerrainBase); 99 PhysicsScene.Logger.ErrorFormat("{0} Failed creation of terrain mesh! base={1}", LogHeader, TerrainBase);
100 // Something is very messed up and a crash is in our future. 100 // Something is very messed up and a crash is in our future.
101 return; 101 return;
102 } 102 }
@@ -108,7 +108,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
108 if (!m_terrainBody.HasPhysicalBody) 108 if (!m_terrainBody.HasPhysicalBody)
109 { 109 {
110 // DISASTER!! 110 // DISASTER!!
111 physicsScene.Logger.ErrorFormat("{0} Failed creation of terrain body! base={1}", LogHeader, TerrainBase); 111 PhysicsScene.Logger.ErrorFormat("{0} Failed creation of terrain body! base={1}", LogHeader, TerrainBase);
112 // Something is very messed up and a crash is in our future. 112 // Something is very messed up and a crash is in our future.
113 return; 113 return;
114 } 114 }
@@ -131,6 +131,12 @@ public sealed class BSTerrainMesh : BSTerrainPhys
131 m_terrainBody.collisionType = CollisionType.Terrain; 131 m_terrainBody.collisionType = CollisionType.Terrain;
132 m_terrainBody.ApplyCollisionMask(PhysicsScene); 132 m_terrainBody.ApplyCollisionMask(PhysicsScene);
133 133
134 if (BSParam.UseSingleSidedMeshes)
135 {
136 PhysicsScene.DetailLog("{0},BSTerrainMesh.settingCustomMaterial", id);
137 PhysicsScene.PE.AddToCollisionFlags(m_terrainBody, CollisionFlags.CF_CUSTOM_MATERIAL_CALLBACK);
138 }
139
134 // Make it so the terrain will not move or be considered for movement. 140 // Make it so the terrain will not move or be considered for movement.
135 PhysicsScene.PE.ForceActivationState(m_terrainBody, ActivationState.DISABLE_SIMULATION); 141 PhysicsScene.PE.ForceActivationState(m_terrainBody, ActivationState.DISABLE_SIMULATION);
136 } 142 }
@@ -176,8 +182,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
176 182
177 // Convert the passed heightmap to mesh information suitable for CreateMeshShape2(). 183 // Convert the passed heightmap to mesh information suitable for CreateMeshShape2().
178 // Return 'true' if successfully created. 184 // Return 'true' if successfully created.
179 public static bool ConvertHeightmapToMesh( 185 public static bool ConvertHeightmapToMesh( BSScene physicsScene,
180 BSScene physicsScene,
181 float[] heightMap, int sizeX, int sizeY, // parameters of incoming heightmap 186 float[] heightMap, int sizeX, int sizeY, // parameters of incoming heightmap
182 float extentX, float extentY, // zero based range for output vertices 187 float extentX, float extentY, // zero based range for output vertices
183 Vector3 extentBase, // base to be added to all vertices 188 Vector3 extentBase, // base to be added to all vertices
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
index c7a2f7e..8012d91 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
@@ -217,6 +217,10 @@ public static class BulletSimData
217{ 217{
218 218
219// Map of collisionTypes to flags for collision groups and masks. 219// Map of collisionTypes to flags for collision groups and masks.
220// An object's 'group' is the collison groups this object belongs to
221// An object's 'filter' is the groups another object has to belong to in order to collide with me
222// A collision happens if ((obj1.group & obj2.filter) != 0) || ((obj2.group & obj1.filter) != 0)
223//
220// As mentioned above, don't use the CollisionFilterGroups definitions directly in the code 224// As mentioned above, don't use the CollisionFilterGroups definitions directly in the code
221// but, instead, use references to this dictionary. Finding and debugging 225// but, instead, use references to this dictionary. Finding and debugging
222// collision flag problems will be made easier. 226// collision flag problems will be made easier.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
index a3b3556..bda7c47 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
@@ -65,6 +65,8 @@ Vehicle attributes are not restored when a vehicle is rezzed on region creation
65 65
66GENERAL TODO LIST: 66GENERAL TODO LIST:
67================================================= 67=================================================
68Level-of-detail for mesh creation. Prims with circular interiors require lod of 32.
69 Is much saved with lower LODs? At the moment, all set to 32.
68Collisions are inconsistant: arrows are supposed to hit and report collision. Often don't. 70Collisions are inconsistant: arrows are supposed to hit and report collision. Often don't.
69 If arrow show at prim, collision reported about 1/3 of time. If collision reported, 71 If arrow show at prim, collision reported about 1/3 of time. If collision reported,
70 both arrow and prim report it. The arrow bounces off the prim 9 out of 10 times. 72 both arrow and prim report it. The arrow bounces off the prim 9 out of 10 times.
@@ -128,6 +130,9 @@ Physical and phantom will drop through the terrain
128LINKSETS 130LINKSETS
129====================================================== 131======================================================
130Child prims do not report collisions 132Child prims do not report collisions
133Allow children of a linkset to be phantom:
134 http://opensim-dev.2196679.n2.nabble.com/Setting-a-single-child-prim-to-Phantom-tp7578513.html
135 Add OS_STATUS_PHANTOM_PRIM to llSetLinkPrimitaveParamsFast.
131Editing a child of a linkset causes the child to go phantom 136Editing a child of a linkset causes the child to go phantom
132 Move a child prim once when it is physical and can never move it again without it going phantom 137 Move a child prim once when it is physical and can never move it again without it going phantom
133Offset the center of the linkset to be the geometric center of all the prims 138Offset the center of the linkset to be the geometric center of all the prims
diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs
index df980ab..5485eb7 100644
--- a/OpenSim/Region/Physics/Manager/IMesher.cs
+++ b/OpenSim/Region/Physics/Manager/IMesher.cs
@@ -83,6 +83,7 @@ namespace OpenSim.Region.Physics.Manager
83 List<Vector3> getVertexList(); 83 List<Vector3> getVertexList();
84 int[] getIndexListAsInt(); 84 int[] getIndexListAsInt();
85 int[] getIndexListAsIntLocked(); 85 int[] getIndexListAsIntLocked();
86 float[] getVertexListAsFloat();
86 float[] getVertexListAsFloatLocked(); 87 float[] getVertexListAsFloatLocked();
87 void getIndexListAsPtrToIntArray(out IntPtr indices, out int triStride, out int indexCount); 88 void getIndexListAsPtrToIntArray(out IntPtr indices, out int triStride, out int indexCount);
88 void getVertexListAsPtrToFloatArray(out IntPtr vertexList, out int vertexStride, out int vertexCount); 89 void getVertexListAsPtrToFloatArray(out IntPtr vertexList, out int vertexStride, out int vertexCount);
diff --git a/OpenSim/Region/Physics/Meshing/Mesh.cs b/OpenSim/Region/Physics/Meshing/Mesh.cs
index 6970553..e6b32e7 100644
--- a/OpenSim/Region/Physics/Meshing/Mesh.cs
+++ b/OpenSim/Region/Physics/Meshing/Mesh.cs
@@ -226,7 +226,7 @@ namespace OpenSim.Region.Physics.Meshing
226 return result; 226 return result;
227 } 227 }
228 228
229 private float[] getVertexListAsFloat() 229 public float[] getVertexListAsFloat()
230 { 230 {
231 if (m_vertices == null) 231 if (m_vertices == null)
232 throw new NotSupportedException(); 232 throw new NotSupportedException();
diff --git a/OpenSim/Region/Physics/UbitMeshing/Mesh.cs b/OpenSim/Region/Physics/UbitMeshing/Mesh.cs
index b67422f..fa06926 100644
--- a/OpenSim/Region/Physics/UbitMeshing/Mesh.cs
+++ b/OpenSim/Region/Physics/UbitMeshing/Mesh.cs
@@ -301,7 +301,7 @@ namespace OpenSim.Region.Physics.Meshing
301 return result; 301 return result;
302 } 302 }
303 303
304 private float[] getVertexListAsFloat() 304 public float[] getVertexListAsFloat()
305 { 305 {
306 if (m_bdata.m_vertices == null) 306 if (m_bdata.m_vertices == null)
307 throw new NotSupportedException(); 307 throw new NotSupportedException();