From 5648eb7bd1f2345aad1530d90964278fe352faea Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 30 Aug 2015 15:52:26 -0700 Subject: [PATCH 01/33] Moved instantiation of SceneCommunicationService object to inside the scene constructor. This was a left over from the original monolithic design of scene communications. The less the instantiators of scenes know about the scene's internals, the better. --- OpenSim/Region/Application/OpenSimBase.cs | 4 +--- OpenSim/Region/Framework/Scenes/Scene.cs | 3 +-- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 4 +--- OpenSim/Tests/Common/Mock/TestScene.cs | 4 ++-- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 3be411ab08..62a52d6188 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -752,10 +752,8 @@ namespace OpenSim Vector3 regionExtent = new Vector3(regionInfo.RegionSizeX, regionInfo.RegionSizeY, regionInfo.RegionSizeZ); PhysicsScene physicsScene = GetPhysicsScene(regionInfo.RegionName, regionExtent); - SceneCommunicationService sceneGridService = new SceneCommunicationService(); - return new Scene( - regionInfo, circuitManager, physicsScene, sceneGridService, + regionInfo, circuitManager, physicsScene, simDataService, estateDataService, Config, m_version); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index fe99ae5dd6..04e26640f7 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -851,7 +851,6 @@ namespace OpenSim.Region.Framework.Scenes #region Constructors public Scene(RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene, - SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, IConfigSource config, string simulatorVersion) : this(regInfo, physicsScene) @@ -865,7 +864,7 @@ namespace OpenSim.Region.Framework.Scenes m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4); m_authenticateHandler = authen; - m_sceneGridService = sceneGridService; + m_sceneGridService = new SceneCommunicationService(); m_SimulationDataService = simDataService; m_EstateDataService = estateDataService; diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 1fb1c5c961..4f685b61cd 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -148,8 +148,6 @@ namespace OpenSim.Tests.Common regInfo.RegionSizeX = sizeX; regInfo.RegionSizeY = sizeY; - SceneCommunicationService scs = new SceneCommunicationService(); - PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); Vector3 regionExtent = new Vector3( regInfo.RegionSizeX, regInfo.RegionSizeY, regInfo.RegionSizeZ); @@ -158,7 +156,7 @@ namespace OpenSim.Tests.Common "basicphysics", "ZeroMesher", new IniConfigSource(), "test", regionExtent); TestScene testScene = new TestScene( - regInfo, m_acm, physicsScene, scs, SimDataService, m_estateDataService, configSource, null); + regInfo, m_acm, physicsScene, SimDataService, m_estateDataService, configSource, null); INonSharedRegionModule godsModule = new GodsModule(); godsModule.Initialise(new IniConfigSource()); diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs index 45acf91f38..bd36097111 100644 --- a/OpenSim/Tests/Common/Mock/TestScene.cs +++ b/OpenSim/Tests/Common/Mock/TestScene.cs @@ -42,9 +42,9 @@ namespace OpenSim.Tests.Common { public TestScene( RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene, - SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, + ISimulationDataService simDataService, IEstateDataService estateDataService, IConfigSource config, string simulatorVersion) - : base(regInfo, authen, physicsScene, sceneGridService, simDataService, estateDataService, + : base(regInfo, authen, physicsScene, simDataService, estateDataService, config, simulatorVersion) { } From 1d6b33bc2da3b312cff1d1802a73aacdf72b0385 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 30 Aug 2015 20:06:53 -0700 Subject: [PATCH 02/33] Major renaming of Physics dlls / folders. No functional changes, just renames. --- .../BasicPhysics}/AssemblyInfo.cs | 0 .../BasicPhysics}/BasicPhysicsActor.cs | 0 .../BasicPhysics}/BasicPhysicsPlugin.cs | 0 .../BasicPhysics}/BasicPhysicsPrim.cs | 0 .../BasicPhysics}/BasicPhysicsScene.cs | 0 .../BulletS}/BSAPIUnman.cs | 0 .../BulletS}/BSAPIXNA.cs | 0 .../BulletS}/BSActorAvatarMove.cs | 0 .../BulletS}/BSActorHover.cs | 0 .../BulletS}/BSActorLockAxis.cs | 0 .../BulletS}/BSActorMoveToTarget.cs | 0 .../BulletS}/BSActorSetForce.cs | 0 .../BulletS}/BSActorSetTorque.cs | 0 .../BulletS}/BSActors.cs | 0 .../BulletS}/BSApiTemplate.cs | 0 .../BulletS}/BSCharacter.cs | 0 .../BulletS}/BSConstraint.cs | 0 .../BulletS}/BSConstraint6Dof.cs | 0 .../BulletS}/BSConstraintCollection.cs | 0 .../BulletS}/BSConstraintConeTwist.cs | 0 .../BulletS}/BSConstraintHinge.cs | 0 .../BulletS}/BSConstraintSlider.cs | 0 .../BulletS}/BSConstraintSpring.cs | 0 .../BulletS}/BSDynamics.cs | 0 .../BulletS}/BSLinkset.cs | 0 .../BulletS}/BSLinksetCompound.cs | 0 .../BulletS}/BSLinksetConstraints.cs | 0 .../BulletS}/BSMaterials.cs | 0 .../BulletS}/BSMotors.cs | 0 .../BulletS}/BSParam.cs | 0 .../BulletS}/BSPhysObject.cs | 0 .../BulletS}/BSPlugin.cs | 0 .../BulletS}/BSPrim.cs | 0 .../BulletS}/BSPrimDisplaced.cs | 0 .../BulletS}/BSPrimLinkable.cs | 0 .../BulletS}/BSScene.cs | 0 .../BulletS}/BSShapeCollection.cs | 0 .../BulletS}/BSShapes.cs | 0 .../BulletS}/BSTerrainHeightmap.cs | 0 .../BulletS}/BSTerrainManager.cs | 0 .../BulletS}/BSTerrainMesh.cs | 0 .../BulletS}/BulletSimData.cs | 0 .../BulletS}/BulletSimTODO.txt | 0 .../BulletS}/Properties/AssemblyInfo.cs | 0 .../BulletS}/Tests/BasicVehicles.cs | 0 .../BulletS}/Tests/BulletSimTests.cs | 0 .../BulletS}/Tests/BulletSimTestsUtil.cs | 0 .../BulletS}/Tests/HullCreation.cs | 0 .../ConvexDecompositionDotNet/CTri.cs | 0 .../ConvexDecompositionDotNet/Concavity.cs | 0 .../ConvexBuilder.cs | 0 .../ConvexDecomposition.cs | 0 .../ConvexDecompositionDotNet/ConvexResult.cs | 0 .../ConvexDecompositionDotNet/HullClasses.cs | 0 .../ConvexDecompositionDotNet/HullTriangle.cs | 0 .../ConvexDecompositionDotNet/HullUtils.cs | 0 .../ConvexDecompositionDotNet/LICENSE.txt | 0 .../ConvexDecompositionDotNet/Plane.cs | 0 .../ConvexDecompositionDotNet/PlaneTri.cs | 0 .../Properties/AssemblyInfo.cs | 0 .../ConvexDecompositionDotNet/Quaternion.cs | 0 .../ConvexDecompositionDotNet/README.txt | 0 .../ConvexDecompositionDotNet/SplitPlane.cs | 0 .../ConvexDecompositionDotNet/VertexLookup.cs | 0 .../ConvexDecompositionDotNet/float2.cs | 0 .../ConvexDecompositionDotNet/float3.cs | 0 .../ConvexDecompositionDotNet/float3x3.cs | 0 .../ConvexDecompositionDotNet/float4.cs | 0 .../ConvexDecompositionDotNet/float4x4.cs | 0 .../ConvexDecompositionDotNet/int3.cs | 0 .../ConvexDecompositionDotNet/int4.cs | 0 .../Meshing/HelperTypes.cs | 0 .../Meshing/Mesh.cs | 0 .../Meshing/Meshmerizer.cs | 0 .../Meshing/PrimMesher.cs | 0 .../Meshing/Properties/AssemblyInfo.cs | 0 .../Meshing/SculptMap.cs | 0 .../Meshing/SculptMesh.cs | 0 .../Ode}/AssemblyInfo.cs | 0 .../Ode}/ODECharacter.cs | 0 .../Ode}/ODEDynamics.c_comments | 0 .../Ode}/ODEDynamics.cs | 0 .../Ode}/ODEPrim.cs | 0 .../Ode}/ODERayCastRequestManager.cs | 0 .../Ode}/OdePhysicsJoint.cs | 0 .../Ode}/OdePlugin.cs | 0 .../Ode}/OdeScene.cs | 0 .../Ode}/Tests/ODETestClass.cs | 0 .../Ode}/drawstuff.cs | 0 .../POS}/AssemblyInfo.cs | 0 .../POS}/POSCharacter.cs | 0 .../POS}/POSPlugin.cs | 0 .../POS}/POSPrim.cs | 0 .../POS}/POSScene.cs | 0 .../SharedBase}/AssemblyInfo.cs | 0 .../SharedBase}/CollisionLocker.cs | 0 .../SharedBase}/IMesher.cs | 0 .../SharedBase}/IPhysicsParameters.cs | 0 .../SharedBase}/NullPhysicsScene.cs | 0 .../SharedBase}/PhysicsActor.cs | 0 .../SharedBase}/PhysicsJoint.cs | 0 .../SharedBase}/PhysicsPluginManager.cs | 0 .../SharedBase}/PhysicsScene.cs | 0 .../SharedBase}/PhysicsSensor.cs | 0 .../SharedBase}/PhysicsVector.cs | 0 .../SharedBase}/VehicleConstants.cs | 0 .../SharedBase}/ZeroMesher.cs | 0 prebuild.xml | 68 +++++++++---------- 108 files changed, 34 insertions(+), 34 deletions(-) rename OpenSim/Region/{Physics/BasicPhysicsPlugin => PhysicsModules/BasicPhysics}/AssemblyInfo.cs (100%) rename OpenSim/Region/{Physics/BasicPhysicsPlugin => PhysicsModules/BasicPhysics}/BasicPhysicsActor.cs (100%) rename OpenSim/Region/{Physics/BasicPhysicsPlugin => PhysicsModules/BasicPhysics}/BasicPhysicsPlugin.cs (100%) rename OpenSim/Region/{Physics/BasicPhysicsPlugin => PhysicsModules/BasicPhysics}/BasicPhysicsPrim.cs (100%) rename OpenSim/Region/{Physics/BasicPhysicsPlugin => PhysicsModules/BasicPhysics}/BasicPhysicsScene.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSAPIUnman.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSAPIXNA.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSActorAvatarMove.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSActorHover.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSActorLockAxis.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSActorMoveToTarget.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSActorSetForce.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSActorSetTorque.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSActors.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSApiTemplate.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSCharacter.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSConstraint.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSConstraint6Dof.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSConstraintCollection.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSConstraintConeTwist.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSConstraintHinge.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSConstraintSlider.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSConstraintSpring.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSDynamics.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSLinkset.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSLinksetCompound.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSLinksetConstraints.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSMaterials.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSMotors.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSParam.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSPhysObject.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSPlugin.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSPrim.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSPrimDisplaced.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSPrimLinkable.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSScene.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSShapeCollection.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSShapes.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSTerrainHeightmap.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSTerrainManager.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BSTerrainMesh.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BulletSimData.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/BulletSimTODO.txt (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/Properties/AssemblyInfo.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/Tests/BasicVehicles.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/Tests/BulletSimTests.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/Tests/BulletSimTestsUtil.cs (100%) rename OpenSim/Region/{Physics/BulletSPlugin => PhysicsModules/BulletS}/Tests/HullCreation.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/CTri.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/Concavity.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/ConvexBuilder.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/ConvexDecomposition.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/ConvexResult.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/HullClasses.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/HullTriangle.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/HullUtils.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/LICENSE.txt (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/Plane.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/PlaneTri.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/Quaternion.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/README.txt (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/SplitPlane.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/VertexLookup.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/float2.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/float3.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/float3x3.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/float4.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/float4x4.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/int3.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/ConvexDecompositionDotNet/int4.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/Meshing/HelperTypes.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/Meshing/Mesh.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/Meshing/Meshmerizer.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/Meshing/PrimMesher.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/Meshing/Properties/AssemblyInfo.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/Meshing/SculptMap.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/Meshing/SculptMesh.cs (100%) rename OpenSim/Region/{Physics/OdePlugin => PhysicsModules/Ode}/AssemblyInfo.cs (100%) rename OpenSim/Region/{Physics/OdePlugin => PhysicsModules/Ode}/ODECharacter.cs (100%) rename OpenSim/Region/{Physics/OdePlugin => PhysicsModules/Ode}/ODEDynamics.c_comments (100%) rename OpenSim/Region/{Physics/OdePlugin => PhysicsModules/Ode}/ODEDynamics.cs (100%) rename OpenSim/Region/{Physics/OdePlugin => PhysicsModules/Ode}/ODEPrim.cs (100%) rename OpenSim/Region/{Physics/OdePlugin => PhysicsModules/Ode}/ODERayCastRequestManager.cs (100%) rename OpenSim/Region/{Physics/OdePlugin => PhysicsModules/Ode}/OdePhysicsJoint.cs (100%) rename OpenSim/Region/{Physics/OdePlugin => PhysicsModules/Ode}/OdePlugin.cs (100%) rename OpenSim/Region/{Physics/OdePlugin => PhysicsModules/Ode}/OdeScene.cs (100%) rename OpenSim/Region/{Physics/OdePlugin => PhysicsModules/Ode}/Tests/ODETestClass.cs (100%) rename OpenSim/Region/{Physics/OdePlugin => PhysicsModules/Ode}/drawstuff.cs (100%) rename OpenSim/Region/{Physics/POSPlugin => PhysicsModules/POS}/AssemblyInfo.cs (100%) rename OpenSim/Region/{Physics/POSPlugin => PhysicsModules/POS}/POSCharacter.cs (100%) rename OpenSim/Region/{Physics/POSPlugin => PhysicsModules/POS}/POSPlugin.cs (100%) rename OpenSim/Region/{Physics/POSPlugin => PhysicsModules/POS}/POSPrim.cs (100%) rename OpenSim/Region/{Physics/POSPlugin => PhysicsModules/POS}/POSScene.cs (100%) rename OpenSim/Region/{Physics/Manager => PhysicsModules/SharedBase}/AssemblyInfo.cs (100%) rename OpenSim/Region/{Physics/Manager => PhysicsModules/SharedBase}/CollisionLocker.cs (100%) rename OpenSim/Region/{Physics/Manager => PhysicsModules/SharedBase}/IMesher.cs (100%) rename OpenSim/Region/{Physics/Manager => PhysicsModules/SharedBase}/IPhysicsParameters.cs (100%) rename OpenSim/Region/{Physics/Manager => PhysicsModules/SharedBase}/NullPhysicsScene.cs (100%) rename OpenSim/Region/{Physics/Manager => PhysicsModules/SharedBase}/PhysicsActor.cs (100%) rename OpenSim/Region/{Physics/Manager => PhysicsModules/SharedBase}/PhysicsJoint.cs (100%) rename OpenSim/Region/{Physics/Manager => PhysicsModules/SharedBase}/PhysicsPluginManager.cs (100%) rename OpenSim/Region/{Physics/Manager => PhysicsModules/SharedBase}/PhysicsScene.cs (100%) rename OpenSim/Region/{Physics/Manager => PhysicsModules/SharedBase}/PhysicsSensor.cs (100%) rename OpenSim/Region/{Physics/Manager => PhysicsModules/SharedBase}/PhysicsVector.cs (100%) rename OpenSim/Region/{Physics/Manager => PhysicsModules/SharedBase}/VehicleConstants.cs (100%) rename OpenSim/Region/{Physics/Manager => PhysicsModules/SharedBase}/ZeroMesher.cs (100%) diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/AssemblyInfo.cs similarity index 100% rename from OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs rename to OpenSim/Region/PhysicsModules/BasicPhysics/AssemblyInfo.cs diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsActor.cs similarity index 100% rename from OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs rename to OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsActor.cs diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPlugin.cs similarity index 100% rename from OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs rename to OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPlugin.cs diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPrim.cs similarity index 100% rename from OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs rename to OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPrim.cs diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs similarity index 100% rename from OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs rename to OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs b/OpenSim/Region/PhysicsModules/BulletS/BSAPIUnman.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSAPIUnman.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/PhysicsModules/BulletS/BSAPIXNA.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSAPIXNA.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorHover.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSActorHover.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorLockAxis.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSActorLockAxis.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorSetForce.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetForce.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSActorSetForce.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSActorSetForce.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorSetTorque.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSActorSetTorque.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActors.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSActors.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSActors.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/PhysicsModules/BulletS/BSApiTemplate.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSApiTemplate.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraint.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSConstraint.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraint6Dof.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSConstraint6Dof.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintCollection.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSConstraintCollection.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintConeTwist.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintConeTwist.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSConstraintConeTwist.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSConstraintConeTwist.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintHinge.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintHinge.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSConstraintHinge.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSConstraintHinge.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSlider.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintSlider.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSConstraintSlider.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSConstraintSlider.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSpring.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintSpring.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSConstraintSpring.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSConstraintSpring.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/PhysicsModules/BulletS/BSLinkset.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSLinkset.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/PhysicsModules/BulletS/BSLinksetCompound.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSLinksetCompound.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/PhysicsModules/BulletS/BSLinksetConstraints.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSLinksetConstraints.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs b/OpenSim/Region/PhysicsModules/BulletS/BSMaterials.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSMaterials.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs b/OpenSim/Region/PhysicsModules/BulletS/BSMotors.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSMotors.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSParam.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSParam.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPlugin.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSPlugin.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrimDisplaced.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSPrimDisplaced.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSScene.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSScene.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/PhysicsModules/BulletS/BSShapeCollection.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSShapeCollection.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs b/OpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs rename to OpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/PhysicsModules/BulletS/BulletSimTODO.txt similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt rename to OpenSim/Region/PhysicsModules/BulletS/BulletSimTODO.txt diff --git a/OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/BulletS/Properties/AssemblyInfo.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs rename to OpenSim/Region/PhysicsModules/BulletS/Properties/AssemblyInfo.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BasicVehicles.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs rename to OpenSim/Region/PhysicsModules/BulletS/Tests/BasicVehicles.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTests.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTests.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTests.cs rename to OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTests.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTestsUtil.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTestsUtil.cs rename to OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/HullCreation.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/HullCreation.cs similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/Tests/HullCreation.cs rename to OpenSim/Region/PhysicsModules/BulletS/Tests/HullCreation.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/CTri.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/CTri.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/CTri.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/CTri.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Concavity.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Concavity.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/Concavity.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Concavity.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexBuilder.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexBuilder.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexBuilder.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexBuilder.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexDecomposition.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexDecomposition.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexDecomposition.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexDecomposition.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexResult.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexResult.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexResult.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexResult.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/HullClasses.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullClasses.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/HullClasses.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullClasses.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/HullTriangle.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullTriangle.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/HullTriangle.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullTriangle.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/HullUtils.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullUtils.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/HullUtils.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullUtils.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/LICENSE.txt b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/LICENSE.txt similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/LICENSE.txt rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/LICENSE.txt diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Plane.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Plane.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/Plane.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Plane.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/PlaneTri.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/PlaneTri.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/PlaneTri.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/PlaneTri.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Quaternion.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Quaternion.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/Quaternion.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Quaternion.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/README.txt b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/README.txt similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/README.txt rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/README.txt diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/SplitPlane.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/SplitPlane.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/SplitPlane.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/SplitPlane.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/VertexLookup.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/VertexLookup.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/VertexLookup.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/VertexLookup.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float2.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float2.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/float2.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float2.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float3.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/float3.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float3x3.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3x3.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/float3x3.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3x3.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float4.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/float4.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float4x4.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4x4.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/float4x4.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4x4.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/int3.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int3.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/int3.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int3.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/int4.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int4.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/int4.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int4.cs diff --git a/OpenSim/Region/Physics/Meshing/HelperTypes.cs b/OpenSim/Region/PhysicsModules/Meshing/HelperTypes.cs similarity index 100% rename from OpenSim/Region/Physics/Meshing/HelperTypes.cs rename to OpenSim/Region/PhysicsModules/Meshing/HelperTypes.cs diff --git a/OpenSim/Region/Physics/Meshing/Mesh.cs b/OpenSim/Region/PhysicsModules/Meshing/Mesh.cs similarity index 100% rename from OpenSim/Region/Physics/Meshing/Mesh.cs rename to OpenSim/Region/PhysicsModules/Meshing/Mesh.cs diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer.cs similarity index 100% rename from OpenSim/Region/Physics/Meshing/Meshmerizer.cs rename to OpenSim/Region/PhysicsModules/Meshing/Meshmerizer.cs diff --git a/OpenSim/Region/Physics/Meshing/PrimMesher.cs b/OpenSim/Region/PhysicsModules/Meshing/PrimMesher.cs similarity index 100% rename from OpenSim/Region/Physics/Meshing/PrimMesher.cs rename to OpenSim/Region/PhysicsModules/Meshing/PrimMesher.cs diff --git a/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs similarity index 100% rename from OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs rename to OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs diff --git a/OpenSim/Region/Physics/Meshing/SculptMap.cs b/OpenSim/Region/PhysicsModules/Meshing/SculptMap.cs similarity index 100% rename from OpenSim/Region/Physics/Meshing/SculptMap.cs rename to OpenSim/Region/PhysicsModules/Meshing/SculptMap.cs diff --git a/OpenSim/Region/Physics/Meshing/SculptMesh.cs b/OpenSim/Region/PhysicsModules/Meshing/SculptMesh.cs similarity index 100% rename from OpenSim/Region/Physics/Meshing/SculptMesh.cs rename to OpenSim/Region/PhysicsModules/Meshing/SculptMesh.cs diff --git a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs similarity index 100% rename from OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs rename to OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs similarity index 100% rename from OpenSim/Region/Physics/OdePlugin/ODECharacter.cs rename to OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.c_comments b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.c_comments similarity index 100% rename from OpenSim/Region/Physics/OdePlugin/ODEDynamics.c_comments rename to OpenSim/Region/PhysicsModules/Ode/ODEDynamics.c_comments diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs similarity index 100% rename from OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs rename to OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs similarity index 100% rename from OpenSim/Region/Physics/OdePlugin/ODEPrim.cs rename to OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs diff --git a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs similarity index 100% rename from OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs rename to OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs diff --git a/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs b/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs similarity index 100% rename from OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs rename to OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs similarity index 100% rename from OpenSim/Region/Physics/OdePlugin/OdePlugin.cs rename to OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs similarity index 100% rename from OpenSim/Region/Physics/OdePlugin/OdeScene.cs rename to OpenSim/Region/PhysicsModules/Ode/OdeScene.cs diff --git a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs similarity index 100% rename from OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs rename to OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs diff --git a/OpenSim/Region/Physics/OdePlugin/drawstuff.cs b/OpenSim/Region/PhysicsModules/Ode/drawstuff.cs similarity index 100% rename from OpenSim/Region/Physics/OdePlugin/drawstuff.cs rename to OpenSim/Region/PhysicsModules/Ode/drawstuff.cs diff --git a/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/POS/AssemblyInfo.cs similarity index 100% rename from OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs rename to OpenSim/Region/PhysicsModules/POS/AssemblyInfo.cs diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/PhysicsModules/POS/POSCharacter.cs similarity index 100% rename from OpenSim/Region/Physics/POSPlugin/POSCharacter.cs rename to OpenSim/Region/PhysicsModules/POS/POSCharacter.cs diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/PhysicsModules/POS/POSPlugin.cs similarity index 100% rename from OpenSim/Region/Physics/POSPlugin/POSPlugin.cs rename to OpenSim/Region/PhysicsModules/POS/POSPlugin.cs diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/PhysicsModules/POS/POSPrim.cs similarity index 100% rename from OpenSim/Region/Physics/POSPlugin/POSPrim.cs rename to OpenSim/Region/PhysicsModules/POS/POSPrim.cs diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/PhysicsModules/POS/POSScene.cs similarity index 100% rename from OpenSim/Region/Physics/POSPlugin/POSScene.cs rename to OpenSim/Region/PhysicsModules/POS/POSScene.cs diff --git a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/SharedBase/AssemblyInfo.cs similarity index 100% rename from OpenSim/Region/Physics/Manager/AssemblyInfo.cs rename to OpenSim/Region/PhysicsModules/SharedBase/AssemblyInfo.cs diff --git a/OpenSim/Region/Physics/Manager/CollisionLocker.cs b/OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs similarity index 100% rename from OpenSim/Region/Physics/Manager/CollisionLocker.cs rename to OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs similarity index 100% rename from OpenSim/Region/Physics/Manager/IMesher.cs rename to OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs diff --git a/OpenSim/Region/Physics/Manager/IPhysicsParameters.cs b/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs similarity index 100% rename from OpenSim/Region/Physics/Manager/IPhysicsParameters.cs rename to OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs diff --git a/OpenSim/Region/Physics/Manager/NullPhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs similarity index 100% rename from OpenSim/Region/Physics/Manager/NullPhysicsScene.cs rename to OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs similarity index 100% rename from OpenSim/Region/Physics/Manager/PhysicsActor.cs rename to OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs diff --git a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs similarity index 100% rename from OpenSim/Region/Physics/Manager/PhysicsJoint.cs rename to OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs similarity index 100% rename from OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs rename to OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs similarity index 100% rename from OpenSim/Region/Physics/Manager/PhysicsScene.cs rename to OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs diff --git a/OpenSim/Region/Physics/Manager/PhysicsSensor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs similarity index 100% rename from OpenSim/Region/Physics/Manager/PhysicsSensor.cs rename to OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs similarity index 100% rename from OpenSim/Region/Physics/Manager/PhysicsVector.cs rename to OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs diff --git a/OpenSim/Region/Physics/Manager/VehicleConstants.cs b/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs similarity index 100% rename from OpenSim/Region/Physics/Manager/VehicleConstants.cs rename to OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs diff --git a/OpenSim/Region/Physics/Manager/ZeroMesher.cs b/OpenSim/Region/PhysicsModules/SharedBase/ZeroMesher.cs similarity index 100% rename from OpenSim/Region/Physics/Manager/ZeroMesher.cs rename to OpenSim/Region/PhysicsModules/SharedBase/ZeroMesher.cs diff --git a/prebuild.xml b/prebuild.xml index b5ebed1958..f1ab322929 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -410,7 +410,7 @@ - + ../../../../bin/ @@ -438,7 +438,7 @@ - + ../../../../bin/Physics/ @@ -455,13 +455,13 @@ - + - + ../../../../bin/Physics/ @@ -478,13 +478,13 @@ - + - + ../../../../bin/Physics/ @@ -503,7 +503,7 @@ - + @@ -514,7 +514,7 @@ - + ../../../../bin/Physics/ @@ -536,7 +536,7 @@ - + @@ -653,7 +653,7 @@ - + @@ -1507,7 +1507,7 @@ - + @@ -1594,7 +1594,7 @@ - + @@ -1648,7 +1648,7 @@ - + @@ -1700,7 +1700,7 @@ - + @@ -1749,7 +1749,7 @@ - + @@ -1801,7 +1801,7 @@ - + ../../../../bin/ @@ -1826,7 +1826,7 @@ - + ../../../../bin/Physics/ @@ -1852,9 +1852,9 @@ - - - + + + @@ -1897,7 +1897,7 @@ - + @@ -2270,7 +2270,7 @@ - + @@ -2464,7 +2464,7 @@ - + @@ -2729,7 +2729,7 @@ - + @@ -3056,7 +3056,7 @@ - + @@ -3136,7 +3136,7 @@ - + @@ -3204,7 +3204,7 @@ - + @@ -3369,7 +3369,7 @@ TODO: this is kind of lame, we basically build a duplicate assembly but with tests added in, just because we can't resolve cross-bin-dir-refs. --> - + ../../../../../bin/ @@ -3388,8 +3388,8 @@ - - + + @@ -3400,7 +3400,7 @@ - + ../../../../../bin/ @@ -3424,9 +3424,9 @@ - - - + + + From 2c0cad6dd3014e9ad363090f5f7872c43daffcbd Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 30 Aug 2015 20:29:31 -0700 Subject: [PATCH 03/33] Renamed the namespaces too --- OpenSim/Region/Application/OpenSimBase.cs | 2 +- .../ClientStack/RegionApplicationBase.cs | 2 +- .../EntityTransfer/EntityTransferModule.cs | 2 +- .../EntityTransferStateMachine.cs | 2 +- .../CoreModules/World/Land/DwellModule.cs | 2 +- .../World/Land/LandManagementModule.cs | 2 +- .../World/Warp3DMap/Warp3DImageModule.cs | 2 +- .../Scenes/Animation/ScenePresenceAnimator.cs | 2 +- .../Region/Framework/Scenes/EventManager.cs | 24 +++++++++---------- .../Region/Framework/Scenes/KeyframeMotion.cs | 2 +- .../Region/Framework/Scenes/Prioritizer.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +- .../Framework/Scenes/SceneObjectGroup.cs | 2 +- .../Framework/Scenes/SceneObjectPart.cs | 2 +- .../Region/Framework/Scenes/ScenePresence.cs | 2 +- .../Scenes/Serialization/SceneXmlLoader.cs | 2 +- .../Tests/ScenePresenceAnimationTests.cs | 2 +- .../PhysicsParameters/PhysicsParameters.cs | 2 +- .../ExtendedPhysics/ExtendedPhysics.cs | 2 +- .../Scripting/Minimodule/SOPObject.cs | 2 +- .../PhysicsModules/BulletS/BSAPIUnman.cs | 2 +- .../Region/PhysicsModules/BulletS/BSAPIXNA.cs | 2 +- .../BulletS/BSActorAvatarMove.cs | 4 ++-- .../PhysicsModules/BulletS/BSActorHover.cs | 4 ++-- .../PhysicsModules/BulletS/BSActorLockAxis.cs | 2 +- .../BulletS/BSActorMoveToTarget.cs | 4 ++-- .../PhysicsModules/BulletS/BSActorSetForce.cs | 4 ++-- .../BulletS/BSActorSetTorque.cs | 4 ++-- .../Region/PhysicsModules/BulletS/BSActors.cs | 2 +- .../PhysicsModules/BulletS/BSApiTemplate.cs | 2 +- .../PhysicsModules/BulletS/BSCharacter.cs | 4 ++-- .../PhysicsModules/BulletS/BSConstraint.cs | 2 +- .../BulletS/BSConstraint6Dof.cs | 2 +- .../BulletS/BSConstraintCollection.cs | 2 +- .../BulletS/BSConstraintConeTwist.cs | 2 +- .../BulletS/BSConstraintHinge.cs | 2 +- .../BulletS/BSConstraintSlider.cs | 2 +- .../BulletS/BSConstraintSpring.cs | 2 +- .../PhysicsModules/BulletS/BSDynamics.cs | 4 ++-- .../PhysicsModules/BulletS/BSLinkset.cs | 2 +- .../BulletS/BSLinksetCompound.cs | 2 +- .../BulletS/BSLinksetConstraints.cs | 2 +- .../PhysicsModules/BulletS/BSMaterials.cs | 2 +- .../Region/PhysicsModules/BulletS/BSMotors.cs | 2 +- .../Region/PhysicsModules/BulletS/BSParam.cs | 4 ++-- .../PhysicsModules/BulletS/BSPhysObject.cs | 4 ++-- .../Region/PhysicsModules/BulletS/BSPlugin.cs | 4 ++-- .../Region/PhysicsModules/BulletS/BSPrim.cs | 6 ++--- .../PhysicsModules/BulletS/BSPrimDisplaced.cs | 4 ++-- .../PhysicsModules/BulletS/BSPrimLinkable.cs | 4 ++-- .../Region/PhysicsModules/BulletS/BSScene.cs | 4 ++-- .../BulletS/BSShapeCollection.cs | 6 ++--- .../Region/PhysicsModules/BulletS/BSShapes.cs | 8 +++---- .../BulletS/BSTerrainHeightmap.cs | 4 ++-- .../BulletS/BSTerrainManager.cs | 4 ++-- .../PhysicsModules/BulletS/BSTerrainMesh.cs | 4 ++-- .../PhysicsModules/BulletS/BulletSimData.cs | 2 +- .../BulletS/Tests/BasicVehicles.cs | 6 ++--- .../BulletS/Tests/BulletSimTests.cs | 2 +- .../BulletS/Tests/BulletSimTestsUtil.cs | 6 ++--- .../BulletS/Tests/HullCreation.cs | 6 ++--- .../ConvexDecompositionDotNet/CTri.cs | 2 +- .../ConvexDecompositionDotNet/Concavity.cs | 2 +- .../ConvexBuilder.cs | 2 +- .../ConvexDecomposition.cs | 2 +- .../ConvexDecompositionDotNet/ConvexResult.cs | 2 +- .../ConvexDecompositionDotNet/HullClasses.cs | 2 +- .../ConvexDecompositionDotNet/HullTriangle.cs | 2 +- .../ConvexDecompositionDotNet/HullUtils.cs | 2 +- .../ConvexDecompositionDotNet/Plane.cs | 2 +- .../ConvexDecompositionDotNet/PlaneTri.cs | 2 +- .../ConvexDecompositionDotNet/Quaternion.cs | 2 +- .../ConvexDecompositionDotNet/SplitPlane.cs | 2 +- .../ConvexDecompositionDotNet/VertexLookup.cs | 2 +- .../ConvexDecompositionDotNet/float2.cs | 2 +- .../ConvexDecompositionDotNet/float3.cs | 2 +- .../ConvexDecompositionDotNet/float3x3.cs | 2 +- .../ConvexDecompositionDotNet/float4.cs | 2 +- .../ConvexDecompositionDotNet/float4x4.cs | 2 +- .../ConvexDecompositionDotNet/int3.cs | 2 +- .../ConvexDecompositionDotNet/int4.cs | 2 +- .../PhysicsModules/Meshing/HelperTypes.cs | 4 ++-- OpenSim/Region/PhysicsModules/Meshing/Mesh.cs | 4 ++-- .../PhysicsModules/Meshing/Meshmerizer.cs | 4 ++-- .../Region/PhysicsModules/Ode/ODECharacter.cs | 4 ++-- .../Region/PhysicsModules/Ode/ODEDynamics.cs | 4 ++-- OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs | 4 ++-- .../Ode/ODERayCastRequestManager.cs | 4 ++-- .../PhysicsModules/Ode/OdePhysicsJoint.cs | 6 ++--- .../Region/PhysicsModules/Ode/OdePlugin.cs | 4 ++-- OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | 4 ++-- .../PhysicsModules/Ode/Tests/ODETestClass.cs | 8 +++---- .../Region/PhysicsModules/POS/POSCharacter.cs | 4 ++-- .../Region/PhysicsModules/POS/POSPlugin.cs | 4 ++-- OpenSim/Region/PhysicsModules/POS/POSPrim.cs | 4 ++-- OpenSim/Region/PhysicsModules/POS/POSScene.cs | 4 ++-- .../SharedBase/CollisionLocker.cs | 2 +- .../PhysicsModules/SharedBase/IMesher.cs | 2 +- .../SharedBase/IPhysicsParameters.cs | 2 +- .../SharedBase/NullPhysicsScene.cs | 2 +- .../PhysicsModules/SharedBase/PhysicsActor.cs | 2 +- .../PhysicsModules/SharedBase/PhysicsJoint.cs | 2 +- .../SharedBase/PhysicsPluginManager.cs | 2 +- .../PhysicsModules/SharedBase/PhysicsScene.cs | 2 +- .../SharedBase/PhysicsSensor.cs | 2 +- .../SharedBase/PhysicsVector.cs | 2 +- .../SharedBase/VehicleConstants.cs | 2 +- .../PhysicsModules/SharedBase/ZeroMesher.cs | 2 +- .../RegionCombinerModule.cs | 2 +- .../Shared/Api/Implementation/LSL_Api.cs | 2 +- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 2 +- OpenSim/Tests/Common/Mock/TestScene.cs | 2 +- 113 files changed, 171 insertions(+), 171 deletions(-) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 62a52d6188..f26355629e 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -46,7 +46,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenSim.Server.Base; using OpenSim.Services.Base; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index c497b1c7db..b08bf4d616 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -38,7 +38,7 @@ using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenSim.Services.Interfaces; namespace OpenSim.Region.ClientStack diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 4be19f0d74..371b4f2925 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -36,7 +36,7 @@ using OpenSim.Framework.Client; using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs index 6a04acf905..0f57aeeed4 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs @@ -38,7 +38,7 @@ using OpenSim.Framework.Capabilities; using OpenSim.Framework.Client; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs index d17c517289..bfa032045a 100644 --- a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs @@ -45,7 +45,7 @@ using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.CoreModules.Framework.InterfaceCommander; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenSim.Services.Interfaces; using Caps = OpenSim.Framework.Capabilities.Caps; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 25e14547c8..f467e2ab27 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -44,7 +44,7 @@ using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenSim.Services.Interfaces; using Caps = OpenSim.Framework.Capabilities.Caps; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index dd919512cb..a97075572b 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs @@ -41,7 +41,7 @@ using Mono.Addins; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenSim.Services.Interfaces; using OpenMetaverse; diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 5beee7371d..b6f2d3dd35 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -35,7 +35,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; namespace OpenSim.Region.Framework.Scenes.Animation { diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index d325240596..97b9482550 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -632,8 +632,8 @@ namespace OpenSim.Region.Framework.Scenes /// Triggered by /// in /// via - /// via - /// via + /// via + /// via /// public event ScriptColliding OnScriptColliderStart; @@ -646,8 +646,8 @@ namespace OpenSim.Region.Framework.Scenes /// Triggered by /// in /// via - /// via - /// via + /// via + /// via /// public event ScriptColliding OnScriptColliding; @@ -659,8 +659,8 @@ namespace OpenSim.Region.Framework.Scenes /// Triggered by /// in /// via - /// via - /// via + /// via + /// via /// public event ScriptColliding OnScriptCollidingEnd; @@ -672,8 +672,8 @@ namespace OpenSim.Region.Framework.Scenes /// Triggered by /// in /// via - /// via - /// via + /// via + /// via /// public event ScriptColliding OnScriptLandColliderStart; @@ -685,8 +685,8 @@ namespace OpenSim.Region.Framework.Scenes /// Triggered by /// in /// via - /// via - /// via + /// via + /// via /// public event ScriptColliding OnScriptLandColliding; @@ -698,8 +698,8 @@ namespace OpenSim.Region.Framework.Scenes /// Triggered by /// in /// via - /// via - /// via + /// via + /// via /// public event ScriptColliding OnScriptLandColliderEnd; diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index 646403ff18..103386c822 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs @@ -36,7 +36,7 @@ using System.Threading; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenSim.Region.Framework.Scenes.Serialization; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization; diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 1b10e3cb85..2ca24651b6 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -31,7 +31,7 @@ using log4net; using Nini.Config; using OpenSim.Framework; using OpenMetaverse; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; /* * Steps to add a new prioritization policy: diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 04e26640f7..86a57721fc 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -47,7 +47,7 @@ using OpenSim.Framework.Console; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes.Scripting; using OpenSim.Region.Framework.Scenes.Serialization; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using Timer = System.Timers.Timer; using TPFlags = OpenSim.Framework.Constants.TeleportFlags; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index c2e9b61ea8..96488104bc 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -34,7 +34,7 @@ using OpenMetaverse.Packets; using log4net; using OpenSim.Framework; using OpenSim.Region.Framework.Scenes.Types; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.Framework.Scenes diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 866a43c1a9..3be6ad2a6a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -38,7 +38,7 @@ using OpenMetaverse; using OpenMetaverse.Packets; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenSim.Region.Framework.Scenes.Serialization; using PermissionMask = OpenSim.Framework.PermissionMask; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f6e8c7feaf..dae8c547b6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -42,7 +42,7 @@ using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes.Scripting; using OpenSim.Region.Framework.Scenes.Serialization; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using PermissionMask = OpenSim.Framework.PermissionMask; namespace OpenSim.Region.Framework.Scenes diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2f19b50ea5..d8c6c9446a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -41,7 +41,7 @@ using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes.Animation; using OpenSim.Region.Framework.Scenes.Types; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenSim.Services.Interfaces; using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags; diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index a3485d29e6..53815f0f20 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs @@ -34,7 +34,7 @@ using OpenMetaverse; using log4net; using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; namespace OpenSim.Region.Framework.Scenes.Serialization { diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs index 42cfa1b4c4..5f87f4a659 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs @@ -41,7 +41,7 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.Framework.EntityTransfer; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenSim.Tests.Common; namespace OpenSim.Region.Framework.Scenes.Tests diff --git a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs index 3083a337ff..1c039cb0e9 100755 --- a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs +++ b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs @@ -36,7 +36,7 @@ using OpenSim.Framework.Console; using OpenSim.Region.CoreModules.Framework.InterfaceCommander; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; namespace OpenSim.Region.OptionalModules.PhysicsParameters { diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs index ff4afbf90e..c5753b9264 100755 --- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs @@ -36,7 +36,7 @@ using OpenSim.Region.CoreModules; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using Mono.Addins; using Nini.Config; diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index 5ed1514ad4..7922db6559 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs @@ -34,7 +34,7 @@ using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.OptionalModules.Scripting.Minimodule.Object; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using PrimType=OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.PrimType; using SculptType=OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.SculptType; diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSAPIUnman.cs b/OpenSim/Region/PhysicsModules/BulletS/BSAPIUnman.cs index 3bd81d4fd0..c4a923c39c 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSAPIUnman.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSAPIUnman.cs @@ -35,7 +35,7 @@ using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSAPIUnman : BSAPITemplate { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSAPIXNA.cs b/OpenSim/Region/PhysicsModules/BulletS/BSAPIXNA.cs index 741f8dbf1d..887311d723 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSAPIXNA.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSAPIXNA.cs @@ -40,7 +40,7 @@ using BulletXNA.BulletCollision; using BulletXNA.BulletDynamics; using BulletXNA.BulletCollision.CollisionDispatch; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSAPIXNA : BSAPITemplate { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs index bde4557800..f1a06cc8ae 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs @@ -31,11 +31,11 @@ using System.Linq; using System.Text; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSActorAvatarMove : BSActor { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSActorHover.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorHover.cs index e54c27b266..7fbe920c33 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSActorHover.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorHover.cs @@ -30,11 +30,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSActorHover : BSActor { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSActorLockAxis.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorLockAxis.cs index 3b3c161763..78c1b6aacb 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSActorLockAxis.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorLockAxis.cs @@ -32,7 +32,7 @@ using System.Text; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSActorLockAxis : BSActor { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs index 114500632a..6a886b022a 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs @@ -30,11 +30,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSActorMoveToTarget : BSActor { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSActorSetForce.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetForce.cs index 4e81363024..e81452abfb 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSActorSetForce.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetForce.cs @@ -30,11 +30,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSActorSetForce : BSActor { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs index 79e1d38612..7eeb533aaa 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs @@ -30,11 +30,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSActorSetTorque : BSActor { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSActors.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActors.cs index 7f45e2cc4e..851347b493 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSActors.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActors.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; using System.Text; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSActorCollection { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSApiTemplate.cs b/OpenSim/Region/PhysicsModules/BulletS/BSApiTemplate.cs index 8491c0f548..7756b10a8c 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSApiTemplate.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSApiTemplate.cs @@ -31,7 +31,7 @@ using System.Security; using System.Text; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin { +namespace OpenSim.Region.PhysicsModule.BulletS { // Constraint type values as defined by Bullet public enum ConstraintType : int diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs index 9c3f160300..d6b85517c9 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs @@ -30,9 +30,9 @@ using System.Reflection; using log4net; using OMV = OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSCharacter : BSPhysObject { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSConstraint.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraint.cs index b47e9a85f6..e42e868853 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSConstraint.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraint.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using System.Text; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public abstract class BSConstraint : IDisposable diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSConstraint6Dof.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraint6Dof.cs index 7fcb75c178..4bcde2bb27 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSConstraint6Dof.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraint6Dof.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using System.Text; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSConstraint6Dof : BSConstraint diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSConstraintCollection.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintCollection.cs index 5c8d94e07e..5746ac1746 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSConstraintCollection.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintCollection.cs @@ -30,7 +30,7 @@ using System.Text; using log4net; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSConstraintCollection : IDisposable diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSConstraintConeTwist.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintConeTwist.cs index 7a76a9a8e9..e7566a83dd 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSConstraintConeTwist.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintConeTwist.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using System.Text; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSConstraintConeTwist : BSConstraint diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSConstraintHinge.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintHinge.cs index ed89f630e1..d20538d58d 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSConstraintHinge.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintHinge.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using System.Text; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSConstraintHinge : BSConstraint diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSConstraintSlider.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintSlider.cs index 37cfa07ae8..83d42af912 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSConstraintSlider.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintSlider.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using System.Text; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSConstraintSlider : BSConstraint diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSConstraintSpring.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintSpring.cs index 8e7ddff102..563a1b1ef5 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSConstraintSpring.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintSpring.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using System.Text; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSConstraintSpring : BSConstraint6Dof diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs b/OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs index c6d6331825..fcf0dd53c3 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs @@ -36,9 +36,9 @@ using System.Reflection; using System.Runtime.InteropServices; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSDynamics : BSActor { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSLinkset.cs b/OpenSim/Region/PhysicsModules/BulletS/BSLinkset.cs index 87eba33860..83122398e2 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSLinkset.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSLinkset.cs @@ -30,7 +30,7 @@ using System.Text; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public abstract class BSLinkset diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSLinksetCompound.cs b/OpenSim/Region/PhysicsModules/BulletS/BSLinksetCompound.cs index cae9efad58..953ddee0dd 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSLinksetCompound.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSLinksetCompound.cs @@ -32,7 +32,7 @@ using OpenSim.Framework; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSLinksetCompound : BSLinkset diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSLinksetConstraints.cs b/OpenSim/Region/PhysicsModules/BulletS/BSLinksetConstraints.cs index 4384cdc36e..d7be470d81 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSLinksetConstraints.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSLinksetConstraints.cs @@ -32,7 +32,7 @@ using OpenSim.Region.OptionalModules.Scripting; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSLinksetConstraints : BSLinkset { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSMaterials.cs b/OpenSim/Region/PhysicsModules/BulletS/BSMaterials.cs index ee77d6e3f8..0e44d03770 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSMaterials.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSMaterials.cs @@ -30,7 +30,7 @@ using System.Text; using System.Reflection; using Nini.Config; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public struct MaterialAttributes diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSMotors.cs b/OpenSim/Region/PhysicsModules/BulletS/BSMotors.cs index 7693195763..2faf2d4c0c 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSMotors.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSMotors.cs @@ -31,7 +31,7 @@ using System.Text; using OpenMetaverse; using OpenSim.Framework; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public abstract class BSMotor { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs b/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs index 6d46fe690a..10bbfb308e 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs @@ -29,12 +29,12 @@ using System.Collections.Generic; using System.Reflection; using System.Text; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenMetaverse; using Nini.Config; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public static class BSParam { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs index 90da7a676c..4d69f6111f 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs @@ -30,9 +30,9 @@ using System.Text; using OMV = OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { /* * Class to wrap all objects. diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPlugin.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPlugin.cs index 944285414d..e28cd928ba 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPlugin.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPlugin.cs @@ -27,10 +27,10 @@ using System; using System.Collections.Generic; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { /// /// Entry for a port of Bullet (http://bulletphysics.org/) to OpenSim. diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs index a00991f978..ab6aa5d565 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs @@ -32,11 +32,11 @@ using System.Xml; using log4net; using OMV = OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.ConvexDecompositionDotNet; +using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet; using OpenSim.Region.OptionalModules.Scripting; // for ExtendedPhysics -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { [Serializable] diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPrimDisplaced.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrimDisplaced.cs index 2eb144049f..6b234afa0f 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPrimDisplaced.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPrimDisplaced.cs @@ -31,11 +31,11 @@ using System.Reflection; using System.Runtime.InteropServices; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSPrimDisplaced : BSPrim { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs index 430d645566..91550cb39c 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs @@ -34,7 +34,7 @@ using OpenSim.Region.OptionalModules.Scripting; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSPrimLinkable : BSPrimDisplaced { @@ -72,7 +72,7 @@ public class BSPrimLinkable : BSPrimDisplaced base.Destroy(); } - public override void link(Manager.PhysicsActor obj) + public override void link(SharedBase.PhysicsActor obj) { BSPrimLinkable parent = obj as BSPrimLinkable; if (parent != null) diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs index 8a19944013..18a4a58370 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs @@ -36,12 +36,12 @@ using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework; using OpenSim.Region.CoreModules; using Logging = OpenSim.Region.CoreModules.Framework.Statistics.Logging; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using Nini.Config; using log4net; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSScene : PhysicsScene, IPhysicsParameters { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSShapeCollection.cs b/OpenSim/Region/PhysicsModules/BulletS/BSShapeCollection.cs index d1de844e96..8dba3e4458 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSShapeCollection.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSShapeCollection.cs @@ -29,10 +29,10 @@ using System.Collections.Generic; using System.Text; using OMV = OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.ConvexDecompositionDotNet; +using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSShapeCollection : IDisposable { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs b/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs index 86d86cb0ee..d8189e0ceb 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs @@ -30,13 +30,13 @@ using System.Collections.Generic; using System.Text; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.Meshing; -using OpenSim.Region.Physics.ConvexDecompositionDotNet; +using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModule.Meshing; +using OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { // Information class that holds stats for the shape. Which values mean // something depends on the type of shape. diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs index d70b2fbfaf..7704d1fc53 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs @@ -31,14 +31,14 @@ using System.Text; using OpenSim.Framework; using OpenSim.Region.Framework; using OpenSim.Region.CoreModules; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using Nini.Config; using log4net; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSTerrainHeightmap : BSTerrainPhys { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs index 50f917a485..6e686cec20 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs @@ -31,14 +31,14 @@ using System.Text; using OpenSim.Framework; using OpenSim.Region.Framework; using OpenSim.Region.CoreModules; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using Nini.Config; using log4net; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { // The physical implementation of the terrain is wrapped in this class. diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs index e4ca098b2d..4c3e33a50a 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs @@ -31,14 +31,14 @@ using System.Text; using OpenSim.Framework; using OpenSim.Region.Framework; using OpenSim.Region.CoreModules; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using Nini.Config; using log4net; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSTerrainMesh : BSTerrainPhys { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs b/OpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs index 59324611d6..3329395274 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using System.Text; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { // Classes to allow some type checking for the API // These hold pointers to allocated objects in the unmanaged space. diff --git a/OpenSim/Region/PhysicsModules/BulletS/Tests/BasicVehicles.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BasicVehicles.cs index 48e74eb9d4..160ebb51fe 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/Tests/BasicVehicles.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/BasicVehicles.cs @@ -34,13 +34,13 @@ using NUnit.Framework; using log4net; using OpenSim.Framework; -using OpenSim.Region.Physics.BulletSPlugin; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.BulletS; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenSim.Tests.Common; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin.Tests +namespace OpenSim.Region.PhysicsModule.BulletS.Tests { [TestFixture] public class BasicVehicles : OpenSimTestCase diff --git a/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTests.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTests.cs index 35cbc1d3d1..0be1f4ce6b 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTests.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTests.cs @@ -35,7 +35,7 @@ using log4net; using OpenSim.Tests.Common; -namespace OpenSim.Region.Physics.BulletSPlugin.Tests +namespace OpenSim.Region.PhysicsModule.BulletS.Tests { [TestFixture] public class BulletSimTests : OpenSimTestCase diff --git a/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs index 775bca213c..173e20d314 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs @@ -33,12 +33,12 @@ using System.Text; using Nini.Config; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.Meshing; +using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModule.Meshing; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin.Tests +namespace OpenSim.Region.PhysicsModule.BulletS.Tests { // Utility functions for building up and tearing down the sample physics environments public static class BulletSimTestsUtil diff --git a/OpenSim/Region/PhysicsModules/BulletS/Tests/HullCreation.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/HullCreation.cs index 5a5de110b4..69078f2ebf 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/Tests/HullCreation.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/HullCreation.cs @@ -34,13 +34,13 @@ using NUnit.Framework; using log4net; using OpenSim.Framework; -using OpenSim.Region.Physics.BulletSPlugin; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.BulletS; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenSim.Tests.Common; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin.Tests +namespace OpenSim.Region.PhysicsModule.BulletS.Tests { [TestFixture] public class HullCreation : OpenSimTestCase diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/CTri.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/CTri.cs index 4d84c44704..7ad689e7a1 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/CTri.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/CTri.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class Wpoint { diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Concavity.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Concavity.cs index cc6383a9c6..4140d250d1 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Concavity.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Concavity.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Text; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public static class Concavity { diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexBuilder.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexBuilder.cs index dfaede1176..70c3a2bf6c 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexBuilder.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexBuilder.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class DecompDesc { diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexDecomposition.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexDecomposition.cs index 2e2bb70c7a..5046bce62e 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexDecomposition.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexDecomposition.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public delegate void ConvexDecompositionCallback(ConvexResult result); diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexResult.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexResult.cs index 87758b5971..44e3e50940 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexResult.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexResult.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class ConvexResult { diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullClasses.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullClasses.cs index d81df262ae..8a0164e7b8 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullClasses.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullClasses.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class HullResult { diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullTriangle.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullTriangle.cs index 1119a75e91..d3f0052e36 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullTriangle.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullTriangle.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class HullTriangle : int3 { diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullUtils.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullUtils.cs index c9ccfe2c61..390325465d 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullUtils.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullUtils.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public static class HullUtils { diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Plane.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Plane.cs index d099676208..da9ae0cb8a 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Plane.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Plane.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class Plane { diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/PlaneTri.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/PlaneTri.cs index 31f0182520..42f7a229d6 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/PlaneTri.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/PlaneTri.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public enum PlaneTriResult : int { diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Quaternion.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Quaternion.cs index 0ba8f17a9c..045f62075c 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Quaternion.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Quaternion.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class Quaternion : float4 { diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/SplitPlane.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/SplitPlane.cs index 9f06a9a23f..9f56bc5f48 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/SplitPlane.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/SplitPlane.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class Rect3d { diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/VertexLookup.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/VertexLookup.cs index 6f17c9f711..bfe11e5824 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/VertexLookup.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/VertexLookup.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class VertexPool { diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float2.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float2.cs index ce88fc826e..e7358c1599 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float2.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float2.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class float2 { diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3.cs index 4389114848..fde9b32224 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class float3 : IEquatable { diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3x3.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3x3.cs index 76cf06347a..c420fde85f 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3x3.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3x3.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class float3x3 { diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4.cs index fa6087679f..b2b6fd3949 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class float4 { diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4x4.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4x4.cs index 7d1592f00c..087eba75dd 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4x4.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4x4.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class float4x4 { diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int3.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int3.cs index 9c5760d7e9..90624eb0f6 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int3.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int3.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class int3 { diff --git a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int4.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int4.cs index c2b32e5a4d..e9320c082e 100644 --- a/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int4.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int4.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class int4 { diff --git a/OpenSim/Region/PhysicsModules/Meshing/HelperTypes.cs b/OpenSim/Region/PhysicsModules/Meshing/HelperTypes.cs index 8cd8dcf6ff..2f857ee661 100644 --- a/OpenSim/Region/PhysicsModules/Meshing/HelperTypes.cs +++ b/OpenSim/Region/PhysicsModules/Meshing/HelperTypes.cs @@ -30,8 +30,8 @@ using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using OpenMetaverse; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.Meshing; +using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModule.Meshing; public class Vertex : IComparable { diff --git a/OpenSim/Region/PhysicsModules/Meshing/Mesh.cs b/OpenSim/Region/PhysicsModules/Meshing/Mesh.cs index bd8e3063aa..1a8574e59a 100644 --- a/OpenSim/Region/PhysicsModules/Meshing/Mesh.cs +++ b/OpenSim/Region/PhysicsModules/Meshing/Mesh.cs @@ -29,11 +29,11 @@ using System; using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using PrimMesher; using OpenMetaverse; -namespace OpenSim.Region.Physics.Meshing +namespace OpenSim.Region.PhysicsModule.Meshing { public class Mesh : IMesh { diff --git a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer.cs index 42231b5ec1..c885665589 100644 --- a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenMetaverse; using OpenMetaverse.StructuredData; using System.Drawing; @@ -41,7 +41,7 @@ using Nini.Config; using System.Reflection; using System.IO; -namespace OpenSim.Region.Physics.Meshing +namespace OpenSim.Region.PhysicsModule.Meshing { public class MeshmerizerPlugin : IMeshingPlugin { diff --git a/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs index 05eaf2aa68..048ca447ed 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs @@ -31,10 +31,10 @@ using System.Reflection; using OpenMetaverse; using Ode.NET; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using log4net; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModule.ODE { /// /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. diff --git a/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs index 2342bfa141..0b0c8a984c 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs @@ -46,9 +46,9 @@ using log4net; using OpenMetaverse; using Ode.NET; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModule.ODE { public class ODEDynamics { diff --git a/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs index f934b8a32a..d8849e7fc4 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs @@ -50,9 +50,9 @@ using log4net; using OpenMetaverse; using Ode.NET; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModule.ODE { /// /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. diff --git a/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs index 8d7d3b3ae9..2bcdcd4eb8 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs @@ -31,11 +31,11 @@ using System.Reflection; using System.Runtime.InteropServices; using System.Text; using OpenMetaverse; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using Ode.NET; using log4net; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModule.ODE { /// /// Processes raycast requests as ODE is in a state to be able to do them. diff --git a/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs b/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs index b4a3c48650..5180583662 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs @@ -29,10 +29,10 @@ using System; using OpenMetaverse; using Ode.NET; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.OdePlugin; +using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModule.ODE; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModule.ODE { class OdePhysicsJoint : PhysicsJoint { diff --git a/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs b/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs index 7e652fc022..c3e01dd01c 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs @@ -36,10 +36,10 @@ using log4net; using Nini.Config; using Ode.NET; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenMetaverse; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModule.ODE { /// /// ODE plugin diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index 59535574d1..e30036b399 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs @@ -44,9 +44,9 @@ using OpenMetaverse; using Drawstuff.NET; #endif using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModule.ODE { public enum StatusIndicators : int { diff --git a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs index 16404c69e4..09147b0299 100644 --- a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs +++ b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs @@ -30,20 +30,20 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.OdePlugin; +using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModule.ODE; using OpenSim.Tests.Common; using log4net; using System.Reflection; -namespace OpenSim.Region.Physics.OdePlugin.Tests +namespace OpenSim.Region.PhysicsModule.ODE.Tests { [TestFixture] public class ODETestClass : OpenSimTestCase { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private OpenSim.Region.Physics.OdePlugin.OdePlugin cbt; + private OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt; private PhysicsScene ps; private IMeshingPlugin imp; diff --git a/OpenSim/Region/PhysicsModules/POS/POSCharacter.cs b/OpenSim/Region/PhysicsModules/POS/POSCharacter.cs index 40ab984dc8..1dccbe714b 100644 --- a/OpenSim/Region/PhysicsModules/POS/POSCharacter.cs +++ b/OpenSim/Region/PhysicsModules/POS/POSCharacter.cs @@ -30,9 +30,9 @@ using System.Collections.Generic; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; -namespace OpenSim.Region.Physics.POSPlugin +namespace OpenSim.Region.PhysicsModule.POS { public class POSCharacter : PhysicsActor { diff --git a/OpenSim/Region/PhysicsModules/POS/POSPlugin.cs b/OpenSim/Region/PhysicsModules/POS/POSPlugin.cs index ed086dd7ef..4bf58c1932 100644 --- a/OpenSim/Region/PhysicsModules/POS/POSPlugin.cs +++ b/OpenSim/Region/PhysicsModules/POS/POSPlugin.cs @@ -29,9 +29,9 @@ using System; using System.Collections.Generic; using Nini.Config; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; -namespace OpenSim.Region.Physics.POSPlugin +namespace OpenSim.Region.PhysicsModule.POS { /// /// for now will be a very POS physics engine diff --git a/OpenSim/Region/PhysicsModules/POS/POSPrim.cs b/OpenSim/Region/PhysicsModules/POS/POSPrim.cs index 7c1e91597d..88a950223e 100644 --- a/OpenSim/Region/PhysicsModules/POS/POSPrim.cs +++ b/OpenSim/Region/PhysicsModules/POS/POSPrim.cs @@ -30,9 +30,9 @@ using System.Collections.Generic; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; -namespace OpenSim.Region.Physics.POSPlugin +namespace OpenSim.Region.PhysicsModule.POS { public class POSPrim : PhysicsActor { diff --git a/OpenSim/Region/PhysicsModules/POS/POSScene.cs b/OpenSim/Region/PhysicsModules/POS/POSScene.cs index 080c6abcf5..8c3d5f51c2 100644 --- a/OpenSim/Region/PhysicsModules/POS/POSScene.cs +++ b/OpenSim/Region/PhysicsModules/POS/POSScene.cs @@ -30,9 +30,9 @@ using System.Collections.Generic; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; -namespace OpenSim.Region.Physics.POSPlugin +namespace OpenSim.Region.PhysicsModule.POS { public class POSScene : PhysicsScene { diff --git a/OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs b/OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs index cace4e44cf..687c4ca66a 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModule.SharedBase { public class CollisionLocker { diff --git a/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs b/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs index 2e7bb5d7a0..e6cb76e3c2 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModule.SharedBase { public interface IMesher { diff --git a/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs b/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs index 31a397c7d4..da0054a3c1 100755 --- a/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModule.SharedBase { public struct PhysParameterEntry { diff --git a/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs index b52f1f62f7..d5fc9c6c30 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs @@ -32,7 +32,7 @@ using Nini.Config; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModule.SharedBase { class NullPhysicsScene : PhysicsScene { diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs index 6bc6e23f8d..bfa6254abb 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs @@ -32,7 +32,7 @@ using System.Reflection; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModule.SharedBase { public delegate void PositionUpdate(Vector3 position); public delegate void VelocityUpdate(Vector3 velocity); diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs index b685d04d19..8fc2638070 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModule.SharedBase { public enum PhysicsJointType : int { diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs index d8279b753a..d08b6ebd29 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs @@ -34,7 +34,7 @@ using log4net; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModule.SharedBase { /// /// Description of MyClass. diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs index 9cdedbf4c9..be0d6f5b24 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs @@ -35,7 +35,7 @@ using Nini.Config; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModule.SharedBase { public delegate void physicsCrash(); diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs index f480d7170a..f0bdd10d76 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs @@ -29,7 +29,7 @@ using System; using System.Timers; using OpenMetaverse; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModule.SharedBase { [Flags] public enum SenseType : uint diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs index f60a63638a..fba861b346 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModule.SharedBase { /*public class PhysicsVector { diff --git a/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs b/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs index f0775c1a8e..879e62a431 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModule.SharedBase { public enum Vehicle : int { diff --git a/OpenSim/Region/PhysicsModules/SharedBase/ZeroMesher.cs b/OpenSim/Region/PhysicsModules/SharedBase/ZeroMesher.cs index 270d2eca0c..c938252424 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/ZeroMesher.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/ZeroMesher.cs @@ -41,7 +41,7 @@ using Nini.Config; * it's always availabe and thus the default in case of configuration errors */ -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModule.SharedBase { public class ZeroMesherPlugin : IMeshingPlugin { diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 0fe3ab01c8..695d72aeb4 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -36,7 +36,7 @@ using OpenSim.Framework.Client; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Framework.Console; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using Mono.Addins; namespace OpenSim.Region.RegionCombinerModule diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7719f070d4..5d50a639b7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -51,7 +51,7 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Animation; using OpenSim.Region.Framework.Scenes.Scripting; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; using OpenSim.Region.ScriptEngine.Shared.ScriptBase; diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 4f685b61cd..7ee4c94c3f 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -36,7 +36,7 @@ using OpenSim.Framework.Communications; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs index bd36097111..8a9e279729 100644 --- a/OpenSim/Tests/Common/Mock/TestScene.cs +++ b/OpenSim/Tests/Common/Mock/TestScene.cs @@ -33,7 +33,7 @@ using OpenSim.Framework.Servers; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.SharedBase; using OpenSim.Services.Interfaces; namespace OpenSim.Tests.Common From ce2c67876e0ebf4f84420696f660dc77d96dea6b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 30 Aug 2015 21:05:36 -0700 Subject: [PATCH 04/33] More namespace and dll name changes. Still no functional changes. --- OpenSim/Region/Application/OpenSimBase.cs | 2 +- .../ClientStack/RegionApplicationBase.cs | 2 +- .../EntityTransfer/EntityTransferModule.cs | 2 +- .../EntityTransferStateMachine.cs | 2 +- .../CoreModules/World/Land/DwellModule.cs | 2 +- .../World/Land/LandManagementModule.cs | 2 +- .../World/Warp3DMap/Warp3DImageModule.cs | 2 +- .../Scenes/Animation/ScenePresenceAnimator.cs | 2 +- .../Region/Framework/Scenes/KeyframeMotion.cs | 2 +- .../Region/Framework/Scenes/Prioritizer.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +- .../Framework/Scenes/SceneObjectGroup.cs | 2 +- .../Framework/Scenes/SceneObjectPart.cs | 2 +- .../Region/Framework/Scenes/ScenePresence.cs | 2 +- .../Scenes/Serialization/SceneXmlLoader.cs | 2 +- .../Tests/ScenePresenceAnimationTests.cs | 2 +- .../PhysicsParameters/PhysicsParameters.cs | 2 +- .../ExtendedPhysics/ExtendedPhysics.cs | 2 +- .../Scripting/Minimodule/SOPObject.cs | 2 +- .../BasicPhysics/BasicPhysicsActor.cs | 4 +- .../BasicPhysics/BasicPhysicsPlugin.cs | 4 +- .../BasicPhysics/BasicPhysicsPrim.cs | 4 +- .../BasicPhysics/BasicPhysicsScene.cs | 4 +- .../BulletS/BSActorAvatarMove.cs | 2 +- .../PhysicsModules/BulletS/BSActorHover.cs | 2 +- .../BulletS/BSActorMoveToTarget.cs | 2 +- .../PhysicsModules/BulletS/BSActorSetForce.cs | 2 +- .../BulletS/BSActorSetTorque.cs | 2 +- .../PhysicsModules/BulletS/BSCharacter.cs | 2 +- .../PhysicsModules/BulletS/BSDynamics.cs | 2 +- .../Region/PhysicsModules/BulletS/BSParam.cs | 2 +- .../PhysicsModules/BulletS/BSPhysObject.cs | 2 +- .../Region/PhysicsModules/BulletS/BSPlugin.cs | 2 +- .../Region/PhysicsModules/BulletS/BSPrim.cs | 2 +- .../PhysicsModules/BulletS/BSPrimDisplaced.cs | 2 +- .../PhysicsModules/BulletS/BSPrimLinkable.cs | 2 +- .../Region/PhysicsModules/BulletS/BSScene.cs | 2 +- .../BulletS/BSShapeCollection.cs | 2 +- .../Region/PhysicsModules/BulletS/BSShapes.cs | 2 +- .../BulletS/BSTerrainHeightmap.cs | 2 +- .../BulletS/BSTerrainManager.cs | 2 +- .../PhysicsModules/BulletS/BSTerrainMesh.cs | 2 +- .../BulletS/Tests/BasicVehicles.cs | 2 +- .../BulletS/Tests/BulletSimTestsUtil.cs | 2 +- .../BulletS/Tests/HullCreation.cs | 2 +- .../PhysicsModules/Meshing/HelperTypes.cs | 2 +- OpenSim/Region/PhysicsModules/Meshing/Mesh.cs | 2 +- .../PhysicsModules/Meshing/Meshmerizer.cs | 2 +- .../Region/PhysicsModules/Ode/ODECharacter.cs | 2 +- .../Region/PhysicsModules/Ode/ODEDynamics.cs | 2 +- OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs | 2 +- .../Ode/ODERayCastRequestManager.cs | 2 +- .../PhysicsModules/Ode/OdePhysicsJoint.cs | 2 +- .../Region/PhysicsModules/Ode/OdePlugin.cs | 2 +- OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | 2 +- .../PhysicsModules/Ode/Tests/ODETestClass.cs | 2 +- .../Region/PhysicsModules/POS/POSCharacter.cs | 2 +- .../Region/PhysicsModules/POS/POSPlugin.cs | 2 +- OpenSim/Region/PhysicsModules/POS/POSPrim.cs | 2 +- OpenSim/Region/PhysicsModules/POS/POSScene.cs | 2 +- .../SharedBase/CollisionLocker.cs | 2 +- .../PhysicsModules/SharedBase/IMesher.cs | 2 +- .../SharedBase/IPhysicsParameters.cs | 2 +- .../SharedBase/NullPhysicsScene.cs | 2 +- .../PhysicsModules/SharedBase/PhysicsActor.cs | 2 +- .../PhysicsModules/SharedBase/PhysicsJoint.cs | 2 +- .../SharedBase/PhysicsPluginManager.cs | 6 +-- .../PhysicsModules/SharedBase/PhysicsScene.cs | 2 +- .../SharedBase/PhysicsSensor.cs | 2 +- .../SharedBase/PhysicsVector.cs | 2 +- .../SharedBase/VehicleConstants.cs | 2 +- .../PhysicsModules/SharedBase/ZeroMesher.cs | 2 +- .../RegionCombinerModule.cs | 2 +- .../Shared/Api/Implementation/LSL_Api.cs | 2 +- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 4 +- OpenSim/Tests/Common/Mock/TestScene.cs | 2 +- prebuild.xml | 44 +++++++++---------- 78 files changed, 106 insertions(+), 106 deletions(-) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index f26355629e..68fba972d9 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -46,7 +46,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Server.Base; using OpenSim.Services.Base; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index b08bf4d616..374e34d8e4 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -38,7 +38,7 @@ using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Services.Interfaces; namespace OpenSim.Region.ClientStack diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 371b4f2925..f3acff2d1c 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -36,7 +36,7 @@ using OpenSim.Framework.Client; using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs index 0f57aeeed4..a3109e0459 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs @@ -38,7 +38,7 @@ using OpenSim.Framework.Capabilities; using OpenSim.Framework.Client; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs index bfa032045a..70c6028176 100644 --- a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs @@ -45,7 +45,7 @@ using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.CoreModules.Framework.InterfaceCommander; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Services.Interfaces; using Caps = OpenSim.Framework.Capabilities.Caps; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index f467e2ab27..92f6c1b8ef 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -44,7 +44,7 @@ using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Services.Interfaces; using Caps = OpenSim.Framework.Capabilities.Caps; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index a97075572b..5f2534b146 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs @@ -41,7 +41,7 @@ using Mono.Addins; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Services.Interfaces; using OpenMetaverse; diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index b6f2d3dd35..6d51029e84 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -35,7 +35,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; namespace OpenSim.Region.Framework.Scenes.Animation { diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index 103386c822..bbf3b51613 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs @@ -36,7 +36,7 @@ using System.Threading; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.Framework.Scenes.Serialization; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization; diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 2ca24651b6..ae85560634 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -31,7 +31,7 @@ using log4net; using Nini.Config; using OpenSim.Framework; using OpenMetaverse; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; /* * Steps to add a new prioritization policy: diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 86a57721fc..09a0a6b501 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -47,7 +47,7 @@ using OpenSim.Framework.Console; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes.Scripting; using OpenSim.Region.Framework.Scenes.Serialization; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using Timer = System.Timers.Timer; using TPFlags = OpenSim.Framework.Constants.TeleportFlags; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 96488104bc..eea0fff1fa 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -34,7 +34,7 @@ using OpenMetaverse.Packets; using log4net; using OpenSim.Framework; using OpenSim.Region.Framework.Scenes.Types; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.Framework.Scenes diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3be6ad2a6a..1c4b77a124 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -38,7 +38,7 @@ using OpenMetaverse; using OpenMetaverse.Packets; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.Framework.Scenes.Serialization; using PermissionMask = OpenSim.Framework.PermissionMask; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index dae8c547b6..25aa83f983 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -42,7 +42,7 @@ using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes.Scripting; using OpenSim.Region.Framework.Scenes.Serialization; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using PermissionMask = OpenSim.Framework.PermissionMask; namespace OpenSim.Region.Framework.Scenes diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index d8c6c9446a..1fddd91dfb 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -41,7 +41,7 @@ using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes.Animation; using OpenSim.Region.Framework.Scenes.Types; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenSim.Services.Interfaces; using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags; diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index 53815f0f20..3c03130bd2 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs @@ -34,7 +34,7 @@ using OpenMetaverse; using log4net; using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; namespace OpenSim.Region.Framework.Scenes.Serialization { diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs index 5f87f4a659..700ca8c77a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs @@ -41,7 +41,7 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.Framework.EntityTransfer; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Tests.Common; namespace OpenSim.Region.Framework.Scenes.Tests diff --git a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs index 1c039cb0e9..1d9179cbf8 100755 --- a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs +++ b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs @@ -36,7 +36,7 @@ using OpenSim.Framework.Console; using OpenSim.Region.CoreModules.Framework.InterfaceCommander; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; namespace OpenSim.Region.OptionalModules.PhysicsParameters { diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs index c5753b9264..ab363e5ec2 100755 --- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs @@ -36,7 +36,7 @@ using OpenSim.Region.CoreModules; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using Mono.Addins; using Nini.Config; diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index 7922db6559..47b9c090a8 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs @@ -34,7 +34,7 @@ using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.OptionalModules.Scripting.Minimodule.Object; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using PrimType=OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.PrimType; using SculptType=OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.SculptType; diff --git a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsActor.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsActor.cs index 43fba7b994..e7b30bac68 100644 --- a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsActor.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsActor.cs @@ -30,9 +30,9 @@ using System.Collections.Generic; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; -namespace OpenSim.Region.Physics.BasicPhysicsPlugin +namespace OpenSim.Region.PhysicsModule.BasicPhysics { public class BasicActor : PhysicsActor { diff --git a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPlugin.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPlugin.cs index 373c7e0015..e78c1914fa 100644 --- a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPlugin.cs @@ -29,9 +29,9 @@ using System; using System.Collections.Generic; using Nini.Config; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; -namespace OpenSim.Region.Physics.BasicPhysicsPlugin +namespace OpenSim.Region.PhysicsModule.BasicPhysics { /// /// Effectively a physics plugin that simulates no physics at all. diff --git a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPrim.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPrim.cs index dfe4c19d88..5383f1b090 100644 --- a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPrim.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPrim.cs @@ -30,9 +30,9 @@ using System.Collections.Generic; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; -namespace OpenSim.Region.Physics.BasicPhysicsPlugin +namespace OpenSim.Region.PhysicsModule.BasicPhysics { public class BasicPhysicsPrim : PhysicsActor { diff --git a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs index 06a205e521..8b9e65afb1 100644 --- a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs @@ -30,9 +30,9 @@ using System.Collections.Generic; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; -namespace OpenSim.Region.Physics.BasicPhysicsPlugin +namespace OpenSim.Region.PhysicsModule.BasicPhysics { /// /// This is an incomplete extremely basic physics implementation diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs index f1a06cc8ae..0191893781 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs @@ -31,7 +31,7 @@ using System.Linq; using System.Text; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OMV = OpenMetaverse; diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSActorHover.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorHover.cs index 7fbe920c33..7ff171ed08 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSActorHover.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorHover.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OMV = OpenMetaverse; diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs index 6a886b022a..3db8f2cf25 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OMV = OpenMetaverse; diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSActorSetForce.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetForce.cs index e81452abfb..ecb4b7ff55 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSActorSetForce.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetForce.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OMV = OpenMetaverse; diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs index 7eeb533aaa..a1cf4db95b 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OMV = OpenMetaverse; diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs index d6b85517c9..83fc3a6d9b 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs @@ -30,7 +30,7 @@ using System.Reflection; using log4net; using OMV = OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; namespace OpenSim.Region.PhysicsModule.BulletS { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs b/OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs index fcf0dd53c3..0fc55776a4 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs @@ -36,7 +36,7 @@ using System.Reflection; using System.Runtime.InteropServices; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; namespace OpenSim.Region.PhysicsModule.BulletS { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs b/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs index 10bbfb308e..c2960086bf 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using System.Reflection; using System.Text; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenMetaverse; using Nini.Config; diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs index 4d69f6111f..da3fc18aa8 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs @@ -30,7 +30,7 @@ using System.Text; using OMV = OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; namespace OpenSim.Region.PhysicsModule.BulletS { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPlugin.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPlugin.cs index e28cd928ba..f7954d8999 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPlugin.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPlugin.cs @@ -27,7 +27,7 @@ using System; using System.Collections.Generic; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenMetaverse; namespace OpenSim.Region.PhysicsModule.BulletS diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs index ab6aa5d565..3e744281be 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs @@ -32,7 +32,7 @@ using System.Xml; using log4net; using OMV = OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet; using OpenSim.Region.OptionalModules.Scripting; // for ExtendedPhysics diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPrimDisplaced.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrimDisplaced.cs index 6b234afa0f..d8ed56b4a4 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPrimDisplaced.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPrimDisplaced.cs @@ -31,7 +31,7 @@ using System.Reflection; using System.Runtime.InteropServices; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OMV = OpenMetaverse; diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs index 91550cb39c..8f494cca05 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs @@ -72,7 +72,7 @@ public class BSPrimLinkable : BSPrimDisplaced base.Destroy(); } - public override void link(SharedBase.PhysicsActor obj) + public override void link(OpenSim.Region.PhysicsModules.SharedBase.PhysicsActor obj) { BSPrimLinkable parent = obj as BSPrimLinkable; if (parent != null) diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs index 18a4a58370..80f98ef653 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs @@ -36,7 +36,7 @@ using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework; using OpenSim.Region.CoreModules; using Logging = OpenSim.Region.CoreModules.Framework.Statistics.Logging; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using Nini.Config; using log4net; using OpenMetaverse; diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSShapeCollection.cs b/OpenSim/Region/PhysicsModules/BulletS/BSShapeCollection.cs index 8dba3e4458..b1002733fa 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSShapeCollection.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSShapeCollection.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using System.Text; using OMV = OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet; namespace OpenSim.Region.PhysicsModule.BulletS diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs b/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs index d8189e0ceb..7357962e2f 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using System.Text; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.PhysicsModule.Meshing; using OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet; diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs index 7704d1fc53..e5607961e8 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs @@ -31,7 +31,7 @@ using System.Text; using OpenSim.Framework; using OpenSim.Region.Framework; using OpenSim.Region.CoreModules; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using Nini.Config; using log4net; diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs index 6e686cec20..bd84fceac0 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs @@ -31,7 +31,7 @@ using System.Text; using OpenSim.Framework; using OpenSim.Region.Framework; using OpenSim.Region.CoreModules; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using Nini.Config; using log4net; diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs index 4c3e33a50a..ae96491237 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs @@ -31,7 +31,7 @@ using System.Text; using OpenSim.Framework; using OpenSim.Region.Framework; using OpenSim.Region.CoreModules; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using Nini.Config; using log4net; diff --git a/OpenSim/Region/PhysicsModules/BulletS/Tests/BasicVehicles.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BasicVehicles.cs index 160ebb51fe..35eba29373 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/Tests/BasicVehicles.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/BasicVehicles.cs @@ -35,7 +35,7 @@ using log4net; using OpenSim.Framework; using OpenSim.Region.PhysicsModule.BulletS; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Tests.Common; using OpenMetaverse; diff --git a/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs index 173e20d314..8915e6f2d4 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs @@ -33,7 +33,7 @@ using System.Text; using Nini.Config; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.PhysicsModule.Meshing; using OpenMetaverse; diff --git a/OpenSim/Region/PhysicsModules/BulletS/Tests/HullCreation.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/HullCreation.cs index 69078f2ebf..c0cf19ab2b 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/Tests/HullCreation.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/HullCreation.cs @@ -35,7 +35,7 @@ using log4net; using OpenSim.Framework; using OpenSim.Region.PhysicsModule.BulletS; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Tests.Common; using OpenMetaverse; diff --git a/OpenSim/Region/PhysicsModules/Meshing/HelperTypes.cs b/OpenSim/Region/PhysicsModules/Meshing/HelperTypes.cs index 2f857ee661..a0e3b7f107 100644 --- a/OpenSim/Region/PhysicsModules/Meshing/HelperTypes.cs +++ b/OpenSim/Region/PhysicsModules/Meshing/HelperTypes.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using OpenMetaverse; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.PhysicsModule.Meshing; public class Vertex : IComparable diff --git a/OpenSim/Region/PhysicsModules/Meshing/Mesh.cs b/OpenSim/Region/PhysicsModules/Meshing/Mesh.cs index 1a8574e59a..2ccb976bb2 100644 --- a/OpenSim/Region/PhysicsModules/Meshing/Mesh.cs +++ b/OpenSim/Region/PhysicsModules/Meshing/Mesh.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using PrimMesher; using OpenMetaverse; diff --git a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer.cs index c885665589..77fdebf225 100644 --- a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenMetaverse; using OpenMetaverse.StructuredData; using System.Drawing; diff --git a/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs index 048ca447ed..44f403979d 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs @@ -31,7 +31,7 @@ using System.Reflection; using OpenMetaverse; using Ode.NET; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using log4net; namespace OpenSim.Region.PhysicsModule.ODE diff --git a/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs index 0b0c8a984c..8f8e2bde5d 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs @@ -46,7 +46,7 @@ using log4net; using OpenMetaverse; using Ode.NET; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; namespace OpenSim.Region.PhysicsModule.ODE { diff --git a/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs index d8849e7fc4..91a4302ae8 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs @@ -50,7 +50,7 @@ using log4net; using OpenMetaverse; using Ode.NET; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; namespace OpenSim.Region.PhysicsModule.ODE { diff --git a/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs index 2bcdcd4eb8..21bfea3eff 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs @@ -31,7 +31,7 @@ using System.Reflection; using System.Runtime.InteropServices; using System.Text; using OpenMetaverse; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using Ode.NET; using log4net; diff --git a/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs b/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs index 5180583662..2eb7ba634e 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs @@ -29,7 +29,7 @@ using System; using OpenMetaverse; using Ode.NET; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.PhysicsModule.ODE; namespace OpenSim.Region.PhysicsModule.ODE diff --git a/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs b/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs index c3e01dd01c..1d9d0e5f15 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs @@ -36,7 +36,7 @@ using log4net; using Nini.Config; using Ode.NET; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenMetaverse; namespace OpenSim.Region.PhysicsModule.ODE diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index e30036b399..d7163e2aa2 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs @@ -44,7 +44,7 @@ using OpenMetaverse; using Drawstuff.NET; #endif using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; namespace OpenSim.Region.PhysicsModule.ODE { diff --git a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs index 09147b0299..181665627c 100644 --- a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs +++ b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs @@ -30,7 +30,7 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.PhysicsModule.ODE; using OpenSim.Tests.Common; using log4net; diff --git a/OpenSim/Region/PhysicsModules/POS/POSCharacter.cs b/OpenSim/Region/PhysicsModules/POS/POSCharacter.cs index 1dccbe714b..32469d9d4d 100644 --- a/OpenSim/Region/PhysicsModules/POS/POSCharacter.cs +++ b/OpenSim/Region/PhysicsModules/POS/POSCharacter.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; namespace OpenSim.Region.PhysicsModule.POS { diff --git a/OpenSim/Region/PhysicsModules/POS/POSPlugin.cs b/OpenSim/Region/PhysicsModules/POS/POSPlugin.cs index 4bf58c1932..3fe1a0af04 100644 --- a/OpenSim/Region/PhysicsModules/POS/POSPlugin.cs +++ b/OpenSim/Region/PhysicsModules/POS/POSPlugin.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using Nini.Config; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; namespace OpenSim.Region.PhysicsModule.POS { diff --git a/OpenSim/Region/PhysicsModules/POS/POSPrim.cs b/OpenSim/Region/PhysicsModules/POS/POSPrim.cs index 88a950223e..8aae716403 100644 --- a/OpenSim/Region/PhysicsModules/POS/POSPrim.cs +++ b/OpenSim/Region/PhysicsModules/POS/POSPrim.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; namespace OpenSim.Region.PhysicsModule.POS { diff --git a/OpenSim/Region/PhysicsModules/POS/POSScene.cs b/OpenSim/Region/PhysicsModules/POS/POSScene.cs index 8c3d5f51c2..603502f496 100644 --- a/OpenSim/Region/PhysicsModules/POS/POSScene.cs +++ b/OpenSim/Region/PhysicsModules/POS/POSScene.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; namespace OpenSim.Region.PhysicsModule.POS { diff --git a/OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs b/OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs index 687c4ca66a..6e658b53e2 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; -namespace OpenSim.Region.PhysicsModule.SharedBase +namespace OpenSim.Region.PhysicsModules.SharedBase { public class CollisionLocker { diff --git a/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs b/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs index e6cb76e3c2..5c7530713c 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.PhysicsModule.SharedBase +namespace OpenSim.Region.PhysicsModules.SharedBase { public interface IMesher { diff --git a/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs b/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs index da0054a3c1..fb0c9e21db 100755 --- a/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.PhysicsModule.SharedBase +namespace OpenSim.Region.PhysicsModules.SharedBase { public struct PhysParameterEntry { diff --git a/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs index d5fc9c6c30..da896a3527 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs @@ -32,7 +32,7 @@ using Nini.Config; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.PhysicsModule.SharedBase +namespace OpenSim.Region.PhysicsModules.SharedBase { class NullPhysicsScene : PhysicsScene { diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs index bfa6254abb..c04ff585e6 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs @@ -32,7 +32,7 @@ using System.Reflection; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.PhysicsModule.SharedBase +namespace OpenSim.Region.PhysicsModules.SharedBase { public delegate void PositionUpdate(Vector3 position); public delegate void VelocityUpdate(Vector3 velocity); diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs index 8fc2638070..ce2bf05b96 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.PhysicsModule.SharedBase +namespace OpenSim.Region.PhysicsModules.SharedBase { public enum PhysicsJointType : int { diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs index d08b6ebd29..f7992d5f73 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs @@ -34,7 +34,7 @@ using log4net; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.PhysicsModule.SharedBase +namespace OpenSim.Region.PhysicsModules.SharedBase { /// /// Description of MyClass. @@ -129,8 +129,8 @@ namespace OpenSim.Region.PhysicsModule.SharedBase public void LoadPluginsFromAssembly(string assemblyPath) { // TODO / NOTE - // The assembly named 'OpenSim.Region.Physics.BasicPhysicsPlugin' was loaded from - // 'file:///C:/OpenSim/trunk2/bin/Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll' + // The assembly named 'OpenSim.Region.PhysicsModule.BasicPhysics' was loaded from + // 'file:///C:/OpenSim/trunk2/bin/Physics/OpenSim.Region.PhysicsModule.BasicPhysics.dll' // using the LoadFrom context. The use of this context can result in unexpected behavior // for serialization, casting and dependency resolution. In almost all cases, it is recommended // that the LoadFrom context be avoided. This can be done by installing assemblies in the diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs index be0d6f5b24..0394494d8b 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs @@ -35,7 +35,7 @@ using Nini.Config; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.PhysicsModule.SharedBase +namespace OpenSim.Region.PhysicsModules.SharedBase { public delegate void physicsCrash(); diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs index f0bdd10d76..da9c96c469 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs @@ -29,7 +29,7 @@ using System; using System.Timers; using OpenMetaverse; -namespace OpenSim.Region.PhysicsModule.SharedBase +namespace OpenSim.Region.PhysicsModules.SharedBase { [Flags] public enum SenseType : uint diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs index fba861b346..76a82fa291 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.PhysicsModule.SharedBase +namespace OpenSim.Region.PhysicsModules.SharedBase { /*public class PhysicsVector { diff --git a/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs b/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs index 879e62a431..63a8cb8f3c 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.PhysicsModule.SharedBase +namespace OpenSim.Region.PhysicsModules.SharedBase { public enum Vehicle : int { diff --git a/OpenSim/Region/PhysicsModules/SharedBase/ZeroMesher.cs b/OpenSim/Region/PhysicsModules/SharedBase/ZeroMesher.cs index c938252424..fe8796289c 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/ZeroMesher.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/ZeroMesher.cs @@ -41,7 +41,7 @@ using Nini.Config; * it's always availabe and thus the default in case of configuration errors */ -namespace OpenSim.Region.PhysicsModule.SharedBase +namespace OpenSim.Region.PhysicsModules.SharedBase { public class ZeroMesherPlugin : IMeshingPlugin { diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 695d72aeb4..98b0ae1d10 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -36,7 +36,7 @@ using OpenSim.Framework.Client; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Framework.Console; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using Mono.Addins; namespace OpenSim.Region.RegionCombinerModule diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5d50a639b7..4eda4438c2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -51,7 +51,7 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Animation; using OpenSim.Region.Framework.Scenes.Scripting; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; using OpenSim.Region.ScriptEngine.Shared.ScriptBase; diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 7ee4c94c3f..a26e844cd1 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -36,7 +36,7 @@ using OpenSim.Framework.Communications; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -149,7 +149,7 @@ namespace OpenSim.Tests.Common regInfo.RegionSizeY = sizeY; PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); - physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); + physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.PhysicsModule.BasicPhysics.dll"); Vector3 regionExtent = new Vector3( regInfo.RegionSizeX, regInfo.RegionSizeY, regInfo.RegionSizeZ); PhysicsScene physicsScene = physicsPluginManager.GetPhysicsScene( diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs index 8a9e279729..08cfff2805 100644 --- a/OpenSim/Tests/Common/Mock/TestScene.cs +++ b/OpenSim/Tests/Common/Mock/TestScene.cs @@ -33,7 +33,7 @@ using OpenSim.Framework.Servers; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Services.Interfaces; namespace OpenSim.Tests.Common diff --git a/prebuild.xml b/prebuild.xml index f1ab322929..92d5caf4ab 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -410,7 +410,7 @@ - + ../../../../bin/ @@ -438,7 +438,7 @@ - + ../../../../bin/Physics/ @@ -455,7 +455,7 @@ - + @@ -478,7 +478,7 @@ - + @@ -503,7 +503,7 @@ - + @@ -536,7 +536,7 @@ - + @@ -653,7 +653,7 @@ - + @@ -1507,7 +1507,7 @@ - + @@ -1594,7 +1594,7 @@ - + @@ -1648,7 +1648,7 @@ - + @@ -1700,7 +1700,7 @@ - + @@ -1749,7 +1749,7 @@ - + @@ -1852,7 +1852,7 @@ - + @@ -1897,7 +1897,7 @@ - + @@ -2270,7 +2270,7 @@ - + @@ -2464,7 +2464,7 @@ - + @@ -2729,7 +2729,7 @@ - + @@ -3056,7 +3056,7 @@ - + @@ -3136,7 +3136,7 @@ - + @@ -3204,7 +3204,7 @@ - + @@ -3388,7 +3388,7 @@ - + @@ -3425,7 +3425,7 @@ - + From 3741edd1c791e87a38805a62530755cbf0c55cab Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 31 Aug 2015 09:21:05 -0700 Subject: [PATCH 05/33] Refactored Meshing modules: - Moved ZeroMesher from OpenSim.Region.PhysicsModules.SharedBase to OpenSim.Region.PhysicsModules.Meshing - Created subfolder for all Meshmerizer files, also in the same Meshing dll - Made them both region modules, with ZeroMesher being the default one This compiles but doesn't run yet. --- .../Meshing/{ => Meshmerizer}/HelperTypes.cs | 2 +- .../Meshing/{ => Meshmerizer}/Mesh.cs | 2 +- .../Meshing/{ => Meshmerizer}/Meshmerizer.cs | 115 ++++++++++++------ .../Meshing/{ => Meshmerizer}/PrimMesher.cs | 0 .../Meshing/{ => Meshmerizer}/SculptMap.cs | 0 .../Meshing/{ => Meshmerizer}/SculptMesh.cs | 0 .../Meshing/Properties/AssemblyInfo.cs | 5 +- .../{SharedBase => Meshing}/ZeroMesher.cs | 71 +++++++++-- .../PhysicsModules/Ode/Tests/ODETestClass.cs | 2 - .../SharedBase/PhysicsPluginManager.cs | 7 -- prebuild.xml | 4 +- 11 files changed, 146 insertions(+), 62 deletions(-) rename OpenSim/Region/PhysicsModules/Meshing/{ => Meshmerizer}/HelperTypes.cs (99%) rename OpenSim/Region/PhysicsModules/Meshing/{ => Meshmerizer}/Mesh.cs (99%) rename OpenSim/Region/PhysicsModules/Meshing/{ => Meshmerizer}/Meshmerizer.cs (94%) rename OpenSim/Region/PhysicsModules/Meshing/{ => Meshmerizer}/PrimMesher.cs (100%) rename OpenSim/Region/PhysicsModules/Meshing/{ => Meshmerizer}/SculptMap.cs (100%) rename OpenSim/Region/PhysicsModules/Meshing/{ => Meshmerizer}/SculptMesh.cs (100%) rename OpenSim/Region/PhysicsModules/{SharedBase => Meshing}/ZeroMesher.cs (64%) diff --git a/OpenSim/Region/PhysicsModules/Meshing/HelperTypes.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/HelperTypes.cs similarity index 99% rename from OpenSim/Region/PhysicsModules/Meshing/HelperTypes.cs rename to OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/HelperTypes.cs index a0e3b7f107..34a925d746 100644 --- a/OpenSim/Region/PhysicsModules/Meshing/HelperTypes.cs +++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/HelperTypes.cs @@ -31,7 +31,7 @@ using System.Diagnostics; using System.Globalization; using OpenMetaverse; using OpenSim.Region.PhysicsModules.SharedBase; -using OpenSim.Region.PhysicsModule.Meshing; +using OpenSim.Region.PhysicsModules.Meshing; public class Vertex : IComparable { diff --git a/OpenSim/Region/PhysicsModules/Meshing/Mesh.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Mesh.cs similarity index 99% rename from OpenSim/Region/PhysicsModules/Meshing/Mesh.cs rename to OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Mesh.cs index 2ccb976bb2..bf397eee1e 100644 --- a/OpenSim/Region/PhysicsModules/Meshing/Mesh.cs +++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Mesh.cs @@ -33,7 +33,7 @@ using OpenSim.Region.PhysicsModules.SharedBase; using PrimMesher; using OpenMetaverse; -namespace OpenSim.Region.PhysicsModule.Meshing +namespace OpenSim.Region.PhysicsModules.Meshing { public class Mesh : IMesh { diff --git a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs similarity index 94% rename from OpenSim/Region/PhysicsModules/Meshing/Meshmerizer.cs rename to OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs index 77fdebf225..4d25bf3916 100644 --- a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs @@ -28,7 +28,11 @@ using System; using System.Collections.Generic; +using System.Reflection; +using System.IO; using OpenSim.Framework; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.PhysicsModules.SharedBase; using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -38,29 +42,12 @@ using System.IO.Compression; using PrimMesher; using log4net; using Nini.Config; -using System.Reflection; -using System.IO; +using Mono.Addins; -namespace OpenSim.Region.PhysicsModule.Meshing +namespace OpenSim.Region.PhysicsModules.Meshing { - public class MeshmerizerPlugin : IMeshingPlugin - { - public MeshmerizerPlugin() - { - } - - public string GetName() - { - return "Meshmerizer"; - } - - public IMesher GetMesher(IConfigSource config) - { - return new Meshmerizer(config); - } - } - - public class Meshmerizer : IMesher + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "Meshmerizer")] + public class Meshmerizer : IMesher, INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static string LogHeader = "[MESH]"; @@ -72,6 +59,8 @@ namespace OpenSim.Region.PhysicsModule.Meshing #else private const string baseDir = null; //"rawFiles"; #endif + private bool m_Enabled = false; + // If 'true', lots of DEBUG logging of asset parsing details private bool debugDetail = false; @@ -87,30 +76,79 @@ namespace OpenSim.Region.PhysicsModule.Meshing // Mesh cache. Static so it can be shared across instances of this class private static Dictionary m_uniqueMeshes = new Dictionary(); - public Meshmerizer(IConfigSource config) + #region INonSharedRegionModule + public string Name { - IConfig start_config = config.Configs["Startup"]; - IConfig mesh_config = config.Configs["Mesh"]; + get { return "Meshmerizer"; } + } - decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache"); - cacheSculptMaps = start_config.GetBoolean("CacheSculptMaps", cacheSculptMaps); - if (mesh_config != null) - { - useMeshiesPhysicsMesh = mesh_config.GetBoolean("UseMeshiesPhysicsMesh", useMeshiesPhysicsMesh); - debugDetail = mesh_config.GetBoolean("LogMeshDetails", debugDetail); - } + public Type ReplaceableInterface + { + get { return null; } + } - try + public void Initialise(IConfigSource source) + { + IConfig config = source.Configs["Startup"]; + if (config != null) { - if (!Directory.Exists(decodedSculptMapPath)) - Directory.CreateDirectory(decodedSculptMapPath); - } - catch (Exception e) - { - m_log.WarnFormat("[SCULPT]: Unable to create {0} directory: ", decodedSculptMapPath, e.Message); + string mesher = config.GetString("meshing", string.Empty); + if (mesher == Name) + { + m_Enabled = true; + + IConfig mesh_config = source.Configs["Mesh"]; + + decodedSculptMapPath = config.GetString("DecodedSculptMapPath", "j2kDecodeCache"); + cacheSculptMaps = config.GetBoolean("CacheSculptMaps", cacheSculptMaps); + if (mesh_config != null) + { + useMeshiesPhysicsMesh = mesh_config.GetBoolean("UseMeshiesPhysicsMesh", useMeshiesPhysicsMesh); + debugDetail = mesh_config.GetBoolean("LogMeshDetails", debugDetail); + } + + try + { + if (!Directory.Exists(decodedSculptMapPath)) + Directory.CreateDirectory(decodedSculptMapPath); + } + catch (Exception e) + { + m_log.WarnFormat("[SCULPT]: Unable to create {0} directory: ", decodedSculptMapPath, e.Message); + } + + } } } + public void Close() + { + } + + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + + scene.RegisterModuleInterface(this); + } + + public void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + + scene.UnregisterModuleInterface(this); + } + + public void RegionLoaded(Scene scene) + { + if (!m_Enabled) + return; + } + #endregion + + /// /// creates a simple box mesh of the specified size. This mesh is of very low vertex count and may /// be useful as a backup proxy when level of detail is not needed or when more complex meshes fail @@ -967,5 +1005,6 @@ namespace OpenSim.Region.PhysicsModule.Meshing return mesh; } + } } diff --git a/OpenSim/Region/PhysicsModules/Meshing/PrimMesher.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/PrimMesher.cs similarity index 100% rename from OpenSim/Region/PhysicsModules/Meshing/PrimMesher.cs rename to OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/PrimMesher.cs diff --git a/OpenSim/Region/PhysicsModules/Meshing/SculptMap.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMap.cs similarity index 100% rename from OpenSim/Region/PhysicsModules/Meshing/SculptMap.cs rename to OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMap.cs diff --git a/OpenSim/Region/PhysicsModules/Meshing/SculptMesh.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMesh.cs similarity index 100% rename from OpenSim/Region/PhysicsModules/Meshing/SculptMesh.cs rename to OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMesh.cs diff --git a/OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs index ec968c0b65..d6ac8b2260 100644 --- a/OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs @@ -1,11 +1,12 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using Mono.Addins; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Region.Physics.Meshing")] +[assembly: AssemblyTitle("OpenSim.Region.PhysicsModules.Meshing")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("http://opensimulator.org")] @@ -31,3 +32,5 @@ using System.Runtime.InteropServices; // [assembly: AssemblyVersion("0.8.2.*")] +[assembly: Addin("OpenSim.Region.PhysicsModules.Meshing", OpenSim.VersionInfo.VersionNumber)] +[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] diff --git a/OpenSim/Region/PhysicsModules/SharedBase/ZeroMesher.cs b/OpenSim/Region/PhysicsModules/Meshing/ZeroMesher.cs similarity index 64% rename from OpenSim/Region/PhysicsModules/SharedBase/ZeroMesher.cs rename to OpenSim/Region/PhysicsModules/Meshing/ZeroMesher.cs index fe8796289c..0a3b3a4e80 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/ZeroMesher.cs +++ b/OpenSim/Region/PhysicsModules/Meshing/ZeroMesher.cs @@ -26,9 +26,15 @@ */ using System; +using System.Reflection; using OpenSim.Framework; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenMetaverse; using Nini.Config; +using Mono.Addins; +using log4net; /* * This is the zero mesher. @@ -41,27 +47,67 @@ using Nini.Config; * it's always availabe and thus the default in case of configuration errors */ -namespace OpenSim.Region.PhysicsModules.SharedBase +namespace OpenSim.Region.PhysicsModules.Meshing { - public class ZeroMesherPlugin : IMeshingPlugin + + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ZeroMesher")] + public class ZeroMesher : IMesher, INonSharedRegionModule { - public ZeroMesherPlugin() + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private bool m_Enabled = false; + + #region INonSharedRegionModule + public string Name + { + get { return "ZeroMesher"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) + { + // TODO: Move this out of Startup + IConfig config = source.Configs["Startup"]; + if (config != null) + { + // This is the default Mesher + string mesher = config.GetString("meshing", Name); + if (mesher == Name) + m_Enabled = true; + } + } + + public void Close() { } - public string GetName() + public void AddRegion(Scene scene) { - return "ZeroMesher"; + if (!m_Enabled) + return; + + scene.RegisterModuleInterface(this); } - public IMesher GetMesher(IConfigSource config) + public void RemoveRegion(Scene scene) { - return new ZeroMesher(); - } - } + if (!m_Enabled) + return; - public class ZeroMesher : IMesher - { + scene.UnregisterModuleInterface(this); + } + + public void RegionLoaded(Scene scene) + { + if (!m_Enabled) + return; + } + #endregion + + #region IMesher public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod) { return CreateMesh(primName, primShape, size, lod, false, false); @@ -79,5 +125,8 @@ namespace OpenSim.Region.PhysicsModules.SharedBase return null; } + #endregion + + } } diff --git a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs index 181665627c..bbf64d5a8d 100644 --- a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs +++ b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs @@ -56,8 +56,6 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests // Loading ODEPlugin cbt = new OdePlugin(); - // Loading Zero Mesher - imp = new ZeroMesherPlugin(); // Getting Physics Scene ps = cbt.GetScene("test"); // Initializing Physics Scene. diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs index f7992d5f73..6316463ed5 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs @@ -51,13 +51,6 @@ namespace OpenSim.Region.PhysicsModules.SharedBase /// public PhysicsPluginManager() { - // Load "plugins", that are hard coded and not existing in form of an external lib, and hence always - // available - IMeshingPlugin plugHard; - plugHard = new ZeroMesherPlugin(); - _MeshPlugins.Add(plugHard.GetName(), plugHard); - - m_log.Info("[PHYSICS]: Added meshing engine: " + plugHard.GetName()); } /// diff --git a/prebuild.xml b/prebuild.xml index 92d5caf4ab..e08ff29a83 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -514,7 +514,7 @@ - + ../../../../bin/Physics/ @@ -537,7 +537,9 @@ + + From 49ab478d286b873e9ff1b4f6748b920abcc0f1b1 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 31 Aug 2015 09:41:00 -0700 Subject: [PATCH 06/33] Fixed a namespace dependency. Also started preparing prebuild.xml for making physics region modules. --- .../Region/PhysicsModules/BulletS/BSShapes.cs | 2 +- .../BulletS/Tests/BulletSimTestsUtil.cs | 2 +- prebuild.xml | 284 +++++++++--------- 3 files changed, 148 insertions(+), 140 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs b/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs index 7357962e2f..1c55b51b20 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs @@ -31,7 +31,7 @@ using System.Text; using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; -using OpenSim.Region.PhysicsModule.Meshing; +using OpenSim.Region.PhysicsModules.Meshing; using OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet; using OMV = OpenMetaverse; diff --git a/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs index 8915e6f2d4..34c057170a 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs @@ -34,7 +34,7 @@ using Nini.Config; using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; -using OpenSim.Region.PhysicsModule.Meshing; +using OpenSim.Region.PhysicsModules.Meshing; using OpenMetaverse; diff --git a/prebuild.xml b/prebuild.xml index e08ff29a83..77b1657f45 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -410,142 +410,6 @@ - - - - ../../../../bin/ - - - - - ../../../../bin/ - - - - ../../../../bin/ - - - - - - - - - - - - - - - - - - - ../../../../bin/Physics/ - - - - - ../../../../bin/Physics/ - - - - ../../../../bin/ - - - - - - - - - - - - - - ../../../../bin/Physics/ - - - - - ../../../../bin/Physics/ - - - - ../../../../bin/ - - - - - - - - - - - - - - ../../../../bin/Physics/ - - - - - ../../../../bin/Physics/ - - - - ../../../../bin/ - - - - - - - - - - - - - - - - - - - - - ../../../../bin/Physics/ - - - - - ../../../../bin/Physics/ - - - - ../../../../bin/ - - - - - - - - - - - - - - - - - - - @@ -1828,6 +1692,148 @@ + + + + ../../../../bin/ + + + + + ../../../../bin/ + + + + ../../../../bin/ + + + + + + + + + + + + + + + + + + ../../../../bin/Physics/ + + + + + ../../../../bin/Physics/ + + + + ../../../../bin/ + + + + + + + + + + + + + + + + + + + + + + + + ../../../../bin/Physics/ + + + + + ../../../../bin/Physics/ + + + + ../../../../bin/ + + + + + + + + + + + + + + + + ../../../../bin/Physics/ + + + + + ../../../../bin/Physics/ + + + + ../../../../bin/ + + + + + + + + + + + + + + + + ../../../../bin/Physics/ + + + + + ../../../../bin/Physics/ + + + + ../../../../bin/ + + + + + + + + + + + + + + + + + + + @@ -1855,8 +1861,10 @@ - + + + @@ -3426,7 +3434,7 @@ - + From 134d4300f0b6e9b0df0326cfe0b5df9f41f42865 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 31 Aug 2015 13:02:51 -0700 Subject: [PATCH 07/33] All physics plugins are now region modules. Compiles but doesn't run. --- .../Logging => Framework}/LogWriter.cs | 2 +- .../BasicPhysics/AssemblyInfo.cs | 8 +- .../BasicPhysics/BasicPhysicsPlugin.cs | 42 +- .../BasicPhysics/BasicPhysicsScene.cs | 63 +- .../Region/PhysicsModules/BulletS/BSPlugin.cs | 54 +- .../Region/PhysicsModules/BulletS/BSScene.cs | 2329 +++++++++-------- .../Region/PhysicsModules/BulletS/BSShapes.cs | 4 +- .../BulletS/BSTerrainHeightmap.cs | 1 - .../BulletS/BSTerrainManager.cs | 1 - .../PhysicsModules/BulletS/BSTerrainMesh.cs | 1 - .../BulletS/Properties/AssemblyInfo.cs | 3 + .../Region/PhysicsModules/Ode/AssemblyInfo.cs | 4 + .../Region/PhysicsModules/Ode/ODECharacter.cs | 2 +- OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs | 2 +- .../Region/PhysicsModules/Ode/OdePlugin.cs | 70 +- OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | 111 +- .../PhysicsModules/Ode/Tests/ODETestClass.cs | 8 +- .../Region/PhysicsModules/POS/AssemblyInfo.cs | 4 + .../Region/PhysicsModules/POS/POSPlugin.cs | 42 +- OpenSim/Region/PhysicsModules/POS/POSScene.cs | 56 +- .../SharedBase/NullPhysicsScene.cs | 5 - .../SharedBase/PhysicsPluginManager.cs | 2 +- .../PhysicsModules/SharedBase/PhysicsScene.cs | 13 +- prebuild.xml | 4 +- 24 files changed, 1518 insertions(+), 1313 deletions(-) rename OpenSim/{Region/CoreModules/Framework/Statistics/Logging => Framework}/LogWriter.cs (99%) diff --git a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs b/OpenSim/Framework/LogWriter.cs similarity index 99% rename from OpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs rename to OpenSim/Framework/LogWriter.cs index a176958669..2e0bf4a354 100755 --- a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs +++ b/OpenSim/Framework/LogWriter.cs @@ -30,7 +30,7 @@ using System.IO; using System.Text; using log4net; -namespace OpenSim.Region.CoreModules.Framework.Statistics.Logging +namespace OpenSim.Framework { /// /// Class for writing a high performance, high volume log file. diff --git a/OpenSim/Region/PhysicsModules/BasicPhysics/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/AssemblyInfo.cs index 7d054ddac2..1765ae0867 100644 --- a/OpenSim/Region/PhysicsModules/BasicPhysics/AssemblyInfo.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/AssemblyInfo.cs @@ -27,6 +27,7 @@ using System.Reflection; using System.Runtime.InteropServices; +using Mono.Addins; // Information about this assembly is defined by the following // attributes. @@ -34,11 +35,11 @@ using System.Runtime.InteropServices; // change them to the information which is associated with the assembly // you compile. -[assembly : AssemblyTitle("BasicPhysicsPlugin")] +[assembly : AssemblyTitle("BasicPhysicsModule")] [assembly : AssemblyDescription("")] [assembly : AssemblyConfiguration("")] [assembly : AssemblyCompany("http://opensimulator.org")] -[assembly : AssemblyProduct("BasicPhysicsPlugin")] +[assembly : AssemblyProduct("BasicPhysicsModule")] [assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers")] [assembly : AssemblyTrademark("")] [assembly : AssemblyCulture("")] @@ -56,3 +57,6 @@ using System.Runtime.InteropServices; // numbers with the '*' character (the default): [assembly : AssemblyVersion("0.8.2.*")] + +[assembly: Addin("OpenSim.Region.PhysicsModule.BasicPhysics", OpenSim.VersionInfo.VersionNumber)] +[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] diff --git a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPlugin.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPlugin.cs index e78c1914fa..db02eb6c7f 100644 --- a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPlugin.cs @@ -36,29 +36,29 @@ namespace OpenSim.Region.PhysicsModule.BasicPhysics /// /// Effectively a physics plugin that simulates no physics at all. /// - public class BasicPhysicsPlugin : IPhysicsPlugin - { - public BasicPhysicsPlugin() - { - } + //public class BasicPhysicsPlugin : IPhysicsPlugin + //{ + // public BasicPhysicsPlugin() + // { + // } - public bool Init() - { - return true; - } + // public bool Init() + // { + // return true; + // } - public PhysicsScene GetScene(string sceneIdentifier) - { - return new BasicScene(GetName(), sceneIdentifier); - } + // public PhysicsScene GetScene(string sceneIdentifier) + // { + // return new BasicScene(GetName(), sceneIdentifier); + // } - public string GetName() - { - return ("basicphysics"); - } + // public string GetName() + // { + // return ("basicphysics"); + // } - public void Dispose() - { - } - } + // public void Dispose() + // { + // } + //} } diff --git a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs index 8b9e65afb1..5ec0f858b5 100644 --- a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs @@ -28,9 +28,12 @@ using System; using System.Collections.Generic; using Nini.Config; +using Mono.Addins; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.PhysicsModule.BasicPhysics { @@ -41,32 +44,71 @@ namespace OpenSim.Region.PhysicsModule.BasicPhysics /// Not useful for anything at the moment apart from some regression testing in other components where some form /// of physics plugin is needed. /// - public class BasicScene : PhysicsScene + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BasicPhysicsScene")] + public class BasicScene : PhysicsScene, INonSharedRegionModule { private List _actors = new List(); private List _prims = new List(); private float[] _heightMap; private Vector3 m_regionExtent; + private bool m_Enabled = false; + //protected internal string sceneIdentifier; - - public BasicScene(string engineType, string _sceneIdentifier) + #region INonSharedRegionModule + public string Name { - EngineType = engineType; - Name = EngineType + "/" + _sceneIdentifier; - //sceneIdentifier = _sceneIdentifier; + get { return "basicphysics"; } } - public override void Initialise(IMesher meshmerizer, IConfigSource config) + public Type ReplaceableInterface { - throw new Exception("Should not be called."); + get { return null; } } - public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) + public void Initialise(IConfigSource source) { - m_regionExtent = regionExtent; + // TODO: Move this out of Startup + IConfig config = source.Configs["Startup"]; + if (config != null) + { + string physics = config.GetString("physics", string.Empty); + if (physics == Name) + m_Enabled = true; + } + } + public void Close() + { + } + + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + + EngineType = Name; + PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName; + + scene.RegisterModuleInterface(this); + m_regionExtent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); + + } + + public void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + } + + public void RegionLoaded(Scene scene) + { + if (!m_Enabled) + return; + } + #endregion + public override void Dispose() {} public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, @@ -206,5 +248,6 @@ namespace OpenSim.Region.PhysicsModule.BasicPhysics Dictionary returncolliders = new Dictionary(); return returncolliders; } + } } diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPlugin.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPlugin.cs index f7954d8999..7fc51f78cb 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPlugin.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPlugin.cs @@ -40,37 +40,37 @@ namespace OpenSim.Region.PhysicsModule.BulletS /// The unmanaged library is compiled and linked statically with Bullet /// to create BulletSim.dll and libBulletSim.so (for both 32 and 64 bit). /// -public class BSPlugin : IPhysicsPlugin -{ - //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); +//public class BSPlugin : IPhysicsPlugin +//{ +// //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private BSScene _mScene; +// private BSScene _mScene; - public BSPlugin() - { - } +// public BSPlugin() +// { +// } - public bool Init() - { - return true; - } +// public bool Init() +// { +// return true; +// } - public PhysicsScene GetScene(String sceneIdentifier) - { - if (_mScene == null) - { - _mScene = new BSScene(GetName(), sceneIdentifier); - } - return (_mScene); - } +// public PhysicsScene GetScene(String sceneIdentifier) +// { +// if (_mScene == null) +// { +// _mScene = new BSScene(GetName(), sceneIdentifier); +// } +// return (_mScene); +// } - public string GetName() - { - return ("BulletSim"); - } +// public string GetName() +// { +// return ("BulletSim"); +// } - public void Dispose() - { - } -} +// public void Dispose() +// { +// } +//} } diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs index 80f98ef653..26af343887 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs @@ -33,1249 +33,1294 @@ using System.Text; using System.Threading; using OpenSim.Framework; using OpenSim.Framework.Monitoring; -using OpenSim.Region.Framework; -using OpenSim.Region.CoreModules; -using Logging = OpenSim.Region.CoreModules.Framework.Statistics.Logging; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.PhysicsModules.SharedBase; using Nini.Config; using log4net; using OpenMetaverse; +using Mono.Addins; namespace OpenSim.Region.PhysicsModule.BulletS { -public sealed class BSScene : PhysicsScene, IPhysicsParameters -{ - internal static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - internal static readonly string LogHeader = "[BULLETS SCENE]"; - - // The name of the region we're working for. - public string RegionName { get; private set; } - - public string BulletSimVersion = "?"; - - // The handle to the underlying managed or unmanaged version of Bullet being used. - public string BulletEngineName { get; private set; } - public BSAPITemplate PE; - - // If the physics engine is running on a separate thread - public Thread m_physicsThread; - - public Dictionary PhysObjects; - public BSShapeCollection Shapes; - - // Keeping track of the objects with collisions so we can report begin and end of a collision - public HashSet ObjectsWithCollisions = new HashSet(); - public HashSet ObjectsWithNoMoreCollisions = new HashSet(); - - // All the collision processing is protected with this lock object - public Object CollisionLock = new Object(); - - // Properties are updated here - public Object UpdateLock = new Object(); - public HashSet ObjectsWithUpdates = new HashSet(); - - // Keep track of all the avatars so we can send them a collision event - // every tick so OpenSim will update its animation. - private HashSet AvatarsInScene = new HashSet(); - private Object AvatarsInSceneLock = new Object(); - - // let my minuions use my logger - public ILog Logger { get { return m_log; } } - - public IMesher mesher; - public uint WorldID { get; private set; } - public BulletWorld World { get; private set; } - - // All the constraints that have been allocated in this instance. - public BSConstraintCollection Constraints { get; private set; } - - // Simulation parameters - //internal float m_physicsStepTime; // if running independently, the interval simulated by default - - internal int m_maxSubSteps; - internal float m_fixedTimeStep; - - internal float m_simulatedTime; // the time simulated previously. Used for physics framerate calc. - - internal long m_simulationStep = 0; // The current simulation step. - public long SimulationStep { get { return m_simulationStep; } } - // A number to use for SimulationStep that is probably not any step value - // Used by the collision code (which remembers the step when a collision happens) to remember not any simulation step. - public static long NotASimulationStep = -1234; - - internal float LastTimeStep { get; private set; } // The simulation time from the last invocation of Simulate() - - internal float NominalFrameRate { get; set; } // Parameterized ideal frame rate that simulation is scaled to - - // Physical objects can register for prestep or poststep events - public delegate void PreStepAction(float timeStep); - public delegate void PostStepAction(float timeStep); - public event PreStepAction BeforeStep; - public event PostStepAction AfterStep; - - // A value of the time 'now' so all the collision and update routines do not have to get their own - // Set to 'now' just before all the prims and actors are called for collisions and updates - public int SimulationNowTime { get; private set; } - - // True if initialized and ready to do simulation steps - private bool m_initialized = false; - - // Flag which is true when processing taints. - // Not guaranteed to be correct all the time (don't depend on this) but good for debugging. - public bool InTaintTime { get; private set; } - - // Pinned memory used to pass step information between managed and unmanaged - internal int m_maxCollisionsPerFrame; - internal CollisionDesc[] m_collisionArray; - - internal int m_maxUpdatesPerFrame; - internal EntityProperties[] m_updateArray; - - /// - /// Used to control physics simulation timing if Bullet is running on its own thread. - /// - private ManualResetEvent m_updateWaitEvent; - - public const uint TERRAIN_ID = 0; // OpenSim senses terrain with a localID of zero - public const uint GROUNDPLANE_ID = 1; - public const uint CHILDTERRAIN_ID = 2; // Terrain allocated based on our mega-prim childre start here - - public float SimpleWaterLevel { get; set; } - public BSTerrainManager TerrainManager { get; private set; } - - public ConfigurationParameters Params + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BulletSPhysicsScene")] + public sealed class BSScene : PhysicsScene, IPhysicsParameters, INonSharedRegionModule { - get { return UnmanagedParams[0]; } - } - public Vector3 DefaultGravity - { - get { return new Vector3(0f, 0f, Params.gravity); } - } - // Just the Z value of the gravity - public float DefaultGravityZ - { - get { return Params.gravity; } - } + internal static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + internal static readonly string LogHeader = "[BULLETS SCENE]"; - // When functions in the unmanaged code must be called, it is only - // done at a known time just before the simulation step. The taint - // system saves all these function calls and executes them in - // order before the simulation. - public delegate void TaintCallback(); - private struct TaintCallbackEntry - { - public String originator; - public String ident; - public TaintCallback callback; - public TaintCallbackEntry(string pIdent, TaintCallback pCallBack) + private bool m_Enabled = false; + private IConfigSource m_Config; + + // The name of the region we're working for. + public string RegionName { get; private set; } + + public string BulletSimVersion = "?"; + + // The handle to the underlying managed or unmanaged version of Bullet being used. + public string BulletEngineName { get; private set; } + public BSAPITemplate PE; + + // If the physics engine is running on a separate thread + public Thread m_physicsThread; + + public Dictionary PhysObjects; + public BSShapeCollection Shapes; + + // Keeping track of the objects with collisions so we can report begin and end of a collision + public HashSet ObjectsWithCollisions = new HashSet(); + public HashSet ObjectsWithNoMoreCollisions = new HashSet(); + + // All the collision processing is protected with this lock object + public Object CollisionLock = new Object(); + + // Properties are updated here + public Object UpdateLock = new Object(); + public HashSet ObjectsWithUpdates = new HashSet(); + + // Keep track of all the avatars so we can send them a collision event + // every tick so OpenSim will update its animation. + private HashSet AvatarsInScene = new HashSet(); + private Object AvatarsInSceneLock = new Object(); + + // let my minuions use my logger + public ILog Logger { get { return m_log; } } + + public IMesher mesher; + public uint WorldID { get; private set; } + public BulletWorld World { get; private set; } + + // All the constraints that have been allocated in this instance. + public BSConstraintCollection Constraints { get; private set; } + + // Simulation parameters + //internal float m_physicsStepTime; // if running independently, the interval simulated by default + + internal int m_maxSubSteps; + internal float m_fixedTimeStep; + + internal float m_simulatedTime; // the time simulated previously. Used for physics framerate calc. + + internal long m_simulationStep = 0; // The current simulation step. + public long SimulationStep { get { return m_simulationStep; } } + // A number to use for SimulationStep that is probably not any step value + // Used by the collision code (which remembers the step when a collision happens) to remember not any simulation step. + public static long NotASimulationStep = -1234; + + internal float LastTimeStep { get; private set; } // The simulation time from the last invocation of Simulate() + + internal float NominalFrameRate { get; set; } // Parameterized ideal frame rate that simulation is scaled to + + // Physical objects can register for prestep or poststep events + public delegate void PreStepAction(float timeStep); + public delegate void PostStepAction(float timeStep); + public event PreStepAction BeforeStep; + public event PostStepAction AfterStep; + + // A value of the time 'now' so all the collision and update routines do not have to get their own + // Set to 'now' just before all the prims and actors are called for collisions and updates + public int SimulationNowTime { get; private set; } + + // True if initialized and ready to do simulation steps + private bool m_initialized = false; + + // Flag which is true when processing taints. + // Not guaranteed to be correct all the time (don't depend on this) but good for debugging. + public bool InTaintTime { get; private set; } + + // Pinned memory used to pass step information between managed and unmanaged + internal int m_maxCollisionsPerFrame; + internal CollisionDesc[] m_collisionArray; + + internal int m_maxUpdatesPerFrame; + internal EntityProperties[] m_updateArray; + + /// + /// Used to control physics simulation timing if Bullet is running on its own thread. + /// + private ManualResetEvent m_updateWaitEvent; + + public const uint TERRAIN_ID = 0; // OpenSim senses terrain with a localID of zero + public const uint GROUNDPLANE_ID = 1; + public const uint CHILDTERRAIN_ID = 2; // Terrain allocated based on our mega-prim childre start here + + public float SimpleWaterLevel { get; set; } + public BSTerrainManager TerrainManager { get; private set; } + + public ConfigurationParameters Params { - originator = BSScene.DetailLogZero; - ident = pIdent; - callback = pCallBack; + get { return UnmanagedParams[0]; } } - public TaintCallbackEntry(string pOrigin, string pIdent, TaintCallback pCallBack) + public Vector3 DefaultGravity { - originator = pOrigin; - ident = pIdent; - callback = pCallBack; + get { return new Vector3(0f, 0f, Params.gravity); } } - } - private Object _taintLock = new Object(); // lock for using the next object - private List _taintOperations; - private Dictionary _postTaintOperations; - private List _postStepOperations; - - // A pointer to an instance if this structure is passed to the C++ code - // Used to pass basic configuration values to the unmanaged code. - internal ConfigurationParameters[] UnmanagedParams; - - // Sometimes you just have to log everything. - public Logging.LogWriter PhysicsLogging; - private bool m_physicsLoggingEnabled; - private string m_physicsLoggingDir; - private string m_physicsLoggingPrefix; - private int m_physicsLoggingFileMinutes; - private bool m_physicsLoggingDoFlush; - private bool m_physicsPhysicalDumpEnabled; - public int PhysicsMetricDumpFrames { get; set; } - // 'true' of the vehicle code is to log lots of details - public bool VehicleLoggingEnabled { get; private set; } - public bool VehiclePhysicalLoggingEnabled { get; private set; } - - #region Construction and Initialization - public BSScene(string engineType, string identifier) - { - m_initialized = false; - - // The name of the region we're working for is passed to us. Keep for identification. - RegionName = identifier; - - // Set identifying variables in the PhysicsScene interface. - EngineType = engineType; - Name = EngineType + "/" + RegionName; - } - - // Old version of initialization that assumes legacy sized regions (256x256) - public override void Initialise(IMesher meshmerizer, IConfigSource config) - { - m_log.ErrorFormat("{0} WARNING WARNING WARNING! BulletSim initialized without region extent specification. Terrain will be messed up."); - Vector3 regionExtent = new Vector3( Constants.RegionSize, Constants.RegionSize, Constants.RegionSize); - Initialise(meshmerizer, config, regionExtent); - - } - - public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) - { - mesher = meshmerizer; - _taintOperations = new List(); - _postTaintOperations = new Dictionary(); - _postStepOperations = new List(); - PhysObjects = new Dictionary(); - Shapes = new BSShapeCollection(this); - - m_simulatedTime = 0f; - LastTimeStep = 0.1f; - - // Allocate pinned memory to pass parameters. - UnmanagedParams = new ConfigurationParameters[1]; - - // Set default values for physics parameters plus any overrides from the ini file - GetInitialParameterValues(config); - - // Force some parameters to values depending on other configurations - // Only use heightmap terrain implementation if terrain larger than legacy size - if ((uint)regionExtent.X > Constants.RegionSize || (uint)regionExtent.Y > Constants.RegionSize) + // Just the Z value of the gravity + public float DefaultGravityZ { - m_log.WarnFormat("{0} Forcing terrain implementation to heightmap for large region", LogHeader); - BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap; + get { return Params.gravity; } } - // Get the connection to the physics engine (could be native or one of many DLLs) - PE = SelectUnderlyingBulletEngine(BulletEngineName); - - // Enable very detailed logging. - // By creating an empty logger when not logging, the log message invocation code - // can be left in and every call doesn't have to check for null. - if (m_physicsLoggingEnabled) + // When functions in the unmanaged code must be called, it is only + // done at a known time just before the simulation step. The taint + // system saves all these function calls and executes them in + // order before the simulation. + public delegate void TaintCallback(); + private struct TaintCallbackEntry { - PhysicsLogging = new Logging.LogWriter(m_physicsLoggingDir, m_physicsLoggingPrefix, m_physicsLoggingFileMinutes, m_physicsLoggingDoFlush); - PhysicsLogging.ErrorLogger = m_log; // for DEBUG. Let's the logger output its own error messages. - } - else - { - PhysicsLogging = new Logging.LogWriter(); - } - - // Allocate memory for returning of the updates and collisions from the physics engine - m_collisionArray = new CollisionDesc[m_maxCollisionsPerFrame]; - m_updateArray = new EntityProperties[m_maxUpdatesPerFrame]; - - // The bounding box for the simulated world. The origin is 0,0,0 unless we're - // a child in a mega-region. - // Bullet actually doesn't care about the extents of the simulated - // area. It tracks active objects no matter where they are. - Vector3 worldExtent = regionExtent; - - World = PE.Initialize(worldExtent, Params, m_maxCollisionsPerFrame, ref m_collisionArray, m_maxUpdatesPerFrame, ref m_updateArray); - - Constraints = new BSConstraintCollection(World); - - TerrainManager = new BSTerrainManager(this, worldExtent); - TerrainManager.CreateInitialGroundPlaneAndTerrain(); - - // Put some informational messages into the log file. - m_log.InfoFormat("{0} Linksets implemented with {1}", LogHeader, (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation); - - InTaintTime = false; - m_initialized = true; - - // If the physics engine runs on its own thread, start same. - if (BSParam.UseSeparatePhysicsThread) - { - // The physics simulation should happen independently of the heartbeat loop - m_physicsThread - = WorkManager.StartThread( - BulletSPluginPhysicsThread, - string.Format("{0} ({1})", BulletEngineName, RegionName), - ThreadPriority.Normal, - true, - true); - } - } - - // All default parameter values are set here. There should be no values set in the - // variable definitions. - private void GetInitialParameterValues(IConfigSource config) - { - ConfigurationParameters parms = new ConfigurationParameters(); - UnmanagedParams[0] = parms; - - BSParam.SetParameterDefaultValues(this); - - if (config != null) - { - // If there are specifications in the ini file, use those values - IConfig pConfig = config.Configs["BulletSim"]; - if (pConfig != null) + public String originator; + public String ident; + public TaintCallback callback; + public TaintCallbackEntry(string pIdent, TaintCallback pCallBack) { - BSParam.SetParameterConfigurationValues(this, pConfig); + originator = BSScene.DetailLogZero; + ident = pIdent; + callback = pCallBack; + } + public TaintCallbackEntry(string pOrigin, string pIdent, TaintCallback pCallBack) + { + originator = pOrigin; + ident = pIdent; + callback = pCallBack; + } + } + private Object _taintLock = new Object(); // lock for using the next object + private List _taintOperations; + private Dictionary _postTaintOperations; + private List _postStepOperations; - // There are two Bullet implementations to choose from - BulletEngineName = pConfig.GetString("BulletEngine", "BulletUnmanaged"); + // A pointer to an instance if this structure is passed to the C++ code + // Used to pass basic configuration values to the unmanaged code. + internal ConfigurationParameters[] UnmanagedParams; - // Very detailed logging for physics debugging - // TODO: the boolean values can be moved to the normal parameter processing. - m_physicsLoggingEnabled = pConfig.GetBoolean("PhysicsLoggingEnabled", false); - m_physicsLoggingDir = pConfig.GetString("PhysicsLoggingDir", "."); - m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-%REGIONNAME%-"); - m_physicsLoggingFileMinutes = pConfig.GetInt("PhysicsLoggingFileMinutes", 5); - m_physicsLoggingDoFlush = pConfig.GetBoolean("PhysicsLoggingDoFlush", false); - m_physicsPhysicalDumpEnabled = pConfig.GetBoolean("PhysicsPhysicalDumpEnabled", false); - // Very detailed logging for vehicle debugging - VehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false); - VehiclePhysicalLoggingEnabled = pConfig.GetBoolean("VehiclePhysicalLoggingEnabled", false); + // Sometimes you just have to log everything. + public LogWriter PhysicsLogging; + private bool m_physicsLoggingEnabled; + private string m_physicsLoggingDir; + private string m_physicsLoggingPrefix; + private int m_physicsLoggingFileMinutes; + private bool m_physicsLoggingDoFlush; + private bool m_physicsPhysicalDumpEnabled; + public int PhysicsMetricDumpFrames { get; set; } + // 'true' of the vehicle code is to log lots of details + public bool VehicleLoggingEnabled { get; private set; } + public bool VehiclePhysicalLoggingEnabled { get; private set; } - // Do any replacements in the parameters - m_physicsLoggingPrefix = m_physicsLoggingPrefix.Replace("%REGIONNAME%", RegionName); + #region INonSharedRegionModule + public string Name + { + get { return "BulletSim"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) + { + // TODO: Move this out of Startup + IConfig config = source.Configs["Startup"]; + if (config != null) + { + string physics = config.GetString("physics", string.Empty); + if (physics == Name) + { + m_Enabled = true; + m_Config = source; + } + } + + } + + public void Close() + { + } + + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + + EngineType = Name; + RegionName = scene.RegionInfo.RegionName; + PhysicsSceneName = EngineType + "/" + RegionName; + + scene.RegisterModuleInterface(this); + Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); + Initialise(m_Config, extent); + } + + public void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + } + + public void RegionLoaded(Scene scene) + { + if (!m_Enabled) + return; + + mesher = scene.RequestModuleInterface(); + if (mesher == null) + m_log.WarnFormat("{0} No mesher. Things will not work well.", LogHeader); + } + #endregion + + #region Initialization + + private void Initialise(IConfigSource config, Vector3 regionExtent) + { + _taintOperations = new List(); + _postTaintOperations = new Dictionary(); + _postStepOperations = new List(); + PhysObjects = new Dictionary(); + Shapes = new BSShapeCollection(this); + + m_simulatedTime = 0f; + LastTimeStep = 0.1f; + + // Allocate pinned memory to pass parameters. + UnmanagedParams = new ConfigurationParameters[1]; + + // Set default values for physics parameters plus any overrides from the ini file + GetInitialParameterValues(config); + + // Force some parameters to values depending on other configurations + // Only use heightmap terrain implementation if terrain larger than legacy size + if ((uint)regionExtent.X > Constants.RegionSize || (uint)regionExtent.Y > Constants.RegionSize) + { + m_log.WarnFormat("{0} Forcing terrain implementation to heightmap for large region", LogHeader); + BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap; + } + + // Get the connection to the physics engine (could be native or one of many DLLs) + PE = SelectUnderlyingBulletEngine(BulletEngineName); + + // Enable very detailed logging. + // By creating an empty logger when not logging, the log message invocation code + // can be left in and every call doesn't have to check for null. + if (m_physicsLoggingEnabled) + { + PhysicsLogging = new LogWriter(m_physicsLoggingDir, m_physicsLoggingPrefix, m_physicsLoggingFileMinutes, m_physicsLoggingDoFlush); + PhysicsLogging.ErrorLogger = m_log; // for DEBUG. Let's the logger output its own error messages. } else { - // Nothing in the configuration INI file so assume unmanaged and other defaults. - BulletEngineName = "BulletUnmanaged"; - m_physicsLoggingEnabled = false; - VehicleLoggingEnabled = false; + PhysicsLogging = new LogWriter(); } - // The material characteristics. - BSMaterials.InitializeFromDefaults(Params); - if (pConfig != null) + // Allocate memory for returning of the updates and collisions from the physics engine + m_collisionArray = new CollisionDesc[m_maxCollisionsPerFrame]; + m_updateArray = new EntityProperties[m_maxUpdatesPerFrame]; + + // The bounding box for the simulated world. The origin is 0,0,0 unless we're + // a child in a mega-region. + // Bullet actually doesn't care about the extents of the simulated + // area. It tracks active objects no matter where they are. + Vector3 worldExtent = regionExtent; + + World = PE.Initialize(worldExtent, Params, m_maxCollisionsPerFrame, ref m_collisionArray, m_maxUpdatesPerFrame, ref m_updateArray); + + Constraints = new BSConstraintCollection(World); + + TerrainManager = new BSTerrainManager(this, worldExtent); + TerrainManager.CreateInitialGroundPlaneAndTerrain(); + + // Put some informational messages into the log file. + m_log.InfoFormat("{0} Linksets implemented with {1}", LogHeader, (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation); + + InTaintTime = false; + m_initialized = true; + + // If the physics engine runs on its own thread, start same. + if (BSParam.UseSeparatePhysicsThread) { - // Let the user add new and interesting material property values. - BSMaterials.InitializefromParameters(pConfig); + // The physics simulation should happen independently of the heartbeat loop + m_physicsThread + = WorkManager.StartThread( + BulletSPluginPhysicsThread, + string.Format("{0} ({1})", BulletEngineName, RegionName), + ThreadPriority.Normal, + true, + true); } } - } - // A helper function that handles a true/false parameter and returns the proper float number encoding - float ParamBoolean(IConfig config, string parmName, float deflt) - { - float ret = deflt; - if (config.Contains(parmName)) + // All default parameter values are set here. There should be no values set in the + // variable definitions. + private void GetInitialParameterValues(IConfigSource config) { - ret = ConfigurationParameters.numericFalse; - if (config.GetBoolean(parmName, false)) + ConfigurationParameters parms = new ConfigurationParameters(); + UnmanagedParams[0] = parms; + + BSParam.SetParameterDefaultValues(this); + + if (config != null) { - ret = ConfigurationParameters.numericTrue; - } - } - return ret; - } - - // Select the connection to the actual Bullet implementation. - // The main engine selection is the engineName up to the first hypen. - // So "Bullet-2.80-OpenCL-Intel" specifies the 'bullet' class here and the whole name - // is passed to the engine to do its special selection, etc. - private BSAPITemplate SelectUnderlyingBulletEngine(string engineName) - { - // For the moment, do a simple switch statement. - // Someday do fancyness with looking up the interfaces in the assembly. - BSAPITemplate ret = null; - - string selectionName = engineName.ToLower(); - int hyphenIndex = engineName.IndexOf("-"); - if (hyphenIndex > 0) - selectionName = engineName.ToLower().Substring(0, hyphenIndex - 1); - - switch (selectionName) - { - case "bullet": - case "bulletunmanaged": - ret = new BSAPIUnman(engineName, this); - break; - case "bulletxna": - ret = new BSAPIXNA(engineName, this); - // Disable some features that are not implemented in BulletXNA - m_log.InfoFormat("{0} Disabling some physics features not implemented by BulletXNA", LogHeader); - m_log.InfoFormat("{0} Disabling ShouldUseBulletHACD", LogHeader); - BSParam.ShouldUseBulletHACD = false; - m_log.InfoFormat("{0} Disabling ShouldUseSingleConvexHullForPrims", LogHeader); - BSParam.ShouldUseSingleConvexHullForPrims = false; - m_log.InfoFormat("{0} Disabling ShouldUseGImpactShapeForPrims", LogHeader); - BSParam.ShouldUseGImpactShapeForPrims = false; - m_log.InfoFormat("{0} Setting terrain implimentation to Heightmap", LogHeader); - BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap; - break; - } - - if (ret == null) - { - m_log.ErrorFormat("{0} COULD NOT SELECT BULLET ENGINE: '[BulletSim]PhysicsEngine' must be either 'BulletUnmanaged-*' or 'BulletXNA-*'", LogHeader); - } - else - { - m_log.InfoFormat("{0} Selected bullet engine {1} -> {2}/{3}", LogHeader, engineName, ret.BulletEngineName, ret.BulletEngineVersion); - } - - return ret; - } - - public override void Dispose() - { - // m_log.DebugFormat("{0}: Dispose()", LogHeader); - - // make sure no stepping happens while we're deleting stuff - m_initialized = false; - - lock (PhysObjects) - { - foreach (KeyValuePair kvp in PhysObjects) - { - kvp.Value.Destroy(); - } - PhysObjects.Clear(); - } - - // Now that the prims are all cleaned up, there should be no constraints left - if (Constraints != null) - { - Constraints.Dispose(); - Constraints = null; - } - - if (Shapes != null) - { - Shapes.Dispose(); - Shapes = null; - } - - if (TerrainManager != null) - { - TerrainManager.ReleaseGroundPlaneAndTerrain(); - TerrainManager.Dispose(); - TerrainManager = null; - } - - // Anything left in the unmanaged code should be cleaned out - PE.Shutdown(World); - - // Not logging any more - PhysicsLogging.Close(); - } - #endregion // Construction and Initialization - - #region Prim and Avatar addition and removal - - public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) - { - m_log.ErrorFormat("{0}: CALL TO AddAvatar in BSScene. NOT IMPLEMENTED", LogHeader); - return null; - } - - public override PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) - { - // m_log.DebugFormat("{0}: AddAvatar: {1}", LogHeader, avName); - - if (!m_initialized) return null; - - BSCharacter actor = new BSCharacter(localID, avName, this, position, velocity, size, isFlying); - lock (PhysObjects) - PhysObjects.Add(localID, actor); - - // TODO: Remove kludge someday. - // We must generate a collision for avatars whether they collide or not. - // This is required by OpenSim to update avatar animations, etc. - lock (AvatarsInSceneLock) - AvatarsInScene.Add(actor); - - return actor; - } - - public override void RemoveAvatar(PhysicsActor actor) - { - // m_log.DebugFormat("{0}: RemoveAvatar", LogHeader); - - if (!m_initialized) return; - - BSCharacter bsactor = actor as BSCharacter; - if (bsactor != null) - { - try - { - lock (PhysObjects) - PhysObjects.Remove(bsactor.LocalID); - // Remove kludge someday - lock (AvatarsInSceneLock) - AvatarsInScene.Remove(bsactor); - } - catch (Exception e) - { - m_log.WarnFormat("{0}: Attempt to remove avatar that is not in physics scene: {1}", LogHeader, e); - } - bsactor.Destroy(); - // bsactor.dispose(); - } - else - { - m_log.ErrorFormat("{0}: Requested to remove avatar that is not a BSCharacter. ID={1}, type={2}", - LogHeader, actor.LocalID, actor.GetType().Name); - } - } - - public override void RemovePrim(PhysicsActor prim) - { - if (!m_initialized) return; - - BSPhysObject bsprim = prim as BSPhysObject; - if (bsprim != null) - { - DetailLog("{0},RemovePrim,call", bsprim.LocalID); - // m_log.DebugFormat("{0}: RemovePrim. id={1}/{2}", LogHeader, bsprim.Name, bsprim.LocalID); - try - { - lock (PhysObjects) PhysObjects.Remove(bsprim.LocalID); - } - catch (Exception e) - { - m_log.ErrorFormat("{0}: Attempt to remove prim that is not in physics scene: {1}", LogHeader, e); - } - bsprim.Destroy(); - // bsprim.dispose(); - } - else - { - m_log.ErrorFormat("{0}: Attempt to remove prim that is not a BSPrim type.", LogHeader); - } - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical, uint localID) - { - // m_log.DebugFormat("{0}: AddPrimShape2: {1}", LogHeader, primName); - - if (!m_initialized) return null; - - // DetailLog("{0},BSScene.AddPrimShape,call", localID); - - BSPhysObject prim = new BSPrimLinkable(localID, primName, this, position, size, rotation, pbs, isPhysical); - lock (PhysObjects) PhysObjects.Add(localID, prim); - return prim; - } - - // This is a call from the simulator saying that some physical property has been updated. - // The BulletSim driver senses the changing of relevant properties so this taint - // information call is not needed. - public override void AddPhysicsActorTaint(PhysicsActor prim) { } - - #endregion // Prim and Avatar addition and removal - - #region Simulation - - // Call from the simulator to send physics information to the simulator objects. - // This pushes all the collision and property update events into the objects in - // the simulator and, since it is on the heartbeat thread, there is an implicit - // locking of those data structures from other heartbeat events. - // If the physics engine is running on a separate thread, the update information - // will be in the ObjectsWithCollions and ObjectsWithUpdates structures. - public override float Simulate(float timeStep) - { - if (!BSParam.UseSeparatePhysicsThread) - { - DoPhysicsStep(timeStep); - } - return SendUpdatesToSimulator(timeStep); - } - - // Call the physics engine to do one 'timeStep' and collect collisions and updates - // into ObjectsWithCollisions and ObjectsWithUpdates data structures. - private void DoPhysicsStep(float timeStep) - { - // prevent simulation until we've been initialized - if (!m_initialized) return; - - LastTimeStep = timeStep; - - int updatedEntityCount = 0; - int collidersCount = 0; - - int beforeTime = Util.EnvironmentTickCount(); - int simTime = 0; - - int numTaints = _taintOperations.Count; - InTaintTime = true; // Only used for debugging so locking is not necessary. - - // update the prim states while we know the physics engine is not busy - ProcessTaints(); - - // Some of the physical objects requre individual, pre-step calls - // (vehicles and avatar movement, in particular) - TriggerPreStepEvent(timeStep); - - // the prestep actions might have added taints - numTaints += _taintOperations.Count; - ProcessTaints(); - - InTaintTime = false; // Only used for debugging so locking is not necessary. - - // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world. - // Only enable this in a limited test world with few objects. - if (m_physicsPhysicalDumpEnabled) - PE.DumpAllInfo(World); - - // step the physical world one interval - m_simulationStep++; - int numSubSteps = 0; - try - { - numSubSteps = PE.PhysicsStep(World, timeStep, m_maxSubSteps, m_fixedTimeStep, out updatedEntityCount, out collidersCount); - - } - catch (Exception e) - { - m_log.WarnFormat("{0},PhysicsStep Exception: nTaints={1}, substeps={2}, updates={3}, colliders={4}, e={5}", - LogHeader, numTaints, numSubSteps, updatedEntityCount, collidersCount, e); - DetailLog("{0},PhysicsStepException,call, nTaints={1}, substeps={2}, updates={3}, colliders={4}", - DetailLogZero, numTaints, numSubSteps, updatedEntityCount, collidersCount); - updatedEntityCount = 0; - collidersCount = 0; - } - - // Make the physics engine dump useful statistics periodically - if (PhysicsMetricDumpFrames != 0 && ((m_simulationStep % PhysicsMetricDumpFrames) == 0)) - PE.DumpPhysicsStatistics(World); - - // Get a value for 'now' so all the collision and update routines don't have to get their own. - SimulationNowTime = Util.EnvironmentTickCount(); - - // Send collision information to the colliding objects. The objects decide if the collision - // is 'real' (like linksets don't collide with themselves) and the individual objects - // know if the simulator has subscribed to collisions. - lock (CollisionLock) - { - if (collidersCount > 0) - { - lock (PhysObjects) + // If there are specifications in the ini file, use those values + IConfig pConfig = config.Configs["BulletSim"]; + if (pConfig != null) { - for (int ii = 0; ii < collidersCount; ii++) - { - uint cA = m_collisionArray[ii].aID; - uint cB = m_collisionArray[ii].bID; - Vector3 point = m_collisionArray[ii].point; - Vector3 normal = m_collisionArray[ii].normal; - float penetration = m_collisionArray[ii].penetration; - SendCollision(cA, cB, point, normal, penetration); - SendCollision(cB, cA, point, -normal, penetration); - } + BSParam.SetParameterConfigurationValues(this, pConfig); + + // There are two Bullet implementations to choose from + BulletEngineName = pConfig.GetString("BulletEngine", "BulletUnmanaged"); + + // Very detailed logging for physics debugging + // TODO: the boolean values can be moved to the normal parameter processing. + m_physicsLoggingEnabled = pConfig.GetBoolean("PhysicsLoggingEnabled", false); + m_physicsLoggingDir = pConfig.GetString("PhysicsLoggingDir", "."); + m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-%REGIONNAME%-"); + m_physicsLoggingFileMinutes = pConfig.GetInt("PhysicsLoggingFileMinutes", 5); + m_physicsLoggingDoFlush = pConfig.GetBoolean("PhysicsLoggingDoFlush", false); + m_physicsPhysicalDumpEnabled = pConfig.GetBoolean("PhysicsPhysicalDumpEnabled", false); + // Very detailed logging for vehicle debugging + VehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false); + VehiclePhysicalLoggingEnabled = pConfig.GetBoolean("VehiclePhysicalLoggingEnabled", false); + + // Do any replacements in the parameters + m_physicsLoggingPrefix = m_physicsLoggingPrefix.Replace("%REGIONNAME%", RegionName); + } + else + { + // Nothing in the configuration INI file so assume unmanaged and other defaults. + BulletEngineName = "BulletUnmanaged"; + m_physicsLoggingEnabled = false; + VehicleLoggingEnabled = false; + } + + // The material characteristics. + BSMaterials.InitializeFromDefaults(Params); + if (pConfig != null) + { + // Let the user add new and interesting material property values. + BSMaterials.InitializefromParameters(pConfig); } } } - // If any of the objects had updated properties, tell the managed objects about the update - // and remember that there was a change so it will be passed to the simulator. - lock (UpdateLock) + // A helper function that handles a true/false parameter and returns the proper float number encoding + float ParamBoolean(IConfig config, string parmName, float deflt) { - if (updatedEntityCount > 0) + float ret = deflt; + if (config.Contains(parmName)) { - lock (PhysObjects) + ret = ConfigurationParameters.numericFalse; + if (config.GetBoolean(parmName, false)) { - for (int ii = 0; ii < updatedEntityCount; ii++) + ret = ConfigurationParameters.numericTrue; + } + } + return ret; + } + + // Select the connection to the actual Bullet implementation. + // The main engine selection is the engineName up to the first hypen. + // So "Bullet-2.80-OpenCL-Intel" specifies the 'bullet' class here and the whole name + // is passed to the engine to do its special selection, etc. + private BSAPITemplate SelectUnderlyingBulletEngine(string engineName) + { + // For the moment, do a simple switch statement. + // Someday do fancyness with looking up the interfaces in the assembly. + BSAPITemplate ret = null; + + string selectionName = engineName.ToLower(); + int hyphenIndex = engineName.IndexOf("-"); + if (hyphenIndex > 0) + selectionName = engineName.ToLower().Substring(0, hyphenIndex - 1); + + switch (selectionName) + { + case "bullet": + case "bulletunmanaged": + ret = new BSAPIUnman(engineName, this); + break; + case "bulletxna": + ret = new BSAPIXNA(engineName, this); + // Disable some features that are not implemented in BulletXNA + m_log.InfoFormat("{0} Disabling some physics features not implemented by BulletXNA", LogHeader); + m_log.InfoFormat("{0} Disabling ShouldUseBulletHACD", LogHeader); + BSParam.ShouldUseBulletHACD = false; + m_log.InfoFormat("{0} Disabling ShouldUseSingleConvexHullForPrims", LogHeader); + BSParam.ShouldUseSingleConvexHullForPrims = false; + m_log.InfoFormat("{0} Disabling ShouldUseGImpactShapeForPrims", LogHeader); + BSParam.ShouldUseGImpactShapeForPrims = false; + m_log.InfoFormat("{0} Setting terrain implimentation to Heightmap", LogHeader); + BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap; + break; + } + + if (ret == null) + { + m_log.ErrorFormat("{0} COULD NOT SELECT BULLET ENGINE: '[BulletSim]PhysicsEngine' must be either 'BulletUnmanaged-*' or 'BulletXNA-*'", LogHeader); + } + else + { + m_log.InfoFormat("{0} Selected bullet engine {1} -> {2}/{3}", LogHeader, engineName, ret.BulletEngineName, ret.BulletEngineVersion); + } + + return ret; + } + + public override void Dispose() + { + // m_log.DebugFormat("{0}: Dispose()", LogHeader); + + // make sure no stepping happens while we're deleting stuff + m_initialized = false; + + lock (PhysObjects) + { + foreach (KeyValuePair kvp in PhysObjects) + { + kvp.Value.Destroy(); + } + PhysObjects.Clear(); + } + + // Now that the prims are all cleaned up, there should be no constraints left + if (Constraints != null) + { + Constraints.Dispose(); + Constraints = null; + } + + if (Shapes != null) + { + Shapes.Dispose(); + Shapes = null; + } + + if (TerrainManager != null) + { + TerrainManager.ReleaseGroundPlaneAndTerrain(); + TerrainManager.Dispose(); + TerrainManager = null; + } + + // Anything left in the unmanaged code should be cleaned out + PE.Shutdown(World); + + // Not logging any more + PhysicsLogging.Close(); + } + #endregion // Construction and Initialization + + #region Prim and Avatar addition and removal + + public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) + { + m_log.ErrorFormat("{0}: CALL TO AddAvatar in BSScene. NOT IMPLEMENTED", LogHeader); + return null; + } + + public override PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) + { + // m_log.DebugFormat("{0}: AddAvatar: {1}", LogHeader, avName); + + if (!m_initialized) return null; + + BSCharacter actor = new BSCharacter(localID, avName, this, position, velocity, size, isFlying); + lock (PhysObjects) + PhysObjects.Add(localID, actor); + + // TODO: Remove kludge someday. + // We must generate a collision for avatars whether they collide or not. + // This is required by OpenSim to update avatar animations, etc. + lock (AvatarsInSceneLock) + AvatarsInScene.Add(actor); + + return actor; + } + + public override void RemoveAvatar(PhysicsActor actor) + { + // m_log.DebugFormat("{0}: RemoveAvatar", LogHeader); + + if (!m_initialized) return; + + BSCharacter bsactor = actor as BSCharacter; + if (bsactor != null) + { + try + { + lock (PhysObjects) + PhysObjects.Remove(bsactor.LocalID); + // Remove kludge someday + lock (AvatarsInSceneLock) + AvatarsInScene.Remove(bsactor); + } + catch (Exception e) + { + m_log.WarnFormat("{0}: Attempt to remove avatar that is not in physics scene: {1}", LogHeader, e); + } + bsactor.Destroy(); + // bsactor.dispose(); + } + else + { + m_log.ErrorFormat("{0}: Requested to remove avatar that is not a BSCharacter. ID={1}, type={2}", + LogHeader, actor.LocalID, actor.GetType().Name); + } + } + + public override void RemovePrim(PhysicsActor prim) + { + if (!m_initialized) return; + + BSPhysObject bsprim = prim as BSPhysObject; + if (bsprim != null) + { + DetailLog("{0},RemovePrim,call", bsprim.LocalID); + // m_log.DebugFormat("{0}: RemovePrim. id={1}/{2}", LogHeader, bsprim.Name, bsprim.LocalID); + try + { + lock (PhysObjects) PhysObjects.Remove(bsprim.LocalID); + } + catch (Exception e) + { + m_log.ErrorFormat("{0}: Attempt to remove prim that is not in physics scene: {1}", LogHeader, e); + } + bsprim.Destroy(); + // bsprim.dispose(); + } + else + { + m_log.ErrorFormat("{0}: Attempt to remove prim that is not a BSPrim type.", LogHeader); + } + } + + public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, + Vector3 size, Quaternion rotation, bool isPhysical, uint localID) + { + // m_log.DebugFormat("{0}: AddPrimShape2: {1}", LogHeader, primName); + + if (!m_initialized) return null; + + // DetailLog("{0},BSScene.AddPrimShape,call", localID); + + BSPhysObject prim = new BSPrimLinkable(localID, primName, this, position, size, rotation, pbs, isPhysical); + lock (PhysObjects) PhysObjects.Add(localID, prim); + return prim; + } + + // This is a call from the simulator saying that some physical property has been updated. + // The BulletSim driver senses the changing of relevant properties so this taint + // information call is not needed. + public override void AddPhysicsActorTaint(PhysicsActor prim) { } + + #endregion // Prim and Avatar addition and removal + + #region Simulation + + // Call from the simulator to send physics information to the simulator objects. + // This pushes all the collision and property update events into the objects in + // the simulator and, since it is on the heartbeat thread, there is an implicit + // locking of those data structures from other heartbeat events. + // If the physics engine is running on a separate thread, the update information + // will be in the ObjectsWithCollions and ObjectsWithUpdates structures. + public override float Simulate(float timeStep) + { + if (!BSParam.UseSeparatePhysicsThread) + { + DoPhysicsStep(timeStep); + } + return SendUpdatesToSimulator(timeStep); + } + + // Call the physics engine to do one 'timeStep' and collect collisions and updates + // into ObjectsWithCollisions and ObjectsWithUpdates data structures. + private void DoPhysicsStep(float timeStep) + { + // prevent simulation until we've been initialized + if (!m_initialized) return; + + LastTimeStep = timeStep; + + int updatedEntityCount = 0; + int collidersCount = 0; + + int beforeTime = Util.EnvironmentTickCount(); + int simTime = 0; + + int numTaints = _taintOperations.Count; + InTaintTime = true; // Only used for debugging so locking is not necessary. + + // update the prim states while we know the physics engine is not busy + ProcessTaints(); + + // Some of the physical objects requre individual, pre-step calls + // (vehicles and avatar movement, in particular) + TriggerPreStepEvent(timeStep); + + // the prestep actions might have added taints + numTaints += _taintOperations.Count; + ProcessTaints(); + + InTaintTime = false; // Only used for debugging so locking is not necessary. + + // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world. + // Only enable this in a limited test world with few objects. + if (m_physicsPhysicalDumpEnabled) + PE.DumpAllInfo(World); + + // step the physical world one interval + m_simulationStep++; + int numSubSteps = 0; + try + { + numSubSteps = PE.PhysicsStep(World, timeStep, m_maxSubSteps, m_fixedTimeStep, out updatedEntityCount, out collidersCount); + + } + catch (Exception e) + { + m_log.WarnFormat("{0},PhysicsStep Exception: nTaints={1}, substeps={2}, updates={3}, colliders={4}, e={5}", + LogHeader, numTaints, numSubSteps, updatedEntityCount, collidersCount, e); + DetailLog("{0},PhysicsStepException,call, nTaints={1}, substeps={2}, updates={3}, colliders={4}", + DetailLogZero, numTaints, numSubSteps, updatedEntityCount, collidersCount); + updatedEntityCount = 0; + collidersCount = 0; + } + + // Make the physics engine dump useful statistics periodically + if (PhysicsMetricDumpFrames != 0 && ((m_simulationStep % PhysicsMetricDumpFrames) == 0)) + PE.DumpPhysicsStatistics(World); + + // Get a value for 'now' so all the collision and update routines don't have to get their own. + SimulationNowTime = Util.EnvironmentTickCount(); + + // Send collision information to the colliding objects. The objects decide if the collision + // is 'real' (like linksets don't collide with themselves) and the individual objects + // know if the simulator has subscribed to collisions. + lock (CollisionLock) + { + if (collidersCount > 0) + { + lock (PhysObjects) { - EntityProperties entprop = m_updateArray[ii]; - BSPhysObject pobj; - if (PhysObjects.TryGetValue(entprop.ID, out pobj)) + for (int ii = 0; ii < collidersCount; ii++) { - if (pobj.IsInitialized) - pobj.UpdateProperties(entprop); + uint cA = m_collisionArray[ii].aID; + uint cB = m_collisionArray[ii].bID; + Vector3 point = m_collisionArray[ii].point; + Vector3 normal = m_collisionArray[ii].normal; + float penetration = m_collisionArray[ii].penetration; + SendCollision(cA, cB, point, normal, penetration); + SendCollision(cB, cA, point, -normal, penetration); } } } } - } - // Some actors want to know when the simulation step is complete. - TriggerPostStepEvent(timeStep); - - simTime = Util.EnvironmentTickCountSubtract(beforeTime); - if (PhysicsLogging.Enabled) - { - DetailLog("{0},DoPhysicsStep,complete,frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}, objWColl={7}", - DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps, - updatedEntityCount, collidersCount, ObjectsWithCollisions.Count); - } - - // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world. - // Only enable this in a limited test world with few objects. - if (m_physicsPhysicalDumpEnabled) - PE.DumpAllInfo(World); - - // The physics engine returns the number of milliseconds it simulated this call. - // These are summed and normalized to one second and divided by 1000 to give the reported physics FPS. - // Multiply by a fixed nominal frame rate to give a rate similar to the simulator (usually 55). - m_simulatedTime += (float)numSubSteps * m_fixedTimeStep * 1000f * NominalFrameRate; - } - - // Called by a BSPhysObject to note that it has changed properties and this information - // should be passed up to the simulator at the proper time. - // Note: this is called by the BSPhysObject from invocation via DoPhysicsStep() above so - // this is is under UpdateLock. - public void PostUpdate(BSPhysObject updatee) - { - lock (UpdateLock) - { - ObjectsWithUpdates.Add(updatee); - } - } - - // The simulator thinks it is physics time so return all the collisions and position - // updates that were collected in actual physics simulation. - private float SendUpdatesToSimulator(float timeStep) - { - if (!m_initialized) return 5.0f; - - DetailLog("{0},SendUpdatesToSimulator,collisions={1},updates={2},simedTime={3}", - BSScene.DetailLogZero, ObjectsWithCollisions.Count, ObjectsWithUpdates.Count, m_simulatedTime); - // Push the collisions into the simulator. - lock (CollisionLock) - { - if (ObjectsWithCollisions.Count > 0) + // If any of the objects had updated properties, tell the managed objects about the update + // and remember that there was a change so it will be passed to the simulator. + lock (UpdateLock) { - foreach (BSPhysObject bsp in ObjectsWithCollisions) - if (!bsp.SendCollisions()) + if (updatedEntityCount > 0) + { + lock (PhysObjects) { - // If the object is done colliding, see that it's removed from the colliding list - ObjectsWithNoMoreCollisions.Add(bsp); + for (int ii = 0; ii < updatedEntityCount; ii++) + { + EntityProperties entprop = m_updateArray[ii]; + BSPhysObject pobj; + if (PhysObjects.TryGetValue(entprop.ID, out pobj)) + { + if (pobj.IsInitialized) + pobj.UpdateProperties(entprop); + } + } } + } } - // This is a kludge to get avatar movement updates. - // The simulator expects collisions for avatars even if there are have been no collisions. - // The event updates avatar animations and stuff. - // If you fix avatar animation updates, remove this overhead and let normal collision processing happen. - // Note that we get a copy of the list to search because SendCollision() can take a while. - HashSet tempAvatarsInScene; - lock (AvatarsInSceneLock) - { - tempAvatarsInScene = new HashSet(AvatarsInScene); - } - foreach (BSPhysObject actor in tempAvatarsInScene) - { - if (!ObjectsWithCollisions.Contains(actor)) // don't call avatars twice - actor.SendCollisions(); - } - tempAvatarsInScene = null; + // Some actors want to know when the simulation step is complete. + TriggerPostStepEvent(timeStep); - // Objects that are done colliding are removed from the ObjectsWithCollisions list. - // Not done above because it is inside an iteration of ObjectWithCollisions. - // This complex collision processing is required to create an empty collision - // event call after all real collisions have happened on an object. This allows - // the simulator to generate the 'collision end' event. - if (ObjectsWithNoMoreCollisions.Count > 0) + simTime = Util.EnvironmentTickCountSubtract(beforeTime); + if (PhysicsLogging.Enabled) { - foreach (BSPhysObject po in ObjectsWithNoMoreCollisions) - ObjectsWithCollisions.Remove(po); - ObjectsWithNoMoreCollisions.Clear(); + DetailLog("{0},DoPhysicsStep,complete,frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}, objWColl={7}", + DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps, + updatedEntityCount, collidersCount, ObjectsWithCollisions.Count); + } + + // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world. + // Only enable this in a limited test world with few objects. + if (m_physicsPhysicalDumpEnabled) + PE.DumpAllInfo(World); + + // The physics engine returns the number of milliseconds it simulated this call. + // These are summed and normalized to one second and divided by 1000 to give the reported physics FPS. + // Multiply by a fixed nominal frame rate to give a rate similar to the simulator (usually 55). + m_simulatedTime += (float)numSubSteps * m_fixedTimeStep * 1000f * NominalFrameRate; + } + + // Called by a BSPhysObject to note that it has changed properties and this information + // should be passed up to the simulator at the proper time. + // Note: this is called by the BSPhysObject from invocation via DoPhysicsStep() above so + // this is is under UpdateLock. + public void PostUpdate(BSPhysObject updatee) + { + lock (UpdateLock) + { + ObjectsWithUpdates.Add(updatee); } } - // Call the simulator for each object that has physics property updates. - HashSet updatedObjects = null; - lock (UpdateLock) + // The simulator thinks it is physics time so return all the collisions and position + // updates that were collected in actual physics simulation. + private float SendUpdatesToSimulator(float timeStep) { - if (ObjectsWithUpdates.Count > 0) + if (!m_initialized) return 5.0f; + + DetailLog("{0},SendUpdatesToSimulator,collisions={1},updates={2},simedTime={3}", + BSScene.DetailLogZero, ObjectsWithCollisions.Count, ObjectsWithUpdates.Count, m_simulatedTime); + // Push the collisions into the simulator. + lock (CollisionLock) { - updatedObjects = ObjectsWithUpdates; - ObjectsWithUpdates = new HashSet(); + if (ObjectsWithCollisions.Count > 0) + { + foreach (BSPhysObject bsp in ObjectsWithCollisions) + if (!bsp.SendCollisions()) + { + // If the object is done colliding, see that it's removed from the colliding list + ObjectsWithNoMoreCollisions.Add(bsp); + } + } + + // This is a kludge to get avatar movement updates. + // The simulator expects collisions for avatars even if there are have been no collisions. + // The event updates avatar animations and stuff. + // If you fix avatar animation updates, remove this overhead and let normal collision processing happen. + // Note that we get a copy of the list to search because SendCollision() can take a while. + HashSet tempAvatarsInScene; + lock (AvatarsInSceneLock) + { + tempAvatarsInScene = new HashSet(AvatarsInScene); + } + foreach (BSPhysObject actor in tempAvatarsInScene) + { + if (!ObjectsWithCollisions.Contains(actor)) // don't call avatars twice + actor.SendCollisions(); + } + tempAvatarsInScene = null; + + // Objects that are done colliding are removed from the ObjectsWithCollisions list. + // Not done above because it is inside an iteration of ObjectWithCollisions. + // This complex collision processing is required to create an empty collision + // event call after all real collisions have happened on an object. This allows + // the simulator to generate the 'collision end' event. + if (ObjectsWithNoMoreCollisions.Count > 0) + { + foreach (BSPhysObject po in ObjectsWithNoMoreCollisions) + ObjectsWithCollisions.Remove(po); + ObjectsWithNoMoreCollisions.Clear(); + } } - } - if (updatedObjects != null) - { - foreach (BSPhysObject obj in updatedObjects) + + // Call the simulator for each object that has physics property updates. + HashSet updatedObjects = null; + lock (UpdateLock) { - obj.RequestPhysicsterseUpdate(); + if (ObjectsWithUpdates.Count > 0) + { + updatedObjects = ObjectsWithUpdates; + ObjectsWithUpdates = new HashSet(); + } } - updatedObjects.Clear(); + if (updatedObjects != null) + { + foreach (BSPhysObject obj in updatedObjects) + { + obj.RequestPhysicsterseUpdate(); + } + updatedObjects.Clear(); + } + + // Return the framerate simulated to give the above returned results. + // (Race condition here but this is just bookkeeping so rare mistakes do not merit a lock). + float simTime = m_simulatedTime; + m_simulatedTime = 0f; + return simTime; } - // Return the framerate simulated to give the above returned results. - // (Race condition here but this is just bookkeeping so rare mistakes do not merit a lock). - float simTime = m_simulatedTime; - m_simulatedTime = 0f; - return simTime; - } - - // Something has collided - private void SendCollision(uint localID, uint collidingWith, Vector3 collidePoint, Vector3 collideNormal, float penetration) - { - if (localID <= TerrainManager.HighestTerrainID) + // Something has collided + private void SendCollision(uint localID, uint collidingWith, Vector3 collidePoint, Vector3 collideNormal, float penetration) { - return; // don't send collisions to the terrain - } + if (localID <= TerrainManager.HighestTerrainID) + { + return; // don't send collisions to the terrain + } + + BSPhysObject collider; + // NOTE that PhysObjects was locked before the call to SendCollision(). + if (!PhysObjects.TryGetValue(localID, out collider)) + { + // If the object that is colliding cannot be found, just ignore the collision. + DetailLog("{0},BSScene.SendCollision,colliderNotInObjectList,id={1},with={2}", DetailLogZero, localID, collidingWith); + return; + } + + // Note: the terrain is not in the physical object list so 'collidee' can be null when Collide() is called. + BSPhysObject collidee = null; + PhysObjects.TryGetValue(collidingWith, out collidee); + + // DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith); + + if (collider.IsInitialized) + { + if (collider.Collide(collidingWith, collidee, collidePoint, collideNormal, penetration)) + { + // If a collision was 'good', remember to send it to the simulator + lock (CollisionLock) + { + ObjectsWithCollisions.Add(collider); + } + } + } - BSPhysObject collider; - // NOTE that PhysObjects was locked before the call to SendCollision(). - if (!PhysObjects.TryGetValue(localID, out collider)) - { - // If the object that is colliding cannot be found, just ignore the collision. - DetailLog("{0},BSScene.SendCollision,colliderNotInObjectList,id={1},with={2}", DetailLogZero, localID, collidingWith); return; } - // Note: the terrain is not in the physical object list so 'collidee' can be null when Collide() is called. - BSPhysObject collidee = null; - PhysObjects.TryGetValue(collidingWith, out collidee); - - // DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith); - - if (collider.IsInitialized) + public void BulletSPluginPhysicsThread() { - if (collider.Collide(collidingWith, collidee, collidePoint, collideNormal, penetration)) + Thread.CurrentThread.Priority = ThreadPriority.Highest; + m_updateWaitEvent = new ManualResetEvent(false); + + while (m_initialized) { - // If a collision was 'good', remember to send it to the simulator - lock (CollisionLock) + int beginSimulationRealtimeMS = Util.EnvironmentTickCount(); + + if (BSParam.Active) + DoPhysicsStep(BSParam.PhysicsTimeStep); + + int simulationRealtimeMS = Util.EnvironmentTickCountSubtract(beginSimulationRealtimeMS); + int simulationTimeVsRealtimeDifferenceMS = ((int)(BSParam.PhysicsTimeStep*1000f)) - simulationRealtimeMS; + + if (simulationTimeVsRealtimeDifferenceMS > 0) { - ObjectsWithCollisions.Add(collider); + // The simulation of the time interval took less than realtime. + // Do a wait for the rest of realtime. + m_updateWaitEvent.WaitOne(simulationTimeVsRealtimeDifferenceMS); + //Thread.Sleep(simulationTimeVsRealtimeDifferenceMS); } + else + { + // The simulation took longer than realtime. + // Do some scaling of simulation time. + // TODO. + DetailLog("{0},BulletSPluginPhysicsThread,longerThanRealtime={1}", BSScene.DetailLogZero, simulationTimeVsRealtimeDifferenceMS); + } + + Watchdog.UpdateThread(); } + + Watchdog.RemoveThread(); } - return; - } + #endregion // Simulation - public void BulletSPluginPhysicsThread() - { - Thread.CurrentThread.Priority = ThreadPriority.Highest; - m_updateWaitEvent = new ManualResetEvent(false); + public override void GetResults() { } - while (m_initialized) + #region Terrain + + public override void SetTerrain(float[] heightMap) { + TerrainManager.SetTerrain(heightMap); + } + + public override void SetWaterLevel(float baseheight) { - int beginSimulationRealtimeMS = Util.EnvironmentTickCount(); + SimpleWaterLevel = baseheight; + } - if (BSParam.Active) - DoPhysicsStep(BSParam.PhysicsTimeStep); + public override void DeleteTerrain() + { + // m_log.DebugFormat("{0}: DeleteTerrain()", LogHeader); + } - int simulationRealtimeMS = Util.EnvironmentTickCountSubtract(beginSimulationRealtimeMS); - int simulationTimeVsRealtimeDifferenceMS = ((int)(BSParam.PhysicsTimeStep*1000f)) - simulationRealtimeMS; + // Although no one seems to check this, I do support combining. + public override bool SupportsCombining() + { + return TerrainManager.SupportsCombining(); + } + // This call says I am a child to region zero in a mega-region. 'pScene' is that + // of region zero, 'offset' is my offset from regions zero's origin, and + // 'extents' is the largest XY that is handled in my region. + public override void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) + { + TerrainManager.Combine(pScene, offset, extents); + } - if (simulationTimeVsRealtimeDifferenceMS > 0) + // Unhook all the combining that I know about. + public override void UnCombine(PhysicsScene pScene) + { + TerrainManager.UnCombine(pScene); + } + + #endregion // Terrain + + public override Dictionary GetTopColliders() + { + Dictionary topColliders; + + lock (PhysObjects) { - // The simulation of the time interval took less than realtime. - // Do a wait for the rest of realtime. - m_updateWaitEvent.WaitOne(simulationTimeVsRealtimeDifferenceMS); - //Thread.Sleep(simulationTimeVsRealtimeDifferenceMS); + foreach (KeyValuePair kvp in PhysObjects) + { + kvp.Value.ComputeCollisionScore(); + } + + List orderedPrims = new List(PhysObjects.Values); + orderedPrims.OrderByDescending(p => p.CollisionScore); + topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore); } + + return topColliders; + } + + public override bool IsThreaded { get { return false; } } + + #region Extensions + public override object Extension(string pFunct, params object[] pParams) + { + DetailLog("{0} BSScene.Extension,op={1}", DetailLogZero, pFunct); + return base.Extension(pFunct, pParams); + } + #endregion // Extensions + + public static string PrimitiveBaseShapeToString(PrimitiveBaseShape pbs) + { + float pathShearX = pbs.PathShearX < 128 ? (float)pbs.PathShearX * 0.01f : (float)(pbs.PathShearX - 256) * 0.01f; + float pathShearY = pbs.PathShearY < 128 ? (float)pbs.PathShearY * 0.01f : (float)(pbs.PathShearY - 256) * 0.01f; + float pathBegin = (float)pbs.PathBegin * 2.0e-5f; + float pathEnd = 1.0f - (float)pbs.PathEnd * 2.0e-5f; + float pathScaleX = (float)(200 - pbs.PathScaleX) * 0.01f; + float pathScaleY = (float)(200 - pbs.PathScaleY) * 0.01f; + float pathTaperX = pbs.PathTaperX * 0.01f; + float pathTaperY = pbs.PathTaperY * 0.01f; + + float profileBegin = (float)pbs.ProfileBegin * 2.0e-5f; + float profileEnd = 1.0f - (float)pbs.ProfileEnd * 2.0e-5f; + float profileHollow = (float)pbs.ProfileHollow * 2.0e-5f; + if (profileHollow > 0.95f) + profileHollow = 0.95f; + + StringBuilder buff = new StringBuilder(); + buff.Append("shape="); + buff.Append(((ProfileShape)pbs.ProfileShape).ToString()); + buff.Append(","); + buff.Append("hollow="); + buff.Append(((HollowShape)pbs.HollowShape).ToString()); + buff.Append(","); + buff.Append("pathCurve="); + buff.Append(((Extrusion)pbs.PathCurve).ToString()); + buff.Append(","); + buff.Append("profCurve="); + buff.Append(((Extrusion)pbs.ProfileCurve).ToString()); + buff.Append(","); + buff.Append("profHollow="); + buff.Append(profileHollow.ToString()); + buff.Append(","); + buff.Append("pathBegEnd="); + buff.Append(pathBegin.ToString()); + buff.Append("/"); + buff.Append(pathEnd.ToString()); + buff.Append(","); + buff.Append("profileBegEnd="); + buff.Append(profileBegin.ToString()); + buff.Append("/"); + buff.Append(profileEnd.ToString()); + buff.Append(","); + buff.Append("scaleXY="); + buff.Append(pathScaleX.ToString()); + buff.Append("/"); + buff.Append(pathScaleY.ToString()); + buff.Append(","); + buff.Append("shearXY="); + buff.Append(pathShearX.ToString()); + buff.Append("/"); + buff.Append(pathShearY.ToString()); + buff.Append(","); + buff.Append("taperXY="); + buff.Append(pbs.PathTaperX.ToString()); + buff.Append("/"); + buff.Append(pbs.PathTaperY.ToString()); + buff.Append(","); + buff.Append("skew="); + buff.Append(pbs.PathSkew.ToString()); + buff.Append(","); + buff.Append("twist/Beg="); + buff.Append(pbs.PathTwist.ToString()); + buff.Append("/"); + buff.Append(pbs.PathTwistBegin.ToString()); + + return buff.ToString(); + } + + #region Taints + // The simulation execution order is: + // Simulate() + // DoOneTimeTaints + // TriggerPreStepEvent + // DoOneTimeTaints + // Step() + // ProcessAndSendToSimulatorCollisions + // ProcessAndSendToSimulatorPropertyUpdates + // TriggerPostStepEvent + + // Calls to the PhysicsActors can't directly call into the physics engine + // because it might be busy. We delay changes to a known time. + // We rely on C#'s closure to save and restore the context for the delegate. + public void TaintedObject(string pOriginator, string pIdent, TaintCallback pCallback) + { + TaintedObject(false /*inTaintTime*/, pOriginator, pIdent, pCallback); + } + public void TaintedObject(uint pOriginator, String pIdent, TaintCallback pCallback) + { + TaintedObject(false /*inTaintTime*/, m_physicsLoggingEnabled ? pOriginator.ToString() : BSScene.DetailLogZero, pIdent, pCallback); + } + public void TaintedObject(bool inTaintTime, String pIdent, TaintCallback pCallback) + { + TaintedObject(inTaintTime, BSScene.DetailLogZero, pIdent, pCallback); + } + public void TaintedObject(bool inTaintTime, uint pOriginator, String pIdent, TaintCallback pCallback) + { + TaintedObject(inTaintTime, m_physicsLoggingEnabled ? pOriginator.ToString() : BSScene.DetailLogZero, pIdent, pCallback); + } + // Sometimes a potentially tainted operation can be used in and out of taint time. + // This routine executes the command immediately if in taint-time otherwise it is queued. + public void TaintedObject(bool inTaintTime, string pOriginator, string pIdent, TaintCallback pCallback) + { + if (!m_initialized) return; + + if (inTaintTime) + pCallback(); else { - // The simulation took longer than realtime. - // Do some scaling of simulation time. - // TODO. - DetailLog("{0},BulletSPluginPhysicsThread,longerThanRealtime={1}", BSScene.DetailLogZero, simulationTimeVsRealtimeDifferenceMS); - } - - Watchdog.UpdateThread(); - } - - Watchdog.RemoveThread(); - } - - #endregion // Simulation - - public override void GetResults() { } - - #region Terrain - - public override void SetTerrain(float[] heightMap) { - TerrainManager.SetTerrain(heightMap); - } - - public override void SetWaterLevel(float baseheight) - { - SimpleWaterLevel = baseheight; - } - - public override void DeleteTerrain() - { - // m_log.DebugFormat("{0}: DeleteTerrain()", LogHeader); - } - - // Although no one seems to check this, I do support combining. - public override bool SupportsCombining() - { - return TerrainManager.SupportsCombining(); - } - // This call says I am a child to region zero in a mega-region. 'pScene' is that - // of region zero, 'offset' is my offset from regions zero's origin, and - // 'extents' is the largest XY that is handled in my region. - public override void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) - { - TerrainManager.Combine(pScene, offset, extents); - } - - // Unhook all the combining that I know about. - public override void UnCombine(PhysicsScene pScene) - { - TerrainManager.UnCombine(pScene); - } - - #endregion // Terrain - - public override Dictionary GetTopColliders() - { - Dictionary topColliders; - - lock (PhysObjects) - { - foreach (KeyValuePair kvp in PhysObjects) - { - kvp.Value.ComputeCollisionScore(); - } - - List orderedPrims = new List(PhysObjects.Values); - orderedPrims.OrderByDescending(p => p.CollisionScore); - topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore); - } - - return topColliders; - } - - public override bool IsThreaded { get { return false; } } - - #region Extensions - public override object Extension(string pFunct, params object[] pParams) - { - DetailLog("{0} BSScene.Extension,op={1}", DetailLogZero, pFunct); - return base.Extension(pFunct, pParams); - } - #endregion // Extensions - - public static string PrimitiveBaseShapeToString(PrimitiveBaseShape pbs) - { - float pathShearX = pbs.PathShearX < 128 ? (float)pbs.PathShearX * 0.01f : (float)(pbs.PathShearX - 256) * 0.01f; - float pathShearY = pbs.PathShearY < 128 ? (float)pbs.PathShearY * 0.01f : (float)(pbs.PathShearY - 256) * 0.01f; - float pathBegin = (float)pbs.PathBegin * 2.0e-5f; - float pathEnd = 1.0f - (float)pbs.PathEnd * 2.0e-5f; - float pathScaleX = (float)(200 - pbs.PathScaleX) * 0.01f; - float pathScaleY = (float)(200 - pbs.PathScaleY) * 0.01f; - float pathTaperX = pbs.PathTaperX * 0.01f; - float pathTaperY = pbs.PathTaperY * 0.01f; - - float profileBegin = (float)pbs.ProfileBegin * 2.0e-5f; - float profileEnd = 1.0f - (float)pbs.ProfileEnd * 2.0e-5f; - float profileHollow = (float)pbs.ProfileHollow * 2.0e-5f; - if (profileHollow > 0.95f) - profileHollow = 0.95f; - - StringBuilder buff = new StringBuilder(); - buff.Append("shape="); - buff.Append(((ProfileShape)pbs.ProfileShape).ToString()); - buff.Append(","); - buff.Append("hollow="); - buff.Append(((HollowShape)pbs.HollowShape).ToString()); - buff.Append(","); - buff.Append("pathCurve="); - buff.Append(((Extrusion)pbs.PathCurve).ToString()); - buff.Append(","); - buff.Append("profCurve="); - buff.Append(((Extrusion)pbs.ProfileCurve).ToString()); - buff.Append(","); - buff.Append("profHollow="); - buff.Append(profileHollow.ToString()); - buff.Append(","); - buff.Append("pathBegEnd="); - buff.Append(pathBegin.ToString()); - buff.Append("/"); - buff.Append(pathEnd.ToString()); - buff.Append(","); - buff.Append("profileBegEnd="); - buff.Append(profileBegin.ToString()); - buff.Append("/"); - buff.Append(profileEnd.ToString()); - buff.Append(","); - buff.Append("scaleXY="); - buff.Append(pathScaleX.ToString()); - buff.Append("/"); - buff.Append(pathScaleY.ToString()); - buff.Append(","); - buff.Append("shearXY="); - buff.Append(pathShearX.ToString()); - buff.Append("/"); - buff.Append(pathShearY.ToString()); - buff.Append(","); - buff.Append("taperXY="); - buff.Append(pbs.PathTaperX.ToString()); - buff.Append("/"); - buff.Append(pbs.PathTaperY.ToString()); - buff.Append(","); - buff.Append("skew="); - buff.Append(pbs.PathSkew.ToString()); - buff.Append(","); - buff.Append("twist/Beg="); - buff.Append(pbs.PathTwist.ToString()); - buff.Append("/"); - buff.Append(pbs.PathTwistBegin.ToString()); - - return buff.ToString(); - } - - #region Taints - // The simulation execution order is: - // Simulate() - // DoOneTimeTaints - // TriggerPreStepEvent - // DoOneTimeTaints - // Step() - // ProcessAndSendToSimulatorCollisions - // ProcessAndSendToSimulatorPropertyUpdates - // TriggerPostStepEvent - - // Calls to the PhysicsActors can't directly call into the physics engine - // because it might be busy. We delay changes to a known time. - // We rely on C#'s closure to save and restore the context for the delegate. - public void TaintedObject(string pOriginator, string pIdent, TaintCallback pCallback) - { - TaintedObject(false /*inTaintTime*/, pOriginator, pIdent, pCallback); - } - public void TaintedObject(uint pOriginator, String pIdent, TaintCallback pCallback) - { - TaintedObject(false /*inTaintTime*/, m_physicsLoggingEnabled ? pOriginator.ToString() : BSScene.DetailLogZero, pIdent, pCallback); - } - public void TaintedObject(bool inTaintTime, String pIdent, TaintCallback pCallback) - { - TaintedObject(inTaintTime, BSScene.DetailLogZero, pIdent, pCallback); - } - public void TaintedObject(bool inTaintTime, uint pOriginator, String pIdent, TaintCallback pCallback) - { - TaintedObject(inTaintTime, m_physicsLoggingEnabled ? pOriginator.ToString() : BSScene.DetailLogZero, pIdent, pCallback); - } - // Sometimes a potentially tainted operation can be used in and out of taint time. - // This routine executes the command immediately if in taint-time otherwise it is queued. - public void TaintedObject(bool inTaintTime, string pOriginator, string pIdent, TaintCallback pCallback) - { - if (!m_initialized) return; - - if (inTaintTime) - pCallback(); - else - { - lock (_taintLock) - { - _taintOperations.Add(new TaintCallbackEntry(pOriginator, pIdent, pCallback)); - } - } - } - - private void TriggerPreStepEvent(float timeStep) - { - PreStepAction actions = BeforeStep; - if (actions != null) - actions(timeStep); - - } - - private void TriggerPostStepEvent(float timeStep) - { - PostStepAction actions = AfterStep; - if (actions != null) - actions(timeStep); - - } - - // When someone tries to change a property on a BSPrim or BSCharacter, the object queues - // a callback into itself to do the actual property change. That callback is called - // here just before the physics engine is called to step the simulation. - public void ProcessTaints() - { - ProcessRegularTaints(); - ProcessPostTaintTaints(); - } - - private void ProcessRegularTaints() - { - if (m_initialized && _taintOperations.Count > 0) // save allocating new list if there is nothing to process - { - // swizzle a new list into the list location so we can process what's there - List oldList; - lock (_taintLock) - { - oldList = _taintOperations; - _taintOperations = new List(); - } - - foreach (TaintCallbackEntry tcbe in oldList) - { - try + lock (_taintLock) { - DetailLog("{0},BSScene.ProcessTaints,doTaint,id={1}", tcbe.originator, tcbe.ident); // DEBUG DEBUG DEBUG - tcbe.callback(); - } - catch (Exception e) - { - m_log.ErrorFormat("{0}: ProcessTaints: {1}: Exception: {2}", LogHeader, tcbe.ident, e); + _taintOperations.Add(new TaintCallbackEntry(pOriginator, pIdent, pCallback)); } } - oldList.Clear(); - } - } - - // Schedule an update to happen after all the regular taints are processed. - // Note that new requests for the same operation ("ident") for the same object ("ID") - // will replace any previous operation by the same object. - public void PostTaintObject(String ident, uint ID, TaintCallback callback) - { - string IDAsString = ID.ToString(); - string uniqueIdent = ident + "-" + IDAsString; - lock (_taintLock) - { - _postTaintOperations[uniqueIdent] = new TaintCallbackEntry(IDAsString, uniqueIdent, callback); } - return; - } - - // Taints that happen after the normal taint processing but before the simulation step. - private void ProcessPostTaintTaints() - { - if (m_initialized && _postTaintOperations.Count > 0) + private void TriggerPreStepEvent(float timeStep) { - Dictionary oldList; - lock (_taintLock) - { - oldList = _postTaintOperations; - _postTaintOperations = new Dictionary(); - } + PreStepAction actions = BeforeStep; + if (actions != null) + actions(timeStep); - foreach (KeyValuePair kvp in oldList) + } + + private void TriggerPostStepEvent(float timeStep) + { + PostStepAction actions = AfterStep; + if (actions != null) + actions(timeStep); + + } + + // When someone tries to change a property on a BSPrim or BSCharacter, the object queues + // a callback into itself to do the actual property change. That callback is called + // here just before the physics engine is called to step the simulation. + public void ProcessTaints() + { + ProcessRegularTaints(); + ProcessPostTaintTaints(); + } + + private void ProcessRegularTaints() + { + if (m_initialized && _taintOperations.Count > 0) // save allocating new list if there is nothing to process { - try + // swizzle a new list into the list location so we can process what's there + List oldList; + lock (_taintLock) { - DetailLog("{0},BSScene.ProcessPostTaintTaints,doTaint,id={1}", DetailLogZero, kvp.Key); // DEBUG DEBUG DEBUG - kvp.Value.callback(); + oldList = _taintOperations; + _taintOperations = new List(); } - catch (Exception e) + + foreach (TaintCallbackEntry tcbe in oldList) { - m_log.ErrorFormat("{0}: ProcessPostTaintTaints: {1}: Exception: {2}", LogHeader, kvp.Key, e); - } - } - oldList.Clear(); - } - } - - // Only used for debugging. Does not change state of anything so locking is not necessary. - public bool AssertInTaintTime(string whereFrom) - { - if (!InTaintTime) - { - DetailLog("{0},BSScene.AssertInTaintTime,NOT IN TAINT TIME,Region={1},Where={2}", DetailLogZero, RegionName, whereFrom); - m_log.ErrorFormat("{0} NOT IN TAINT TIME!! Region={1}, Where={2}", LogHeader, RegionName, whereFrom); - // Util.PrintCallStack(DetailLog); - } - return InTaintTime; - } - - #endregion // Taints - - #region IPhysicsParameters - // Get the list of parameters this physics engine supports - public PhysParameterEntry[] GetParameterList() - { - BSParam.BuildParameterTable(); - return BSParam.SettableParameters; - } - - // Set parameter on a specific or all instances. - // Return 'false' if not able to set the parameter. - // Setting the value in the m_params block will change the value the physics engine - // will use the next time since it's pinned and shared memory. - // Some of the values require calling into the physics engine to get the new - // value activated ('terrainFriction' for instance). - public bool SetPhysicsParameter(string parm, string val, uint localID) - { - bool ret = false; - - BSParam.ParameterDefnBase theParam; - if (BSParam.TryGetParameter(parm, out theParam)) - { - // Set the value in the C# code - theParam.SetValue(this, val); - - // Optionally set the parameter in the unmanaged code - if (theParam.HasSetOnObject) - { - // update all the localIDs specified - // If the local ID is APPLY_TO_NONE, just change the default value - // If the localID is APPLY_TO_ALL change the default value and apply the new value to all the lIDs - // If the localID is a specific object, apply the parameter change to only that object - List objectIDs = new List(); - switch (localID) - { - case PhysParameterEntry.APPLY_TO_NONE: - // This will cause a call into the physical world if some operation is specified (SetOnObject). - objectIDs.Add(TERRAIN_ID); - TaintedUpdateParameter(parm, objectIDs, val); - break; - case PhysParameterEntry.APPLY_TO_ALL: - lock (PhysObjects) objectIDs = new List(PhysObjects.Keys); - TaintedUpdateParameter(parm, objectIDs, val); - break; - default: - // setting only one localID - objectIDs.Add(localID); - TaintedUpdateParameter(parm, objectIDs, val); - break; - } - } - - ret = true; - } - return ret; - } - - // schedule the actual updating of the paramter to when the phys engine is not busy - private void TaintedUpdateParameter(string parm, List lIDs, string val) - { - string xval = val; - List xlIDs = lIDs; - string xparm = parm; - TaintedObject(DetailLogZero, "BSScene.UpdateParameterSet", delegate() { - BSParam.ParameterDefnBase thisParam; - if (BSParam.TryGetParameter(xparm, out thisParam)) - { - if (thisParam.HasSetOnObject) - { - foreach (uint lID in xlIDs) + try { - BSPhysObject theObject = null; - if (PhysObjects.TryGetValue(lID, out theObject)) - thisParam.SetOnObject(this, theObject); + DetailLog("{0},BSScene.ProcessTaints,doTaint,id={1}", tcbe.originator, tcbe.ident); // DEBUG DEBUG DEBUG + tcbe.callback(); + } + catch (Exception e) + { + m_log.ErrorFormat("{0}: ProcessTaints: {1}: Exception: {2}", LogHeader, tcbe.ident, e); } } + oldList.Clear(); } - }); - } - - // Get parameter. - // Return 'false' if not able to get the parameter. - public bool GetPhysicsParameter(string parm, out string value) - { - string val = String.Empty; - bool ret = false; - BSParam.ParameterDefnBase theParam; - if (BSParam.TryGetParameter(parm, out theParam)) - { - val = theParam.GetValue(this); - ret = true; } - value = val; - return ret; + + // Schedule an update to happen after all the regular taints are processed. + // Note that new requests for the same operation ("ident") for the same object ("ID") + // will replace any previous operation by the same object. + public void PostTaintObject(String ident, uint ID, TaintCallback callback) + { + string IDAsString = ID.ToString(); + string uniqueIdent = ident + "-" + IDAsString; + lock (_taintLock) + { + _postTaintOperations[uniqueIdent] = new TaintCallbackEntry(IDAsString, uniqueIdent, callback); + } + + return; + } + + // Taints that happen after the normal taint processing but before the simulation step. + private void ProcessPostTaintTaints() + { + if (m_initialized && _postTaintOperations.Count > 0) + { + Dictionary oldList; + lock (_taintLock) + { + oldList = _postTaintOperations; + _postTaintOperations = new Dictionary(); + } + + foreach (KeyValuePair kvp in oldList) + { + try + { + DetailLog("{0},BSScene.ProcessPostTaintTaints,doTaint,id={1}", DetailLogZero, kvp.Key); // DEBUG DEBUG DEBUG + kvp.Value.callback(); + } + catch (Exception e) + { + m_log.ErrorFormat("{0}: ProcessPostTaintTaints: {1}: Exception: {2}", LogHeader, kvp.Key, e); + } + } + oldList.Clear(); + } + } + + // Only used for debugging. Does not change state of anything so locking is not necessary. + public bool AssertInTaintTime(string whereFrom) + { + if (!InTaintTime) + { + DetailLog("{0},BSScene.AssertInTaintTime,NOT IN TAINT TIME,Region={1},Where={2}", DetailLogZero, RegionName, whereFrom); + m_log.ErrorFormat("{0} NOT IN TAINT TIME!! Region={1}, Where={2}", LogHeader, RegionName, whereFrom); + // Util.PrintCallStack(DetailLog); + } + return InTaintTime; + } + + #endregion // Taints + + #region IPhysicsParameters + // Get the list of parameters this physics engine supports + public PhysParameterEntry[] GetParameterList() + { + BSParam.BuildParameterTable(); + return BSParam.SettableParameters; + } + + // Set parameter on a specific or all instances. + // Return 'false' if not able to set the parameter. + // Setting the value in the m_params block will change the value the physics engine + // will use the next time since it's pinned and shared memory. + // Some of the values require calling into the physics engine to get the new + // value activated ('terrainFriction' for instance). + public bool SetPhysicsParameter(string parm, string val, uint localID) + { + bool ret = false; + + BSParam.ParameterDefnBase theParam; + if (BSParam.TryGetParameter(parm, out theParam)) + { + // Set the value in the C# code + theParam.SetValue(this, val); + + // Optionally set the parameter in the unmanaged code + if (theParam.HasSetOnObject) + { + // update all the localIDs specified + // If the local ID is APPLY_TO_NONE, just change the default value + // If the localID is APPLY_TO_ALL change the default value and apply the new value to all the lIDs + // If the localID is a specific object, apply the parameter change to only that object + List objectIDs = new List(); + switch (localID) + { + case PhysParameterEntry.APPLY_TO_NONE: + // This will cause a call into the physical world if some operation is specified (SetOnObject). + objectIDs.Add(TERRAIN_ID); + TaintedUpdateParameter(parm, objectIDs, val); + break; + case PhysParameterEntry.APPLY_TO_ALL: + lock (PhysObjects) objectIDs = new List(PhysObjects.Keys); + TaintedUpdateParameter(parm, objectIDs, val); + break; + default: + // setting only one localID + objectIDs.Add(localID); + TaintedUpdateParameter(parm, objectIDs, val); + break; + } + } + + ret = true; + } + return ret; + } + + // schedule the actual updating of the paramter to when the phys engine is not busy + private void TaintedUpdateParameter(string parm, List lIDs, string val) + { + string xval = val; + List xlIDs = lIDs; + string xparm = parm; + TaintedObject(DetailLogZero, "BSScene.UpdateParameterSet", delegate() { + BSParam.ParameterDefnBase thisParam; + if (BSParam.TryGetParameter(xparm, out thisParam)) + { + if (thisParam.HasSetOnObject) + { + foreach (uint lID in xlIDs) + { + BSPhysObject theObject = null; + if (PhysObjects.TryGetValue(lID, out theObject)) + thisParam.SetOnObject(this, theObject); + } + } + } + }); + } + + // Get parameter. + // Return 'false' if not able to get the parameter. + public bool GetPhysicsParameter(string parm, out string value) + { + string val = String.Empty; + bool ret = false; + BSParam.ParameterDefnBase theParam; + if (BSParam.TryGetParameter(parm, out theParam)) + { + val = theParam.GetValue(this); + ret = true; + } + value = val; + return ret; + } + + #endregion IPhysicsParameters + + // Invoke the detailed logger and output something if it's enabled. + public void DetailLog(string msg, params Object[] args) + { + PhysicsLogging.Write(msg, args); + } + // Used to fill in the LocalID when there isn't one. It's the correct number of characters. + public const string DetailLogZero = "0000000000"; + } - - #endregion IPhysicsParameters - - // Invoke the detailed logger and output something if it's enabled. - public void DetailLog(string msg, params Object[] args) - { - PhysicsLogging.Write(msg, args); - } - // Used to fill in the LocalID when there isn't one. It's the correct number of characters. - public const string DetailLogZero = "0000000000"; - -} } diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs b/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs index 1c55b51b20..086a412248 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs @@ -299,7 +299,7 @@ public abstract class BSShape { xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch; physicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}", - LogHeader, physicsScene.Name); + LogHeader, physicsScene.PhysicsSceneName); } } else @@ -336,7 +336,7 @@ public abstract class BSShape if (pScene != null) { buff.Append("/rgn="); - buff.Append(pScene.Name); + buff.Append(pScene.PhysicsSceneName); } return buff.ToString(); } diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs index e5607961e8..42fc11bcd5 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs @@ -30,7 +30,6 @@ using System.Text; using OpenSim.Framework; using OpenSim.Region.Framework; -using OpenSim.Region.CoreModules; using OpenSim.Region.PhysicsModules.SharedBase; using Nini.Config; diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs index bd84fceac0..d11baa6cef 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs @@ -30,7 +30,6 @@ using System.Text; using OpenSim.Framework; using OpenSim.Region.Framework; -using OpenSim.Region.CoreModules; using OpenSim.Region.PhysicsModules.SharedBase; using Nini.Config; diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs index ae96491237..cd59b656ea 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs @@ -30,7 +30,6 @@ using System.Text; using OpenSim.Framework; using OpenSim.Region.Framework; -using OpenSim.Region.CoreModules; using OpenSim.Region.PhysicsModules.SharedBase; using Nini.Config; diff --git a/OpenSim/Region/PhysicsModules/BulletS/Properties/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/BulletS/Properties/AssemblyInfo.cs index 4f90eee5da..5a33bdf0f2 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/Properties/AssemblyInfo.cs @@ -1,6 +1,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using Mono.Addins; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -31,3 +32,5 @@ using System.Runtime.InteropServices; // [assembly: AssemblyVersion("0.8.2.*")] +[assembly: Addin("OpenSim.Region.PhysicsModule.BulletS", OpenSim.VersionInfo.VersionNumber)] +[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] diff --git a/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs index 076da7816c..7869739574 100644 --- a/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs +++ b/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs @@ -27,6 +27,7 @@ using System.Reflection; using System.Runtime.InteropServices; +using Mono.Addins; // Information about this assembly is defined by the following // attributes. @@ -56,3 +57,6 @@ using System.Runtime.InteropServices; // numbers with the '*' character (the default): [assembly : AssemblyVersion("0.8.2.*")] + +[assembly: Addin("OpenSim.Region.PhysicsModule.ODE", OpenSim.VersionInfo.VersionNumber)] +[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] diff --git a/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs index 44f403979d..b35c2998cc 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs @@ -511,7 +511,7 @@ namespace OpenSim.Region.PhysicsModule.ODE } else { - m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size for {0} in {1}", Name, _parent_scene.Name); + m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size for {0} in {1}", Name, _parent_scene.PhysicsSceneName); } } diff --git a/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs index 91a4302ae8..445fef8132 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs @@ -3380,7 +3380,7 @@ Console.WriteLine(" JointCreateFixed"); { m_log.WarnFormat( "[ODE PRIM]: Could not get mesh/sculpt asset {0} for {1} at {2} in {3}", - _pbs.SculptTexture, Name, _position, _parent_scene.Name); + _pbs.SculptTexture, Name, _position, _parent_scene.PhysicsSceneName); } } } diff --git a/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs b/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs index 1d9d0e5f15..bb2fad9e92 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs @@ -44,47 +44,47 @@ namespace OpenSim.Region.PhysicsModule.ODE /// /// ODE plugin /// - public class OdePlugin : IPhysicsPlugin - { -// private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); +// public class OdePlugin : IPhysicsPlugin +// { +//// private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - private OdeScene m_scene; +// private OdeScene m_scene; - public bool Init() - { - return true; - } +// public bool Init() +// { +// return true; +// } - public PhysicsScene GetScene(String sceneIdentifier) - { - if (m_scene == null) - { - // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether - // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports - // will find it already loaded later on. - // - // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be - // controlled in Ode.NET.dll.config - if (Util.IsWindows()) - Util.LoadArchSpecificWindowsDll("ode.dll"); +// public PhysicsScene GetScene(String sceneIdentifier) +// { +// if (m_scene == null) +// { +// // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether +// // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports +// // will find it already loaded later on. +// // +// // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be +// // controlled in Ode.NET.dll.config +// if (Util.IsWindows()) +// Util.LoadArchSpecificWindowsDll("ode.dll"); - // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to - // http://opensimulator.org/mantis/view.php?id=2750). - d.InitODE(); +// // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to +// // http://opensimulator.org/mantis/view.php?id=2750). +// d.InitODE(); - m_scene = new OdeScene(GetName(), sceneIdentifier); - } +// m_scene = new OdeScene(GetName(), sceneIdentifier); +// } - return m_scene; - } +// return m_scene; +// } - public string GetName() - { - return ("OpenDynamicsEngine"); - } +// public string GetName() +// { +// return ("OpenDynamicsEngine"); +// } - public void Dispose() - { - } - } +// public void Dispose() +// { +// } +// } } \ No newline at end of file diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index d7163e2aa2..36162006c8 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs @@ -38,6 +38,7 @@ using System.Runtime.InteropServices; using System.Threading; using log4net; using Nini.Config; +using Mono.Addins; using Ode.NET; using OpenMetaverse; #if USE_DRAWSTUFF @@ -45,6 +46,9 @@ using Drawstuff.NET; #endif using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; + namespace OpenSim.Region.PhysicsModule.ODE { @@ -101,9 +105,12 @@ namespace OpenSim.Region.PhysicsModule.ODE Rubber = 6 } + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ODEPhysicsScene")] public class OdeScene : PhysicsScene { - private readonly ILog m_log; + private readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString()); + private bool m_Enabled = false; + // private Dictionary m_storedCollisions = new Dictionary(); /// @@ -288,7 +295,7 @@ namespace OpenSim.Region.PhysicsModule.ODE private int framecount = 0; //private int m_returncollisions = 10; - private readonly IntPtr contactgroup; + private IntPtr contactgroup; internal IntPtr WaterGeom; @@ -520,19 +527,90 @@ namespace OpenSim.Region.PhysicsModule.ODE private ODERayCastRequestManager m_rayCastManager; + + #region INonSharedRegionModule + public string Name + { + get { return "OpenDynamicsEngine"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) + { + // TODO: Move this out of Startup + IConfig config = source.Configs["Startup"]; + if (config != null) + { + string physics = config.GetString("physics", string.Empty); + if (physics == Name) + { + m_Enabled = true; + m_config = source; + + // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether + // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports + // will find it already loaded later on. + // + // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be + // controlled in Ode.NET.dll.config + if (Util.IsWindows()) + Util.LoadArchSpecificWindowsDll("ode.dll"); + + // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to + // http://opensimulator.org/mantis/view.php?id=2750). + d.InitODE(); + + } + } + + } + + public void Close() + { + } + + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + + EngineType = Name; + PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName; + + scene.RegisterModuleInterface(this); + Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); + Initialise(); + InitialiseFromConfig(m_config); + } + + public void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + } + + public void RegionLoaded(Scene scene) + { + if (!m_Enabled) + return; + + mesher = scene.RequestModuleInterface(); + if (mesher == null) + m_log.WarnFormat("[ODE SCENE]: No mesher in {0}. Things will not work well.", PhysicsSceneName); + } + #endregion + /// /// Initiailizes the scene /// Sets many properties that ODE requires to be stable /// These settings need to be tweaked 'exactly' right or weird stuff happens. /// - /// Name of the scene. Useful in debug messages. - public OdeScene(string engineType, string name) + private void Initialise() { - m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + name); - - Name = name; - EngineType = engineType; - nearCallback = near; triCallback = TriCallback; triArrayCallback = TriArrayCallback; @@ -572,12 +650,11 @@ namespace OpenSim.Region.PhysicsModule.ODE } #endif - // Initialize the mesh plugin - public override void Initialise(IMesher meshmerizer, IConfigSource config) + // Initialize from configs + private void InitialiseFromConfig(IConfigSource config) { InitializeExtraStats(); - mesher = meshmerizer; m_config = config; // Defaults @@ -1818,7 +1895,7 @@ namespace OpenSim.Region.PhysicsModule.ODE } catch (AccessViolationException) { - m_log.ErrorFormat("[ODE SCENE]: Unable to space collide {0}", Name); + m_log.ErrorFormat("[ODE SCENE]: Unable to space collide {0}", PhysicsSceneName); } //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); @@ -3082,7 +3159,7 @@ namespace OpenSim.Region.PhysicsModule.ODE { m_log.ErrorFormat( "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when moving", - actor.Name, actor.LocalID, Name); + actor.Name, actor.LocalID, PhysicsSceneName); RemoveCharacter(actor); actor.DestroyOdeStructures(); @@ -3198,7 +3275,7 @@ namespace OpenSim.Region.PhysicsModule.ODE { m_log.ErrorFormat( "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when updating position and velocity", - actor.Name, actor.LocalID, Name); + actor.Name, actor.LocalID, PhysicsSceneName); RemoveCharacter(actor); actor.DestroyOdeStructures(); @@ -3795,7 +3872,7 @@ namespace OpenSim.Region.PhysicsModule.ODE private void SetTerrain(float[] heightMap, Vector3 pOffset) { int startTime = Util.EnvironmentTickCount(); - m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0} with offset {1}", Name, pOffset); + m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0} with offset {1}", PhysicsSceneName, pOffset); // this._heightmap[i] = (double)heightMap[i]; // dbm (danx0r) -- creating a buffer zone of one extra sample all around @@ -3920,7 +3997,7 @@ namespace OpenSim.Region.PhysicsModule.ODE } m_log.DebugFormat( - "[ODE SCENE]: Setting terrain for {0} took {1}ms", Name, Util.EnvironmentTickCountSubtract(startTime)); + "[ODE SCENE]: Setting terrain for {0} took {1}ms", PhysicsSceneName, Util.EnvironmentTickCountSubtract(startTime)); } public override void DeleteTerrain() diff --git a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs index bbf64d5a8d..eca670c8bd 100644 --- a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs +++ b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs @@ -43,7 +43,7 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt; + //private OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt; private PhysicsScene ps; private IMeshingPlugin imp; @@ -55,11 +55,11 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests config.Set("DecodedSculptMapPath","j2kDecodeCache"); // Loading ODEPlugin - cbt = new OdePlugin(); + //cbt = new OdePlugin(); // Getting Physics Scene - ps = cbt.GetScene("test"); + //ps = cbt.GetScene("test"); // Initializing Physics Scene. - ps.Initialise(imp.GetMesher(TopConfig),null); + //ps.Initialise(imp.GetMesher(TopConfig), null, Vector3.Zero); float[] _heightmap = new float[(int)Constants.RegionSize * (int)Constants.RegionSize]; for (int i = 0; i < ((int)Constants.RegionSize * (int)Constants.RegionSize); i++) { diff --git a/OpenSim/Region/PhysicsModules/POS/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/POS/AssemblyInfo.cs index fc1ffba1cb..e3a3e356c2 100644 --- a/OpenSim/Region/PhysicsModules/POS/AssemblyInfo.cs +++ b/OpenSim/Region/PhysicsModules/POS/AssemblyInfo.cs @@ -27,6 +27,7 @@ using System.Reflection; using System.Runtime.InteropServices; +using Mono.Addins; // Information about this assembly is defined by the following // attributes. @@ -56,3 +57,6 @@ using System.Runtime.InteropServices; // numbers with the '*' character (the default): [assembly : AssemblyVersion("0.8.2.*")] + +[assembly: Addin("OpenSim.Region.PhysicsModule.POS", OpenSim.VersionInfo.VersionNumber)] +[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] diff --git a/OpenSim/Region/PhysicsModules/POS/POSPlugin.cs b/OpenSim/Region/PhysicsModules/POS/POSPlugin.cs index 3fe1a0af04..d233097157 100644 --- a/OpenSim/Region/PhysicsModules/POS/POSPlugin.cs +++ b/OpenSim/Region/PhysicsModules/POS/POSPlugin.cs @@ -36,29 +36,29 @@ namespace OpenSim.Region.PhysicsModule.POS /// /// for now will be a very POS physics engine /// - public class POSPlugin : IPhysicsPlugin - { - public POSPlugin() - { - } + //public class POSPlugin : IPhysicsPlugin + //{ + // public POSPlugin() + // { + // } - public bool Init() - { - return true; - } + // public bool Init() + // { + // return true; + // } - public PhysicsScene GetScene(string sceneIdentifier) - { - return new POSScene(GetName(), sceneIdentifier); - } + // public PhysicsScene GetScene(string sceneIdentifier) + // { + // return new POSScene(GetName(), sceneIdentifier); + // } - public string GetName() - { - return ("POS"); - } + // public string GetName() + // { + // return ("POS"); + // } - public void Dispose() - { - } - } + // public void Dispose() + // { + // } + //} } diff --git a/OpenSim/Region/PhysicsModules/POS/POSScene.cs b/OpenSim/Region/PhysicsModules/POS/POSScene.cs index 603502f496..915fa8cf12 100644 --- a/OpenSim/Region/PhysicsModules/POS/POSScene.cs +++ b/OpenSim/Region/PhysicsModules/POS/POSScene.cs @@ -29,11 +29,15 @@ using System; using System.Collections.Generic; using Nini.Config; using OpenMetaverse; +using Mono.Addins; using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.PhysicsModule.POS { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "POSPhysicsScene")] public class POSScene : PhysicsScene { private List _characters = new List(); @@ -41,19 +45,61 @@ namespace OpenSim.Region.PhysicsModule.POS private float[] _heightMap; private const float gravity = -9.8f; + private bool m_Enabled = false; //protected internal string sceneIdentifier; - public POSScene(string engineType, String _sceneIdentifier) + #region INonSharedRegionModule + public string Name { - EngineType = engineType; - Name = EngineType + "/" + _sceneIdentifier; - //sceneIdentifier = _sceneIdentifier; + get { return "POS"; } } - public override void Initialise(IMesher meshmerizer, IConfigSource config) + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) + { + // TODO: Move this out of Startup + IConfig config = source.Configs["Startup"]; + if (config != null) + { + string physics = config.GetString("physics", string.Empty); + if (physics == Name) + m_Enabled = true; + } + + } + + public void Close() { } + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + + EngineType = Name; + PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName; + + scene.RegisterModuleInterface(this); + } + + public void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + } + + public void RegionLoaded(Scene scene) + { + if (!m_Enabled) + return; + } + #endregion + public override void Dispose() { } diff --git a/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs index da896a3527..432708c840 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs @@ -40,11 +40,6 @@ namespace OpenSim.Region.PhysicsModules.SharedBase private static int m_workIndicator; - public override void Initialise(IMesher meshmerizer, IConfigSource config) - { - // Does nothing right now - } - public override PhysicsActor AddAvatar( string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) { diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs index 6316463ed5..487582c41a 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs @@ -89,7 +89,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase { m_log.Info("[PHYSICS]: creating " + physEngineName); PhysicsScene result = _PhysPlugins[physEngineName].GetScene(regionName); - result.Initialise(meshEngine, config, regionExtent); + //result.Initialise(meshEngine, config, regionExtent); return result; } else diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs index 0394494d8b..247f355708 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs @@ -98,7 +98,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase /// Useful in debug messages to distinguish one OdeScene instance from another. /// Usually set to include the region name that the physics engine is acting for. /// - public string Name { get; protected set; } + public string PhysicsSceneName { get; protected set; } /// /// A string identifying the family of this physics engine. Most common values returned @@ -126,17 +126,6 @@ namespace OpenSim.Region.PhysicsModules.SharedBase } } - // Deprecated. Do not use this for new physics engines. - public abstract void Initialise(IMesher meshmerizer, IConfigSource config); - - // For older physics engines that do not implement non-legacy region sizes. - // If the physics engine handles the region extent feature, it overrides this function. - public virtual void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) - { - // If not overridden, call the old initialization entry. - Initialise(meshmerizer, config); - } - /// /// Add an avatar /// diff --git a/prebuild.xml b/prebuild.xml index 77b1657f45..6de8c6dc12 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1857,13 +1857,11 @@ - - @@ -3433,7 +3431,7 @@ - + From 11194209df8a29f5103e6e34104eae7834f3280a Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 31 Aug 2015 14:09:15 -0700 Subject: [PATCH 08/33] First commit where physics work as region module. Moved all physics dlls out of Physics and into bin directly, so they can be found by the module loader. Removed call to PhysicsPluginManager. --- OpenSim/Region/Application/OpenSimBase.cs | 15 +--- .../ClientStack/RegionApplicationBase.cs | 29 -------- .../Framework/Library/LibraryModule.cs | 2 +- .../Grid/Tests/GridConnectorsTests.cs | 8 +- OpenSim/Region/Framework/Scenes/Scene.cs | 7 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 7 +- .../BasicPhysics/BasicPhysicsScene.cs | 1 + .../Region/PhysicsModules/BulletS/BSScene.cs | 5 +- .../BulletS/Tests/BulletSimTestsUtil.cs | 27 +++++-- OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | 2 + OpenSim/Region/PhysicsModules/POS/POSScene.cs | 2 + .../PhysicsModules/SharedBase/PhysicsScene.cs | 8 ++ OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 5 +- OpenSim/Tests/Common/Mock/TestScene.cs | 4 +- OpenSim/Tests/Common/OpenSimTestCase.cs | 2 +- ...m.Region.PhysicsModule.BulletS.dll.config} | 0 prebuild.xml | 73 +++++++++---------- 17 files changed, 91 insertions(+), 106 deletions(-) rename bin/{Physics/OpenSim.Region.Physics.BulletSPlugin.dll.config => OpenSim.Region.PhysicsModule.BulletS.dll.config} (100%) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 68fba972d9..980fa8508b 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -734,10 +734,6 @@ namespace OpenSim clientServer = clientNetworkServers; scene.LoadWorldMap(); - scene.PhysicsScene.RequestAssetMethod = scene.PhysicsRequestAsset; - scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); - scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight); - return scene; } @@ -749,11 +745,8 @@ namespace OpenSim protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager) { - Vector3 regionExtent = new Vector3(regionInfo.RegionSizeX, regionInfo.RegionSizeY, regionInfo.RegionSizeZ); - PhysicsScene physicsScene = GetPhysicsScene(regionInfo.RegionName, regionExtent); - return new Scene( - regionInfo, circuitManager, physicsScene, + regionInfo, circuitManager, simDataService, estateDataService, Config, m_version); } @@ -796,12 +789,6 @@ namespace OpenSim # region Setup methods - protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier, Vector3 regionExtent) - { - return GetPhysicsScene( - m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, Config, osSceneIdentifier, regionExtent); - } - /// /// Handler to supply the current status of this sim /// diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 374e34d8e4..343780b56d 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -62,16 +62,6 @@ namespace OpenSim.Region.ClientStack protected abstract void Initialize(); - /// - /// Get a new physics scene. - /// - /// - /// - /// The name of the OpenSim scene this physics scene is serving. This will be used in log messages. - /// - /// - protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier, Vector3 regionExtent); - protected abstract ClientStackManager CreateClientStackManager(); protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager); @@ -113,24 +103,5 @@ namespace OpenSim.Region.ClientStack base.StartupSpecific(); } - /// - /// Get a new physics scene. - /// - /// The name of the physics engine to use - /// The name of the mesh engine to use - /// The configuration data to pass to the physics and mesh engines - /// - /// The name of the OpenSim scene this physics scene is serving. This will be used in log messages. - /// - /// - protected PhysicsScene GetPhysicsScene( - string engine, string meshEngine, IConfigSource config, string osSceneIdentifier, Vector3 regionExtent) - { - PhysicsPluginManager physicsPluginManager; - physicsPluginManager = new PhysicsPluginManager(); - physicsPluginManager.LoadPluginsFromAssemblies("Physics"); - - return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier, regionExtent); - } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs index d10c9b427a..69d7e16203 100644 --- a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs @@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library } RegionInfo regInfo = new RegionInfo(); - Scene m_MockScene = new Scene(regInfo, null); + Scene m_MockScene = new Scene(regInfo); LocalInventoryService invService = new LocalInventoryService(lib); m_MockScene.RegisterModuleInterface(invService); m_MockScene.RegisterModuleInterface(m_Scene.AssetService); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs index aa5f889287..25ae689b7c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs @@ -85,7 +85,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests r1.ExternalHostName = "127.0.0.1"; r1.HttpPort = 9001; r1.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); - Scene s = new Scene(new RegionInfo(), null); + Scene s = new Scene(new RegionInfo()); s.RegionInfo.RegionID = r1.RegionID; m_LocalConnector.AddRegion(s); @@ -97,7 +97,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests r2.ExternalHostName = "127.0.0.1"; r2.HttpPort = 9002; r2.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); - s = new Scene(new RegionInfo(), null); + s = new Scene(new RegionInfo()); s.RegionInfo.RegionID = r2.RegionID; m_LocalConnector.AddRegion(s); @@ -109,7 +109,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests r3.ExternalHostName = "127.0.0.1"; r3.HttpPort = 9003; r3.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); - s = new Scene(new RegionInfo(), null); + s = new Scene(new RegionInfo()); s.RegionInfo.RegionID = r3.RegionID; m_LocalConnector.AddRegion(s); @@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests r4.ExternalHostName = "127.0.0.1"; r4.HttpPort = 9004; r4.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); - s = new Scene(new RegionInfo(), null); + s = new Scene(new RegionInfo()); s.RegionInfo.RegionID = r4.RegionID; m_LocalConnector.AddRegion(s); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 09a0a6b501..900e715651 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -850,10 +850,10 @@ namespace OpenSim.Region.Framework.Scenes #region Constructors - public Scene(RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene, + public Scene(RegionInfo regInfo, AgentCircuitManager authen, ISimulationDataService simDataService, IEstateDataService estateDataService, IConfigSource config, string simulatorVersion) - : this(regInfo, physicsScene) + : this(regInfo) { m_config = config; MinFrameTicks = 89; @@ -1192,11 +1192,10 @@ namespace OpenSim.Region.Framework.Scenes } - public Scene(RegionInfo regInfo, PhysicsScene physicsScene) + public Scene(RegionInfo regInfo) : base(regInfo) { m_sceneGraph = new SceneGraph(this); - m_sceneGraph.PhysicsScene = physicsScene; // If the scene graph has an Unrecoverable error, restart this sim. // Currently the only thing that causes it to happen is two kinds of specific diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index eea0fff1fa..d77e3242d9 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -111,7 +111,12 @@ namespace OpenSim.Region.Framework.Scenes public PhysicsScene PhysicsScene { - get { return _PhyScene; } + get + { + if (_PhyScene == null) + _PhyScene = m_parentScene.RequestModuleInterface(); + return _PhyScene; + } set { // If we're not doing the initial set diff --git a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs index 5ec0f858b5..f7760c5df7 100644 --- a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs @@ -93,6 +93,7 @@ namespace OpenSim.Region.PhysicsModule.BasicPhysics scene.RegisterModuleInterface(this); m_regionExtent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); + base.Initialise(scene.PhysicsRequestAsset, scene.Heightmap.GetFloatsSerialised(), (float)scene.RegionInfo.RegionSettings.WaterHeight); } diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs index 26af343887..b412561c72 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs @@ -248,7 +248,10 @@ namespace OpenSim.Region.PhysicsModule.BulletS scene.RegisterModuleInterface(this); Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); - Initialise(m_Config, extent); + Initialise(m_Config, extent); + + base.Initialise(scene.PhysicsRequestAsset, scene.Heightmap.GetFloatsSerialised(), (float)scene.RegionInfo.RegionSettings.WaterHeight); + } public void RemoveRegion(Scene scene) diff --git a/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs index 34c057170a..d86c841e5f 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs @@ -35,6 +35,7 @@ using Nini.Config; using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.PhysicsModules.Meshing; +using OpenSim.Region.Framework.Interfaces; using OpenMetaverse; @@ -78,22 +79,32 @@ public static class BulletSimTestsUtil bulletSimConfig.Set("VehicleLoggingEnabled","True"); } - PhysicsPluginManager physicsPluginManager; - physicsPluginManager = new PhysicsPluginManager(); - physicsPluginManager.LoadPluginsFromAssemblies("Physics"); - Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); - PhysicsScene pScene = physicsPluginManager.GetPhysicsScene( - "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent); + //PhysicsScene pScene = physicsPluginManager.GetPhysicsScene( + // "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent); + RegionInfo info = new RegionInfo(); + info.RegionName = "BSTestRegion"; + info.RegionSizeX = info.RegionSizeY = info.RegionSizeZ = Constants.RegionSize; + OpenSim.Region.Framework.Scenes.Scene scene = new OpenSim.Region.Framework.Scenes.Scene(info); - BSScene bsScene = pScene as BSScene; + IMesher mesher = new OpenSim.Region.PhysicsModules.Meshing.Meshmerizer(); + INonSharedRegionModule mod = mesher as INonSharedRegionModule; + mod.Initialise(openSimINI); + mod.AddRegion(scene); + mod.RegionLoaded(scene); + + BSScene pScene = new BSScene(); + mod = (pScene as INonSharedRegionModule); + mod.Initialise(openSimINI); + mod.AddRegion(scene); + mod.RegionLoaded(scene); // Since the asset requestor is not initialized, any mesh or sculptie will be a cube. // In the future, add a fake asset fetcher to get meshes and sculpts. // bsScene.RequestAssetMethod = ???; - return bsScene; + return pScene; } } diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index 36162006c8..f090953807 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs @@ -585,6 +585,8 @@ namespace OpenSim.Region.PhysicsModule.ODE Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); Initialise(); InitialiseFromConfig(m_config); + base.Initialise(scene.PhysicsRequestAsset, scene.Heightmap.GetFloatsSerialised(), (float)scene.RegionInfo.RegionSettings.WaterHeight); + } public void RemoveRegion(Scene scene) diff --git a/OpenSim/Region/PhysicsModules/POS/POSScene.cs b/OpenSim/Region/PhysicsModules/POS/POSScene.cs index 915fa8cf12..beaa177156 100644 --- a/OpenSim/Region/PhysicsModules/POS/POSScene.cs +++ b/OpenSim/Region/PhysicsModules/POS/POSScene.cs @@ -85,6 +85,8 @@ namespace OpenSim.Region.PhysicsModule.POS PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName; scene.RegisterModuleInterface(this); + base.Initialise(scene.PhysicsRequestAsset, scene.Heightmap.GetFloatsSerialised(), (float)scene.RegionInfo.RegionSettings.WaterHeight); + } public void RemoveRegion(Scene scene) diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs index 247f355708..32691fc28a 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs @@ -117,6 +117,14 @@ namespace OpenSim.Region.PhysicsModules.SharedBase public RequestAssetDelegate RequestAssetMethod { get; set; } + protected void Initialise(RequestAssetDelegate m, float[] terrain, float waterHeight) + { + RequestAssetMethod = m; + SetTerrain(terrain); + SetWaterLevel(waterHeight); + + } + public virtual void TriggerPhysicsBasedRestart() { physicsCrash handler = OnPhysicsCrash; diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index a26e844cd1..27705bdad7 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -151,12 +151,9 @@ namespace OpenSim.Tests.Common PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.PhysicsModule.BasicPhysics.dll"); Vector3 regionExtent = new Vector3( regInfo.RegionSizeX, regInfo.RegionSizeY, regInfo.RegionSizeZ); - PhysicsScene physicsScene - = physicsPluginManager.GetPhysicsScene( - "basicphysics", "ZeroMesher", new IniConfigSource(), "test", regionExtent); TestScene testScene = new TestScene( - regInfo, m_acm, physicsScene, SimDataService, m_estateDataService, configSource, null); + regInfo, m_acm, SimDataService, m_estateDataService, configSource, null); INonSharedRegionModule godsModule = new GodsModule(); godsModule.Initialise(new IniConfigSource()); diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs index 08cfff2805..951f1035b6 100644 --- a/OpenSim/Tests/Common/Mock/TestScene.cs +++ b/OpenSim/Tests/Common/Mock/TestScene.cs @@ -41,10 +41,10 @@ namespace OpenSim.Tests.Common public class TestScene : Scene { public TestScene( - RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene, + RegionInfo regInfo, AgentCircuitManager authen, ISimulationDataService simDataService, IEstateDataService estateDataService, IConfigSource config, string simulatorVersion) - : base(regInfo, authen, physicsScene, simDataService, estateDataService, + : base(regInfo, authen, simDataService, estateDataService, config, simulatorVersion) { } diff --git a/OpenSim/Tests/Common/OpenSimTestCase.cs b/OpenSim/Tests/Common/OpenSimTestCase.cs index c1415afe43..9fea34820c 100644 --- a/OpenSim/Tests/Common/OpenSimTestCase.cs +++ b/OpenSim/Tests/Common/OpenSimTestCase.cs @@ -38,7 +38,7 @@ namespace OpenSim.Tests.Common [SetUp] public virtual void SetUp() { -// TestHelpers.InMethod(); + //TestHelpers.InMethod(); // Disable logging for each test so that one where logging is enabled doesn't cause all subsequent tests // to have logging on if it failed with an exception. TestHelpers.DisableLogging(); diff --git a/bin/Physics/OpenSim.Region.Physics.BulletSPlugin.dll.config b/bin/OpenSim.Region.PhysicsModule.BulletS.dll.config similarity index 100% rename from bin/Physics/OpenSim.Region.Physics.BulletSPlugin.dll.config rename to bin/OpenSim.Region.PhysicsModule.BulletS.dll.config diff --git a/prebuild.xml b/prebuild.xml index 6de8c6dc12..2685c30303 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -487,6 +487,32 @@ + + + + ../../../../bin/ + + + + + ../../../../bin/ + + + + ../../../../bin/ + + + + + + + + + + + + + @@ -1692,42 +1718,15 @@ - - - - ../../../../bin/ - - - - - ../../../../bin/ - - - - ../../../../bin/ - - - - - - - - - - - - - - - ../../../../bin/Physics/ + ../../../../bin/ - ../../../../bin/Physics/ + ../../../../bin/ @@ -1755,12 +1754,12 @@ - ../../../../bin/Physics/ + ../../../../bin/ - ../../../../bin/Physics/ + ../../../../bin/ @@ -1780,12 +1779,12 @@ - ../../../../bin/Physics/ + ../../../../bin/ - ../../../../bin/Physics/ + ../../../../bin/ @@ -1805,12 +1804,12 @@ - ../../../../bin/Physics/ + ../../../../bin/ - ../../../../bin/Physics/ + ../../../../bin/ @@ -1837,13 +1836,13 @@ - ../../../../bin/Physics/ + ../../../../bin/ true - ../../../../bin/Physics/ + ../../../../bin/ true From 50e7e38f450599b5755c9ab887b8d9bd9c3d8981 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 31 Aug 2015 15:04:10 -0700 Subject: [PATCH 09/33] Physics refactoring: all unit tests pass. --- .../BasicPhysics/BasicPhysicsScene.cs | 4 +- .../Region/PhysicsModules/BulletS/BSScene.cs | 4 +- .../BulletS/Tests/BulletSimTestsUtil.cs | 2 - OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | 6 ++- .../PhysicsModules/Ode/Tests/ODETestClass.cs | 50 ++++++++++++++----- OpenSim/Region/PhysicsModules/POS/POSScene.cs | 4 +- prebuild.xml | 7 +-- 7 files changed, 55 insertions(+), 22 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs index f7760c5df7..10684d19f0 100644 --- a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs @@ -93,7 +93,9 @@ namespace OpenSim.Region.PhysicsModule.BasicPhysics scene.RegisterModuleInterface(this); m_regionExtent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); - base.Initialise(scene.PhysicsRequestAsset, scene.Heightmap.GetFloatsSerialised(), (float)scene.RegionInfo.RegionSettings.WaterHeight); + base.Initialise(scene.PhysicsRequestAsset, + (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[Constants.RegionSize * Constants.RegionSize]), + (float)scene.RegionInfo.RegionSettings.WaterHeight); } diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs index b412561c72..d116c3b636 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs @@ -250,7 +250,9 @@ namespace OpenSim.Region.PhysicsModule.BulletS Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); Initialise(m_Config, extent); - base.Initialise(scene.PhysicsRequestAsset, scene.Heightmap.GetFloatsSerialised(), (float)scene.RegionInfo.RegionSettings.WaterHeight); + base.Initialise(scene.PhysicsRequestAsset, + (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[Constants.RegionSize * Constants.RegionSize]), + (float)scene.RegionInfo.RegionSettings.WaterHeight); } diff --git a/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs index d86c841e5f..4eeea4d618 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs @@ -81,8 +81,6 @@ public static class BulletSimTestsUtil Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); - //PhysicsScene pScene = physicsPluginManager.GetPhysicsScene( - // "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent); RegionInfo info = new RegionInfo(); info.RegionName = "BSTestRegion"; info.RegionSizeX = info.RegionSizeY = info.RegionSizeZ = Constants.RegionSize; diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index f090953807..f49b0f74e8 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs @@ -106,7 +106,7 @@ namespace OpenSim.Region.PhysicsModule.ODE } [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ODEPhysicsScene")] - public class OdeScene : PhysicsScene + public class OdeScene : PhysicsScene, INonSharedRegionModule { private readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString()); private bool m_Enabled = false; @@ -585,7 +585,9 @@ namespace OpenSim.Region.PhysicsModule.ODE Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); Initialise(); InitialiseFromConfig(m_config); - base.Initialise(scene.PhysicsRequestAsset, scene.Heightmap.GetFloatsSerialised(), (float)scene.RegionInfo.RegionSettings.WaterHeight); + base.Initialise(scene.PhysicsRequestAsset, + (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[Constants.RegionSize * Constants.RegionSize]), + (float)scene.RegionInfo.RegionSettings.WaterHeight); } diff --git a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs index eca670c8bd..36b65cf586 100644 --- a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs +++ b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs @@ -32,6 +32,8 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.PhysicsModule.ODE; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; using OpenSim.Tests.Common; using log4net; using System.Reflection; @@ -44,15 +46,39 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //private OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt; - private PhysicsScene ps; + private PhysicsScene pScene; private IMeshingPlugin imp; [SetUp] public void Initialize() { - IConfigSource TopConfig = new IniConfigSource(); - IConfig config = TopConfig.AddConfig("Startup"); - config.Set("DecodedSculptMapPath","j2kDecodeCache"); + IConfigSource openSimINI = new IniConfigSource(); + IConfig startupConfig = openSimINI.AddConfig("Startup"); + startupConfig.Set("physics", "OpenDynamicsEngine"); + startupConfig.Set("DecodedSculptMapPath", "j2kDecodeCache"); + + Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); + + //PhysicsScene pScene = physicsPluginManager.GetPhysicsScene( + // "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent); + RegionInfo info = new RegionInfo(); + info.RegionName = "ODETestRegion"; + info.RegionSizeX = info.RegionSizeY = info.RegionSizeZ = Constants.RegionSize; + OpenSim.Region.Framework.Scenes.Scene scene = new OpenSim.Region.Framework.Scenes.Scene(info); + + //IMesher mesher = new OpenSim.Region.PhysicsModules.Meshing.Meshmerizer(); + //INonSharedRegionModule mod = mesher as INonSharedRegionModule; + //mod.Initialise(openSimINI); + //mod.AddRegion(scene); + //mod.RegionLoaded(scene); + + pScene = new OdeScene(); + Console.WriteLine("HERE " + (pScene == null ? "Null" : "Not null")); + INonSharedRegionModule mod = (pScene as INonSharedRegionModule); + Console.WriteLine("HERE " + (mod == null ? "Null" : "Not null")); + mod.Initialise(openSimINI); + mod.AddRegion(scene); + mod.RegionLoaded(scene); // Loading ODEPlugin //cbt = new OdePlugin(); @@ -65,14 +91,14 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests { _heightmap[i] = 21f; } - ps.SetTerrain(_heightmap); + pScene.SetTerrain(_heightmap); } [TearDown] public void Terminate() { - ps.DeleteTerrain(); - ps.Dispose(); + pScene.DeleteTerrain(); + pScene.Dispose(); } @@ -83,9 +109,9 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f); Vector3 size = new Vector3(0.5f, 0.5f, 0.5f); Quaternion rot = Quaternion.Identity; - PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true, 0); + PhysicsActor prim = pScene.AddPrimShape("CoolShape", newcube, position, size, rot, true, 0); OdePrim oprim = (OdePrim)prim; - OdeScene pscene = (OdeScene) ps; + OdeScene pscene = (OdeScene)pScene; Assert.That(oprim.m_taintadd); @@ -93,7 +119,7 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests for (int i = 0; i < 58; i++) { - ps.Simulate(0.133f); + pScene.Simulate(0.133f); Assert.That(oprim.prim_geom != (IntPtr)0); @@ -117,9 +143,9 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests // Make sure we're not somewhere above the ground Assert.That(prim.Position.Z < 21.5f); - ps.RemovePrim(prim); + pScene.RemovePrim(prim); Assert.That(oprim.m_taintremove); - ps.Simulate(0.133f); + pScene.Simulate(0.133f); Assert.That(oprim.Body == (IntPtr)0); } } diff --git a/OpenSim/Region/PhysicsModules/POS/POSScene.cs b/OpenSim/Region/PhysicsModules/POS/POSScene.cs index beaa177156..f47d245015 100644 --- a/OpenSim/Region/PhysicsModules/POS/POSScene.cs +++ b/OpenSim/Region/PhysicsModules/POS/POSScene.cs @@ -85,7 +85,9 @@ namespace OpenSim.Region.PhysicsModule.POS PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName; scene.RegisterModuleInterface(this); - base.Initialise(scene.PhysicsRequestAsset, scene.Heightmap.GetFloatsSerialised(), (float)scene.RegionInfo.RegionSettings.WaterHeight); + base.Initialise(scene.PhysicsRequestAsset, + (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[Constants.RegionSize * Constants.RegionSize]), + (float)scene.RegionInfo.RegionSettings.WaterHeight); } diff --git a/prebuild.xml b/prebuild.xml index 2685c30303..4d98c19607 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -3396,7 +3396,8 @@ - + + @@ -3431,9 +3432,9 @@ - + - + From 9435405ca1c173963dd6e97116a27b798a211801 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 31 Aug 2015 16:23:43 -0700 Subject: [PATCH 10/33] Deleted physics plugin classes. More unit tests fixed. --- .../BasicPhysics/BasicPhysicsPlugin.cs | 64 ----- .../BasicPhysics/BasicPhysicsScene.cs | 6 +- .../Region/PhysicsModules/BulletS/BSPlugin.cs | 76 ------ .../Region/PhysicsModules/BulletS/BSScene.cs | 2 +- .../Region/PhysicsModules/Ode/OdePlugin.cs | 90 ------- .../PhysicsModules/Ode/Tests/ODETestClass.cs | 1 - .../Region/PhysicsModules/POS/POSPlugin.cs | 64 ----- .../SharedBase/PhysicsPluginManager.cs | 235 ------------------ OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 26 +- prebuild.xml | 1 + 10 files changed, 27 insertions(+), 538 deletions(-) delete mode 100644 OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPlugin.cs delete mode 100644 OpenSim/Region/PhysicsModules/BulletS/BSPlugin.cs delete mode 100644 OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs delete mode 100644 OpenSim/Region/PhysicsModules/POS/POSPlugin.cs delete mode 100644 OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs diff --git a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPlugin.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPlugin.cs deleted file mode 100644 index db02eb6c7f..0000000000 --- a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPlugin.cs +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Region.PhysicsModules.SharedBase; - -namespace OpenSim.Region.PhysicsModule.BasicPhysics -{ - /// - /// Effectively a physics plugin that simulates no physics at all. - /// - //public class BasicPhysicsPlugin : IPhysicsPlugin - //{ - // public BasicPhysicsPlugin() - // { - // } - - // public bool Init() - // { - // return true; - // } - - // public PhysicsScene GetScene(string sceneIdentifier) - // { - // return new BasicScene(GetName(), sceneIdentifier); - // } - - // public string GetName() - // { - // return ("basicphysics"); - // } - - // public void Dispose() - // { - // } - //} -} diff --git a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs index 10684d19f0..20b337a475 100644 --- a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs @@ -94,7 +94,7 @@ namespace OpenSim.Region.PhysicsModule.BasicPhysics scene.RegisterModuleInterface(this); m_regionExtent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); base.Initialise(scene.PhysicsRequestAsset, - (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[Constants.RegionSize * Constants.RegionSize]), + (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[scene.RegionInfo.RegionSizeX * scene.RegionInfo.RegionSizeY]), (float)scene.RegionInfo.RegionSettings.WaterHeight); } @@ -164,8 +164,8 @@ namespace OpenSim.Region.PhysicsModule.BasicPhysics Vector3 actorPosition = actor.Position; Vector3 actorVelocity = actor.Velocity; -// Console.WriteLine( -// "Processing actor {0}, starting pos {1}, starting vel {2}", i, actorPosition, actorVelocity); + //Console.WriteLine( + // "Processing actor {0}, starting pos {1}, starting vel {2}", i, actorPosition, actorVelocity); actorPosition.X += actor.Velocity.X * timeStep; actorPosition.Y += actor.Velocity.Y * timeStep; diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPlugin.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPlugin.cs deleted file mode 100644 index 7fc51f78cb..0000000000 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPlugin.cs +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyrightD - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -using System; -using System.Collections.Generic; -using OpenSim.Framework; -using OpenSim.Region.PhysicsModules.SharedBase; -using OpenMetaverse; - -namespace OpenSim.Region.PhysicsModule.BulletS -{ - /// - /// Entry for a port of Bullet (http://bulletphysics.org/) to OpenSim. - /// This module interfaces to an unmanaged C++ library which makes the - /// actual calls into the Bullet physics engine. - /// The unmanaged library is found in opensim-libs::trunk/unmanaged/BulletSim/. - /// The unmanaged library is compiled and linked statically with Bullet - /// to create BulletSim.dll and libBulletSim.so (for both 32 and 64 bit). - /// -//public class BSPlugin : IPhysicsPlugin -//{ -// //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - -// private BSScene _mScene; - -// public BSPlugin() -// { -// } - -// public bool Init() -// { -// return true; -// } - -// public PhysicsScene GetScene(String sceneIdentifier) -// { -// if (_mScene == null) -// { -// _mScene = new BSScene(GetName(), sceneIdentifier); -// } -// return (_mScene); -// } - -// public string GetName() -// { -// return ("BulletSim"); -// } - -// public void Dispose() -// { -// } -//} -} diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs index d116c3b636..db4d3cf72d 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs @@ -251,7 +251,7 @@ namespace OpenSim.Region.PhysicsModule.BulletS Initialise(m_Config, extent); base.Initialise(scene.PhysicsRequestAsset, - (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[Constants.RegionSize * Constants.RegionSize]), + (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[scene.RegionInfo.RegionSizeX * scene.RegionInfo.RegionSizeY]), (float)scene.RegionInfo.RegionSettings.WaterHeight); } diff --git a/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs b/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs deleted file mode 100644 index bb2fad9e92..0000000000 --- a/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Threading; -using System.IO; -using System.Diagnostics; -using log4net; -using Nini.Config; -using Ode.NET; -using OpenSim.Framework; -using OpenSim.Region.PhysicsModules.SharedBase; -using OpenMetaverse; - -namespace OpenSim.Region.PhysicsModule.ODE -{ - /// - /// ODE plugin - /// -// public class OdePlugin : IPhysicsPlugin -// { -//// private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - -// private OdeScene m_scene; - -// public bool Init() -// { -// return true; -// } - -// public PhysicsScene GetScene(String sceneIdentifier) -// { -// if (m_scene == null) -// { -// // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether -// // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports -// // will find it already loaded later on. -// // -// // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be -// // controlled in Ode.NET.dll.config -// if (Util.IsWindows()) -// Util.LoadArchSpecificWindowsDll("ode.dll"); - -// // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to -// // http://opensimulator.org/mantis/view.php?id=2750). -// d.InitODE(); - -// m_scene = new OdeScene(GetName(), sceneIdentifier); -// } - -// return m_scene; -// } - -// public string GetName() -// { -// return ("OpenDynamicsEngine"); -// } - -// public void Dispose() -// { -// } -// } -} \ No newline at end of file diff --git a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs index 36b65cf586..6dc22bd66d 100644 --- a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs +++ b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs @@ -47,7 +47,6 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests //private OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt; private PhysicsScene pScene; - private IMeshingPlugin imp; [SetUp] public void Initialize() diff --git a/OpenSim/Region/PhysicsModules/POS/POSPlugin.cs b/OpenSim/Region/PhysicsModules/POS/POSPlugin.cs deleted file mode 100644 index d233097157..0000000000 --- a/OpenSim/Region/PhysicsModules/POS/POSPlugin.cs +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Region.PhysicsModules.SharedBase; - -namespace OpenSim.Region.PhysicsModule.POS -{ - /// - /// for now will be a very POS physics engine - /// - //public class POSPlugin : IPhysicsPlugin - //{ - // public POSPlugin() - // { - // } - - // public bool Init() - // { - // return true; - // } - - // public PhysicsScene GetScene(string sceneIdentifier) - // { - // return new POSScene(GetName(), sceneIdentifier); - // } - - // public string GetName() - // { - // return ("POS"); - // } - - // public void Dispose() - // { - // } - //} -} diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs deleted file mode 100644 index 487582c41a..0000000000 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsPluginManager.cs +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using Nini.Config; -using log4net; -using OpenSim.Framework; -using OpenMetaverse; - -namespace OpenSim.Region.PhysicsModules.SharedBase -{ - /// - /// Description of MyClass. - /// - public class PhysicsPluginManager - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private Dictionary _PhysPlugins = new Dictionary(); - private Dictionary _MeshPlugins = new Dictionary(); - - /// - /// Constructor. - /// - public PhysicsPluginManager() - { - } - - /// - /// Get a physics scene for the given physics engine and mesher. - /// - /// - /// - /// - /// - public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, - IConfigSource config, string regionName, Vector3 regionExtent) - { - if (String.IsNullOrEmpty(physEngineName)) - { - return PhysicsScene.Null; - } - - if (String.IsNullOrEmpty(meshEngineName)) - { - return PhysicsScene.Null; - } - - IMesher meshEngine = null; - if (_MeshPlugins.ContainsKey(meshEngineName)) - { - m_log.Info("[PHYSICS]: creating meshing engine " + meshEngineName); - meshEngine = _MeshPlugins[meshEngineName].GetMesher(config); - } - else - { - m_log.WarnFormat("[PHYSICS]: couldn't find meshingEngine: {0}", meshEngineName); - throw new ArgumentException(String.Format("couldn't find meshingEngine: {0}", meshEngineName)); - } - - if (_PhysPlugins.ContainsKey(physEngineName)) - { - m_log.Info("[PHYSICS]: creating " + physEngineName); - PhysicsScene result = _PhysPlugins[physEngineName].GetScene(regionName); - //result.Initialise(meshEngine, config, regionExtent); - return result; - } - else - { - m_log.WarnFormat("[PHYSICS]: couldn't find physicsEngine: {0}", physEngineName); - throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}", physEngineName)); - } - } - - /// - /// Load all plugins in assemblies at the given path - /// - /// - public void LoadPluginsFromAssemblies(string assembliesPath) - { - // Walk all assemblies (DLLs effectively) and see if they are home - // of a plugin that is of interest for us - string[] pluginFiles = Directory.GetFiles(assembliesPath, "*.dll"); - - for (int i = 0; i < pluginFiles.Length; i++) - { - LoadPluginsFromAssembly(pluginFiles[i]); - } - } - - /// - /// Load plugins from an assembly at the given path - /// - /// - public void LoadPluginsFromAssembly(string assemblyPath) - { - // TODO / NOTE - // The assembly named 'OpenSim.Region.PhysicsModule.BasicPhysics' was loaded from - // 'file:///C:/OpenSim/trunk2/bin/Physics/OpenSim.Region.PhysicsModule.BasicPhysics.dll' - // using the LoadFrom context. The use of this context can result in unexpected behavior - // for serialization, casting and dependency resolution. In almost all cases, it is recommended - // that the LoadFrom context be avoided. This can be done by installing assemblies in the - // Global Assembly Cache or in the ApplicationBase directory and using Assembly. - // Load when explicitly loading assemblies. - Assembly pluginAssembly = null; - Type[] types = null; - - try - { - pluginAssembly = Assembly.LoadFrom(assemblyPath); - } - catch (Exception ex) - { - m_log.Error("[PHYSICS]: Failed to load plugin from " + assemblyPath, ex); - } - - if (pluginAssembly != null) - { - try - { - types = pluginAssembly.GetTypes(); - } - catch (ReflectionTypeLoadException ex) - { - m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + assemblyPath + ": " + - ex.LoaderExceptions[0].Message, ex); - } - catch (Exception ex) - { - m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + assemblyPath, ex); - } - - if (types != null) - { - foreach (Type pluginType in types) - { - if (pluginType.IsPublic) - { - if (!pluginType.IsAbstract) - { - Type physTypeInterface = pluginType.GetInterface("IPhysicsPlugin"); - - if (physTypeInterface != null) - { - IPhysicsPlugin plug = - (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - plug.Init(); - if (!_PhysPlugins.ContainsKey(plug.GetName())) - { - _PhysPlugins.Add(plug.GetName(), plug); - m_log.Info("[PHYSICS]: Added physics engine: " + plug.GetName()); - } - } - - Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin"); - - if (meshTypeInterface != null) - { - IMeshingPlugin plug = - (IMeshingPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - if (!_MeshPlugins.ContainsKey(plug.GetName())) - { - _MeshPlugins.Add(plug.GetName(), plug); - m_log.Info("[PHYSICS]: Added meshing engine: " + plug.GetName()); - } - } - - physTypeInterface = null; - meshTypeInterface = null; - } - } - } - } - } - - pluginAssembly = null; - } - - //--- - public static void PhysicsPluginMessage(string message, bool isWarning) - { - if (isWarning) - { - m_log.Warn("[PHYSICS]: " + message); - } - else - { - m_log.Info("[PHYSICS]: " + message); - } - } - - //--- - } - - public interface IPhysicsPlugin - { - bool Init(); - PhysicsScene GetScene(String sceneIdentifier); - string GetName(); - void Dispose(); - } - - public interface IMeshingPlugin - { - string GetName(); - IMesher GetMesher(IConfigSource config); - } -} diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 27705bdad7..53509dc23e 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -48,6 +48,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence; +using OpenSim.Region.PhysicsModule.BasicPhysics; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; @@ -77,6 +78,8 @@ namespace OpenSim.Tests.Common private CoreAssetCache m_cache; + private PhysicsScene m_physicsScene; + public SceneHelpers() : this(null) {} public SceneHelpers(CoreAssetCache cache) @@ -97,6 +100,8 @@ namespace OpenSim.Tests.Common m_cache = cache; + m_physicsScene = StartPhysicsScene(); + SimDataService = OpenSim.Server.Base.ServerUtils.LoadPlugin("OpenSim.Tests.Common.dll", null); } @@ -148,10 +153,6 @@ namespace OpenSim.Tests.Common regInfo.RegionSizeX = sizeX; regInfo.RegionSizeY = sizeY; - PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); - physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.PhysicsModule.BasicPhysics.dll"); - Vector3 regionExtent = new Vector3( regInfo.RegionSizeX, regInfo.RegionSizeY, regInfo.RegionSizeZ); - TestScene testScene = new TestScene( regInfo, m_acm, SimDataService, m_estateDataService, configSource, null); @@ -159,6 +160,10 @@ namespace OpenSim.Tests.Common godsModule.Initialise(new IniConfigSource()); godsModule.AddRegion(testScene); + // Add scene to physics + ((INonSharedRegionModule)m_physicsScene).AddRegion(testScene); + ((INonSharedRegionModule)m_physicsScene).RegionLoaded(testScene); + // Add scene to services m_assetService.AddRegion(testScene); @@ -325,6 +330,19 @@ namespace OpenSim.Tests.Common return presenceService; } + private static PhysicsScene StartPhysicsScene() + { + IConfigSource config = new IniConfigSource(); + config.AddConfig("Startup"); + config.Configs["Startup"].Set("physics", "basicphysics"); + + PhysicsScene pScene = new BasicScene(); + INonSharedRegionModule mod = pScene as INonSharedRegionModule; + mod.Initialise(config); + + return pScene; + } + /// /// Setup modules for a scene using their default settings. /// diff --git a/prebuild.xml b/prebuild.xml index 4d98c19607..d41c145fcf 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -2737,6 +2737,7 @@ + From 0235e58fff47d3794777392a987feb4de8a5f99a Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 1 Sep 2015 09:20:20 -0700 Subject: [PATCH 11/33] Moved ExtendedPhysics from OptionalModules to Bullet project, because it's very much an optional Bullet feature. This way, Bullet doesn't need to depend on the OptionalModules dll. No changes in configs or behavior. --- .../ExtendedPhysics/ExtendedPhysics.cs | 623 ------------------ .../BulletS/BSLinksetConstraints.cs | 2 - .../Region/PhysicsModules/BulletS/BSPrim.cs | 1 - .../PhysicsModules/BulletS/BSPrimLinkable.cs | 1 - .../PhysicsModules/BulletS/ExtendedPhysics.cs | 622 +++++++++++++++++ prebuild.xml | 1 - 6 files changed, 622 insertions(+), 628 deletions(-) delete mode 100755 OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs create mode 100755 OpenSim/Region/PhysicsModules/BulletS/ExtendedPhysics.cs diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs deleted file mode 100755 index ab363e5ec2..0000000000 --- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs +++ /dev/null @@ -1,623 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyrightD - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading; - -using OpenSim.Framework; -using OpenSim.Region.CoreModules; -using OpenSim.Region.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.PhysicsModules.SharedBase; - -using Mono.Addins; -using Nini.Config; -using log4net; -using OpenMetaverse; - -namespace OpenSim.Region.OptionalModules.Scripting -{ -[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] -public class ExtendedPhysics : INonSharedRegionModule -{ - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static string LogHeader = "[EXTENDED PHYSICS]"; - - // ============================================================= - // Since BulletSim is a plugin, this these values aren't defined easily in one place. - // This table must correspond to an identical table in BSScene. - - // Per scene functions. See BSScene. - - // Per avatar functions. See BSCharacter. - - // Per prim functions. See BSPrim. - public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType"; - public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType"; - public const string PhysFunctChangeLinkFixed = "BulletSim.ChangeLinkFixed"; - public const string PhysFunctChangeLinkType = "BulletSim.ChangeLinkType"; - public const string PhysFunctGetLinkType = "BulletSim.GetLinkType"; - public const string PhysFunctChangeLinkParams = "BulletSim.ChangeLinkParams"; - public const string PhysFunctAxisLockLimits = "BulletSim.AxisLockLimits"; - - // ============================================================= - - private IConfig Configuration { get; set; } - private bool Enabled { get; set; } - private Scene BaseScene { get; set; } - private IScriptModuleComms Comms { get; set; } - - #region INonSharedRegionModule - - public string Name { get { return this.GetType().Name; } } - - public void Initialise(IConfigSource config) - { - BaseScene = null; - Enabled = false; - Configuration = null; - Comms = null; - - try - { - if ((Configuration = config.Configs["ExtendedPhysics"]) != null) - { - Enabled = Configuration.GetBoolean("Enabled", Enabled); - } - } - catch (Exception e) - { - m_log.ErrorFormat("{0} Initialization error: {0}", LogHeader, e); - } - - m_log.InfoFormat("{0} module {1} enabled", LogHeader, (Enabled ? "is" : "is not")); - } - - public void Close() - { - if (BaseScene != null) - { - BaseScene.EventManager.OnObjectAddedToScene -= EventManager_OnObjectAddedToScene; - BaseScene.EventManager.OnSceneObjectPartUpdated -= EventManager_OnSceneObjectPartUpdated; - BaseScene = null; - } - } - - public void AddRegion(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - if (BaseScene != null && BaseScene == scene) - { - Close(); - } - } - - public void RegionLoaded(Scene scene) - { - if (!Enabled) return; - - BaseScene = scene; - - Comms = BaseScene.RequestModuleInterface(); - if (Comms == null) - { - m_log.WarnFormat("{0} ScriptModuleComms interface not defined", LogHeader); - Enabled = false; - - return; - } - - // Register as LSL functions all the [ScriptInvocation] marked methods. - Comms.RegisterScriptInvocations(this); - Comms.RegisterConstants(this); - - // When an object is modified, we might need to update its extended physics parameters - BaseScene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene; - BaseScene.EventManager.OnSceneObjectPartUpdated += EventManager_OnSceneObjectPartUpdated; - - } - - public Type ReplaceableInterface { get { return null; } } - - #endregion // INonSharedRegionModule - - private void EventManager_OnObjectAddedToScene(SceneObjectGroup obj) - { - } - - // Event generated when some property of a prim changes. - private void EventManager_OnSceneObjectPartUpdated(SceneObjectPart sop, bool isFullUpdate) - { - } - - [ScriptConstant] - public const int PHYS_CENTER_OF_MASS = 1 << 0; - - [ScriptInvocation] - public string physGetEngineType(UUID hostID, UUID scriptID) - { - string ret = string.Empty; - - if (BaseScene.PhysicsScene != null) - { - ret = BaseScene.PhysicsScene.EngineType; - } - - return ret; - } - - // Code for specifying params. - // The choice if 14700 is arbitrary and only serves to catch parameter code misuse. - [ScriptConstant] - public const int PHYS_AXIS_LOCK_LINEAR = 14700; - [ScriptConstant] - public const int PHYS_AXIS_LOCK_LINEAR_X = 14701; - [ScriptConstant] - public const int PHYS_AXIS_LIMIT_LINEAR_X = 14702; - [ScriptConstant] - public const int PHYS_AXIS_LOCK_LINEAR_Y = 14703; - [ScriptConstant] - public const int PHYS_AXIS_LIMIT_LINEAR_Y = 14704; - [ScriptConstant] - public const int PHYS_AXIS_LOCK_LINEAR_Z = 14705; - [ScriptConstant] - public const int PHYS_AXIS_LIMIT_LINEAR_Z = 14706; - [ScriptConstant] - public const int PHYS_AXIS_LOCK_ANGULAR = 14707; - [ScriptConstant] - public const int PHYS_AXIS_LOCK_ANGULAR_X = 14708; - [ScriptConstant] - public const int PHYS_AXIS_LIMIT_ANGULAR_X = 14709; - [ScriptConstant] - public const int PHYS_AXIS_LOCK_ANGULAR_Y = 14710; - [ScriptConstant] - public const int PHYS_AXIS_LIMIT_ANGULAR_Y = 14711; - [ScriptConstant] - public const int PHYS_AXIS_LOCK_ANGULAR_Z = 14712; - [ScriptConstant] - public const int PHYS_AXIS_LIMIT_ANGULAR_Z = 14713; - [ScriptConstant] - public const int PHYS_AXIS_UNLOCK_LINEAR = 14714; - [ScriptConstant] - public const int PHYS_AXIS_UNLOCK_LINEAR_X = 14715; - [ScriptConstant] - public const int PHYS_AXIS_UNLOCK_LINEAR_Y = 14716; - [ScriptConstant] - public const int PHYS_AXIS_UNLOCK_LINEAR_Z = 14717; - [ScriptConstant] - public const int PHYS_AXIS_UNLOCK_ANGULAR = 14718; - [ScriptConstant] - public const int PHYS_AXIS_UNLOCK_ANGULAR_X = 14719; - [ScriptConstant] - public const int PHYS_AXIS_UNLOCK_ANGULAR_Y = 14720; - [ScriptConstant] - public const int PHYS_AXIS_UNLOCK_ANGULAR_Z = 14721; - [ScriptConstant] - public const int PHYS_AXIS_UNLOCK = 14722; - // physAxisLockLimits() - [ScriptInvocation] - public int physAxisLock(UUID hostID, UUID scriptID, object[] parms) - { - int ret = -1; - if (!Enabled) return ret; - - PhysicsActor rootPhysActor; - if (GetRootPhysActor(hostID, out rootPhysActor)) - { - object[] parms2 = AddToBeginningOfArray(rootPhysActor, null, parms); - ret = MakeIntError(rootPhysActor.Extension(PhysFunctAxisLockLimits, parms2)); - } - - return ret; - } - - [ScriptConstant] - public const int PHYS_LINKSET_TYPE_CONSTRAINT = 0; - [ScriptConstant] - public const int PHYS_LINKSET_TYPE_COMPOUND = 1; - [ScriptConstant] - public const int PHYS_LINKSET_TYPE_MANUAL = 2; - - [ScriptInvocation] - public int physSetLinksetType(UUID hostID, UUID scriptID, int linksetType) - { - int ret = -1; - if (!Enabled) return ret; - - // The part that is requesting the change. - SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID); - - if (requestingPart != null) - { - // The change is always made to the root of a linkset. - SceneObjectGroup containingGroup = requestingPart.ParentGroup; - SceneObjectPart rootPart = containingGroup.RootPart; - - if (rootPart != null) - { - PhysicsActor rootPhysActor = rootPart.PhysActor; - if (rootPhysActor != null) - { - if (rootPhysActor.IsPhysical) - { - // Change a physical linkset by making non-physical, waiting for one heartbeat so all - // the prim and linkset state is updated, changing the type and making the - // linkset physical again. - containingGroup.ScriptSetPhysicsStatus(false); - Thread.Sleep(150); // longer than one heartbeat tick - - // A kludge for the moment. - // Since compound linksets move the children but don't generate position updates to the - // simulator, it is possible for compound linkset children to have out-of-sync simulator - // and physical positions. The following causes the simulator to push the real child positions - // down into the physics engine to get everything synced. - containingGroup.UpdateGroupPosition(containingGroup.AbsolutePosition); - containingGroup.UpdateGroupRotationR(containingGroup.GroupRotation); - - object[] parms2 = { rootPhysActor, null, linksetType }; - ret = MakeIntError(rootPhysActor.Extension(PhysFunctSetLinksetType, parms2)); - Thread.Sleep(150); // longer than one heartbeat tick - - containingGroup.ScriptSetPhysicsStatus(true); - } - else - { - // Non-physical linksets don't have a physical instantiation so there is no state to - // worry about being updated. - object[] parms2 = { rootPhysActor, null, linksetType }; - ret = MakeIntError(rootPhysActor.Extension(PhysFunctSetLinksetType, parms2)); - } - } - else - { - m_log.WarnFormat("{0} physSetLinksetType: root part does not have a physics actor. rootName={1}, hostID={2}", - LogHeader, rootPart.Name, hostID); - } - } - else - { - m_log.WarnFormat("{0} physSetLinksetType: root part does not exist. RequestingPartName={1}, hostID={2}", - LogHeader, requestingPart.Name, hostID); - } - } - else - { - m_log.WarnFormat("{0} physSetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID); - } - return ret; - } - - [ScriptInvocation] - public int physGetLinksetType(UUID hostID, UUID scriptID) - { - int ret = -1; - if (!Enabled) return ret; - - PhysicsActor rootPhysActor; - if (GetRootPhysActor(hostID, out rootPhysActor)) - { - object[] parms2 = { rootPhysActor, null }; - ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinksetType, parms2)); - } - else - { - m_log.WarnFormat("{0} physGetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID); - } - return ret; - } - - [ScriptConstant] - public const int PHYS_LINK_TYPE_FIXED = 1234; - [ScriptConstant] - public const int PHYS_LINK_TYPE_HINGE = 4; - [ScriptConstant] - public const int PHYS_LINK_TYPE_SPRING = 9; - [ScriptConstant] - public const int PHYS_LINK_TYPE_6DOF = 6; - [ScriptConstant] - public const int PHYS_LINK_TYPE_SLIDER = 7; - - // physChangeLinkType(integer linkNum, integer typeCode) - [ScriptInvocation] - public int physChangeLinkType(UUID hostID, UUID scriptID, int linkNum, int typeCode) - { - int ret = -1; - if (!Enabled) return ret; - - PhysicsActor rootPhysActor; - PhysicsActor childPhysActor; - - if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) - { - object[] parms2 = { rootPhysActor, childPhysActor, typeCode }; - ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkType, parms2)); - } - - return ret; - } - - // physGetLinkType(integer linkNum) - [ScriptInvocation] - public int physGetLinkType(UUID hostID, UUID scriptID, int linkNum) - { - int ret = -1; - if (!Enabled) return ret; - - PhysicsActor rootPhysActor; - PhysicsActor childPhysActor; - - if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) - { - object[] parms2 = { rootPhysActor, childPhysActor }; - ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinkType, parms2)); - } - - return ret; - } - - // physChangeLinkFixed(integer linkNum) - // Change the link between the root and the linkNum into a fixed, static physical connection. - [ScriptInvocation] - public int physChangeLinkFixed(UUID hostID, UUID scriptID, int linkNum) - { - int ret = -1; - if (!Enabled) return ret; - - PhysicsActor rootPhysActor; - PhysicsActor childPhysActor; - - if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) - { - object[] parms2 = { rootPhysActor, childPhysActor , PHYS_LINK_TYPE_FIXED }; - ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkType, parms2)); - } - - return ret; - } - - // Code for specifying params. - // The choice if 14400 is arbitrary and only serves to catch parameter code misuse. - public const int PHYS_PARAM_MIN = 14401; - - [ScriptConstant] - public const int PHYS_PARAM_FRAMEINA_LOC = 14401; - [ScriptConstant] - public const int PHYS_PARAM_FRAMEINA_ROT = 14402; - [ScriptConstant] - public const int PHYS_PARAM_FRAMEINB_LOC = 14403; - [ScriptConstant] - public const int PHYS_PARAM_FRAMEINB_ROT = 14404; - [ScriptConstant] - public const int PHYS_PARAM_LINEAR_LIMIT_LOW = 14405; - [ScriptConstant] - public const int PHYS_PARAM_LINEAR_LIMIT_HIGH = 14406; - [ScriptConstant] - public const int PHYS_PARAM_ANGULAR_LIMIT_LOW = 14407; - [ScriptConstant] - public const int PHYS_PARAM_ANGULAR_LIMIT_HIGH = 14408; - [ScriptConstant] - public const int PHYS_PARAM_USE_FRAME_OFFSET = 14409; - [ScriptConstant] - public const int PHYS_PARAM_ENABLE_TRANSMOTOR = 14410; - [ScriptConstant] - public const int PHYS_PARAM_TRANSMOTOR_MAXVEL = 14411; - [ScriptConstant] - public const int PHYS_PARAM_TRANSMOTOR_MAXFORCE = 14412; - [ScriptConstant] - public const int PHYS_PARAM_CFM = 14413; - [ScriptConstant] - public const int PHYS_PARAM_ERP = 14414; - [ScriptConstant] - public const int PHYS_PARAM_SOLVER_ITERATIONS = 14415; - [ScriptConstant] - public const int PHYS_PARAM_SPRING_AXIS_ENABLE = 14416; - [ScriptConstant] - public const int PHYS_PARAM_SPRING_DAMPING = 14417; - [ScriptConstant] - public const int PHYS_PARAM_SPRING_STIFFNESS = 14418; - [ScriptConstant] - public const int PHYS_PARAM_LINK_TYPE = 14419; - [ScriptConstant] - public const int PHYS_PARAM_USE_LINEAR_FRAMEA = 14420; - [ScriptConstant] - public const int PHYS_PARAM_SPRING_EQUILIBRIUM_POINT = 14421; - - public const int PHYS_PARAM_MAX = 14421; - - // Used when specifying a parameter that has settings for the three linear and three angular axis - [ScriptConstant] - public const int PHYS_AXIS_ALL = -1; - [ScriptConstant] - public const int PHYS_AXIS_LINEAR_ALL = -2; - [ScriptConstant] - public const int PHYS_AXIS_ANGULAR_ALL = -3; - [ScriptConstant] - public const int PHYS_AXIS_LINEAR_X = 0; - [ScriptConstant] - public const int PHYS_AXIS_LINEAR_Y = 1; - [ScriptConstant] - public const int PHYS_AXIS_LINEAR_Z = 2; - [ScriptConstant] - public const int PHYS_AXIS_ANGULAR_X = 3; - [ScriptConstant] - public const int PHYS_AXIS_ANGULAR_Y = 4; - [ScriptConstant] - public const int PHYS_AXIS_ANGULAR_Z = 5; - - // physChangeLinkParams(integer linkNum, [ PHYS_PARAM_*, value, PHYS_PARAM_*, value, ...]) - [ScriptInvocation] - public int physChangeLinkParams(UUID hostID, UUID scriptID, int linkNum, object[] parms) - { - int ret = -1; - if (!Enabled) return ret; - - PhysicsActor rootPhysActor; - PhysicsActor childPhysActor; - - if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) - { - object[] parms2 = AddToBeginningOfArray(rootPhysActor, childPhysActor, parms); - ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkParams, parms2)); - } - - return ret; - } - - private bool GetRootPhysActor(UUID hostID, out PhysicsActor rootPhysActor) - { - SceneObjectGroup containingGroup; - SceneObjectPart rootPart; - return GetRootPhysActor(hostID, out containingGroup, out rootPart, out rootPhysActor); - } - - private bool GetRootPhysActor(UUID hostID, out SceneObjectGroup containingGroup, out SceneObjectPart rootPart, out PhysicsActor rootPhysActor) - { - bool ret = false; - rootPhysActor = null; - containingGroup = null; - rootPart = null; - - SceneObjectPart requestingPart; - - requestingPart = BaseScene.GetSceneObjectPart(hostID); - if (requestingPart != null) - { - // The type is is always on the root of a linkset. - containingGroup = requestingPart.ParentGroup; - if (containingGroup != null && !containingGroup.IsDeleted) - { - rootPart = containingGroup.RootPart; - if (rootPart != null) - { - rootPhysActor = rootPart.PhysActor; - if (rootPhysActor != null) - { - ret = true; - } - else - { - m_log.WarnFormat("{0} GetRootAndChildPhysActors: Root part does not have a physics actor. rootName={1}, hostID={2}", - LogHeader, rootPart.Name, hostID); - } - } - else - { - m_log.WarnFormat("{0} GetRootAndChildPhysActors: Root part does not exist. RequestingPartName={1}, hostID={2}", - LogHeader, requestingPart.Name, hostID); - } - } - else - { - m_log.WarnFormat("{0} GetRootAndChildPhysActors: Containing group missing or deleted. hostID={1}", LogHeader, hostID); - } - } - else - { - m_log.WarnFormat("{0} GetRootAndChildPhysActors: cannot find script object in scene. hostID={1}", LogHeader, hostID); - } - - return ret; - } - - // Find the root and child PhysActors based on the linkNum. - // Return 'true' if both are found and returned. - private bool GetRootAndChildPhysActors(UUID hostID, int linkNum, out PhysicsActor rootPhysActor, out PhysicsActor childPhysActor) - { - bool ret = false; - rootPhysActor = null; - childPhysActor = null; - - SceneObjectGroup containingGroup; - SceneObjectPart rootPart; - - if (GetRootPhysActor(hostID, out containingGroup, out rootPart, out rootPhysActor)) - { - SceneObjectPart linkPart = containingGroup.GetLinkNumPart(linkNum); - if (linkPart != null) - { - childPhysActor = linkPart.PhysActor; - if (childPhysActor != null) - { - ret = true; - } - else - { - m_log.WarnFormat("{0} GetRootAndChildPhysActors: Link part has no physical actor. rootName={1}, hostID={2}, linknum={3}", - LogHeader, rootPart.Name, hostID, linkNum); - } - } - else - { - m_log.WarnFormat("{0} GetRootAndChildPhysActors: Could not find linknum part. rootName={1}, hostID={2}, linknum={3}", - LogHeader, rootPart.Name, hostID, linkNum); - } - } - else - { - m_log.WarnFormat("{0} GetRootAndChildPhysActors: Root part does not have a physics actor. rootName={1}, hostID={2}", - LogHeader, rootPart.Name, hostID); - } - - return ret; - } - - // Return an array of objects with the passed object as the first object of a new array - private object[] AddToBeginningOfArray(object firstOne, object secondOne, object[] prevArray) - { - object[] newArray = new object[2 + prevArray.Length]; - newArray[0] = firstOne; - newArray[1] = secondOne; - prevArray.CopyTo(newArray, 2); - return newArray; - } - - // Extension() returns an object. Convert that object into the integer error we expect to return. - private int MakeIntError(object extensionRet) - { - int ret = -1; - if (extensionRet != null) - { - try - { - ret = (int)extensionRet; - } - catch - { - ret = -1; - } - } - return ret; - } -} -} diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSLinksetConstraints.cs b/OpenSim/Region/PhysicsModules/BulletS/BSLinksetConstraints.cs index d7be470d81..c4b4c86ec8 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSLinksetConstraints.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSLinksetConstraints.cs @@ -28,8 +28,6 @@ using System; using System.Collections.Generic; using System.Text; -using OpenSim.Region.OptionalModules.Scripting; - using OMV = OpenMetaverse; namespace OpenSim.Region.PhysicsModule.BulletS diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs index 3e744281be..6f27ac7683 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs @@ -34,7 +34,6 @@ using OMV = OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet; -using OpenSim.Region.OptionalModules.Scripting; // for ExtendedPhysics namespace OpenSim.Region.PhysicsModule.BulletS { diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs index 8f494cca05..55b5da09c9 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs @@ -30,7 +30,6 @@ using System.Linq; using System.Text; using OpenSim.Framework; -using OpenSim.Region.OptionalModules.Scripting; using OMV = OpenMetaverse; diff --git a/OpenSim/Region/PhysicsModules/BulletS/ExtendedPhysics.cs b/OpenSim/Region/PhysicsModules/BulletS/ExtendedPhysics.cs new file mode 100755 index 0000000000..2ba3c5a762 --- /dev/null +++ b/OpenSim/Region/PhysicsModules/BulletS/ExtendedPhysics.cs @@ -0,0 +1,622 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyrightD + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading; + +using OpenSim.Framework; +using OpenSim.Region.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.PhysicsModules.SharedBase; + +using Mono.Addins; +using Nini.Config; +using log4net; +using OpenMetaverse; + +namespace OpenSim.Region.PhysicsModule.BulletS +{ + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class ExtendedPhysics : INonSharedRegionModule + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static string LogHeader = "[EXTENDED PHYSICS]"; + + // ============================================================= + // Since BulletSim is a plugin, this these values aren't defined easily in one place. + // This table must correspond to an identical table in BSScene. + + // Per scene functions. See BSScene. + + // Per avatar functions. See BSCharacter. + + // Per prim functions. See BSPrim. + public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType"; + public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType"; + public const string PhysFunctChangeLinkFixed = "BulletSim.ChangeLinkFixed"; + public const string PhysFunctChangeLinkType = "BulletSim.ChangeLinkType"; + public const string PhysFunctGetLinkType = "BulletSim.GetLinkType"; + public const string PhysFunctChangeLinkParams = "BulletSim.ChangeLinkParams"; + public const string PhysFunctAxisLockLimits = "BulletSim.AxisLockLimits"; + + // ============================================================= + + private IConfig Configuration { get; set; } + private bool Enabled { get; set; } + private Scene BaseScene { get; set; } + private IScriptModuleComms Comms { get; set; } + + #region INonSharedRegionModule + + public string Name { get { return this.GetType().Name; } } + + public void Initialise(IConfigSource config) + { + BaseScene = null; + Enabled = false; + Configuration = null; + Comms = null; + + try + { + if ((Configuration = config.Configs["ExtendedPhysics"]) != null) + { + Enabled = Configuration.GetBoolean("Enabled", Enabled); + } + } + catch (Exception e) + { + m_log.ErrorFormat("{0} Initialization error: {0}", LogHeader, e); + } + + m_log.InfoFormat("{0} module {1} enabled", LogHeader, (Enabled ? "is" : "is not")); + } + + public void Close() + { + if (BaseScene != null) + { + BaseScene.EventManager.OnObjectAddedToScene -= EventManager_OnObjectAddedToScene; + BaseScene.EventManager.OnSceneObjectPartUpdated -= EventManager_OnSceneObjectPartUpdated; + BaseScene = null; + } + } + + public void AddRegion(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + if (BaseScene != null && BaseScene == scene) + { + Close(); + } + } + + public void RegionLoaded(Scene scene) + { + if (!Enabled) return; + + BaseScene = scene; + + Comms = BaseScene.RequestModuleInterface(); + if (Comms == null) + { + m_log.WarnFormat("{0} ScriptModuleComms interface not defined", LogHeader); + Enabled = false; + + return; + } + + // Register as LSL functions all the [ScriptInvocation] marked methods. + Comms.RegisterScriptInvocations(this); + Comms.RegisterConstants(this); + + // When an object is modified, we might need to update its extended physics parameters + BaseScene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene; + BaseScene.EventManager.OnSceneObjectPartUpdated += EventManager_OnSceneObjectPartUpdated; + + } + + public Type ReplaceableInterface { get { return null; } } + + #endregion // INonSharedRegionModule + + private void EventManager_OnObjectAddedToScene(SceneObjectGroup obj) + { + } + + // Event generated when some property of a prim changes. + private void EventManager_OnSceneObjectPartUpdated(SceneObjectPart sop, bool isFullUpdate) + { + } + + [ScriptConstant] + public const int PHYS_CENTER_OF_MASS = 1 << 0; + + [ScriptInvocation] + public string physGetEngineType(UUID hostID, UUID scriptID) + { + string ret = string.Empty; + + if (BaseScene.PhysicsScene != null) + { + ret = BaseScene.PhysicsScene.EngineType; + } + + return ret; + } + + // Code for specifying params. + // The choice if 14700 is arbitrary and only serves to catch parameter code misuse. + [ScriptConstant] + public const int PHYS_AXIS_LOCK_LINEAR = 14700; + [ScriptConstant] + public const int PHYS_AXIS_LOCK_LINEAR_X = 14701; + [ScriptConstant] + public const int PHYS_AXIS_LIMIT_LINEAR_X = 14702; + [ScriptConstant] + public const int PHYS_AXIS_LOCK_LINEAR_Y = 14703; + [ScriptConstant] + public const int PHYS_AXIS_LIMIT_LINEAR_Y = 14704; + [ScriptConstant] + public const int PHYS_AXIS_LOCK_LINEAR_Z = 14705; + [ScriptConstant] + public const int PHYS_AXIS_LIMIT_LINEAR_Z = 14706; + [ScriptConstant] + public const int PHYS_AXIS_LOCK_ANGULAR = 14707; + [ScriptConstant] + public const int PHYS_AXIS_LOCK_ANGULAR_X = 14708; + [ScriptConstant] + public const int PHYS_AXIS_LIMIT_ANGULAR_X = 14709; + [ScriptConstant] + public const int PHYS_AXIS_LOCK_ANGULAR_Y = 14710; + [ScriptConstant] + public const int PHYS_AXIS_LIMIT_ANGULAR_Y = 14711; + [ScriptConstant] + public const int PHYS_AXIS_LOCK_ANGULAR_Z = 14712; + [ScriptConstant] + public const int PHYS_AXIS_LIMIT_ANGULAR_Z = 14713; + [ScriptConstant] + public const int PHYS_AXIS_UNLOCK_LINEAR = 14714; + [ScriptConstant] + public const int PHYS_AXIS_UNLOCK_LINEAR_X = 14715; + [ScriptConstant] + public const int PHYS_AXIS_UNLOCK_LINEAR_Y = 14716; + [ScriptConstant] + public const int PHYS_AXIS_UNLOCK_LINEAR_Z = 14717; + [ScriptConstant] + public const int PHYS_AXIS_UNLOCK_ANGULAR = 14718; + [ScriptConstant] + public const int PHYS_AXIS_UNLOCK_ANGULAR_X = 14719; + [ScriptConstant] + public const int PHYS_AXIS_UNLOCK_ANGULAR_Y = 14720; + [ScriptConstant] + public const int PHYS_AXIS_UNLOCK_ANGULAR_Z = 14721; + [ScriptConstant] + public const int PHYS_AXIS_UNLOCK = 14722; + // physAxisLockLimits() + [ScriptInvocation] + public int physAxisLock(UUID hostID, UUID scriptID, object[] parms) + { + int ret = -1; + if (!Enabled) return ret; + + PhysicsActor rootPhysActor; + if (GetRootPhysActor(hostID, out rootPhysActor)) + { + object[] parms2 = AddToBeginningOfArray(rootPhysActor, null, parms); + ret = MakeIntError(rootPhysActor.Extension(PhysFunctAxisLockLimits, parms2)); + } + + return ret; + } + + [ScriptConstant] + public const int PHYS_LINKSET_TYPE_CONSTRAINT = 0; + [ScriptConstant] + public const int PHYS_LINKSET_TYPE_COMPOUND = 1; + [ScriptConstant] + public const int PHYS_LINKSET_TYPE_MANUAL = 2; + + [ScriptInvocation] + public int physSetLinksetType(UUID hostID, UUID scriptID, int linksetType) + { + int ret = -1; + if (!Enabled) return ret; + + // The part that is requesting the change. + SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID); + + if (requestingPart != null) + { + // The change is always made to the root of a linkset. + SceneObjectGroup containingGroup = requestingPart.ParentGroup; + SceneObjectPart rootPart = containingGroup.RootPart; + + if (rootPart != null) + { + PhysicsActor rootPhysActor = rootPart.PhysActor; + if (rootPhysActor != null) + { + if (rootPhysActor.IsPhysical) + { + // Change a physical linkset by making non-physical, waiting for one heartbeat so all + // the prim and linkset state is updated, changing the type and making the + // linkset physical again. + containingGroup.ScriptSetPhysicsStatus(false); + Thread.Sleep(150); // longer than one heartbeat tick + + // A kludge for the moment. + // Since compound linksets move the children but don't generate position updates to the + // simulator, it is possible for compound linkset children to have out-of-sync simulator + // and physical positions. The following causes the simulator to push the real child positions + // down into the physics engine to get everything synced. + containingGroup.UpdateGroupPosition(containingGroup.AbsolutePosition); + containingGroup.UpdateGroupRotationR(containingGroup.GroupRotation); + + object[] parms2 = { rootPhysActor, null, linksetType }; + ret = MakeIntError(rootPhysActor.Extension(PhysFunctSetLinksetType, parms2)); + Thread.Sleep(150); // longer than one heartbeat tick + + containingGroup.ScriptSetPhysicsStatus(true); + } + else + { + // Non-physical linksets don't have a physical instantiation so there is no state to + // worry about being updated. + object[] parms2 = { rootPhysActor, null, linksetType }; + ret = MakeIntError(rootPhysActor.Extension(PhysFunctSetLinksetType, parms2)); + } + } + else + { + m_log.WarnFormat("{0} physSetLinksetType: root part does not have a physics actor. rootName={1}, hostID={2}", + LogHeader, rootPart.Name, hostID); + } + } + else + { + m_log.WarnFormat("{0} physSetLinksetType: root part does not exist. RequestingPartName={1}, hostID={2}", + LogHeader, requestingPart.Name, hostID); + } + } + else + { + m_log.WarnFormat("{0} physSetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID); + } + return ret; + } + + [ScriptInvocation] + public int physGetLinksetType(UUID hostID, UUID scriptID) + { + int ret = -1; + if (!Enabled) return ret; + + PhysicsActor rootPhysActor; + if (GetRootPhysActor(hostID, out rootPhysActor)) + { + object[] parms2 = { rootPhysActor, null }; + ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinksetType, parms2)); + } + else + { + m_log.WarnFormat("{0} physGetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID); + } + return ret; + } + + [ScriptConstant] + public const int PHYS_LINK_TYPE_FIXED = 1234; + [ScriptConstant] + public const int PHYS_LINK_TYPE_HINGE = 4; + [ScriptConstant] + public const int PHYS_LINK_TYPE_SPRING = 9; + [ScriptConstant] + public const int PHYS_LINK_TYPE_6DOF = 6; + [ScriptConstant] + public const int PHYS_LINK_TYPE_SLIDER = 7; + + // physChangeLinkType(integer linkNum, integer typeCode) + [ScriptInvocation] + public int physChangeLinkType(UUID hostID, UUID scriptID, int linkNum, int typeCode) + { + int ret = -1; + if (!Enabled) return ret; + + PhysicsActor rootPhysActor; + PhysicsActor childPhysActor; + + if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) + { + object[] parms2 = { rootPhysActor, childPhysActor, typeCode }; + ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkType, parms2)); + } + + return ret; + } + + // physGetLinkType(integer linkNum) + [ScriptInvocation] + public int physGetLinkType(UUID hostID, UUID scriptID, int linkNum) + { + int ret = -1; + if (!Enabled) return ret; + + PhysicsActor rootPhysActor; + PhysicsActor childPhysActor; + + if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) + { + object[] parms2 = { rootPhysActor, childPhysActor }; + ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinkType, parms2)); + } + + return ret; + } + + // physChangeLinkFixed(integer linkNum) + // Change the link between the root and the linkNum into a fixed, static physical connection. + [ScriptInvocation] + public int physChangeLinkFixed(UUID hostID, UUID scriptID, int linkNum) + { + int ret = -1; + if (!Enabled) return ret; + + PhysicsActor rootPhysActor; + PhysicsActor childPhysActor; + + if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) + { + object[] parms2 = { rootPhysActor, childPhysActor , PHYS_LINK_TYPE_FIXED }; + ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkType, parms2)); + } + + return ret; + } + + // Code for specifying params. + // The choice if 14400 is arbitrary and only serves to catch parameter code misuse. + public const int PHYS_PARAM_MIN = 14401; + + [ScriptConstant] + public const int PHYS_PARAM_FRAMEINA_LOC = 14401; + [ScriptConstant] + public const int PHYS_PARAM_FRAMEINA_ROT = 14402; + [ScriptConstant] + public const int PHYS_PARAM_FRAMEINB_LOC = 14403; + [ScriptConstant] + public const int PHYS_PARAM_FRAMEINB_ROT = 14404; + [ScriptConstant] + public const int PHYS_PARAM_LINEAR_LIMIT_LOW = 14405; + [ScriptConstant] + public const int PHYS_PARAM_LINEAR_LIMIT_HIGH = 14406; + [ScriptConstant] + public const int PHYS_PARAM_ANGULAR_LIMIT_LOW = 14407; + [ScriptConstant] + public const int PHYS_PARAM_ANGULAR_LIMIT_HIGH = 14408; + [ScriptConstant] + public const int PHYS_PARAM_USE_FRAME_OFFSET = 14409; + [ScriptConstant] + public const int PHYS_PARAM_ENABLE_TRANSMOTOR = 14410; + [ScriptConstant] + public const int PHYS_PARAM_TRANSMOTOR_MAXVEL = 14411; + [ScriptConstant] + public const int PHYS_PARAM_TRANSMOTOR_MAXFORCE = 14412; + [ScriptConstant] + public const int PHYS_PARAM_CFM = 14413; + [ScriptConstant] + public const int PHYS_PARAM_ERP = 14414; + [ScriptConstant] + public const int PHYS_PARAM_SOLVER_ITERATIONS = 14415; + [ScriptConstant] + public const int PHYS_PARAM_SPRING_AXIS_ENABLE = 14416; + [ScriptConstant] + public const int PHYS_PARAM_SPRING_DAMPING = 14417; + [ScriptConstant] + public const int PHYS_PARAM_SPRING_STIFFNESS = 14418; + [ScriptConstant] + public const int PHYS_PARAM_LINK_TYPE = 14419; + [ScriptConstant] + public const int PHYS_PARAM_USE_LINEAR_FRAMEA = 14420; + [ScriptConstant] + public const int PHYS_PARAM_SPRING_EQUILIBRIUM_POINT = 14421; + + public const int PHYS_PARAM_MAX = 14421; + + // Used when specifying a parameter that has settings for the three linear and three angular axis + [ScriptConstant] + public const int PHYS_AXIS_ALL = -1; + [ScriptConstant] + public const int PHYS_AXIS_LINEAR_ALL = -2; + [ScriptConstant] + public const int PHYS_AXIS_ANGULAR_ALL = -3; + [ScriptConstant] + public const int PHYS_AXIS_LINEAR_X = 0; + [ScriptConstant] + public const int PHYS_AXIS_LINEAR_Y = 1; + [ScriptConstant] + public const int PHYS_AXIS_LINEAR_Z = 2; + [ScriptConstant] + public const int PHYS_AXIS_ANGULAR_X = 3; + [ScriptConstant] + public const int PHYS_AXIS_ANGULAR_Y = 4; + [ScriptConstant] + public const int PHYS_AXIS_ANGULAR_Z = 5; + + // physChangeLinkParams(integer linkNum, [ PHYS_PARAM_*, value, PHYS_PARAM_*, value, ...]) + [ScriptInvocation] + public int physChangeLinkParams(UUID hostID, UUID scriptID, int linkNum, object[] parms) + { + int ret = -1; + if (!Enabled) return ret; + + PhysicsActor rootPhysActor; + PhysicsActor childPhysActor; + + if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) + { + object[] parms2 = AddToBeginningOfArray(rootPhysActor, childPhysActor, parms); + ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkParams, parms2)); + } + + return ret; + } + + private bool GetRootPhysActor(UUID hostID, out PhysicsActor rootPhysActor) + { + SceneObjectGroup containingGroup; + SceneObjectPart rootPart; + return GetRootPhysActor(hostID, out containingGroup, out rootPart, out rootPhysActor); + } + + private bool GetRootPhysActor(UUID hostID, out SceneObjectGroup containingGroup, out SceneObjectPart rootPart, out PhysicsActor rootPhysActor) + { + bool ret = false; + rootPhysActor = null; + containingGroup = null; + rootPart = null; + + SceneObjectPart requestingPart; + + requestingPart = BaseScene.GetSceneObjectPart(hostID); + if (requestingPart != null) + { + // The type is is always on the root of a linkset. + containingGroup = requestingPart.ParentGroup; + if (containingGroup != null && !containingGroup.IsDeleted) + { + rootPart = containingGroup.RootPart; + if (rootPart != null) + { + rootPhysActor = rootPart.PhysActor; + if (rootPhysActor != null) + { + ret = true; + } + else + { + m_log.WarnFormat("{0} GetRootAndChildPhysActors: Root part does not have a physics actor. rootName={1}, hostID={2}", + LogHeader, rootPart.Name, hostID); + } + } + else + { + m_log.WarnFormat("{0} GetRootAndChildPhysActors: Root part does not exist. RequestingPartName={1}, hostID={2}", + LogHeader, requestingPart.Name, hostID); + } + } + else + { + m_log.WarnFormat("{0} GetRootAndChildPhysActors: Containing group missing or deleted. hostID={1}", LogHeader, hostID); + } + } + else + { + m_log.WarnFormat("{0} GetRootAndChildPhysActors: cannot find script object in scene. hostID={1}", LogHeader, hostID); + } + + return ret; + } + + // Find the root and child PhysActors based on the linkNum. + // Return 'true' if both are found and returned. + private bool GetRootAndChildPhysActors(UUID hostID, int linkNum, out PhysicsActor rootPhysActor, out PhysicsActor childPhysActor) + { + bool ret = false; + rootPhysActor = null; + childPhysActor = null; + + SceneObjectGroup containingGroup; + SceneObjectPart rootPart; + + if (GetRootPhysActor(hostID, out containingGroup, out rootPart, out rootPhysActor)) + { + SceneObjectPart linkPart = containingGroup.GetLinkNumPart(linkNum); + if (linkPart != null) + { + childPhysActor = linkPart.PhysActor; + if (childPhysActor != null) + { + ret = true; + } + else + { + m_log.WarnFormat("{0} GetRootAndChildPhysActors: Link part has no physical actor. rootName={1}, hostID={2}, linknum={3}", + LogHeader, rootPart.Name, hostID, linkNum); + } + } + else + { + m_log.WarnFormat("{0} GetRootAndChildPhysActors: Could not find linknum part. rootName={1}, hostID={2}, linknum={3}", + LogHeader, rootPart.Name, hostID, linkNum); + } + } + else + { + m_log.WarnFormat("{0} GetRootAndChildPhysActors: Root part does not have a physics actor. rootName={1}, hostID={2}", + LogHeader, rootPart.Name, hostID); + } + + return ret; + } + + // Return an array of objects with the passed object as the first object of a new array + private object[] AddToBeginningOfArray(object firstOne, object secondOne, object[] prevArray) + { + object[] newArray = new object[2 + prevArray.Length]; + newArray[0] = firstOne; + newArray[1] = secondOne; + prevArray.CopyTo(newArray, 2); + return newArray; + } + + // Extension() returns an object. Convert that object into the integer error we expect to return. + private int MakeIntError(object extensionRet) + { + int ret = -1; + if (extensionRet != null) + { + try + { + ret = (int)extensionRet; + } + catch + { + ret = -1; + } + } + return ret; + } + } +} diff --git a/prebuild.xml b/prebuild.xml index d41c145fcf..0550211d3f 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1856,7 +1856,6 @@ - From dac8edd5dddb5f3d2a2447fb479144429e32ea68 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 3 Sep 2015 15:59:06 -0700 Subject: [PATCH 12/33] Transformed the LLUDP ad-hoc plugin into a region module. It works. --- .../Region/Application/OpenSimBackground.cs | 2 +- OpenSim/Region/Application/OpenSimBase.cs | 147 ++++++++---------- .../RegionApplicationBase.cs | 5 +- .../Region/ClientStack/ClientStackManager.cs | 147 ------------------ .../ClientStack/IClientNetworkServer.cs | 59 ------- .../ClientStack/Linden/UDP/LLUDPServer.cs | 49 +++++- .../Linden/UDP/Properties/AssemblyInfo.cs | 3 + prebuild.xml | 43 +---- 8 files changed, 118 insertions(+), 337 deletions(-) rename OpenSim/Region/{ClientStack => Application}/RegionApplicationBase.cs (95%) delete mode 100644 OpenSim/Region/ClientStack/ClientStackManager.cs delete mode 100644 OpenSim/Region/ClientStack/IClientNetworkServer.cs diff --git a/OpenSim/Region/Application/OpenSimBackground.cs b/OpenSim/Region/Application/OpenSimBackground.cs index 008c6b07b5..15d9065af3 100644 --- a/OpenSim/Region/Application/OpenSimBackground.cs +++ b/OpenSim/Region/Application/OpenSimBackground.cs @@ -55,7 +55,7 @@ namespace OpenSim base.Startup(); m_log.InfoFormat("[OPENSIM MAIN]: Startup complete, serving {0} region{1}", - m_clientServers.Count.ToString(), m_clientServers.Count > 1 ? "s" : ""); + SceneManager.Scenes.Count, SceneManager.Scenes.Count > 1 ? "s" : ""); WorldHasComeToAnEnd.WaitOne(); WorldHasComeToAnEnd.Close(); diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 980fa8508b..6e984d8f8e 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -41,7 +41,6 @@ using OpenSim.Framework.Console; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Monitoring; -using OpenSim.Region.ClientStack; using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; @@ -117,19 +116,12 @@ namespace OpenSim /// public OpenSimConfigSource ConfigSource { get; private set; } - public List ClientServers - { - get { return m_clientServers; } - } - protected EnvConfigSource m_EnvConfigSource = new EnvConfigSource(); public EnvConfigSource envConfigSource { get { return m_EnvConfigSource; } } - - protected List m_clientServers = new List(); public uint HttpServerPort { @@ -359,9 +351,9 @@ namespace OpenSim /// /// /// - public List CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) + public void CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) { - return CreateRegion(regionInfo, portadd_flag, false, out scene); + CreateRegion(regionInfo, portadd_flag, false, out scene); } /// @@ -369,9 +361,9 @@ namespace OpenSim /// /// /// - public List CreateRegion(RegionInfo regionInfo, out IScene scene) + public void CreateRegion(RegionInfo regionInfo, out IScene scene) { - return CreateRegion(regionInfo, false, true, out scene); + CreateRegion(regionInfo, false, true, out scene); } /// @@ -381,7 +373,7 @@ namespace OpenSim /// /// /// - public List CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) + public void CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) { int port = regionInfo.InternalEndPoint.Port; @@ -406,8 +398,7 @@ namespace OpenSim Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); } - List clientServers; - Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServers); + Scene scene = SetupScene(regionInfo, proxyOffset, Config); m_log.Info("[MODULES]: Loading Region's modules (old style)"); @@ -455,20 +446,20 @@ namespace OpenSim SceneManager.Add(scene); - if (m_autoCreateClientStack) - { - foreach (IClientNetworkServer clientserver in clientServers) - { - m_clientServers.Add(clientserver); - clientserver.Start(); - } - } + //if (m_autoCreateClientStack) + //{ + // foreach (IClientNetworkServer clientserver in clientServers) + // { + // m_clientServers.Add(clientserver); + // clientserver.Start(); + // } + //} scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); }; mscene = scene; - return clientServers; + //return clientServers; } /// @@ -602,7 +593,7 @@ namespace OpenSim scene.DeleteAllSceneObjects(); SceneManager.CloseScene(scene); - ShutdownClientServer(scene.RegionInfo); + //ShutdownClientServer(scene.RegionInfo); if (!cleanup) return; @@ -663,7 +654,7 @@ namespace OpenSim } SceneManager.CloseScene(scene); - ShutdownClientServer(scene.RegionInfo); + //ShutdownClientServer(scene.RegionInfo); } /// @@ -684,9 +675,9 @@ namespace OpenSim /// /// /// - protected Scene SetupScene(RegionInfo regionInfo, out List clientServer) + protected Scene SetupScene(RegionInfo regionInfo) { - return SetupScene(regionInfo, 0, null, out clientServer); + return SetupScene(regionInfo, 0, null); } /// @@ -697,51 +688,45 @@ namespace OpenSim /// /// /// - protected Scene SetupScene( - RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out List clientServer) + protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, IConfigSource configSource) { - List clientNetworkServers = null; + //List clientNetworkServers = null; AgentCircuitManager circuitManager = new AgentCircuitManager(); - IPAddress listenIP = regionInfo.InternalEndPoint.Address; - //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) - // listenIP = IPAddress.Parse("0.0.0.0"); + //IPAddress listenIP = regionInfo.InternalEndPoint.Address; + ////if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) + //// listenIP = IPAddress.Parse("0.0.0.0"); - uint port = (uint) regionInfo.InternalEndPoint.Port; + //uint port = (uint) regionInfo.InternalEndPoint.Port; - if (m_autoCreateClientStack) - { - clientNetworkServers = m_clientStackManager.CreateServers( - listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, - circuitManager); - } - else - { - clientServer = null; - } + //if (m_autoCreateClientStack) + //{ + // clientNetworkServers = m_clientStackManager.CreateServers( + // listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, + // circuitManager); + //} + //else + //{ + // clientServer = null; + //} - regionInfo.InternalEndPoint.Port = (int) port; + //regionInfo.InternalEndPoint.Port = (int) port; Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager); - if (m_autoCreateClientStack) - { - foreach (IClientNetworkServer clientnetserver in clientNetworkServers) - { - clientnetserver.AddScene(scene); - } - } - clientServer = clientNetworkServers; + //if (m_autoCreateClientStack) + //{ + // foreach (IClientNetworkServer clientnetserver in clientNetworkServers) + // { + // clientnetserver.AddScene(scene); + // } + //} + //clientServer = clientNetworkServers; scene.LoadWorldMap(); return scene; } - protected override ClientStackManager CreateClientStackManager() - { - return new ClientStackManager(m_configSettings.ClientstackDll); - } - protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager) { @@ -751,29 +736,29 @@ namespace OpenSim Config, m_version); } - protected void ShutdownClientServer(RegionInfo whichRegion) - { - // Close and remove the clientserver for a region - bool foundClientServer = false; - int clientServerElement = 0; - Location location = new Location(whichRegion.RegionHandle); + //protected void ShutdownClientServer(RegionInfo whichRegion) + //{ + // // Close and remove the clientserver for a region + // bool foundClientServer = false; + // int clientServerElement = 0; + // Location location = new Location(whichRegion.RegionHandle); - for (int i = 0; i < m_clientServers.Count; i++) - { - if (m_clientServers[i].HandlesRegion(location)) - { - clientServerElement = i; - foundClientServer = true; - break; - } - } + // for (int i = 0; i < m_clientServers.Count; i++) + // { + // if (m_clientServers[i].HandlesRegion(location)) + // { + // clientServerElement = i; + // foundClientServer = true; + // break; + // } + // } - if (foundClientServer) - { - m_clientServers[clientServerElement].Stop(); - m_clientServers.RemoveAt(clientServerElement); - } - } + // if (foundClientServer) + // { + // m_clientServers[clientServerElement].Stop(); + // m_clientServers.RemoveAt(clientServerElement); + // } + //} protected virtual void HandleRestartRegion(RegionInfo whichRegion) { @@ -781,7 +766,7 @@ namespace OpenSim "[OPENSIM]: Got restart signal from SceneManager for region {0} ({1},{2})", whichRegion.RegionName, whichRegion.RegionLocX, whichRegion.RegionLocY); - ShutdownClientServer(whichRegion); + //ShutdownClientServer(whichRegion); IScene scene; CreateRegion(whichRegion, true, out scene); scene.Start(); diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/Application/RegionApplicationBase.cs similarity index 95% rename from OpenSim/Region/ClientStack/RegionApplicationBase.cs rename to OpenSim/Region/Application/RegionApplicationBase.cs index 343780b56d..b58c99832a 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/Application/RegionApplicationBase.cs @@ -41,7 +41,7 @@ using OpenSim.Region.Framework.Scenes; using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Services.Interfaces; -namespace OpenSim.Region.ClientStack +namespace OpenSim { public abstract class RegionApplicationBase : BaseOpenSimServer { @@ -53,7 +53,6 @@ namespace OpenSim.Region.ClientStack protected uint m_httpServerPort; protected ISimulationDataService m_simulationDataService; protected IEstateDataService m_estateDataService; - protected ClientStackManager m_clientStackManager; public SceneManager SceneManager { get; protected set; } public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } } @@ -62,13 +61,11 @@ namespace OpenSim.Region.ClientStack protected abstract void Initialize(); - protected abstract ClientStackManager CreateClientStackManager(); protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager); protected override void StartupSpecific() { SceneManager = SceneManager.Instance; - m_clientStackManager = CreateClientStackManager(); Initialize(); diff --git a/OpenSim/Region/ClientStack/ClientStackManager.cs b/OpenSim/Region/ClientStack/ClientStackManager.cs deleted file mode 100644 index 3ec968f706..0000000000 --- a/OpenSim/Region/ClientStack/ClientStackManager.cs +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Net; -using System.Reflection; -using log4net; -using Nini.Config; -using OpenSim.Framework; - -namespace OpenSim.Region.ClientStack -{ - public class ClientStackManager - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private List plugin = new List(); - private List pluginAssembly = new List(); - - public ClientStackManager(string pDllName) - { - List clientstacks = new List(); - if (pDllName.Contains(",")) - { - clientstacks = new List(pDllName.Split(',')); - } - else - { - clientstacks.Add(pDllName); - } - foreach (string dllName in clientstacks) - { - m_log.Info("[CLIENTSTACK]: Attempting to load " + dllName); - - try - { - //plugin = null; - Assembly itemAssembly = Assembly.LoadFrom(dllName); - pluginAssembly.Add(itemAssembly); - - foreach (Type pluginType in itemAssembly.GetTypes()) - { - if (pluginType.IsPublic) - { - Type typeInterface = pluginType.GetInterface("IClientNetworkServer"); - - if (typeInterface != null) - { - m_log.Info("[CLIENTSTACK]: Added IClientNetworkServer Interface"); - plugin.Add(pluginType); - break; - } - } - } - } - catch (ReflectionTypeLoadException e) - { - foreach (Exception e2 in e.LoaderExceptions) - { - m_log.Error(e2.ToString()); - } - throw e; - } - } - } - - /// - /// Create a server that can set up sessions for virtual world client <-> server communications - /// - /// - /// - /// - /// - /// - /// - /// - public List CreateServers( - IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, - AgentCircuitManager authenticateClass) - { - return CreateServers( - _listenIP, ref port, proxyPortOffset, allow_alternate_port, null, authenticateClass); - } - - /// - /// Create a server that can set up sessions for virtual world client <-> server communications - /// - /// - /// - /// - /// - /// - /// Can be null, in which case default values are used - /// - /// - /// - /// - public List CreateServers( - IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource, - AgentCircuitManager authenticateClass) - { - List servers = new List(); - if (plugin != null) - { - for (int i = 0; i < plugin.Count; i++) - { - IClientNetworkServer server = - (IClientNetworkServer) Activator.CreateInstance(pluginAssembly[i].GetType(plugin[i].ToString())); - - server.Initialise( - _listenIP, ref port, proxyPortOffset, allow_alternate_port, - configSource, authenticateClass); - servers.Add(server); - } - return servers; - } - - m_log.Error("[CLIENTSTACK]: Couldn't initialize a new server"); - return null; - } - } -} diff --git a/OpenSim/Region/ClientStack/IClientNetworkServer.cs b/OpenSim/Region/ClientStack/IClientNetworkServer.cs deleted file mode 100644 index bb7e6d0e6f..0000000000 --- a/OpenSim/Region/ClientStack/IClientNetworkServer.cs +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Net; -using System.Net.Sockets; -using Nini.Config; -using OpenSim.Framework; - -namespace OpenSim.Region.ClientStack -{ - public interface IClientNetworkServer - { - void Initialise( - IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, - AgentCircuitManager authenticateClass); - - bool HandlesRegion(Location x); - - /// - /// Add the given scene to be handled by this IClientNetworkServer. - /// - /// - void AddScene(IScene scene); - - /// - /// Start sending and receiving data. - /// - void Start(); - - /// - /// Stop sending and receiving data. - /// - void Stop(); - } -} diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 76be91a40b..45287148cd 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -40,8 +40,9 @@ using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; using OpenMetaverse; - +using Mono.Addins; using TokenBucket = OpenSim.Region.ClientStack.LindenUDP.TokenBucket; namespace OpenSim.Region.ClientStack.LindenUDP @@ -49,14 +50,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// A shim around LLUDPServer that implements the IClientNetworkServer interface /// - public sealed class LLUDPServerShim : IClientNetworkServer + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LLUDPServerShim")] + public sealed class LLUDPServerShim : INonSharedRegionModule { + private bool m_Enabled = true; + private IConfigSource m_Config; LLUDPServer m_udpServer; - public LLUDPServerShim() + #region INonSharedRegionModule + public string Name + { + get { return "LLUDPServerShim"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) + { + m_Config = source; + } + + public void Close() { } + public void AddRegion(Scene scene) + { + uint port = (uint)scene.RegionInfo.InternalEndPoint.Port; + + IPAddress listenIP = scene.RegionInfo.InternalEndPoint.Address; + Initialise(listenIP, ref port, scene.RegionInfo.ProxyOffset, scene.RegionInfo.m_allow_alternate_ports, m_Config, scene.AuthenticateHandler); + scene.RegionInfo.InternalEndPoint.Port = (int)port; + + AddScene(scene); + } + + public void RemoveRegion(Scene scene) + { + Stop(); + } + + public void RegionLoaded(Scene scene) + { + Start(); + } + #endregion + public void Initialise(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) { m_udpServer = new LLUDPServer(listenIP, ref port, proxyPortOffsetParm, allow_alternate_port, configSource, circuitManager); @@ -200,6 +242,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_udpServer.Stop(); } + } /// diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs b/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs index 8795c0c07a..a1ff69e115 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs @@ -1,6 +1,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using Mono.Addins; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -31,3 +32,5 @@ using System.Runtime.InteropServices; // [assembly: AssemblyVersion("0.8.2.*")] +[assembly: Addin("LindenUDP", OpenSim.VersionInfo.VersionNumber)] +[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] diff --git a/prebuild.xml b/prebuild.xml index 0550211d3f..06310f9c55 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1375,41 +1375,6 @@ - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - @@ -1440,13 +1405,13 @@ - + @@ -1902,7 +1867,6 @@ - @@ -1936,7 +1900,6 @@ - @@ -1972,7 +1935,6 @@ - @@ -2006,7 +1968,6 @@ - @@ -3206,7 +3167,6 @@ - @@ -3304,7 +3264,6 @@ - From 9d7e310e21b6405f1ecde074e9b7d4ea29c76ad7 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 4 Sep 2015 09:40:21 -0700 Subject: [PATCH 13/33] Deleted commented code --- OpenSim/Region/Application/OpenSimBase.cs | 51 ----------------------- 1 file changed, 51 deletions(-) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 6e984d8f8e..83c07f163b 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -693,35 +693,8 @@ namespace OpenSim //List clientNetworkServers = null; AgentCircuitManager circuitManager = new AgentCircuitManager(); - //IPAddress listenIP = regionInfo.InternalEndPoint.Address; - ////if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) - //// listenIP = IPAddress.Parse("0.0.0.0"); - - //uint port = (uint) regionInfo.InternalEndPoint.Port; - - //if (m_autoCreateClientStack) - //{ - // clientNetworkServers = m_clientStackManager.CreateServers( - // listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, - // circuitManager); - //} - //else - //{ - // clientServer = null; - //} - - //regionInfo.InternalEndPoint.Port = (int) port; - Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager); - //if (m_autoCreateClientStack) - //{ - // foreach (IClientNetworkServer clientnetserver in clientNetworkServers) - // { - // clientnetserver.AddScene(scene); - // } - //} - //clientServer = clientNetworkServers; scene.LoadWorldMap(); return scene; @@ -736,30 +709,6 @@ namespace OpenSim Config, m_version); } - //protected void ShutdownClientServer(RegionInfo whichRegion) - //{ - // // Close and remove the clientserver for a region - // bool foundClientServer = false; - // int clientServerElement = 0; - // Location location = new Location(whichRegion.RegionHandle); - - // for (int i = 0; i < m_clientServers.Count; i++) - // { - // if (m_clientServers[i].HandlesRegion(location)) - // { - // clientServerElement = i; - // foundClientServer = true; - // break; - // } - // } - - // if (foundClientServer) - // { - // m_clientServers[clientServerElement].Stop(); - // m_clientServers.RemoveAt(clientServerElement); - // } - //} - protected virtual void HandleRestartRegion(RegionInfo whichRegion) { m_log.InfoFormat( From 218eb908be33c1f9694562998e2d4d0b991f58f9 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 4 Sep 2015 10:54:04 -0700 Subject: [PATCH 14/33] In SceneGraph, use the property PhysicsScene instead of the variable _PhysScene, so that it gets properly initialized before being dereferenced. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index d77e3242d9..e0080f2049 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -162,9 +162,9 @@ namespace OpenSim.Region.Framework.Scenes // PhysX does this (runs in the background). - if (_PhyScene.IsThreaded) + if (PhysicsScene.IsThreaded) { - _PhyScene.GetResults(); + PhysicsScene.GetResults(); } } @@ -204,7 +204,7 @@ namespace OpenSim.Region.Framework.Scenes // position). // // Therefore, JointMoved and JointDeactivated events will be fired as a result of the following Simulate(). - return _PhyScene.Simulate((float)elapsed); + return PhysicsScene.Simulate((float)elapsed); } protected internal void UpdateScenePresenceMovement() From cb79e580dca781da9293cbc7a55c8ecafdf7830b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 4 Sep 2015 11:27:39 -0700 Subject: [PATCH 15/33] Fixed wrong path to Meshing dll --- prebuild.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prebuild.xml b/prebuild.xml index 06310f9c55..00fc0c7066 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1823,7 +1823,7 @@ - + From 1559fc42b6b4a7510e654773b3d22100ab539de1 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 4 Sep 2015 13:45:52 -0700 Subject: [PATCH 16/33] Deleted unused interface --- .../Framework/Communications/IUserService.cs | 157 ------------------ 1 file changed, 157 deletions(-) delete mode 100644 OpenSim/Framework/Communications/IUserService.cs diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs deleted file mode 100644 index dfa059d929..0000000000 --- a/OpenSim/Framework/Communications/IUserService.cs +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using OpenMetaverse; -using OpenSim.Services.Interfaces; - -namespace OpenSim.Framework.Communications -{ - public interface IUserService - { - /// - /// Add a temporary user profile. - /// - /// A temporary user profile is one that should exist only for the lifetime of the process. - /// - void AddTemporaryUserProfile(UserProfileData userProfile); - - /// - /// Loads a user profile by name - /// - /// First name - /// Last name - /// A user profile. Returns null if no profile is found - UserProfileData GetUserProfile(string firstName, string lastName); - - /// - /// Loads a user profile from a database by UUID - /// - /// The target UUID - /// A user profile. Returns null if no user profile is found. - UserProfileData GetUserProfile(UUID userId); - - UserProfileData GetUserProfile(Uri uri); - - Uri GetUserUri(UserProfileData userProfile); - - UserAgentData GetAgentByUUID(UUID userId); - - void ClearUserAgent(UUID avatarID); - List GenerateAgentPickerRequestResponse(UUID QueryID, string Query); - - UserProfileData SetupMasterUser(string firstName, string lastName); - UserProfileData SetupMasterUser(string firstName, string lastName, string password); - UserProfileData SetupMasterUser(UUID userId); - - /// - /// Update the user's profile. - /// - /// UserProfileData object with updated data. Should be obtained - /// via a call to GetUserProfile(). - /// true if the update could be applied, false if it could not be applied. - bool UpdateUserProfile(UserProfileData data); - - /// - /// Adds a new friend to the database for XUser - /// - /// The agent that who's friends list is being added to - /// The agent that being added to the friends list of the friends list owner - /// A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects - void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms); - - /// - /// Delete friend on friendlistowner's friendlist. - /// - /// The agent that who's friends list is being updated - /// The Ex-friend agent - void RemoveUserFriend(UUID friendlistowner, UUID friend); - - /// - /// Update permissions for friend on friendlistowner's friendlist. - /// - /// The agent that who's friends list is being updated - /// The agent that is getting or loosing permissions - /// A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects - void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms); - - /// - /// Logs off a user on the user server - /// - /// UUID of the user - /// UUID of the Region - /// regionhandle - /// final position - /// final lookat - void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat); - - /// - /// Logs off a user on the user server (deprecated as of 2008-08-27) - /// - /// UUID of the user - /// UUID of the Region - /// regionhandle - /// final position x - /// final position y - /// final position z - void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz); - - /// - /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship - /// for UUID friendslistowner - /// - /// - /// The agent for whom we're retreiving the friends Data. - /// - /// A List of FriendListItems that contains info about the user's friends. - /// Always returns a list even if the user has no friends - /// - List GetUserFriendList(UUID friendlistowner); - - // This probably shouldn't be here, it belongs to IAuthentication - // But since Scenes only have IUserService references, I'm placing it here for now. - bool VerifySession(UUID userID, UUID sessionID); - - /// - /// Authenticate a user by their password. - /// - /// - /// This is used by callers outside the login process that want to - /// verify a user who has given their password. - /// - /// This should probably also be in IAuthentication but is here for the same reasons as VerifySession() is - /// - /// - /// - /// - bool AuthenticateUserByPassword(UUID userID, string password); - - // Temporary Hack until we move everything to the new service model - void SetInventoryService(IInventoryService invService); - } -} From 9005365115a0c56c4d4827bff67bf8e5e317e5d6 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 4 Sep 2015 14:14:53 -0700 Subject: [PATCH 17/33] Deleted old unfinished code under Framework.Communications that wasn't being used anywhere. Also folded GenericAsyncResult into RestClient, since it is used only there. This is preparation to remove Framework.Communications entirely. --- .../Communications/GenericAsyncResult.cs | 185 ------------------ .../Limit/IRequestLimitStrategy.cs | 66 ------- .../Communications/Limit/NullLimitStrategy.cs | 40 ---- .../Limit/RepeatLimitStrategy.cs | 109 ----------- .../Communications/Limit/TimeLimitStrategy.cs | 140 ------------- .../Framework/Communications/RestClient.cs | 154 +++++++++++++++ .../Communications/XMPP/XmppError.cs | 39 ---- .../Communications/XMPP/XmppIqStanza.cs | 60 ------ .../Communications/XMPP/XmppMessageStanza.cs | 93 --------- .../Communications/XMPP/XmppPresenceStanza.cs | 69 ------- .../Communications/XMPP/XmppSerializer.cs | 79 -------- .../Communications/XMPP/XmppStanza.cs | 70 ------- .../Communications/XMPP/XmppWriter.cs | 57 ------ 13 files changed, 154 insertions(+), 1007 deletions(-) delete mode 100644 OpenSim/Framework/Communications/GenericAsyncResult.cs delete mode 100644 OpenSim/Framework/Communications/Limit/IRequestLimitStrategy.cs delete mode 100644 OpenSim/Framework/Communications/Limit/NullLimitStrategy.cs delete mode 100644 OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs delete mode 100644 OpenSim/Framework/Communications/Limit/TimeLimitStrategy.cs delete mode 100644 OpenSim/Framework/Communications/XMPP/XmppError.cs delete mode 100644 OpenSim/Framework/Communications/XMPP/XmppIqStanza.cs delete mode 100644 OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs delete mode 100644 OpenSim/Framework/Communications/XMPP/XmppPresenceStanza.cs delete mode 100644 OpenSim/Framework/Communications/XMPP/XmppSerializer.cs delete mode 100644 OpenSim/Framework/Communications/XMPP/XmppStanza.cs delete mode 100644 OpenSim/Framework/Communications/XMPP/XmppWriter.cs diff --git a/OpenSim/Framework/Communications/GenericAsyncResult.cs b/OpenSim/Framework/Communications/GenericAsyncResult.cs deleted file mode 100644 index 8e3f62b40e..0000000000 --- a/OpenSim/Framework/Communications/GenericAsyncResult.cs +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Threading; - -namespace OpenSim.Framework.Communications -{ - internal class SimpleAsyncResult : IAsyncResult - { - private readonly AsyncCallback m_callback; - - /// - /// Is process completed? - /// - /// Should really be boolean, but VolatileRead has no boolean method - private byte m_completed; - - /// - /// Did process complete synchronously? - /// - /// I have a hard time imagining a scenario where this is the case, again, same issue about - /// booleans and VolatileRead as m_completed - /// - private byte m_completedSynchronously; - - private readonly object m_asyncState; - private ManualResetEvent m_waitHandle; - private Exception m_exception; - - internal SimpleAsyncResult(AsyncCallback cb, object state) - { - m_callback = cb; - m_asyncState = state; - m_completed = 0; - m_completedSynchronously = 1; - } - - #region IAsyncResult Members - - public object AsyncState - { - get { return m_asyncState; } - } - - public WaitHandle AsyncWaitHandle - { - get - { - if (m_waitHandle == null) - { - bool done = IsCompleted; - ManualResetEvent mre = new ManualResetEvent(done); - if (Interlocked.CompareExchange(ref m_waitHandle, mre, null) != null) - { - mre.Close(); - } - else - { - if (!done && IsCompleted) - { - m_waitHandle.Set(); - } - } - } - - return m_waitHandle; - } - } - - - public bool CompletedSynchronously - { - get { return Thread.VolatileRead(ref m_completedSynchronously) == 1; } - } - - - public bool IsCompleted - { - get { return Thread.VolatileRead(ref m_completed) == 1; } - } - - #endregion - - #region class Methods - - internal void SetAsCompleted(bool completedSynchronously) - { - m_completed = 1; - if (completedSynchronously) - m_completedSynchronously = 1; - else - m_completedSynchronously = 0; - - SignalCompletion(); - } - - internal void HandleException(Exception e, bool completedSynchronously) - { - m_completed = 1; - if (completedSynchronously) - m_completedSynchronously = 1; - else - m_completedSynchronously = 0; - m_exception = e; - - SignalCompletion(); - } - - private void SignalCompletion() - { - if (m_waitHandle != null) m_waitHandle.Set(); - - if (m_callback != null) m_callback(this); - } - - public void EndInvoke() - { - // This method assumes that only 1 thread calls EndInvoke - if (!IsCompleted) - { - // If the operation isn't done, wait for it - AsyncWaitHandle.WaitOne(); - AsyncWaitHandle.Close(); - m_waitHandle.Close(); - m_waitHandle = null; // Allow early GC - } - - // Operation is done: if an exception occured, throw it - if (m_exception != null) throw m_exception; - } - - #endregion - } - - internal class AsyncResult : SimpleAsyncResult - { - private T m_result = default(T); - - public AsyncResult(AsyncCallback asyncCallback, Object state) : - base(asyncCallback, state) - { - } - - public void SetAsCompleted(T result, bool completedSynchronously) - { - // Save the asynchronous operation's result - m_result = result; - - // Tell the base class that the operation completed - // sucessfully (no exception) - base.SetAsCompleted(completedSynchronously); - } - - public new T EndInvoke() - { - base.EndInvoke(); - return m_result; - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Limit/IRequestLimitStrategy.cs b/OpenSim/Framework/Communications/Limit/IRequestLimitStrategy.cs deleted file mode 100644 index 070d106252..0000000000 --- a/OpenSim/Framework/Communications/Limit/IRequestLimitStrategy.cs +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -namespace OpenSim.Framework.Communications.Limit -{ - /// - /// Interface for strategies that can limit requests from the client. Currently only used in the - /// texture modules to deal with repeated requests for certain textures. However, limiting strategies - /// could be used with other requests. - /// - public interface IRequestLimitStrategy - { - /// - /// Should the request be allowed? If the id is not monitored, then the request is always allowed. - /// Otherwise, the strategy criteria will be applied. - /// - /// - /// - bool AllowRequest(TId id); - - /// - /// Has the request been refused just once? - /// - /// False if the request has not yet been refused, or if the request has been refused more - /// than once. - bool IsFirstRefusal(TId id); - - /// - /// Start monitoring for future AllowRequest calls. If the id is already monitored, then monitoring - /// continues. - /// - /// - void MonitorRequests(TId id); - - /// - /// Is the id being monitored? - /// - /// - /// - bool IsMonitoringRequests(TId id); - } -} diff --git a/OpenSim/Framework/Communications/Limit/NullLimitStrategy.cs b/OpenSim/Framework/Communications/Limit/NullLimitStrategy.cs deleted file mode 100644 index 76726531a8..0000000000 --- a/OpenSim/Framework/Communications/Limit/NullLimitStrategy.cs +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -namespace OpenSim.Framework.Communications.Limit -{ - /// - /// Strategy which polices no limits - /// - public class NullLimitStrategy : IRequestLimitStrategy - { - public bool AllowRequest(TId id) { return true; } - public bool IsFirstRefusal(TId id) { return false; } - public void MonitorRequests(TId id) { /* intentionally blank */ } - public bool IsMonitoringRequests(TId id) { return false; } - } -} diff --git a/OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs b/OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs deleted file mode 100644 index 44dd5927a3..0000000000 --- a/OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Collections.Generic; - -namespace OpenSim.Framework.Communications.Limit -{ - /// - /// Limit requests by discarding them after they've been repeated a certain number of times. - /// - public class RepeatLimitStrategy : IRequestLimitStrategy - { - /// - /// Record each asset request that we're notified about. - /// - private readonly Dictionary requestCounts = new Dictionary(); - - /// - /// The maximum number of requests that can be made before we drop subsequent requests. - /// - private readonly int m_maxRequests; - public int MaxRequests - { - get { return m_maxRequests; } - } - - /// - /// The maximum number of requests that may be served before all further - /// requests are dropped. - public RepeatLimitStrategy(int maxRequests) - { - m_maxRequests = maxRequests; - } - - /// - /// - /// - public bool AllowRequest(TId id) - { - if (requestCounts.ContainsKey(id)) - { - requestCounts[id] += 1; - - if (requestCounts[id] > m_maxRequests) - { - return false; - } - } - - return true; - } - - /// - /// - /// - public bool IsFirstRefusal(TId id) - { - if (requestCounts.ContainsKey(id) && m_maxRequests + 1 == requestCounts[id]) - { - return true; - } - - return false; - } - - /// - /// - /// - public void MonitorRequests(TId id) - { - if (!IsMonitoringRequests(id)) - { - requestCounts.Add(id, 1); - } - } - - /// - /// - /// - public bool IsMonitoringRequests(TId id) - { - return requestCounts.ContainsKey(id); - } - } -} diff --git a/OpenSim/Framework/Communications/Limit/TimeLimitStrategy.cs b/OpenSim/Framework/Communications/Limit/TimeLimitStrategy.cs deleted file mode 100644 index 7ac8293b77..0000000000 --- a/OpenSim/Framework/Communications/Limit/TimeLimitStrategy.cs +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; - -namespace OpenSim.Framework.Communications.Limit -{ - /// - /// Limit requests by discarding repeat attempts that occur within a given time period - /// - /// XXX Don't use this for limiting texture downloading, at least not until we better handle multiple requests - /// for the same texture at different resolutions. - /// - public class TimeLimitStrategy : IRequestLimitStrategy - { - /// - /// Record the time at which an asset request occurs. - /// - private readonly Dictionary requests = new Dictionary(); - - /// - /// The minimum time period between which requests for the same data will be serviced. - /// - private readonly TimeSpan m_repeatPeriod; - public TimeSpan RepeatPeriod - { - get { return m_repeatPeriod; } - } - - /// - /// - public TimeLimitStrategy(TimeSpan repeatPeriod) - { - m_repeatPeriod = repeatPeriod; - } - - /// - /// - /// - public bool AllowRequest(TId id) - { - if (IsMonitoringRequests(id)) - { - DateTime now = DateTime.Now; - TimeSpan elapsed = now - requests[id].Time; - - if (elapsed < RepeatPeriod) - { - requests[id].Refusals += 1; - return false; - } - - requests[id].Time = now; - } - - return true; - } - - /// - /// - /// - public bool IsFirstRefusal(TId id) - { - if (IsMonitoringRequests(id)) - { - if (1 == requests[id].Refusals) - { - return true; - } - } - - return false; - } - - /// - /// - /// - public void MonitorRequests(TId id) - { - if (!IsMonitoringRequests(id)) - { - requests.Add(id, new Request(DateTime.Now)); - } - } - - /// - /// - /// - public bool IsMonitoringRequests(TId id) - { - return requests.ContainsKey(id); - } - } - - /// - /// Private request details. - /// - class Request - { - /// - /// Time of last request - /// - public DateTime Time; - - /// - /// Number of refusals associated with this request - /// - public int Refusals; - - public Request(DateTime time) - { - Time = time; - } - } -} diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs index 6f517b6f87..ff7cb4d8fb 100644 --- a/OpenSim/Framework/Communications/RestClient.cs +++ b/OpenSim/Framework/Communications/RestClient.cs @@ -519,4 +519,158 @@ namespace OpenSim.Framework.Communications #endregion Async Invocation } + + internal class SimpleAsyncResult : IAsyncResult + { + private readonly AsyncCallback m_callback; + + /// + /// Is process completed? + /// + /// Should really be boolean, but VolatileRead has no boolean method + private byte m_completed; + + /// + /// Did process complete synchronously? + /// + /// I have a hard time imagining a scenario where this is the case, again, same issue about + /// booleans and VolatileRead as m_completed + /// + private byte m_completedSynchronously; + + private readonly object m_asyncState; + private ManualResetEvent m_waitHandle; + private Exception m_exception; + + internal SimpleAsyncResult(AsyncCallback cb, object state) + { + m_callback = cb; + m_asyncState = state; + m_completed = 0; + m_completedSynchronously = 1; + } + + #region IAsyncResult Members + + public object AsyncState + { + get { return m_asyncState; } + } + + public WaitHandle AsyncWaitHandle + { + get + { + if (m_waitHandle == null) + { + bool done = IsCompleted; + ManualResetEvent mre = new ManualResetEvent(done); + if (Interlocked.CompareExchange(ref m_waitHandle, mre, null) != null) + { + mre.Close(); + } + else + { + if (!done && IsCompleted) + { + m_waitHandle.Set(); + } + } + } + + return m_waitHandle; + } + } + + + public bool CompletedSynchronously + { + get { return Thread.VolatileRead(ref m_completedSynchronously) == 1; } + } + + + public bool IsCompleted + { + get { return Thread.VolatileRead(ref m_completed) == 1; } + } + + #endregion + + #region class Methods + + internal void SetAsCompleted(bool completedSynchronously) + { + m_completed = 1; + if (completedSynchronously) + m_completedSynchronously = 1; + else + m_completedSynchronously = 0; + + SignalCompletion(); + } + + internal void HandleException(Exception e, bool completedSynchronously) + { + m_completed = 1; + if (completedSynchronously) + m_completedSynchronously = 1; + else + m_completedSynchronously = 0; + m_exception = e; + + SignalCompletion(); + } + + private void SignalCompletion() + { + if (m_waitHandle != null) m_waitHandle.Set(); + + if (m_callback != null) m_callback(this); + } + + public void EndInvoke() + { + // This method assumes that only 1 thread calls EndInvoke + if (!IsCompleted) + { + // If the operation isn't done, wait for it + AsyncWaitHandle.WaitOne(); + AsyncWaitHandle.Close(); + m_waitHandle.Close(); + m_waitHandle = null; // Allow early GC + } + + // Operation is done: if an exception occured, throw it + if (m_exception != null) throw m_exception; + } + + #endregion + } + + internal class AsyncResult : SimpleAsyncResult + { + private T m_result = default(T); + + public AsyncResult(AsyncCallback asyncCallback, Object state) : + base(asyncCallback, state) + { + } + + public void SetAsCompleted(T result, bool completedSynchronously) + { + // Save the asynchronous operation's result + m_result = result; + + // Tell the base class that the operation completed + // sucessfully (no exception) + base.SetAsCompleted(completedSynchronously); + } + + public new T EndInvoke() + { + base.EndInvoke(); + return m_result; + } + } + } \ No newline at end of file diff --git a/OpenSim/Framework/Communications/XMPP/XmppError.cs b/OpenSim/Framework/Communications/XMPP/XmppError.cs deleted file mode 100644 index 3d36e9c8cf..0000000000 --- a/OpenSim/Framework/Communications/XMPP/XmppError.cs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Xml.Serialization; - -namespace OpenSim.Framework.Communications.XMPP -{ - [XmlRoot("error")] - public class XmppErrorStanza - { - public XmppErrorStanza() - { - } - } -} diff --git a/OpenSim/Framework/Communications/XMPP/XmppIqStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppIqStanza.cs deleted file mode 100644 index 12263f4e89..0000000000 --- a/OpenSim/Framework/Communications/XMPP/XmppIqStanza.cs +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Xml.Serialization; - -namespace OpenSim.Framework.Communications.XMPP -{ - /// - /// An IQ needs to have one of the follow types set. - /// - public enum XmppIqType - { - [XmlEnum("set")] set, - [XmlEnum("get")] get, - [XmlEnum("result")] result, - [XmlEnum("error")] error, - } - - /// - /// XmppIqStanza needs to be subclassed as the query content is - /// specific to the query type. - /// - [XmlRoot("iq")] - public abstract class XmppIqStanza: XmppStanza - { - /// - /// IQ type: one of set, get, result, error - /// - [XmlAttribute("type")] - public XmppIqType Type; - - public XmppIqStanza(): base() - { - } - } -} diff --git a/OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs deleted file mode 100644 index 1e8c33e52d..0000000000 --- a/OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Xml.Serialization; - -namespace OpenSim.Framework.Communications.XMPP -{ - /// - /// Message types. - /// - public enum XmppMessageType - { - [XmlEnum("chat")] chat, - [XmlEnum("error")] error, - [XmlEnum("groupchat")] groupchat, - [XmlEnum("headline")] headline, - [XmlEnum("normal")] normal, - } - - /// - /// Message body. - /// - public class XmppMessageBody - { - [XmlText] - public string Text; - - public XmppMessageBody() - { - } - - public XmppMessageBody(string message) - { - Text = message; - } - - new public string ToString() - { - return Text; - } - } - - [XmlRoot("message")] - public class XmppMessageStanza: XmppStanza - { - /// - /// IQ type: one of set, get, result, error - /// - [XmlAttribute("type")] - public XmppMessageType MessageType; - - // [XmlAttribute("error")] - // public XmppError Error; - - [XmlElement("body")] - public XmppMessageBody Body; - - public XmppMessageStanza() : base() - { - } - - public XmppMessageStanza(string fromJid, string toJid, XmppMessageType mType, string message) : - base(fromJid, toJid) - { - MessageType = mType; - Body = new XmppMessageBody(message); - } - } -} diff --git a/OpenSim/Framework/Communications/XMPP/XmppPresenceStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppPresenceStanza.cs deleted file mode 100644 index 4d45ac0663..0000000000 --- a/OpenSim/Framework/Communications/XMPP/XmppPresenceStanza.cs +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Xml.Serialization; - -namespace OpenSim.Framework.Communications.XMPP -{ - /// - /// Message types. - /// - public enum XmppPresenceType - { - [XmlEnum("unavailable")] unavailable, - [XmlEnum("subscribe")] subscribe, - [XmlEnum("subscribed")] subscribed, - [XmlEnum("unsubscribe")] unsubscribe, - [XmlEnum("unsubscribed")] unsubscribed, - [XmlEnum("probe")] probe, - [XmlEnum("error")] error, - } - - - [XmlRoot("message")] - public class XmppPresenceStanza: XmppStanza - { - /// - /// IQ type: one of set, get, result, error - /// - [XmlAttribute("type")] - public XmppPresenceType PresenceType; - - // [XmlAttribute("error")] - // public XmppError Error; - - public XmppPresenceStanza() : base() - { - } - - public XmppPresenceStanza(string fromJid, string toJid, XmppPresenceType pType) : - base(fromJid, toJid) - { - PresenceType = pType; - } - } -} diff --git a/OpenSim/Framework/Communications/XMPP/XmppSerializer.cs b/OpenSim/Framework/Communications/XMPP/XmppSerializer.cs deleted file mode 100644 index e37ef2853d..0000000000 --- a/OpenSim/Framework/Communications/XMPP/XmppSerializer.cs +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Xml; -using System.Xml.Serialization; - -namespace OpenSim.Framework.Communications.XMPP -{ - public class XmppSerializer - { - // private static readonly ILog _log = - // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - // need to do it this way, as XmlSerializer(type, extratypes) - // does not work on mono (at least). - private Dictionary _serializerForType = new Dictionary(); - private Dictionary _serializerForName = new Dictionary(); - private XmlSerializerNamespaces _xmlNs; - private string _defaultNS; - - public XmppSerializer(bool server) - { - _xmlNs = new XmlSerializerNamespaces(); - _xmlNs.Add(String.Empty, String.Empty); - if (server) - _defaultNS = "jabber:server"; - else - _defaultNS = "jabber:client"; - - // TODO: do this via reflection - _serializerForType[typeof(XmppMessageStanza)] = _serializerForName["message"] = - new XmlSerializer(typeof(XmppMessageStanza), _defaultNS); - } - - public void Serialize(XmlWriter xw, object o) - { - if (!_serializerForType.ContainsKey(o.GetType())) - throw new ArgumentException(String.Format("no serializer available for type {0}", o.GetType())); - - _serializerForType[o.GetType()].Serialize(xw, o, _xmlNs); - } - - public object Deserialize(XmlReader xr) - { - // position on next element - xr.Read(); - if (!_serializerForName.ContainsKey(xr.LocalName)) - throw new ArgumentException(String.Format("no serializer available for name {0}", xr.LocalName)); - - return _serializerForName[xr.LocalName].Deserialize(xr); - } - } -} diff --git a/OpenSim/Framework/Communications/XMPP/XmppStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppStanza.cs deleted file mode 100644 index 5312a31bb6..0000000000 --- a/OpenSim/Framework/Communications/XMPP/XmppStanza.cs +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Xml.Serialization; - -namespace OpenSim.Framework.Communications.XMPP -{ - public abstract class XmppStanza - { - /// - /// counter used for generating ID - /// - [XmlIgnore] - private static ulong _ctr = 0; - - /// - /// recipient JID - /// - [XmlAttribute("to")] - public string ToJid; - - /// - /// sender JID - /// - [XmlAttribute("from")] - public string FromJid; - - /// - /// unique ID. - /// - [XmlAttribute("id")] - public string MessageId; - - public XmppStanza() - { - } - - public XmppStanza(string fromJid, string toJid) - { - ToJid = toJid; - FromJid = fromJid; - MessageId = String.Format("OpenSim_{0}{1}", DateTime.UtcNow.Ticks, _ctr++); - } - } -} diff --git a/OpenSim/Framework/Communications/XMPP/XmppWriter.cs b/OpenSim/Framework/Communications/XMPP/XmppWriter.cs deleted file mode 100644 index 415d808c2f..0000000000 --- a/OpenSim/Framework/Communications/XMPP/XmppWriter.cs +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.IO; -using System.Text; -using System.Xml; -using IOStream = System.IO.Stream; - -namespace OpenSim.Framework.Communications.XMPP -{ - public class XMPPWriter: XmlTextWriter - { - public XMPPWriter(TextWriter textWriter) : base(textWriter) - { - } - - public XMPPWriter(IOStream stream) : this(stream, Util.UTF8) - { - } - - public XMPPWriter(IOStream stream, Encoding enc) : base(stream, enc) - { - } - - public override void WriteStartDocument() - { - } - - public override void WriteStartDocument(bool standalone) - { - } - } -} From d00f73c3a4cac77c97dcf4df1613fb85a516ffb4 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 4 Sep 2015 14:39:23 -0700 Subject: [PATCH 18/33] Deleted OpenSim.Framework.Communications. Moved its two remaining files to OpenSim.Framework. --- .../RemoteController/RemoteAdminPlugin.cs | 1 - .../Communications/Properties/AssemblyInfo.cs | 65 ---------------- .../{Communications => }/OutboundUrlFilter.cs | 4 +- .../{Communications => }/RestClient.cs | 2 +- OpenSim/Region/Application/OpenSimBase.cs | 1 - .../Application/RegionApplicationBase.cs | 1 - .../Tests/AttachmentsModuleTests.cs | 1 - .../Avatar/BakedTextures/XBakesModule.cs | 1 - .../Avatar/Friends/FriendsModule.cs | 1 - .../Avatar/InstantMessage/MuteListModule.cs | 1 - .../InstantMessage/OfflineMessageModule.cs | 1 - .../Archiver/InventoryArchiverModule.cs | 1 - .../Tests/InventoryArchiveLoadPathTests.cs | 1 - .../Tests/InventoryArchiveLoadTests.cs | 1 - .../Tests/InventoryArchiveSaveTests.cs | 1 - .../Tests/InventoryArchiveTestCase.cs | 1 - .../Tests/InventoryAccessModuleTests.cs | 1 - .../Framework/Library/LibraryModule.cs | 1 - .../HttpRequest/ScriptsHttpRequests.cs | 1 - .../LoadImageURL/LoadImageURLModule.cs | 2 +- .../Simulation/RemoteSimulationConnector.cs | 1 - .../CoreModules/World/Estate/XEstateModule.cs | 1 - .../DataSnapshot/DataSnapshotManager.cs | 1 - .../Framework/Scenes/RegionStatsHandler.cs | 1 - .../Framework/Scenes/Scene.PacketHandlers.cs | 1 - OpenSim/Region/Framework/Scenes/Scene.cs | 1 - .../Scenes/SceneCommunicationService.cs | 1 - .../Scenes/Tests/EntityManagerTests.cs | 1 - .../Framework/Scenes/Tests/SceneGraphTests.cs | 1 - .../Scenes/Tests/SceneManagerTests.cs | 1 - .../Scenes/Tests/SceneObjectBasicTests.cs | 1 - .../Scenes/Tests/SceneObjectCopyTests.cs | 1 - .../Scenes/Tests/SceneObjectDeRezTests.cs | 1 - .../Scenes/Tests/SceneObjectLinkingTests.cs | 1 - .../Scenes/Tests/SceneObjectResizeTests.cs | 1 - .../Scenes/Tests/SceneObjectScriptTests.cs | 1 - .../Tests/SceneObjectSerializationTests.cs | 1 - .../Scenes/Tests/SceneObjectSpatialTests.cs | 1 - .../Scenes/Tests/SceneObjectStatusTests.cs | 1 - .../Scenes/Tests/SceneObjectUndoRedoTests.cs | 1 - .../Scenes/Tests/SceneObjectUserGroupTests.cs | 1 - .../Scenes/Tests/ScenePresenceAgentTests.cs | 1 - .../Tests/ScenePresenceAnimationTests.cs | 1 - .../Tests/ScenePresenceAutopilotTests.cs | 1 - .../Tests/ScenePresenceCapabilityTests.cs | 1 - .../Tests/ScenePresenceCrossingTests.cs | 1 - .../Scenes/Tests/ScenePresenceSitTests.cs | 1 - .../Tests/ScenePresenceTeleportTests.cs | 1 - .../Scenes/Tests/SceneStatisticsTests.cs | 1 - .../Framework/Scenes/Tests/SceneTests.cs | 1 - .../Scenes/Tests/TaskInventoryTests.cs | 1 - .../Scenes/Tests/UserInventoryTests.cs | 1 - .../Avatar/XmlRpcGroups/GroupsModule.cs | 1 - .../SimianGroupsServicesConnectorModule.cs | 1 - .../XmlRpcGroups/Tests/GroupsModuleTests.cs | 1 - .../XmlRpcGroupsServicesConnectorModule.cs | 1 - .../XmlRpcGridRouterModule.cs | 1 - .../World/NPC/Tests/NPCModuleTests.cs | 1 - .../Asset/AssetServicesConnector.cs | 1 - .../AuthorizationServicesConnector.cs | 1 - .../Freeswitch/RemoteFreeswitchConnector.cs | 2 +- .../Friends/FriendsServicesConnector.cs | 2 +- .../Connectors/Grid/GridServicesConnector.cs | 2 +- .../GridUser/GridUserServicesConnector.cs | 2 +- .../Inventory/XInventoryServicesConnector.cs | 2 +- .../Connectors/Land/LandServicesConnector.cs | 2 +- .../MapImage/MapImageServicesConnector.cs | 2 +- .../Neighbour/NeighbourServicesConnector.cs | 2 +- .../Presence/PresenceServicesConnector.cs | 2 +- .../UserAccountServicesConnector.cs | 2 +- .../Common/Helpers/EntityTransferHelpers.cs | 2 +- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 2 +- .../Common/Helpers/UserAccountHelpers.cs | 2 +- OpenSim/Tests/Common/Mock/TestScene.cs | 2 +- .../Tests/Performance/NPCPerformanceTests.cs | 2 +- prebuild.xml | 77 +------------------ 76 files changed, 20 insertions(+), 216 deletions(-) delete mode 100644 OpenSim/Framework/Communications/Properties/AssemblyInfo.cs rename OpenSim/Framework/{Communications => }/OutboundUrlFilter.cs (99%) rename OpenSim/Framework/{Communications => }/RestClient.cs (99%) diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 0228c3c690..808d9e42a2 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -42,7 +42,6 @@ using OpenMetaverse; using Mono.Addins; using OpenSim; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; diff --git a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs deleted file mode 100644 index b398167211..0000000000 --- a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Reflection; -using System.Runtime.InteropServices; - -// General information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly : AssemblyTitle("OpenSim.Framework.Communications")] -[assembly : AssemblyDescription("")] -[assembly : AssemblyConfiguration("")] -[assembly : AssemblyCompany("http://opensimulator.org")] -[assembly : AssemblyProduct("OpenSim")] -[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers")] -[assembly : AssemblyTrademark("")] -[assembly : AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. - -[assembly : ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM - -[assembly : Guid("13e7c396-78a9-4a5c-baf2-6f980ea75d95")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -[assembly : AssemblyVersion("0.8.2.*")] - diff --git a/OpenSim/Framework/Communications/OutboundUrlFilter.cs b/OpenSim/Framework/OutboundUrlFilter.cs similarity index 99% rename from OpenSim/Framework/Communications/OutboundUrlFilter.cs rename to OpenSim/Framework/OutboundUrlFilter.cs index 8b572d1c58..baa3647677 100644 --- a/OpenSim/Framework/Communications/OutboundUrlFilter.cs +++ b/OpenSim/Framework/OutboundUrlFilter.cs @@ -34,7 +34,7 @@ using log4net; using LukeSkywalker.IPNetwork; using Nini.Config; -namespace OpenSim.Framework.Communications +namespace OpenSim.Framework { public class OutboundUrlFilter { @@ -62,7 +62,7 @@ namespace OpenSim.Framework.Communications } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Name of the filter for logging purposes. /// Filter configuration diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/RestClient.cs similarity index 99% rename from OpenSim/Framework/Communications/RestClient.cs rename to OpenSim/Framework/RestClient.cs index ff7cb4d8fb..7080ca5f87 100644 --- a/OpenSim/Framework/Communications/RestClient.cs +++ b/OpenSim/Framework/RestClient.cs @@ -37,7 +37,7 @@ using log4net; using OpenSim.Framework.ServiceAuth; -namespace OpenSim.Framework.Communications +namespace OpenSim.Framework { /// /// Implementation of a generic REST client diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 83c07f163b..ab6f036225 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -36,7 +36,6 @@ using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; diff --git a/OpenSim/Region/Application/RegionApplicationBase.cs b/OpenSim/Region/Application/RegionApplicationBase.cs index b58c99832a..08c8579811 100644 --- a/OpenSim/Region/Application/RegionApplicationBase.cs +++ b/OpenSim/Region/Application/RegionApplicationBase.cs @@ -32,7 +32,6 @@ using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework; diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index f1b002b8a9..3e7e4ed72a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -37,7 +37,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.CoreModules.Avatar.Attachments; diff --git a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs index 7d2cad67c3..414f06a552 100644 --- a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs @@ -38,7 +38,6 @@ using System.Reflection; using log4net; using OpenSim.Framework; using OpenSim.Framework.ServiceAuth; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 7ab568e8e5..08e7dd2cbc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -38,7 +38,6 @@ using OpenMetaverse; using Mono.Addins; using OpenSim.Framework; using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs index 7ce2813139..315d372a60 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs @@ -32,7 +32,6 @@ using Nini.Config; using Mono.Addins; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Framework.Client; using OpenSim.Region.Framework.Interfaces; diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index c75920d8df..9cdb1c2db8 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -32,7 +32,6 @@ using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Framework.Client; using OpenSim.Region.Framework.Interfaces; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 420520e1c6..884741442e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -34,7 +34,6 @@ using NDesk.Options; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Console; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs index 84f9f3f6bd..c2e645f0c1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs @@ -36,7 +36,6 @@ using OpenSim.Data; using OpenSim.Framework; using OpenSim.Framework.Serialization; using OpenSim.Framework.Serialization.External; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs index d5f3a22742..57b4f8067a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs @@ -36,7 +36,6 @@ using OpenSim.Data; using OpenSim.Framework; using OpenSim.Framework.Serialization; using OpenSim.Framework.Serialization.External; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs index b614c180d7..7265405c3c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs @@ -36,7 +36,6 @@ using OpenSim.Data; using OpenSim.Framework; using OpenSim.Framework.Serialization; using OpenSim.Framework.Serialization.External; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index 4b015d7488..519c697483 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs @@ -36,7 +36,6 @@ using OpenSim.Data; using OpenSim.Framework; using OpenSim.Framework.Serialization; using OpenSim.Framework.Serialization.External; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs index c64ab44a8d..1d9116542a 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs @@ -37,7 +37,6 @@ using OpenSim.Data; using OpenSim.Framework; using OpenSim.Framework.Serialization; using OpenSim.Framework.Serialization.External; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; using OpenSim.Region.CoreModules.Framework.InventoryAccess; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs index 69d7e16203..862f0b7eb5 100644 --- a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs @@ -30,7 +30,6 @@ using System.IO; using System.Reflection; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; using OpenSim.Region.Framework; diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index b1f3f9bc8a..9dfeb964b5 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -40,7 +40,6 @@ using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs index 7462ebd182..d45962f520 100644 --- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs @@ -32,7 +32,7 @@ using System.Net; using Nini.Config; using OpenMetaverse; using OpenMetaverse.Imaging; -using OpenSim.Framework.Communications; +using OpenSim.Framework; using OpenSim.Region.CoreModules.Scripting.DynamicTexture; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index dca3dd72f7..f96324210f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs @@ -38,7 +38,6 @@ using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Serialization; diff --git a/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs b/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs index f54ab2c13e..4bb3799dc9 100644 --- a/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs @@ -34,7 +34,6 @@ using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs index 600e826b82..d5ae83ee3b 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs @@ -39,7 +39,6 @@ using Nini.Config; using OpenMetaverse; using Mono.Addins; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.DataSnapshot.Interfaces; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs index f208afb758..3b31281cbe 100644 --- a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs +++ b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs @@ -35,7 +35,6 @@ using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index ef2125b0fb..8ebcd92190 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -31,7 +31,6 @@ using System.Threading; using OpenMetaverse; using OpenMetaverse.Packets; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Services.Interfaces; namespace OpenSim.Region.Framework.Scenes diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 900e715651..8c2f45e9e8 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -42,7 +42,6 @@ using OpenMetaverse.Imaging; using OpenSim.Framework; using OpenSim.Framework.Monitoring; using OpenSim.Services.Interfaces; -using OpenSim.Framework.Communications; using OpenSim.Framework.Console; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes.Scripting; diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index c8c8714a5e..b9526da753 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -35,7 +35,6 @@ using OpenMetaverse.StructuredData; using log4net; using OpenSim.Framework; using OpenSim.Framework.Client; -using OpenSim.Framework.Communications; using OpenSim.Framework.Capabilities; using OpenSim.Region.Framework.Interfaces; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index 766ce8399a..da1894143e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs @@ -34,7 +34,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index b6b3344cf1..ee7c8a917e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs @@ -32,7 +32,6 @@ using System.Text; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs index 6118004bf9..31722278a9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs @@ -32,7 +32,6 @@ using System.Threading; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index bdf0700846..098f1b4b96 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs @@ -33,7 +33,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs index 1d41d3381d..0b196c1b7e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs @@ -32,7 +32,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Framework.EntityTransfer; using OpenSim.Region.CoreModules.Framework.InventoryAccess; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index 558ba2c1bc..1c396ac081 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs @@ -32,7 +32,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Framework.EntityTransfer; using OpenSim.Region.CoreModules.Framework.InventoryAccess; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index c2e0ae318f..e6d5a2f676 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs @@ -31,7 +31,6 @@ using System.Reflection; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; using log4net; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index 11e90848b1..975c4d9008 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs @@ -30,7 +30,6 @@ using System.Reflection; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs index fdbe7aedfa..8a2d2af90f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs @@ -31,7 +31,6 @@ using System.Reflection; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs index 927d8e88d3..e3ceb04e88 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs @@ -36,7 +36,6 @@ using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Serialization.External; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs index 974529ae13..e00defd383 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs @@ -31,7 +31,6 @@ using System.Threading; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index 5ba754cbb0..1737e3c40c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs @@ -31,7 +31,6 @@ using System.Reflection; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs index cdebe2547b..af3ce8e50a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs @@ -30,7 +30,6 @@ using System.Reflection; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs index fd49c887f8..aadf7c636d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs @@ -32,7 +32,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.InstantMessage; using OpenSim.Region.CoreModules.World.Permissions; using OpenSim.Region.Framework.Interfaces; diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 06e6423141..96d112d9f1 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -36,7 +36,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.ClientStack.Linden; diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs index 700ca8c77a..42d91b954a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs @@ -35,7 +35,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.Framework.EntityTransfer; diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs index c6e3b8b7d6..e5c847e3eb 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs @@ -33,7 +33,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs index cca30db32f..2e6dc70ef2 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs @@ -36,7 +36,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.ClientStack.Linden; diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs index e14da8b107..712764400c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs @@ -32,7 +32,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.Framework; diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs index b77517828c..b232a4483a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs @@ -32,7 +32,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index da93d44d1f..bacfc179ce 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs @@ -35,7 +35,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.Framework; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs index 2d36214e16..045fd3cec5 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs @@ -31,7 +31,6 @@ using System.Reflection; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index 33ef83b7ef..517faf14d6 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs @@ -36,7 +36,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.World.Serialiser; diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index 8ec69740e7..b01088d58f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -37,7 +37,6 @@ using NUnit.Framework; using OpenMetaverse; using OpenMetaverse.Assets; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index edc0a5299a..8250e6c892 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -37,7 +37,6 @@ using NUnit.Framework; using OpenMetaverse; using OpenMetaverse.Assets; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index dff3f78f33..1565da9220 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -35,7 +35,6 @@ using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs index 8095b28f5e..1cb4747a58 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs @@ -42,7 +42,6 @@ using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Interfaces; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs index e03e71dd71..9a42bacc59 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs @@ -37,7 +37,6 @@ using OpenMetaverse.Messages.Linden; using OpenMetaverse.Packets; using OpenMetaverse.StructuredData; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.ClientStack.Linden; diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index a040f43d66..20555e4fb6 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -41,7 +41,6 @@ using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Interfaces; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs index 709d389b75..744d1e31f6 100644 --- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs @@ -35,7 +35,6 @@ using OpenMetaverse; using Mono.Addins; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Client; diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 0bebb588b3..77dfd40ea0 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -33,7 +33,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.Attachments; using OpenSim.Region.CoreModules.Avatar.AvatarFactory; using OpenSim.Region.CoreModules.Framework.InventoryAccess; diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index badacb7b8c..bd43552ad4 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -33,7 +33,6 @@ using System.Reflection; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Console; -using OpenSim.Framework.Communications; using OpenSim.Services.Interfaces; using OpenMetaverse; diff --git a/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs b/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs index 63730b3a83..d2da85f398 100644 --- a/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs +++ b/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs @@ -32,7 +32,6 @@ using System.IO; using System.Reflection; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Services.Interfaces; using OpenMetaverse; diff --git a/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs b/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs index d68829996d..20dc1ccf03 100644 --- a/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs +++ b/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs @@ -32,7 +32,7 @@ using System.Collections; using System.Reflection; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Services.Interfaces; using OpenSim.Server.Base; using OpenMetaverse; diff --git a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs index 74851a94db..b7702a8ed0 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs @@ -33,7 +33,7 @@ using System.Reflection; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.ServiceAuth; -using OpenSim.Framework.Communications; + using OpenSim.Services.Interfaces; using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; using OpenSim.Server.Base; diff --git a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs index 9e553568bd..596f86715e 100644 --- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs @@ -32,7 +32,7 @@ using System.IO; using System.Reflection; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Framework.ServiceAuth; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs index ffdd94aca8..b5ca1adb7a 100644 --- a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs +++ b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs @@ -32,7 +32,7 @@ using System.IO; using System.Reflection; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Framework.ServiceAuth; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs index b0615b8f3d..f235446ac9 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs @@ -33,7 +33,7 @@ using System.Reflection; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Console; -using OpenSim.Framework.Communications; + using OpenSim.Framework.Monitoring; using OpenSim.Services.Interfaces; using OpenSim.Server.Base; diff --git a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs index 644331acf6..034c42e94a 100644 --- a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs @@ -33,7 +33,7 @@ using System.IO; using System.Reflection; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Services.Interfaces; using OpenMetaverse; using Nwc.XmlRpc; diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs index 677825e098..c91ed84932 100644 --- a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs +++ b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs @@ -35,7 +35,7 @@ using System.Reflection; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Console; -using OpenSim.Framework.Communications; + using OpenSim.Framework.ServiceAuth; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs index eecf096e2f..925364a8ea 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs @@ -35,7 +35,7 @@ using System.Reflection; using System.Text; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Services.Interfaces; using OpenMetaverse; using OpenMetaverse.StructuredData; diff --git a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs index 63f3f37047..b7e95c43a9 100644 --- a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs +++ b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs @@ -32,7 +32,7 @@ using System.IO; using System.Reflection; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Framework.ServiceAuth; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs index 560e6c4c13..c21db549b9 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs @@ -32,7 +32,7 @@ using System.IO; using System.Reflection; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Framework.ServiceAuth; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs index cf7583e3d4..b215f1e235 100644 --- a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs @@ -37,7 +37,7 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 53509dc23e..df8b14ca2d 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -32,7 +32,7 @@ using Nini.Config; using OpenMetaverse; using OpenSim.Data.Null; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Framework.Console; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; diff --git a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs index 2fbebc4ea9..c62b58eff0 100644 --- a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs @@ -27,7 +27,7 @@ using System.Collections.Generic; using OpenMetaverse; -using OpenSim.Framework.Communications; + using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs index 951f1035b6..1a93c9fef1 100644 --- a/OpenSim/Tests/Common/Mock/TestScene.cs +++ b/OpenSim/Tests/Common/Mock/TestScene.cs @@ -28,7 +28,7 @@ using System; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Framework.Servers; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; diff --git a/OpenSim/Tests/Performance/NPCPerformanceTests.cs b/OpenSim/Tests/Performance/NPCPerformanceTests.cs index e222dc2dfe..ca6ae42049 100644 --- a/OpenSim/Tests/Performance/NPCPerformanceTests.cs +++ b/OpenSim/Tests/Performance/NPCPerformanceTests.cs @@ -34,7 +34,7 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Region.CoreModules.Avatar.Attachments; using OpenSim.Region.CoreModules.Avatar.AvatarFactory; using OpenSim.Region.CoreModules.Framework.InventoryAccess; diff --git a/prebuild.xml b/prebuild.xml index 00fc0c7066..e714abd860 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -107,6 +107,7 @@ + @@ -445,48 +446,6 @@ - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -538,7 +497,6 @@ - @@ -549,7 +507,6 @@ - @@ -562,8 +519,6 @@ - - @@ -716,7 +671,6 @@ - @@ -1404,7 +1358,6 @@ - @@ -1497,7 +1450,6 @@ - @@ -1517,7 +1469,6 @@ - @@ -1552,13 +1503,11 @@ - - @@ -1597,7 +1546,6 @@ - @@ -1616,7 +1564,6 @@ - @@ -1860,7 +1807,6 @@ - @@ -1970,7 +1916,6 @@ - @@ -2005,7 +1950,6 @@ - @@ -2158,7 +2102,6 @@ - @@ -2195,7 +2138,6 @@ - @@ -2232,7 +2174,6 @@ - @@ -2300,7 +2241,6 @@ - @@ -2340,7 +2280,6 @@ - @@ -2376,7 +2315,6 @@ - @@ -2437,7 +2375,6 @@ - @@ -2687,7 +2624,6 @@ - @@ -3016,7 +2952,6 @@ - @@ -3036,7 +2971,6 @@ - @@ -3095,7 +3029,6 @@ - @@ -3116,7 +3049,6 @@ - @@ -3161,7 +3093,6 @@ - @@ -3182,7 +3113,6 @@ - @@ -3223,7 +3153,6 @@ - @@ -3262,7 +3191,6 @@ - @@ -3293,7 +3221,6 @@ - @@ -3472,7 +3399,6 @@ - @@ -3512,7 +3438,6 @@ - From f9a7099abcc8bb2da81dc514adbe7803b14fcd6f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 4 Sep 2015 15:12:36 -0700 Subject: [PATCH 19/33] Moved RegionCombinerModule to OptionalModules. Removed it as its own top-level project/dll. --- .../RegionCombinerClientEventForwarder.cs | 0 .../RegionCombinerIndividualEventForwarder.cs | 0 .../RegionCombinerLargeLandChannel.cs | 0 .../RegionCombinerModule.cs | 0 .../RegionCombinerPermissionModule.cs | 0 .../RegionCombinerModule/RegionConnections.cs | 0 .../RegionCourseLocation.cs | 0 .../RegionCombinerModule/RegionData.cs | 0 .../Properties/AssemblyInfo.cs | 36 ------------------- prebuild.xml | 36 ------------------- 10 files changed, 72 deletions(-) rename OpenSim/Region/{ => OptionalModules}/RegionCombinerModule/RegionCombinerClientEventForwarder.cs (100%) rename OpenSim/Region/{ => OptionalModules}/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs (100%) rename OpenSim/Region/{ => OptionalModules}/RegionCombinerModule/RegionCombinerLargeLandChannel.cs (100%) rename OpenSim/Region/{ => OptionalModules}/RegionCombinerModule/RegionCombinerModule.cs (100%) rename OpenSim/Region/{ => OptionalModules}/RegionCombinerModule/RegionCombinerPermissionModule.cs (100%) rename OpenSim/Region/{ => OptionalModules}/RegionCombinerModule/RegionConnections.cs (100%) rename OpenSim/Region/{ => OptionalModules}/RegionCombinerModule/RegionCourseLocation.cs (100%) rename OpenSim/Region/{ => OptionalModules}/RegionCombinerModule/RegionData.cs (100%) delete mode 100644 OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerClientEventForwarder.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerClientEventForwarder.cs similarity index 100% rename from OpenSim/Region/RegionCombinerModule/RegionCombinerClientEventForwarder.cs rename to OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerClientEventForwarder.cs diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs similarity index 100% rename from OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs rename to OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerLargeLandChannel.cs similarity index 100% rename from OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs rename to OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerLargeLandChannel.cs diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs similarity index 100% rename from OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs rename to OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerPermissionModule.cs similarity index 100% rename from OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs rename to OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerPermissionModule.cs diff --git a/OpenSim/Region/RegionCombinerModule/RegionConnections.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionConnections.cs similarity index 100% rename from OpenSim/Region/RegionCombinerModule/RegionConnections.cs rename to OpenSim/Region/OptionalModules/RegionCombinerModule/RegionConnections.cs diff --git a/OpenSim/Region/RegionCombinerModule/RegionCourseLocation.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCourseLocation.cs similarity index 100% rename from OpenSim/Region/RegionCombinerModule/RegionCourseLocation.cs rename to OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCourseLocation.cs diff --git a/OpenSim/Region/RegionCombinerModule/RegionData.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionData.cs similarity index 100% rename from OpenSim/Region/RegionCombinerModule/RegionData.cs rename to OpenSim/Region/OptionalModules/RegionCombinerModule/RegionData.cs diff --git a/OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs b/OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs deleted file mode 100644 index 11b89d2e03..0000000000 --- a/OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using Mono.Addins; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Region.RegionCombinerModule")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("http://opensimulator.org")] -[assembly: AssemblyProduct("OpenSim")] -[assembly: AssemblyCopyright("OpenSimulator developers")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("73c166d2-c9d8-4ab8-af4e-89c41b4b58a9")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.8.2.*")] - -[assembly: Addin("OpenSim.RegionModules.RegionCombinerModule", OpenSim.VersionInfo.VersionNumber)] -[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] diff --git a/prebuild.xml b/prebuild.xml index e714abd860..d46d178cf3 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1485,42 +1485,6 @@ - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - - From 49d19e36507a01c657e9e9efb3edbfb5b15ddfa8 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 4 Sep 2015 15:17:53 -0700 Subject: [PATCH 20/33] Moved DataSnapshot feature to OptionalModules too. --- .../DataSnapshot/Properties/AssemblyInfo.cs | 33 ----------------- .../DataSnapshot/DataRequestHandler.cs | 0 .../DataSnapshot/DataSnapshotManager.cs | 3 -- .../DataSnapshot/EstateSnapshot.cs | 0 .../DataSnapshot/Interfaces/IDataSnapshot.cs | 0 .../Interfaces/IDataSnapshotProvider.cs | 0 .../DataSnapshot/LLSDDiscovery.cs | 0 .../DataSnapshot/LandSnapshot.cs | 0 .../DataSnapshot/ObjectSnapshot.cs | 0 .../DataSnapshot/SnapshotStore.cs | 0 prebuild.xml | 35 ------------------- 11 files changed, 71 deletions(-) delete mode 100644 OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs rename OpenSim/Region/{ => OptionalModules}/DataSnapshot/DataRequestHandler.cs (100%) rename OpenSim/Region/{ => OptionalModules}/DataSnapshot/DataSnapshotManager.cs (99%) rename OpenSim/Region/{ => OptionalModules}/DataSnapshot/EstateSnapshot.cs (100%) rename OpenSim/Region/{ => OptionalModules}/DataSnapshot/Interfaces/IDataSnapshot.cs (100%) rename OpenSim/Region/{ => OptionalModules}/DataSnapshot/Interfaces/IDataSnapshotProvider.cs (100%) rename OpenSim/Region/{ => OptionalModules}/DataSnapshot/LLSDDiscovery.cs (100%) rename OpenSim/Region/{ => OptionalModules}/DataSnapshot/LandSnapshot.cs (100%) rename OpenSim/Region/{ => OptionalModules}/DataSnapshot/ObjectSnapshot.cs (100%) rename OpenSim/Region/{ => OptionalModules}/DataSnapshot/SnapshotStore.cs (100%) diff --git a/OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs b/OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs deleted file mode 100644 index e60d3ae0a0..0000000000 --- a/OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Region.DataSnapshot")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("http://opensimulator.org")] -[assembly: AssemblyProduct("OpenSim")] -[assembly: AssemblyCopyright("OpenSimulator developers")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("06c36944-a28d-470e-912c-654c3edaba6b")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.8.2.*")] - diff --git a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs b/OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs similarity index 100% rename from OpenSim/Region/DataSnapshot/DataRequestHandler.cs rename to OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs similarity index 99% rename from OpenSim/Region/DataSnapshot/DataSnapshotManager.cs rename to OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs index d5ae83ee3b..0c3446d56e 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs @@ -43,9 +43,6 @@ using OpenSim.Region.DataSnapshot.Interfaces; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -[assembly: Addin("DataSnapshot", OpenSim.VersionInfo.VersionNumber)] -[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] - namespace OpenSim.Region.DataSnapshot { [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DataSnapshotManager")] diff --git a/OpenSim/Region/DataSnapshot/EstateSnapshot.cs b/OpenSim/Region/OptionalModules/DataSnapshot/EstateSnapshot.cs similarity index 100% rename from OpenSim/Region/DataSnapshot/EstateSnapshot.cs rename to OpenSim/Region/OptionalModules/DataSnapshot/EstateSnapshot.cs diff --git a/OpenSim/Region/DataSnapshot/Interfaces/IDataSnapshot.cs b/OpenSim/Region/OptionalModules/DataSnapshot/Interfaces/IDataSnapshot.cs similarity index 100% rename from OpenSim/Region/DataSnapshot/Interfaces/IDataSnapshot.cs rename to OpenSim/Region/OptionalModules/DataSnapshot/Interfaces/IDataSnapshot.cs diff --git a/OpenSim/Region/DataSnapshot/Interfaces/IDataSnapshotProvider.cs b/OpenSim/Region/OptionalModules/DataSnapshot/Interfaces/IDataSnapshotProvider.cs similarity index 100% rename from OpenSim/Region/DataSnapshot/Interfaces/IDataSnapshotProvider.cs rename to OpenSim/Region/OptionalModules/DataSnapshot/Interfaces/IDataSnapshotProvider.cs diff --git a/OpenSim/Region/DataSnapshot/LLSDDiscovery.cs b/OpenSim/Region/OptionalModules/DataSnapshot/LLSDDiscovery.cs similarity index 100% rename from OpenSim/Region/DataSnapshot/LLSDDiscovery.cs rename to OpenSim/Region/OptionalModules/DataSnapshot/LLSDDiscovery.cs diff --git a/OpenSim/Region/DataSnapshot/LandSnapshot.cs b/OpenSim/Region/OptionalModules/DataSnapshot/LandSnapshot.cs similarity index 100% rename from OpenSim/Region/DataSnapshot/LandSnapshot.cs rename to OpenSim/Region/OptionalModules/DataSnapshot/LandSnapshot.cs diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs similarity index 100% rename from OpenSim/Region/DataSnapshot/ObjectSnapshot.cs rename to OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs diff --git a/OpenSim/Region/DataSnapshot/SnapshotStore.cs b/OpenSim/Region/OptionalModules/DataSnapshot/SnapshotStore.cs similarity index 100% rename from OpenSim/Region/DataSnapshot/SnapshotStore.cs rename to OpenSim/Region/OptionalModules/DataSnapshot/SnapshotStore.cs diff --git a/prebuild.xml b/prebuild.xml index d46d178cf3..f47e237a47 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1895,41 +1895,6 @@ - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - From a32187f53a1e72c2bc6c503085c35211e922a4f7 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 4 Sep 2015 15:28:51 -0700 Subject: [PATCH 21/33] Moved UserStatistics feature to OptionalModules too. --- .../UserStatistics/ActiveConnectionsAJAX.cs | 0 .../UserStatistics/Clients_report.cs | 0 .../UserStatistics/Default_Report.cs | 0 .../UserStatistics/HTMLUtil.cs | 0 .../UserStatistics/IStatsReport.cs | 0 .../UserStatistics/LogLinesAJAX.cs | 0 .../UserStatistics/Prototype_distributor.cs | 0 .../UserStatistics/Sessions_Report.cs | 0 .../UserStatistics/SimStatsAJAX.cs | 0 .../UserStatistics/Updater_distributor.cs | 0 .../UserStatistics/WebStatsModule.cs | 3 -- .../UserStatistics/Properties/AssemblyInfo.cs | 33 ------------ prebuild.xml | 50 +------------------ 13 files changed, 2 insertions(+), 84 deletions(-) rename OpenSim/Region/{ => OptionalModules}/UserStatistics/ActiveConnectionsAJAX.cs (100%) rename OpenSim/Region/{ => OptionalModules}/UserStatistics/Clients_report.cs (100%) rename OpenSim/Region/{ => OptionalModules}/UserStatistics/Default_Report.cs (100%) rename OpenSim/Region/{ => OptionalModules}/UserStatistics/HTMLUtil.cs (100%) rename OpenSim/Region/{ => OptionalModules}/UserStatistics/IStatsReport.cs (100%) rename OpenSim/Region/{ => OptionalModules}/UserStatistics/LogLinesAJAX.cs (100%) rename OpenSim/Region/{ => OptionalModules}/UserStatistics/Prototype_distributor.cs (100%) rename OpenSim/Region/{ => OptionalModules}/UserStatistics/Sessions_Report.cs (100%) rename OpenSim/Region/{ => OptionalModules}/UserStatistics/SimStatsAJAX.cs (100%) rename OpenSim/Region/{ => OptionalModules}/UserStatistics/Updater_distributor.cs (100%) rename OpenSim/Region/{ => OptionalModules}/UserStatistics/WebStatsModule.cs (99%) delete mode 100644 OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs diff --git a/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs b/OpenSim/Region/OptionalModules/UserStatistics/ActiveConnectionsAJAX.cs similarity index 100% rename from OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs rename to OpenSim/Region/OptionalModules/UserStatistics/ActiveConnectionsAJAX.cs diff --git a/OpenSim/Region/UserStatistics/Clients_report.cs b/OpenSim/Region/OptionalModules/UserStatistics/Clients_report.cs similarity index 100% rename from OpenSim/Region/UserStatistics/Clients_report.cs rename to OpenSim/Region/OptionalModules/UserStatistics/Clients_report.cs diff --git a/OpenSim/Region/UserStatistics/Default_Report.cs b/OpenSim/Region/OptionalModules/UserStatistics/Default_Report.cs similarity index 100% rename from OpenSim/Region/UserStatistics/Default_Report.cs rename to OpenSim/Region/OptionalModules/UserStatistics/Default_Report.cs diff --git a/OpenSim/Region/UserStatistics/HTMLUtil.cs b/OpenSim/Region/OptionalModules/UserStatistics/HTMLUtil.cs similarity index 100% rename from OpenSim/Region/UserStatistics/HTMLUtil.cs rename to OpenSim/Region/OptionalModules/UserStatistics/HTMLUtil.cs diff --git a/OpenSim/Region/UserStatistics/IStatsReport.cs b/OpenSim/Region/OptionalModules/UserStatistics/IStatsReport.cs similarity index 100% rename from OpenSim/Region/UserStatistics/IStatsReport.cs rename to OpenSim/Region/OptionalModules/UserStatistics/IStatsReport.cs diff --git a/OpenSim/Region/UserStatistics/LogLinesAJAX.cs b/OpenSim/Region/OptionalModules/UserStatistics/LogLinesAJAX.cs similarity index 100% rename from OpenSim/Region/UserStatistics/LogLinesAJAX.cs rename to OpenSim/Region/OptionalModules/UserStatistics/LogLinesAJAX.cs diff --git a/OpenSim/Region/UserStatistics/Prototype_distributor.cs b/OpenSim/Region/OptionalModules/UserStatistics/Prototype_distributor.cs similarity index 100% rename from OpenSim/Region/UserStatistics/Prototype_distributor.cs rename to OpenSim/Region/OptionalModules/UserStatistics/Prototype_distributor.cs diff --git a/OpenSim/Region/UserStatistics/Sessions_Report.cs b/OpenSim/Region/OptionalModules/UserStatistics/Sessions_Report.cs similarity index 100% rename from OpenSim/Region/UserStatistics/Sessions_Report.cs rename to OpenSim/Region/OptionalModules/UserStatistics/Sessions_Report.cs diff --git a/OpenSim/Region/UserStatistics/SimStatsAJAX.cs b/OpenSim/Region/OptionalModules/UserStatistics/SimStatsAJAX.cs similarity index 100% rename from OpenSim/Region/UserStatistics/SimStatsAJAX.cs rename to OpenSim/Region/OptionalModules/UserStatistics/SimStatsAJAX.cs diff --git a/OpenSim/Region/UserStatistics/Updater_distributor.cs b/OpenSim/Region/OptionalModules/UserStatistics/Updater_distributor.cs similarity index 100% rename from OpenSim/Region/UserStatistics/Updater_distributor.cs rename to OpenSim/Region/OptionalModules/UserStatistics/Updater_distributor.cs diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs similarity index 99% rename from OpenSim/Region/UserStatistics/WebStatsModule.cs rename to OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs index 13832084a9..bcb63617e3 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs @@ -50,9 +50,6 @@ using Caps = OpenSim.Framework.Capabilities.Caps; using OSD = OpenMetaverse.StructuredData.OSD; using OSDMap = OpenMetaverse.StructuredData.OSDMap; -[assembly: Addin("WebStats", OpenSim.VersionInfo.VersionNumber)] -[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] - namespace OpenSim.Region.UserStatistics { [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebStatsModule")] diff --git a/OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs b/OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs deleted file mode 100644 index 9fac53e12c..0000000000 --- a/OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Region.UserStatistics")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("http://opensimulator.org")] -[assembly: AssemblyProduct("OpenSim")] -[assembly: AssemblyCopyright("OpenSimulator developers")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("42b28288-5fdd-478f-8903-8dccbbb2d5f9")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.8.2.*")] - diff --git a/prebuild.xml b/prebuild.xml index f47e237a47..0daf6a403f 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1500,6 +1500,7 @@ ../../../bin/ + @@ -1508,6 +1509,7 @@ + @@ -2267,54 +2269,6 @@ - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From d7f22fb2cca6f8b682e9a4de26265ea3d1762e45 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 4 Sep 2015 15:48:59 -0700 Subject: [PATCH 22/33] POSScene wasn't really a region module. Fixed now. --- OpenSim/Region/PhysicsModules/POS/POSScene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/PhysicsModules/POS/POSScene.cs b/OpenSim/Region/PhysicsModules/POS/POSScene.cs index f47d245015..6375f18a96 100644 --- a/OpenSim/Region/PhysicsModules/POS/POSScene.cs +++ b/OpenSim/Region/PhysicsModules/POS/POSScene.cs @@ -38,7 +38,7 @@ using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.PhysicsModule.POS { [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "POSPhysicsScene")] - public class POSScene : PhysicsScene + public class POSScene : PhysicsScene, INonSharedRegionModule { private List _characters = new List(); private List _prims = new List(); From 2210c5807f9d75eab87098c7d2c49d67543043e3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 4 Sep 2015 16:33:07 -0700 Subject: [PATCH 23/33] Fixes a problem with Bullet physics when it is configured to run on a separate thread. --- OpenSim/Region/PhysicsModules/BulletS/BSScene.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs index db4d3cf72d..452ce55509 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs @@ -270,6 +270,8 @@ namespace OpenSim.Region.PhysicsModule.BulletS mesher = scene.RequestModuleInterface(); if (mesher == null) m_log.WarnFormat("{0} No mesher. Things will not work well.", LogHeader); + + scene.PhysicsEnabled = true; } #endregion From 4b0dc6253cf6c8e1c30f930aa062dac47487fd52 Mon Sep 17 00:00:00 2001 From: dahlia Date: Sat, 5 Sep 2015 01:58:59 -0700 Subject: [PATCH 24/33] Best wishes everyone! --- CONTRIBUTORS.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index e14e5efcc1..41c22b8436 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -4,8 +4,7 @@ The following people have contributed to OpenSim (Thank you for your effort!) These folks represent the current core team for OpenSim, and are the people that make the day to day of OpenSim happen. -* justincc (OSVW Consulting, justincc.org) -* dahlia +* justincc (OSVW Consulting, justincc.org) * Melanie Thielker * Diva (Crista Lopes, University of California, Irvine) * BlueWall (James Hughes) @@ -56,6 +55,7 @@ where we are today. * nlin (3Di) * John Hurliman * chi11ken (Genkii) +* dahlia = Additional OpenSim Contributors = From 13b1c5dfcef6e6e74709da8d588ed48d99d560d2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 5 Sep 2015 17:50:55 +0100 Subject: [PATCH 25/33] let ode suport var size regions Signed-off-by: Diva Canto --- .../Ode/ODERayCastRequestManager.cs | 7 + OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | 290 +++++++++--------- 2 files changed, 144 insertions(+), 153 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs index 21bfea3eff..aafc7c6a46 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs @@ -172,6 +172,13 @@ namespace OpenSim.Region.PhysicsModule.ODE /// private void RayCast(ODERayCastRequest req) { + // UBIT: limit ray lenght or collisions will take all avaiable stack space + // this value may still be too large, depending on machine configuration + // of maximum stack + float len = req.length; + if (len > 250f) + len = 250f; + // Create the ray IntPtr ray = d.CreateRay(m_scene.space, req.length); d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index f49b0f74e8..19b957f11d 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs @@ -25,6 +25,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// Ubit changes for varsize regions +// note that raycasts need to have limited range +// (even in normal regions) +// or aplication thread stack may just blowup +// see RayCast(ODERayCastRequest req) + //#define USE_DRAWSTUFF //#define SPAM @@ -270,8 +276,10 @@ namespace OpenSim.Region.PhysicsModule.ODE private Random fluidRandomizer = new Random(Environment.TickCount); - private const uint m_regionWidth = Constants.RegionSize; - private const uint m_regionHeight = Constants.RegionSize; + public bool m_suportCombine = true; + + private uint m_regionWidth = Constants.RegionSize; + private uint m_regionHeight = Constants.RegionSize; private float ODE_STEPSIZE = 0.0178f; private float metersInSpace = 29.9f; @@ -297,7 +305,7 @@ namespace OpenSim.Region.PhysicsModule.ODE private IntPtr contactgroup; - internal IntPtr WaterGeom; +// internal IntPtr WaterGeom; private float nmTerrainContactFriction = 255.0f; private float nmTerrainContactBounce = 0.1f; @@ -514,17 +522,17 @@ namespace OpenSim.Region.PhysicsModule.ODE public d.Vector3 xyz = new d.Vector3(128.1640f, 128.3079f, 25.7600f); public d.Vector3 hpr = new d.Vector3(125.5000f, -17.0000f, 0.0000f); - // TODO: unused: private uint heightmapWidth = m_regionWidth + 1; - // TODO: unused: private uint heightmapHeight = m_regionHeight + 1; - // TODO: unused: private uint heightmapWidthSamples; - // TODO: unused: private uint heightmapHeightSamples; - private volatile int m_global_contactcount = 0; private Vector3 m_worldOffset = Vector3.Zero; public Vector2 WorldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize); private PhysicsScene m_parentScene = null; + float spacesPerMeterX; + float spacesPerMeterY; + int spaceGridMaxX; + int spaceGridMaxY; + private ODERayCastRequestManager m_rayCastManager; @@ -583,10 +591,12 @@ namespace OpenSim.Region.PhysicsModule.ODE scene.RegisterModuleInterface(this); Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); - Initialise(); + Initialise(extent); InitialiseFromConfig(m_config); + + // This may not be that good since terrain may not be avaiable at this point base.Initialise(scene.PhysicsRequestAsset, - (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[Constants.RegionSize * Constants.RegionSize]), + (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[(int)(extent.X * extent.Y)]), (float)scene.RegionInfo.RegionSettings.WaterHeight); } @@ -613,8 +623,15 @@ namespace OpenSim.Region.PhysicsModule.ODE /// Sets many properties that ODE requires to be stable /// These settings need to be tweaked 'exactly' right or weird stuff happens. /// - private void Initialise() + private void Initialise(Vector3 regionExtent) { + WorldExtents.X = regionExtent.X; + m_regionWidth = (uint)regionExtent.X; + WorldExtents.Y = regionExtent.Y; + m_regionHeight = (uint)regionExtent.Y; + + m_suportCombine = false; + nearCallback = near; triCallback = TriCallback; triArrayCallback = TriArrayCallback; @@ -633,7 +650,7 @@ namespace OpenSim.Region.PhysicsModule.ODE viewthread.Start(); #endif - _watermap = new float[258 * 258]; + // _watermap = new float[258 * 258]; // Zero out the prim spaces array (we split our space into smaller spaces so // we can hit test less. @@ -780,7 +797,31 @@ namespace OpenSim.Region.PhysicsModule.ODE contacts = new d.ContactGeom[contactsPerCollision]; - staticPrimspace = new IntPtr[(int)(300 / metersInSpace), (int)(300 / metersInSpace)]; + spacesPerMeterX = 1.0f / metersInSpace; + spacesPerMeterY = 1.0f / metersInSpace; + + spaceGridMaxX = (int)(WorldExtents.X * spacesPerMeterX); + spaceGridMaxY = (int)(WorldExtents.Y * spacesPerMeterY); + + // ubit: limit number of spaces + if (spaceGridMaxX > 24) + { + spaceGridMaxX = 24; + spacesPerMeterX = spaceGridMaxX / WorldExtents.X; + } + if (spaceGridMaxY > 24) + { + spaceGridMaxY = 24; + spacesPerMeterY = spaceGridMaxY / WorldExtents.Y ; + } + + staticPrimspace = new IntPtr[spaceGridMaxX, spaceGridMaxY]; + + // make this index limits + spaceGridMaxX--; + spaceGridMaxY--; + + // Centeral contact friction and bounce // ckrinke 11/10/08 Enabling soft_erp but not soft_cfm until I figure out why @@ -1964,6 +2005,8 @@ namespace OpenSim.Region.PhysicsModule.ODE public override void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) { + if (!m_suportCombine) + return; m_worldOffset = offset; WorldExtents = new Vector2(extents.X, extents.Y); m_parentScene = pScene; @@ -1972,12 +2015,17 @@ namespace OpenSim.Region.PhysicsModule.ODE // Recovered for use by fly height. Kitto Flora internal float GetTerrainHeightAtXY(float x, float y) { - int offsetX = ((int)(x / (int)Constants.RegionSize)) * (int)Constants.RegionSize; - int offsetY = ((int)(y / (int)Constants.RegionSize)) * (int)Constants.RegionSize; - IntPtr heightFieldGeom = IntPtr.Zero; + int offsetX = 0; + int offsetY = 0; - if (RegionTerrain.TryGetValue(new Vector3(offsetX,offsetY,0), out heightFieldGeom)) + if (m_suportCombine) + { + offsetX = ((int)(x / (int)Constants.RegionSize)) * (int)Constants.RegionSize; + offsetY = ((int)(y / (int)Constants.RegionSize)) * (int)Constants.RegionSize; + } + + if(RegionTerrain.TryGetValue(new Vector3(offsetX,offsetY,0), out heightFieldGeom)) { if (heightFieldGeom != IntPtr.Zero) { @@ -1991,8 +2039,8 @@ namespace OpenSim.Region.PhysicsModule.ODE (int)x < 0.001f || (int)y < 0.001f) return 0; - x = x - offsetX; - y = y - offsetY; + x = x - offsetX + 1f; + y = y - offsetY + 1f; index = (int)((int)x * ((int)Constants.RegionSize + 2) + (int)y); @@ -2828,16 +2876,16 @@ namespace OpenSim.Region.PhysicsModule.ODE { int[] returnint = new int[2]; - returnint[0] = (int) (pos.X/metersInSpace); + returnint[0] = (int) (pos.X * spacesPerMeterX); - if (returnint[0] > ((int) (259f/metersInSpace))) - returnint[0] = ((int) (259f/metersInSpace)); + if (returnint[0] > spaceGridMaxX) + returnint[0] = spaceGridMaxX; if (returnint[0] < 0) returnint[0] = 0; - returnint[1] = (int) (pos.Y/metersInSpace); - if (returnint[1] > ((int) (259f/metersInSpace))) - returnint[1] = ((int) (259f/metersInSpace)); + returnint[1] = (int)(pos.Y * spacesPerMeterY); + if (returnint[1] > spaceGridMaxY) + returnint[1] = spaceGridMaxY; if (returnint[1] < 0) returnint[1] = 0; @@ -3591,6 +3639,7 @@ namespace OpenSim.Region.PhysicsModule.ODE get { return false; } } +/* godd try.. but not a fix #region ODE Specific Terrain Fixes private float[] ResizeTerrain512NearestNeighbour(float[] heightMap) { @@ -3857,7 +3906,7 @@ namespace OpenSim.Region.PhysicsModule.ODE } #endregion - +*/ public override void SetTerrain(float[] heightMap) { if (m_worldOffset != Vector3.Zero && m_parentScene != null) @@ -3878,71 +3927,65 @@ namespace OpenSim.Region.PhysicsModule.ODE int startTime = Util.EnvironmentTickCount(); m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0} with offset {1}", PhysicsSceneName, pOffset); - // this._heightmap[i] = (double)heightMap[i]; - // dbm (danx0r) -- creating a buffer zone of one extra sample all around - //_origheightmap = heightMap; - + float[] _heightmap; - // zero out a heightmap array float array (single dimension [flattened])) - //if ((int)Constants.RegionSize == 256) - // _heightmap = new float[514 * 514]; - //else + // ok im lasy this are just a aliases + uint regionsizeX = m_regionWidth; + uint regionsizeY = m_regionHeight; - _heightmap = new float[(((int)Constants.RegionSize + 2) * ((int)Constants.RegionSize + 2))]; + // map is rotated + uint heightmapWidth = regionsizeY + 2; + uint heightmapHeight = regionsizeX + 2; - uint heightmapWidth = Constants.RegionSize + 1; - uint heightmapHeight = Constants.RegionSize + 1; + uint heightmapWidthSamples = heightmapWidth + 1; + uint heightmapHeightSamples = heightmapHeight + 1; - uint heightmapWidthSamples; + _heightmap = new float[heightmapWidthSamples * heightmapHeightSamples]; - uint heightmapHeightSamples; - - //if (((int)Constants.RegionSize) == 256) - //{ - // heightmapWidthSamples = 2 * (uint)Constants.RegionSize + 2; - // heightmapHeightSamples = 2 * (uint)Constants.RegionSize + 2; - // heightmapWidth++; - // heightmapHeight++; - //} - //else - //{ - - heightmapWidthSamples = (uint)Constants.RegionSize + 1; - heightmapHeightSamples = (uint)Constants.RegionSize + 1; - //} const float scale = 1.0f; const float offset = 0.0f; - const float thickness = 0.2f; + const float thickness = 10f; const int wrap = 0; - int regionsize = (int) Constants.RegionSize + 2; - //Double resolution - //if (((int)Constants.RegionSize) == 256) - // heightMap = ResizeTerrain512Interpolation(heightMap); + + float hfmin = float.MaxValue; + float hfmax = float.MinValue; + float val; + uint xx; + uint yy; + + uint maxXX = regionsizeX - 1; + uint maxYY = regionsizeY - 1; + + // flipping map adding one margin all around so things don't fall in edges + + uint xt = 0; + xx = 0; - // if (((int)Constants.RegionSize) == 256 && (int)Constants.RegionSize == 256) - // regionsize = 512; - - float hfmin = 2000; - float hfmax = -2000; - - for (int x = 0; x < heightmapWidthSamples; x++) + for (uint x = 0; x < heightmapWidthSamples; x++) { - for (int y = 0; y < heightmapHeightSamples; y++) + if (x > 1 && xx < maxXX) + xx++; + yy = 0; + for (uint y = 0; y < heightmapHeightSamples; y++) { - int xx = Util.Clip(x - 1, 0, regionsize - 1); - int yy = Util.Clip(y - 1, 0, regionsize - 1); - - - float val= heightMap[yy * (int)Constants.RegionSize + xx]; - _heightmap[x * ((int)Constants.RegionSize + 2) + y] = val; - - hfmin = (val < hfmin) ? val : hfmin; - hfmax = (val > hfmax) ? val : hfmax; + if (y > 1 && y < maxYY) + yy += regionsizeX; + + val = heightMap[yy + xx]; + if (val < 0.0f) + val = 0.0f; + _heightmap[xt + y] = val; + + if (hfmin > val) + hfmin = val; + if (hfmax < val) + hfmax = val; } + xt += heightmapHeightSamples; } lock (OdeLock) @@ -3963,9 +4006,10 @@ namespace OpenSim.Region.PhysicsModule.ODE } IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); - d.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmap, 0, heightmapWidth + 1, heightmapHeight + 1, - (int)heightmapWidthSamples + 1, (int)heightmapHeightSamples + 1, scale, + d.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmap, 0, heightmapWidth, heightmapHeight, + (int)heightmapWidthSamples, (int)heightmapHeightSamples, scale, offset, thickness, wrap); + d.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1); GroundGeom = d.CreateHeightfield(space, HeightmapData, 1); if (GroundGeom != IntPtr.Zero) @@ -3980,17 +4024,15 @@ namespace OpenSim.Region.PhysicsModule.ODE Quaternion q1 = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), 1.5707f); Quaternion q2 = Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), 1.5707f); - //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1)); q1 = q1 * q2; - //q1 = q1 * q3; Vector3 v3; float angle; q1.GetAxisAngle(out v3, out angle); d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); d.GeomSetRotation(GroundGeom, ref R); - d.GeomSetPosition(GroundGeom, (pOffset.X + ((int)Constants.RegionSize * 0.5f)), (pOffset.Y + ((int)Constants.RegionSize * 0.5f)), 0); + d.GeomSetPosition(GroundGeom, pOffset.X + regionsizeX * 0.5f, pOffset.Y + regionsizeY * 0.5f, 0); IntPtr testGround = IntPtr.Zero; if (RegionTerrain.TryGetValue(pOffset, out testGround)) { @@ -4015,89 +4057,31 @@ namespace OpenSim.Region.PhysicsModule.ODE public override bool SupportsCombining() { - return true; + return m_suportCombine; } -// public override void UnCombine(PhysicsScene pScene) -// { -// IntPtr localGround = IntPtr.Zero; -//// float[] localHeightfield; -// bool proceed = false; -// List geomDestroyList = new List(); -// -// lock (OdeLock) -// { -// if (RegionTerrain.TryGetValue(Vector3.Zero, out localGround)) -// { -// foreach (IntPtr geom in TerrainHeightFieldHeights.Keys) -// { -// if (geom == localGround) -// { -//// localHeightfield = TerrainHeightFieldHeights[geom]; -// proceed = true; -// } -// else -// { -// geomDestroyList.Add(geom); -// } -// } -// -// if (proceed) -// { -// m_worldOffset = Vector3.Zero; -// WorldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize); -// m_parentScene = null; -// -// foreach (IntPtr g in geomDestroyList) -// { -// // removingHeightField needs to be done or the garbage collector will -// // collect the terrain data before we tell ODE to destroy it causing -// // memory corruption -// if (TerrainHeightFieldHeights.ContainsKey(g)) -// { -//// float[] removingHeightField = TerrainHeightFieldHeights[g]; -// TerrainHeightFieldHeights.Remove(g); -// -// if (RegionTerrain.ContainsKey(g)) -// { -// RegionTerrain.Remove(g); -// } -// -// d.GeomDestroy(g); -// //removingHeightField = new float[0]; -// } -// } -// -// } -// else -// { -// m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data."); -// } -// } -// } -// } - public override void SetWaterLevel(float baseheight) { waterlevel = baseheight; - randomizeWater(waterlevel); +// randomizeWater(waterlevel); } +/* private void randomizeWater(float baseheight) { - const uint heightmapWidth = m_regionWidth + 2; - const uint heightmapHeight = m_regionHeight + 2; - const uint heightmapWidthSamples = m_regionWidth + 2; - const uint heightmapHeightSamples = m_regionHeight + 2; - const float scale = 1.0f; - const float offset = 0.0f; - const float thickness = 2.9f; - const int wrap = 0; + uint heightmapWidth = m_regionWidth + 2; + uint heightmapHeight = m_regionHeight + 2; + uint heightmapWidthSamples = m_regionWidth + 2; + uint heightmapHeightSamples = m_regionHeight + 2; + float scale = 1.0f; + float offset = 0.0f; + float thickness = 2.9f; + int wrap = 0; for (int i = 0; i < (258 * 258); i++) { _watermap[i] = (baseheight-0.1f) + ((float)fluidRandomizer.Next(1,9) / 10f); - // m_log.Info((baseheight - 0.1f) + ((float)fluidRandomizer.Next(1, 9) / 10f)); + // m_log.Info((baseheight - 0.1f) + ((float)fluidRandomizer.Next(1, 9) / 10f)); } lock (OdeLock) @@ -4108,8 +4092,8 @@ namespace OpenSim.Region.PhysicsModule.ODE } IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); d.GeomHeightfieldDataBuildSingle(HeightmapData, _watermap, 0, heightmapWidth, heightmapHeight, - (int)heightmapWidthSamples, (int)heightmapHeightSamples, scale, - offset, thickness, wrap); + (int)heightmapWidthSamples, (int)heightmapHeightSamples, scale, + offset, thickness, wrap); d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight); WaterGeom = d.CreateHeightfield(space, HeightmapData, 1); if (WaterGeom != IntPtr.Zero) @@ -4137,7 +4121,7 @@ namespace OpenSim.Region.PhysicsModule.ODE d.GeomSetPosition(WaterGeom, 128, 128, 0); } } - +*/ public override void Dispose() { _worldInitialized = false; From c2346a082336ee8ab50d86b04007389adad64f45 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 5 Sep 2015 10:28:44 -0700 Subject: [PATCH 26/33] Changed a couple of comments to be more generic --- OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs | 2 +- OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs index aafc7c6a46..cd5dbf8ea6 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs @@ -172,7 +172,7 @@ namespace OpenSim.Region.PhysicsModule.ODE /// private void RayCast(ODERayCastRequest req) { - // UBIT: limit ray lenght or collisions will take all avaiable stack space + // NOTE: limit ray lenght or collisions will take all avaiable stack space // this value may still be too large, depending on machine configuration // of maximum stack float len = req.length; diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index 19b957f11d..88d4d157ea 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs @@ -25,7 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// Ubit changes for varsize regions +// changes for varsize regions // note that raycasts need to have limited range // (even in normal regions) // or aplication thread stack may just blowup @@ -803,7 +803,7 @@ namespace OpenSim.Region.PhysicsModule.ODE spaceGridMaxX = (int)(WorldExtents.X * spacesPerMeterX); spaceGridMaxY = (int)(WorldExtents.Y * spacesPerMeterY); - // ubit: limit number of spaces + // note: limit number of spaces if (spaceGridMaxX > 24) { spaceGridMaxX = 24; From 5bfc2743c68a74ad59d9ae5e3e73fef58e17bf89 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 5 Sep 2015 15:20:32 -0700 Subject: [PATCH 27/33] Deleted unused file. --- OpenSim/Framework/ForeignUserProfileData.cs | 77 --------------------- 1 file changed, 77 deletions(-) delete mode 100644 OpenSim/Framework/ForeignUserProfileData.cs diff --git a/OpenSim/Framework/ForeignUserProfileData.cs b/OpenSim/Framework/ForeignUserProfileData.cs deleted file mode 100644 index 2beaf80f80..0000000000 --- a/OpenSim/Framework/ForeignUserProfileData.cs +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; - -namespace OpenSim.Framework -{ - public class ForeignUserProfileData : UserProfileData - { - /// - /// The address of the users home sim, used for foreigners. - /// - private string _userUserServerURI = String.Empty; - - /// - /// The address of the users home sim, used for foreigners. - /// - private string _userHomeAddress = String.Empty; - - /// - /// The port of the users home sim, used for foreigners. - /// - private string _userHomePort = String.Empty; - /// - /// The remoting port of the users home sim, used for foreigners. - /// - private string _userHomeRemotingPort = String.Empty; - - public string UserServerURI - { - get { return _userUserServerURI; } - set { _userUserServerURI = value; } - } - - public string UserHomeAddress - { - get { return _userHomeAddress; } - set { _userHomeAddress = value; } - } - - public string UserHomePort - { - get { return _userHomePort; } - set { _userHomePort = value; } - } - - public string UserHomeRemotingPort - { - get { return _userHomeRemotingPort; } - set { _userHomeRemotingPort = value; } - } - } -} From 3cf07564b6d4e72f6193f5affdcb0dc14624991a Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 5 Sep 2015 17:37:07 -0700 Subject: [PATCH 28/33] Moved the two region loaders into the RegionLoaderPlugin dll, therefore eliminating 2 top-level dlls that didn't make much sense. --- .../LoadRegions}/IRegionLoader.cs | 0 .../LoadRegions/LoadRegionsPlugin.cs | 2 - .../LoadRegions}/RegionLoaderFileSystem.cs | 3 +- .../LoadRegions}/RegionLoaderWebServer.cs | 3 +- prebuild.xml | 52 ------------------- 5 files changed, 4 insertions(+), 56 deletions(-) rename OpenSim/{Framework => ApplicationPlugins/LoadRegions}/IRegionLoader.cs (100%) rename OpenSim/{Framework/RegionLoader/Filesystem => ApplicationPlugins/LoadRegions}/RegionLoaderFileSystem.cs (98%) rename OpenSim/{Framework/RegionLoader/Web => ApplicationPlugins/LoadRegions}/RegionLoaderWebServer.cs (98%) diff --git a/OpenSim/Framework/IRegionLoader.cs b/OpenSim/ApplicationPlugins/LoadRegions/IRegionLoader.cs similarity index 100% rename from OpenSim/Framework/IRegionLoader.cs rename to OpenSim/ApplicationPlugins/LoadRegions/IRegionLoader.cs diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index 74d9ae4bbf..89224a64a8 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs @@ -32,8 +32,6 @@ using System.Threading; using log4net; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.RegionLoader.Filesystem; -using OpenSim.Framework.RegionLoader.Web; using OpenSim.Region.CoreModules.Agent.AssetTransaction; using OpenSim.Region.CoreModules.Avatar.InstantMessage; using OpenSim.Region.CoreModules.Scripting.DynamicTexture; diff --git a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs similarity index 98% rename from OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs rename to OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs index 8332c14478..1873a0658e 100644 --- a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs @@ -31,8 +31,9 @@ using System.Collections.Generic; using System.IO; using System.Reflection; using Nini.Config; +using OpenSim.Framework; -namespace OpenSim.Framework.RegionLoader.Filesystem +namespace OpenSim.ApplicationPlugins.LoadRegions { public class RegionLoaderFileSystem : IRegionLoader { diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderWebServer.cs similarity index 98% rename from OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs rename to OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderWebServer.cs index f60bb121c3..850f3e08d2 100644 --- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderWebServer.cs @@ -32,8 +32,9 @@ using System.Reflection; using System.Xml; using log4net; using Nini.Config; +using OpenSim.Framework; -namespace OpenSim.Framework.RegionLoader.Web +namespace OpenSim.ApplicationPlugins.LoadRegions { public class RegionLoaderWebServer : IRegionLoader { diff --git a/prebuild.xml b/prebuild.xml index 0daf6a403f..7b17001bea 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -325,58 +325,6 @@ - - - - ../../../../bin/ - - - - - ../../../../bin/ - - - - ../../../../bin/ - - - - - - - - - - - - - - - - - ../../../../bin/ - - - - - ../../../../bin/ - - - - ../../../../bin/ - - - - - - - - - - - - - From f928d41a275daf661a4d0df0e6bebd33a52d79a6 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 5 Sep 2015 17:40:27 -0700 Subject: [PATCH 29/33] Amend to previous commit: delete the corresponding AssemblyInfo's --- .../Filesystem/Properties/AssemblyInfo.cs | 33 ------------------- .../Web/Properties/AssemblyInfo.cs | 33 ------------------- 2 files changed, 66 deletions(-) delete mode 100644 OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs delete mode 100644 OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs diff --git a/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs b/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs deleted file mode 100644 index 3bcbe2fa71..0000000000 --- a/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Framework.RegionLoader.Filesystem")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("http://opensimulator.org")] -[assembly: AssemblyProduct("OpenSim")] -[assembly: AssemblyCopyright("OpenSimulator developers")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("4ab5c74b-e886-40a1-b67d-a04df285e706")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.8.2.*")] - diff --git a/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs b/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs deleted file mode 100644 index 1b2519cb61..0000000000 --- a/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Framework.RegionLoader.Web")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("http://opensimulator.org")] -[assembly: AssemblyProduct("OpenSim")] -[assembly: AssemblyCopyright("OpenSimulator developers")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("985afff8-e7ed-4056-acce-39abf7a43d33")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.8.2.*")] - From 4f208b6282174bf19a5d9c6802f90900c0e74ec8 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 6 Sep 2015 09:31:35 -0700 Subject: [PATCH 30/33] Related to previous commits: fixed namespace. --- OpenSim/ApplicationPlugins/LoadRegions/IRegionLoader.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/ApplicationPlugins/LoadRegions/IRegionLoader.cs b/OpenSim/ApplicationPlugins/LoadRegions/IRegionLoader.cs index c566fc7916..2d1505dbe5 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/IRegionLoader.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/IRegionLoader.cs @@ -26,8 +26,9 @@ */ using Nini.Config; +using OpenSim.Framework; -namespace OpenSim.Framework +namespace OpenSim.ApplicationPlugins.LoadRegions { public interface IRegionLoader { From 82ea4179da7ea32ea2efbd1cb209c77d5871b3fd Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 6 Sep 2015 10:00:20 -0700 Subject: [PATCH 31/33] Clean up viewer-based access control specifications. --- OpenSim/Region/Framework/Scenes/Scene.cs | 10 ++-- .../HypergridService/GatekeeperService.cs | 7 ++- .../Services/LLLoginService/LLLoginService.cs | 8 ++- bin/OpenSim.ini.example | 7 +-- bin/OpenSimDefaults.ini | 8 +++ bin/Robust.HG.ini.example | 54 +++++++------------ bin/Robust.ini.example | 38 +++++++------ 7 files changed, 71 insertions(+), 61 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8c2f45e9e8..dce2247dc5 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1051,11 +1051,11 @@ namespace OpenSim.Region.Framework.Scenes } } - string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "Startup" }; + string[] possibleAccessControlConfigSections = new string[] { "Startup", "AccessControl"}; string grant = Util.GetConfigVarFromSections( - config, "AllowedClients", possibleAccessControlConfigSections, ""); + config, "AllowedClients", possibleAccessControlConfigSections, string.Empty); if (grant.Length > 0) { @@ -1067,7 +1067,11 @@ namespace OpenSim.Region.Framework.Scenes grant = Util.GetConfigVarFromSections( - config, "BannedClients", possibleAccessControlConfigSections, ""); + config, "DeniedClients", possibleAccessControlConfigSections, String.Empty); + // Deal with the mess of someone having used a different word at some point + if (grant == String.Empty) + grant = Util.GetConfigVarFromSections( + config, "BannedClients", possibleAccessControlConfigSections, String.Empty); if (grant.Length > 0) { diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 44b26d5ac2..87c681033d 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -131,8 +131,11 @@ namespace OpenSim.Services.HypergridService else if (simulationService != string.Empty) m_SimulationService = ServerUtils.LoadPlugin(simulationService, args); - m_AllowedClients = serverConfig.GetString("AllowedClients", string.Empty); - m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty); + string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "GatekeeperService" }; + m_AllowedClients = Util.GetConfigVarFromSections( + config, "AllowedClients", possibleAccessControlConfigSections, string.Empty); + m_DeniedClients = Util.GetConfigVarFromSections( + config, "DeniedClients", possibleAccessControlConfigSections, string.Empty); m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions); diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index d67bc4df25..10c2e8cb94 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -123,8 +123,12 @@ namespace OpenSim.Services.LLLoginService m_DestinationGuide = m_LoginServerConfig.GetString ("DestinationGuide", string.Empty); m_AvatarPicker = m_LoginServerConfig.GetString ("AvatarPicker", string.Empty); - m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty); - m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty); + string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "LoginService" }; + m_AllowedClients = Util.GetConfigVarFromSections( + config, "AllowedClients", possibleAccessControlConfigSections, string.Empty); + m_DeniedClients = Util.GetConfigVarFromSections( + config, "DeniedClients", possibleAccessControlConfigSections, string.Empty); + m_MessageUrl = m_LoginServerConfig.GetString("MessageUrl", string.Empty); m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time"); diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 71e76dbe8e..f5268bdb10 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -308,9 +308,9 @@ ;; - "Imprudence" has access ;; - "Imprudence 1.3" has access ;; - "Imprudence 1.3.1" has no access - ; AllowedClients = + ; AllowedClients = "" - ;# {BannedClients} {} {Bar (|) separated list of banned clients} {} + ;# {DeniedClients} {} {Bar (|) separated list of denied clients} {} ;; Bar (|) separated list of viewers which may not gain access to the regions. ;; One can use a Substring of the viewer name to disable only certain ;; versions @@ -318,7 +318,8 @@ ;; - "Imprudence" has no access ;; - "Imprudence 1.3" has no access ;; - "Imprudence 1.3.1" has access - ; BannedClients = + ;; + ; DeniedClients = "" [Map] diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index c0c81346ff..963eeffe07 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -531,6 +531,14 @@ ; many simultaneous requests, default is 30 and is currently applied only to assets ;MaxRequestConcurrency = 30 +[AccessControl] + ; Viewer-based access control. |-separated list of allowed viewers. + ; AllowedClients = "" + + ; Viewer-based access control. |-separated list of denied viewers. + ; No restrictions by default. + ; DeniedClients = "" + [ClientStack.LindenUDP] ; Set this to true to process incoming packets asynchronously. Networking is diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 36025d5fba..82eaf1ffa8 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -184,6 +184,26 @@ ;; This is a default that can be overwritten in some sections. ; GatekeeperURI = "${Const|BaseURL}:${Const|PublicPort}" +[AccessControl] + ;# {AllowedClients} {} {Bar (|) separated list of allowed clients} {} + ;; Bar (|) separated list of viewers which may gain access to the regions. + ;; One can use a substring of the viewer name to enable only certain + ;; versions + ;; Example: Agent uses the viewer "Imprudence 1.3.2.0" + ;; - "Imprudence" has access + ;; - "Imprudence 1.3" has access + ;; - "Imprudence 1.3.1" has no access + ; AllowedClients = "" + + ;# {DeniedClients} {} {Bar (|) separated list of denied clients} {} + ;; Bar (|) separated list of viewers which may not gain access to the regions. + ;; One can use a Substring of the viewer name to disable only certain + ;; versions + ;; Example: Agent uses the viewer "Imprudence 1.3.2.0" + ;; - "Imprudence" has no access + ;; - "Imprudence 1.3" has no access + ;; - "Imprudence 1.3.1" has access + ; DeniedClients = "" [DatabaseService] ; PGSQL @@ -482,23 +502,6 @@ SRV_IMServerURI = "${Const|BaseURL}:${Const|PublicPort}" SRV_GroupsServerURI = "${Const|BaseURL}:${Const|PublicPort}" - ;; Regular expressions for controlling which client versions are accepted/denied. - ;; An empty string means nothing is checked. - ;; - ;; Example 1: allow only these 3 types of clients (any version of them) - ;; AllowedClients = "Imprudence|Hippo|Second Life" - ;; - ;; Example 2: allow all clients except these - ;; DeniedClients = "Twisted|Crawler|Cryolife|FuckLife|StreetLife|GreenLife|AntiLife|KORE-Phaze|Synlyfe|Purple Second Life|SecondLi |Emerald" - ;; - ;; Note that these are regular expressions, so every character counts. - ;; Also note that this is very weak security and should not be trusted as a reliable means - ;; for keeping bad clients out; modified clients can fake their identifiers. - ;; - ;; - ;AllowedClients = "" - ;DeniedClients = "" - ;# {DSTZone} {} {Override Daylight Saving Time rules} {* none local} "America/Los_Angeles;Pacific Standard Time" ;; Viewers do not receive timezone information from the server - almost all (?) default to Pacific Standard Time ;; However, they do rely on the server to tell them whether it's Daylight Saving Time or not. @@ -595,23 +598,6 @@ ; If you run this gatekeeper server behind a proxy, set this to true ; HasProxy = false - ;; Regular expressions for controlling which client versions are accepted/denied. - ;; An empty string means nothing is checked. - ;; - ;; Example 1: allow only these 3 types of clients (any version of them) - ;; AllowedClients = "Imprudence|Hippo|Second Life" - ;; - ;; Example 2: allow all clients except these - ;; DeniedClients = "Twisted|Crawler|Cryolife|FuckLife|StreetLife|GreenLife|AntiLife|KORE-Phaze|Synlyfe|Purple Second Life|SecondLi |Emerald" - ;; - ;; Note that these are regular expressions, so every character counts. - ;; Also note that this is very weak security and should not be trusted as a reliable means - ;; for keeping bad clients out; modified clients can fake their identifiers. - ;; - ;; - ;AllowedClients = "" - ;DeniedClients = "" - ;; Are foreign visitors allowed? ;ForeignAgentsAllowed = true ;; diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 284e9699e1..8d6496db6a 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -145,6 +145,27 @@ ;ConsolePass = secret ;ConsolePort = 0 +[AccessControl] + ;# {AllowedClients} {} {Bar (|) separated list of allowed clients} {} + ;; Bar (|) separated list of viewers which may gain access to the regions. + ;; One can use a substring of the viewer name to enable only certain + ;; versions + ;; Example: Agent uses the viewer "Imprudence 1.3.2.0" + ;; - "Imprudence" has access + ;; - "Imprudence 1.3" has access + ;; - "Imprudence 1.3.1" has no access + ; AllowedClients = "" + + ;# {DeniedClients} {} {Bar (|) separated list of denied clients} {} + ;; Bar (|) separated list of viewers which may not gain access to the regions. + ;; One can use a Substring of the viewer name to disable only certain + ;; versions + ;; Example: Agent uses the viewer "Imprudence 1.3.2.0" + ;; - "Imprudence" has no access + ;; - "Imprudence 1.3" has no access + ;; - "Imprudence 1.3.1" has access + ; DeniedClients = "" + [DatabaseService] ; PGSQL @@ -431,23 +452,6 @@ ; If you run this login server behind a proxy, set this to true ; HasProxy = false - ;; Regular expressions for controlling which client versions are accepted/denied. - ;; An empty string means nothing is checked. - ;; - ;; Example 1: allow only these 3 types of clients (any version of them) - ;; AllowedClients = "Imprudence|Hippo|Second Life" - ;; - ;; Example 2: allow all clients except these - ;; DeniedClients = "Twisted|Crawler|Cryolife|FuckLife|StreetLife|GreenLife|AntiLife|KORE-Phaze|Synlyfe|Purple Second Life|SecondLi |Emerald" - ;; - ;; Note that these are regular expressions, so every character counts. - ;; Also note that this is very weak security and should not be trusted as a reliable means - ;; for keeping bad clients out; modified clients can fake their identifiers. - ;; - ;; - ;AllowedClients = "" - ;DeniedClients = "" - ;# {DSTZone} {} {Override Daylight Saving Time rules} {* none local} "America/Los_Angeles;Pacific Standard Time" ;; Viewers do not listen to timezone sent by the server. They use Pacific Standard Time instead, ;; but rely on the server to calculate Daylight Saving Time. Sending another DST than US Pacific From 3a72e755b900c39248f1d12092ffbb91a7f28a0d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 6 Sep 2015 10:02:16 -0700 Subject: [PATCH 32/33] Deleted access control spec from [LoginService] section of standalone config. It's in OpenSim.ini now under [AccessControl]. Backwards compatibility preserved. --- bin/config-include/StandaloneCommon.ini.example | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index 179be94775..76d7a9953c 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -145,23 +145,6 @@ ;; Set minimum fee to publish classified ; ClassifiedFee = 0 - ;; Regular expressions for controlling which client versions are accepted/denied. - ;; An empty string means nothing is checked. - ;; - ;; Example 1: allow only these 3 types of clients (any version of them) - ;; AllowedClients = "Imprudence|Hippo|Second Life" - ;; - ;; Example 2: allow all clients except these - ;; DeniedClients = "Twisted|Crawler|Cryolife|FuckLife|StreetLife|GreenLife|AntiLife|KORE-Phaze|Synlyfe|Purple Second Life|SecondLi |Emerald" - ;; - ;; Note that these are regular expressions, so every character counts. - ;; Also note that this is very weak security and should not be trusted as a reliable means - ;; for keeping bad clients out; modified clients can fake their identifiers. - ;; - ;; - ;AllowedClients = "" - ;DeniedClients = "" - ; Basic Login Service Dos Protection Tweaks ; ; ; ; Some Grids/Users use a transparent proxy that makes use of the X-Forwarded-For HTTP Header, If you do, set this to true From 4dd17c4117ea413fb0c4418511956cb3abfe258c Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 8 Sep 2015 06:15:46 -0700 Subject: [PATCH 33/33] More 'everything is a module' merging. Have most of UbitOde converted. There are compile errors in OpenSimBase as the new modules stuff is not all there. Removed ChOdePlugin as it's connection to OdePlugin was tangled. --- OpenSim/Region/Framework/Scenes/SOPVehicle.cs | 2 +- .../Physics/ChOdePlugin/AssemblyInfo.cs | 58 - .../Physics/ChOdePlugin/ODECharacter.cs | 1467 ------ OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs | 4124 ----------------- .../ChOdePlugin/ODERayCastRequestManager.cs | 384 -- .../Physics/ChOdePlugin/OdePhysicsJoint.cs | 48 - .../Region/Physics/ChOdePlugin/OdePlugin.cs | 3887 ---------------- .../Region/Physics/ChOdePlugin/OdeUtils.cs | 353 -- .../Physics/ChOdePlugin/Tests/ODETestClass.cs | 122 - .../Region/Physics/ChOdePlugin/drawstuff.cs | 98 - .../Region/Physics/UbitOdePlugin/OdePlugin.cs | 90 - OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | 4 +- .../UbitMeshing/HelperTypes.cs | 0 .../UbitMeshing/Mesh.cs | 0 .../UbitMeshing/Meshmerizer.cs | 0 .../UbitMeshing/PrimMesher.cs | 0 .../UbitMeshing/SculptMap.cs | 0 .../UbitMeshing/SculptMesh.cs | 0 .../UbitOdePlugin/AssemblyInfo.cs | 0 .../UbitOdePlugin/ODECharacter.cs | 4 +- .../UbitOdePlugin/ODEDynamics.cs | 4 +- .../UbitOdePlugin/ODEMeshWorker.cs | 6 +- .../UbitOdePlugin/ODEPrim.cs | 4 +- .../UbitOdePlugin/ODERayCastRequestManager.cs | 6 +- .../UbitOdePlugin/ODESitAvatar.cs | 6 +- .../UbitOdePlugin/OdeApi.cs | 0 .../UbitOdePlugin/OdeScene.cs | 93 +- prebuild.xml | 44 +- 28 files changed, 102 insertions(+), 10702 deletions(-) delete mode 100644 OpenSim/Region/Physics/ChOdePlugin/AssemblyInfo.cs delete mode 100644 OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs delete mode 100644 OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs delete mode 100644 OpenSim/Region/Physics/ChOdePlugin/ODERayCastRequestManager.cs delete mode 100644 OpenSim/Region/Physics/ChOdePlugin/OdePhysicsJoint.cs delete mode 100644 OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs delete mode 100644 OpenSim/Region/Physics/ChOdePlugin/OdeUtils.cs delete mode 100644 OpenSim/Region/Physics/ChOdePlugin/Tests/ODETestClass.cs delete mode 100644 OpenSim/Region/Physics/ChOdePlugin/drawstuff.cs delete mode 100644 OpenSim/Region/Physics/UbitOdePlugin/OdePlugin.cs rename OpenSim/Region/{Physics => PhysicsModules}/UbitMeshing/HelperTypes.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/UbitMeshing/Mesh.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/UbitMeshing/Meshmerizer.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/UbitMeshing/PrimMesher.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/UbitMeshing/SculptMap.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/UbitMeshing/SculptMesh.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/UbitOdePlugin/AssemblyInfo.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/UbitOdePlugin/ODECharacter.cs (99%) rename OpenSim/Region/{Physics => PhysicsModules}/UbitOdePlugin/ODEDynamics.cs (99%) rename OpenSim/Region/{Physics => PhysicsModules}/UbitOdePlugin/ODEMeshWorker.cs (99%) rename OpenSim/Region/{Physics => PhysicsModules}/UbitOdePlugin/ODEPrim.cs (96%) rename OpenSim/Region/{Physics => PhysicsModules}/UbitOdePlugin/ODERayCastRequestManager.cs (99%) rename OpenSim/Region/{Physics => PhysicsModules}/UbitOdePlugin/ODESitAvatar.cs (99%) rename OpenSim/Region/{Physics => PhysicsModules}/UbitOdePlugin/OdeApi.cs (100%) rename OpenSim/Region/{Physics => PhysicsModules}/UbitOdePlugin/OdeScene.cs (97%) diff --git a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs index b617f52e44..58f4641f2e 100644 --- a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs +++ b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using System.Text; using System.IO; using System.Xml; diff --git a/OpenSim/Region/Physics/ChOdePlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/ChOdePlugin/AssemblyInfo.cs deleted file mode 100644 index d65929a290..0000000000 --- a/OpenSim/Region/Physics/ChOdePlugin/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Reflection; -using System.Runtime.InteropServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly : AssemblyTitle("OdePlugin")] -[assembly : AssemblyDescription("")] -[assembly : AssemblyConfiguration("")] -[assembly : AssemblyCompany("http://opensimulator.org")] -[assembly : AssemblyProduct("OdePlugin")] -[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")] -[assembly : AssemblyTrademark("")] -[assembly : AssemblyCulture("")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. - -[assembly : ComVisible(false)] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly : AssemblyVersion("0.6.5.*")] diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs deleted file mode 100644 index e7a39eb9d2..0000000000 --- a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs +++ /dev/null @@ -1,1467 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Reflection; -using OpenMetaverse; -using Ode.NET; -using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using log4net; - -namespace OpenSim.Region.Physics.OdePlugin -{ - /// - /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. - /// - - public enum dParam : int - { - LowStop = 0, - HiStop = 1, - Vel = 2, - FMax = 3, - FudgeFactor = 4, - Bounce = 5, - CFM = 6, - StopERP = 7, - StopCFM = 8, - LoStop2 = 256, - HiStop2 = 257, - Vel2 = 258, - FMax2 = 259, - StopERP2 = 7 + 256, - StopCFM2 = 8 + 256, - LoStop3 = 512, - HiStop3 = 513, - Vel3 = 514, - FMax3 = 515, - StopERP3 = 7 + 512, - StopCFM3 = 8 + 512 - } - public class OdeCharacter : PhysicsActor - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private Vector3 _position; - private d.Vector3 _zeroPosition; - // private d.Matrix3 m_StandUpRotation; - private bool _zeroFlag = false; - private bool m_lastUpdateSent = false; - private Vector3 _velocity; - private Vector3 _target_velocity; - private Vector3 _acceleration; - private Vector3 m_rotationalVelocity; - private float m_mass = 80f; - public float m_density = 60f; - private bool m_pidControllerActive = true; - public float PID_D = 800.0f; - public float PID_P = 900.0f; - //private static float POSTURE_SERVO = 10000.0f; - public float CAPSULE_RADIUS = 0.37f; - public float CAPSULE_LENGTH = 2.140599f; - public float m_tensor = 3800000f; - public float heightFudgeFactor = 0.52f; - public float walkDivisor = 1.3f; - public float runDivisor = 0.8f; - private bool flying = false; - private bool jumping = false; // add for jumping - private bool m_iscolliding = false; - private bool m_iscollidingGround = false; - private bool m_wascolliding = false; - private bool m_wascollidingGround = false; - private bool m_iscollidingObj = false; - private bool m_alwaysRun = false; - private bool m_hackSentFall = false; - private bool m_hackSentFly = false; - private int m_requestedUpdateFrequency = 0; - private Vector3 m_taintPosition = Vector3.Zero; - public uint m_localID = 0; - public bool m_returnCollisions = false; - // taints and their non-tainted counterparts - public bool m_isPhysical = false; // the current physical status - public bool m_tainted_isPhysical = false; // set when the physical status is tainted (false=not existing in physics engine, true=existing) - public float MinimumGroundFlightOffset = 3f; - - private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes. - private float m_tiltMagnitudeWhenProjectedOnXYPlane = 0.1131371f; // used to introduce a fixed tilt because a straight-up capsule falls through terrain, probably a bug in terrain collider - - - private float m_buoyancy = 0f; - - // private CollisionLocker ode; - - private string m_name = String.Empty; - - private bool[] m_colliderarr = new bool[11]; - private bool[] m_colliderGroundarr = new bool[11]; - - // Default we're a Character - private CollisionCategories m_collisionCategories = (CollisionCategories.Character); - - // Default, Collide with Other Geometries, spaces, bodies and characters. - private CollisionCategories m_collisionFlags = (CollisionCategories.Geom - | CollisionCategories.Space - | CollisionCategories.Body - | CollisionCategories.Character - | CollisionCategories.Land); - public IntPtr Body = IntPtr.Zero; - private OdeScene _parent_scene; - public IntPtr Shell = IntPtr.Zero; - public IntPtr Amotor = IntPtr.Zero; - public d.Mass ShellMass; - public bool collidelock = false; - - public int m_eventsubscription = 0; - private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); - - private Vector3 m_taintMomentum = Vector3.Zero; - private bool m_haveTaintMomentum = false; - - - // unique UUID of this character object - public UUID m_uuid; - public bool bad = false; - private Object m_syncRoot = new Object(); - - public OdeCharacter(String avName, OdeScene parent_scene, Vector3 pos, CollisionLocker dode, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor) - { - m_uuid = UUID.Random(); - - if (pos.IsFinite()) - { - if (pos.Z > 9999999f) - { - pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5; - } - if (pos.Z < -90000f) - { - pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5; - } - _position = pos; - m_taintPosition.X = pos.X; - m_taintPosition.Y = pos.Y; - m_taintPosition.Z = pos.Z; - } - else - { - _position = new Vector3(((float)_parent_scene.WorldExtents.X * 0.5f), ((float)_parent_scene.WorldExtents.Y * 0.5f), parent_scene.GetTerrainHeightAtXY(128f, 128f) + 10f); - m_taintPosition.X = _position.X; - m_taintPosition.Y = _position.Y; - m_taintPosition.Z = _position.Z; - m_log.Warn("[PHYSICS]: Got NaN Position on Character Create"); - } - - _parent_scene = parent_scene; - - PID_D = pid_d; - PID_P = pid_p; - CAPSULE_RADIUS = capsule_radius; - m_tensor = tensor; - m_density = density; - heightFudgeFactor = height_fudge_factor; - walkDivisor = walk_divisor; - runDivisor = rundivisor; - - // m_StandUpRotation = - // new d.Matrix3(0.5f, 0.7071068f, 0.5f, -0.7071068f, 0f, 0.7071068f, 0.5f, -0.7071068f, - // 0.5f); - - for (int i = 0; i < 11; i++) - { - m_colliderarr[i] = false; - } - CAPSULE_LENGTH = (size.Z * 1.15f) - CAPSULE_RADIUS * 2.0f; - //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); - m_tainted_CAPSULE_LENGTH = CAPSULE_LENGTH; - - m_isPhysical = false; // current status: no ODE information exists - m_tainted_isPhysical = true; // new tainted status: need to create ODE information - - _parent_scene.AddPhysicsActorTaint(this); - - m_name = avName; - } - - public override int PhysicsActorType - { - get { return (int) ActorTypes.Agent; } - set { return; } - } - - /// - /// If this is set, the avatar will move faster - /// - public override bool SetAlwaysRun - { - get { return m_alwaysRun; } - set { m_alwaysRun = value; } - } - - public override uint LocalID - { - set { m_localID = value; } - } - - public override bool Grabbed - { - set { return; } - } - - public override bool Selected - { -// set { return; } - set { jumping = value; } // add for jumping flag - } - - public override float Buoyancy - { - get { return m_buoyancy; } - set { m_buoyancy = value; } - } - - public override bool FloatOnWater - { - set { return; } - } - - public override bool IsPhysical - { - get { return false; } - set { return; } - } - - public override bool ThrottleUpdates - { - get { return false; } - set { return; } - } - - public override bool Flying - { - get { return flying; } - set { flying = value; } - } - - /// - /// Returns if the avatar is colliding in general. - /// This includes the ground and objects and avatar. - /// - public override bool IsColliding - { -//#@ get { return m_iscolliding; } - get { //## -//Console.WriteLine(">>>>>>>>>>>> IC get = {0}", m_iscolliding); //## - return m_iscolliding; } //## - set - { - int i; - int truecount = 0; - int falsecount = 0; - - if (m_colliderarr.Length >= 10) - { - for (i = 0; i < 10; i++) - { - m_colliderarr[i] = m_colliderarr[i + 1]; - } - } - m_colliderarr[10] = value; - - for (i = 0; i < 11; i++) - { - if (m_colliderarr[i]) - { - truecount++; - } - else - { - falsecount++; - } - } - - // Equal truecounts and false counts means we're colliding with something. - - if (falsecount > 1.2*truecount) - { - m_iscolliding = false; - } - else - { - m_iscolliding = true; - } -// ## Console.WriteLine("IC SET = {0} t{1} f{2} i {3}", value, truecount, falsecount, m_iscolliding); - if (m_wascolliding != m_iscolliding) - { - //base.SendCollisionUpdate(new CollisionEventUpdate()); - } - m_wascolliding = m_iscolliding; - } - } - - /// - /// Returns if an avatar is colliding with the ground - /// - public override bool CollidingGround - { - get { return m_iscollidingGround; } - set - { - // Collisions against the ground are not really reliable - // So, to get a consistant value we have to average the current result over time - // Currently we use 1 second = 10 calls to this. - int i; - int truecount = 0; - int falsecount = 0; - - if (m_colliderGroundarr.Length >= 10) - { - for (i = 0; i < 10; i++) - { - m_colliderGroundarr[i] = m_colliderGroundarr[i + 1]; - } - } - m_colliderGroundarr[10] = value; - - for (i = 0; i < 11; i++) - { - if (m_colliderGroundarr[i]) - { - truecount++; - } - else - { - falsecount++; - } - } - - // Equal truecounts and false counts means we're colliding with something. - - if (falsecount > 1.2*truecount) - { - m_iscollidingGround = false; - } - else - { - m_iscollidingGround = true; - } - if (m_wascollidingGround != m_iscollidingGround) - { - //base.SendCollisionUpdate(new CollisionEventUpdate()); - } - m_wascollidingGround = m_iscollidingGround; - } - } - - /// - /// Returns if the avatar is colliding with an object - /// - public override bool CollidingObj - { - get { return m_iscollidingObj; } - set - { - m_iscollidingObj = value; - if (value) - m_pidControllerActive = false; - else - m_pidControllerActive = true; - } - } - - /// - /// turn the PID controller on or off. - /// The PID Controller will turn on all by itself in many situations - /// - /// - public void SetPidStatus(bool status) - { - m_pidControllerActive = status; - } - - public override bool Stopped - { - get { return _zeroFlag; } - } - - /// - /// This 'puts' an avatar somewhere in the physics space. - /// Not really a good choice unless you 'know' it's a good - /// spot otherwise you're likely to orbit the avatar. - /// - public override Vector3 Position - { - get { return _position; } - set - { - if (Body == IntPtr.Zero || Shell == IntPtr.Zero) - { - if (value.IsFinite()) - { - if (value.Z > 9999999f) - { - value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5; - } - if (value.Z < -90000f) - { - value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5; - } - - _position.X = value.X; - _position.Y = value.Y; - _position.Z = value.Z; - - m_taintPosition.X = value.X; - m_taintPosition.Y = value.Y; - m_taintPosition.Z = value.Z; - _parent_scene.AddPhysicsActorTaint(this); - } - else - { - m_log.Warn("[PHYSICS]: Got a NaN Position from Scene on a Character"); - } - } - } - } - - public override Vector3 RotationalVelocity - { - get { return m_rotationalVelocity; } - set { m_rotationalVelocity = value; } - } - - /// - /// This property sets the height of the avatar only. We use the height to make sure the avatar stands up straight - /// and use it to offset landings properly - /// - public override Vector3 Size - { - get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); } - set - { - if (value.IsFinite()) - { - m_pidControllerActive = true; - - Vector3 SetSize = value; - m_tainted_CAPSULE_LENGTH = (SetSize.Z*1.15f) - CAPSULE_RADIUS*2.0f; - //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); - - Velocity = Vector3.Zero; - m_taintPosition = _position; // update the stale taint position - _parent_scene.AddPhysicsActorTaint(this); - } - else - { - m_log.Warn("[PHYSICS]: Got a NaN Size from Scene on a Character"); - } - } - } - - private void AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3 movementVector) - { - movementVector.Z = 0f; - float magnitude = (float)Math.Sqrt((double)(movementVector.X * movementVector.X + movementVector.Y * movementVector.Y)); - if (magnitude < 0.1f) return; - - // normalize the velocity vector - float invMagnitude = 1.0f / magnitude; - movementVector.X *= invMagnitude; - movementVector.Y *= invMagnitude; - - // if we change the capsule heading too often, the capsule can fall down - // therefore we snap movement vector to just 1 of 4 predefined directions (ne, nw, se, sw), - // meaning only 4 possible capsule tilt orientations - if (movementVector.X > 0) - { - // east - if (movementVector.Y > 0) - { - // northeast - movementVector.X = (float)Math.Sqrt(2.0); - movementVector.Y = (float)Math.Sqrt(2.0); - } - else - { - // southeast - movementVector.X = (float)Math.Sqrt(2.0); - movementVector.Y = -(float)Math.Sqrt(2.0); - } - } - else - { - // west - if (movementVector.Y > 0) - { - // northwest - movementVector.X = -(float)Math.Sqrt(2.0); - movementVector.Y = (float)Math.Sqrt(2.0); - } - else - { - // southwest - movementVector.X = -(float)Math.Sqrt(2.0); - movementVector.Y = -(float)Math.Sqrt(2.0); - } - } - - - // movementVector.Z is zero - - // calculate tilt components based on desired amount of tilt and current (snapped) heading. - // the "-" sign is to force the tilt to be OPPOSITE the direction of movement. - float xTiltComponent = -movementVector.X * m_tiltMagnitudeWhenProjectedOnXYPlane; - float yTiltComponent = -movementVector.Y * m_tiltMagnitudeWhenProjectedOnXYPlane; - - //m_log.Debug("[PHYSICS] changing avatar tilt"); - d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, xTiltComponent); - d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, xTiltComponent); // must be same as lowstop, else a different, spurious tilt is introduced - d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, yTiltComponent); - d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, yTiltComponent); // same as lowstop - d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, 0f); - d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop - } - - /// - /// This creates the Avatar's physical Surrogate at the position supplied - /// - /// - /// - /// - - // WARNING: This MUST NOT be called outside of ProcessTaints, else we can have unsynchronized access - // to ODE internals. ProcessTaints is called from within thread-locked Simulate(), so it is the only - // place that is safe to call this routine AvatarGeomAndBodyCreation. - private void AvatarGeomAndBodyCreation(float npositionX, float npositionY, float npositionZ, float tensor) - { - //CAPSULE_LENGTH = -5; - //CAPSULE_RADIUS = -5; - int dAMotorEuler = 1; - _parent_scene.waitForSpaceUnlock(_parent_scene.space); - if (CAPSULE_LENGTH <= 0) - { - m_log.Warn("[PHYSICS]: The capsule size you specified in opensim.ini is invalid! Setting it to the smallest possible size!"); - CAPSULE_LENGTH = 0.01f; - - } - - if (CAPSULE_RADIUS <= 0) - { - m_log.Warn("[PHYSICS]: The capsule size you specified in opensim.ini is invalid! Setting it to the smallest possible size!"); - CAPSULE_RADIUS = 0.01f; - - } - - if(Shell != IntPtr.Zero) - { - try - { - d.GeomDestroy(Shell); - } - catch (System.AccessViolationException) - { - m_log.Error("[PHYSICS]: PrimGeom dead"); - } - // Remove any old entries -//string tShell; -//_parent_scene.geom_name_map.TryGetValue(Shell, out tShell); -//Console.WriteLine("**** Remove {0}", tShell); - if(_parent_scene.geom_name_map.ContainsKey(Shell)) _parent_scene.geom_name_map.Remove(Shell); - if(_parent_scene.actor_name_map.ContainsKey(Shell)) _parent_scene.actor_name_map.Remove(Shell); - } - - Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); - _parent_scene.geom_name_map[Shell] = m_name; - _parent_scene.actor_name_map[Shell] = (PhysicsActor)this; -//Console.WriteLine("**** Create {2} Dicts: actor={0} name={1} height={3} rad={4}", _parent_scene.actor_name_map.Count, _parent_scene.geom_name_map.Count, m_name, CAPSULE_LENGTH, CAPSULE_RADIUS); - - d.GeomSetCategoryBits(Shell, (int)m_collisionCategories); - d.GeomSetCollideBits(Shell, (int)m_collisionFlags); - - d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH); - Body = d.BodyCreate(_parent_scene.world); - d.BodySetPosition(Body, npositionX, npositionY, npositionZ); - - _position.X = npositionX; - _position.Y = npositionY; - _position.Z = npositionZ; - - - m_taintPosition.X = npositionX; - m_taintPosition.Y = npositionY; - m_taintPosition.Z = npositionZ; - - d.BodySetMass(Body, ref ShellMass); - d.Matrix3 m_caprot; - // 90 Stand up on the cap of the capped cyllinder - if (_parent_scene.IsAvCapsuleTilted) - { - d.RFromAxisAndAngle(out m_caprot, 1, 0, 1, (float)(Math.PI / 2)); - } - else - { - d.RFromAxisAndAngle(out m_caprot, 0, 0, 1, (float)(Math.PI / 2)); - } - - - d.GeomSetRotation(Shell, ref m_caprot); - d.BodySetRotation(Body, ref m_caprot); - - d.GeomSetBody(Shell, Body); - - - // The purpose of the AMotor here is to keep the avatar's physical - // surrogate from rotating while moving - Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero); - d.JointAttach(Amotor, Body, IntPtr.Zero); - d.JointSetAMotorMode(Amotor, dAMotorEuler); - d.JointSetAMotorNumAxes(Amotor, 3); - d.JointSetAMotorAxis(Amotor, 0, 0, 1, 0, 0); - d.JointSetAMotorAxis(Amotor, 1, 0, 0, 1, 0); - d.JointSetAMotorAxis(Amotor, 2, 0, 0, 0, 1); - d.JointSetAMotorAngle(Amotor, 0, 0); - d.JointSetAMotorAngle(Amotor, 1, 0); - d.JointSetAMotorAngle(Amotor, 2, 0); - - // These lowstops and high stops are effectively (no wiggle room) - if (_parent_scene.IsAvCapsuleTilted) - { - d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0.000000000001f); - d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0.000000000001f); - d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -0.000000000001f); - d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.000000000001f); - d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0.000000000001f); - d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f); - } - else - { - #region Documentation of capsule motor LowStop and HighStop parameters - // Intentionally introduce some tilt into the capsule by setting - // the motor stops to small epsilon values. This small tilt prevents - // the capsule from falling into the terrain; a straight-up capsule - // (with -0..0 motor stops) falls into the terrain for reasons yet - // to be comprehended in their entirety. - #endregion - AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3.Zero); - d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f); - d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f); - d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f); - d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.08f); // must be same as lowstop, else a different, spurious tilt is introduced - d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop - d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.08f); // same as lowstop - } - - // Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the - // capped cyllinder will fall over - d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f); - d.JointSetAMotorParam(Amotor, (int)dParam.FMax, tensor); - - //d.Matrix3 bodyrotation = d.BodyGetRotation(Body); - //d.QfromR( - //d.Matrix3 checkrotation = new d.Matrix3(0.7071068,0.5, -0.7071068, - // - //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); - //standupStraight(); - } - - // - /// - /// Uses the capped cyllinder volume formula to calculate the avatar's mass. - /// This may be used in calculations in the scene/scenepresence - /// - public override float Mass - { - get - { - float AVvolume = (float) (Math.PI*Math.Pow(CAPSULE_RADIUS, 2)*CAPSULE_LENGTH); - return m_density*AVvolume; - } - } - public override void link(PhysicsActor obj) - { - - } - - public override void delink() - { - - } - - public override void LockAngularMotion(Vector3 axis) - { - - } - -// This code is very useful. Written by DanX0r. We're just not using it right now. -// Commented out to prevent a warning. -// -// private void standupStraight() -// { -// // The purpose of this routine here is to quickly stabilize the Body while it's popped up in the air. -// // The amotor needs a few seconds to stabilize so without it, the avatar shoots up sky high when you -// // change appearance and when you enter the simulator -// // After this routine is done, the amotor stabilizes much quicker -// d.Vector3 feet; -// d.Vector3 head; -// d.BodyGetRelPointPos(Body, 0.0f, 0.0f, -1.0f, out feet); -// d.BodyGetRelPointPos(Body, 0.0f, 0.0f, 1.0f, out head); -// float posture = head.Z - feet.Z; - -// // restoring force proportional to lack of posture: -// float servo = (2.5f - posture) * POSTURE_SERVO; -// d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f); -// d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f); -// //d.Matrix3 bodyrotation = d.BodyGetRotation(Body); -// //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); -// } - - public override Vector3 Force - { - get { return _target_velocity; } - set { return; } - } - - public override int VehicleType - { - get { return 0; } - set { return; } - } - - public override void VehicleFloatParam(int param, float value) - { - - } - - public override void VehicleVectorParam(int param, Vector3 value) - { - - } - - public override void VehicleRotationParam(int param, Quaternion rotation) - { - - } - - public override void VehicleFlags(int flags, bool remove) - { - } - - public override void SetVolumeDetect(int param) - { - - } - - public override Vector3 CenterOfMass - { - get { return Vector3.Zero; } - } - - public override Vector3 GeometricCenter - { - get { return Vector3.Zero; } - } - - public override PrimitiveBaseShape Shape - { - set { return; } - } - - public override Vector3 Velocity - { - get { - // There's a problem with Vector3.Zero! Don't Use it Here! - if (_zeroFlag) - return Vector3.Zero; - m_lastUpdateSent = false; - return _velocity; - } - set - { - if (value.IsFinite()) - { - _target_velocity = value; - m_pidControllerActive = true; - } - else - { - m_log.Warn("[PHYSICS]: Got a NaN velocity from Scene in a Character"); - } - } - } - - public override Vector3 Torque - { - get { return Vector3.Zero; } - set { return; } - } - - public override float CollisionScore - { - get { return 0f; } - set { } - } - - public override bool Kinematic - { - get { return false; } - set { } - } - - public override Quaternion Orientation - { - get { return Quaternion.Identity; } - set { - //Matrix3 or = Orientation.ToRotationMatrix(); - //d.Matrix3 ord = new d.Matrix3(or.m00, or.m10, or.m20, or.m01, or.m11, or.m21, or.m02, or.m12, or.m22); - //d.BodySetRotation(Body, ref ord); - } - } - - public override Vector3 Acceleration - { - get { return _acceleration; } - set { _acceleration = value; } - } - - public void SetAcceleration(Vector3 accel) - { - m_pidControllerActive = true; - _acceleration = accel; - } - - /// - /// Adds the force supplied to the Target Velocity - /// The PID controller takes this target velocity and tries to make it a reality - /// - /// - public override void AddForce(Vector3 force, bool pushforce) - { - if (force.IsFinite()) - { - if (pushforce) - { - m_pidControllerActive = false; - force *= 100f; -//Console.WriteLine("DF 1"); // ## - if (!force.ApproxEquals(Vector3.Zero, 0.01f)) - doForce(force); - // If uncommented, things get pushed off world - // - // m_log.Debug("Push!"); - // _target_velocity.X += force.X; - // _target_velocity.Y += force.Y; - // _target_velocity.Z += force.Z; - } - else - { - m_pidControllerActive = true; - _target_velocity.X += force.X; - _target_velocity.Y += force.Y; - _target_velocity.Z += force.Z; - } - } - else - { - m_log.Warn("[PHYSICS]: Got a NaN force applied to a Character"); - } - //m_lastUpdateSent = false; - } - - public override void AddAngularForce(Vector3 force, bool pushforce) - { - - } - - /// - /// After all of the forces add up with 'add force' we apply them with doForce - /// - /// - public void doForce(Vector3 force) - { - if (!collidelock) - { - d.BodyAddForce(Body, force.X, force.Y, force.Z); - //d.BodySetRotation(Body, ref m_StandUpRotation); - //standupStraight(); - d.Vector3 vel = d.BodyGetLinearVel(Body); //## -//Console.WriteLine("AvVel <{0},{1},{2}>", vel.X, vel.Y, vel.Z); //## - } - } - - public override void SetMomentum(Vector3 momentum) - { - if (momentum.IsFinite()) - { - m_taintMomentum = momentum; - m_haveTaintMomentum = true; - _parent_scene.AddPhysicsActorTaint(this); - } - else - m_log.Warn("[PHYSICS] !isFinite momentum"); - } - - - /// - /// Called from Simulate - /// This is the avatar's movement control + PID Controller - /// - /// - public void Move(float timeStep, List defects) - { - // no lock; for now it's only called from within Simulate() - - // If the PID Controller isn't active then we set our force - // calculating base velocity to the current position - - if (Body == IntPtr.Zero) - return; - - if (m_pidControllerActive == false) - { - _zeroPosition = d.BodyGetPosition(Body); - } - //PidStatus = true; - - d.Vector3 localpos = d.BodyGetPosition(Body); - Vector3 localPos = new Vector3(localpos.X, localpos.Y, localpos.Z); - - if (!localPos.IsFinite()) - { - - m_log.Warn("[PHYSICS]: Avatar Position is non-finite!"); - defects.Add(this); - // _parent_scene.RemoveCharacter(this); - - // destroy avatar capsule and related ODE data - if (Amotor != IntPtr.Zero) - { - // Kill the Amotor - d.JointDestroy(Amotor); - Amotor = IntPtr.Zero; - } - - //kill the Geometry - _parent_scene.waitForSpaceUnlock(_parent_scene.space); - - if (Body != IntPtr.Zero) - { - //kill the body - d.BodyDestroy(Body); - - Body = IntPtr.Zero; - } - - if(Shell != IntPtr.Zero) - { - try - { - d.GeomDestroy(Shell); - } - catch (System.AccessViolationException) - { - m_log.Error("[PHYSICS]: PrimGeom dead"); - } - // Remove any old entries -//string tShell; -//_parent_scene.geom_name_map.TryGetValue(Shell, out tShell); -//Console.WriteLine("**** Remove {0}", tShell); - - if(_parent_scene.geom_name_map.ContainsKey(Shell)) _parent_scene.geom_name_map.Remove(Shell); - if(_parent_scene.actor_name_map.ContainsKey(Shell)) _parent_scene.actor_name_map.Remove(Shell); - Shell = IntPtr.Zero; - } - - return; - } - - Vector3 vec = Vector3.Zero; - d.Vector3 vel = d.BodyGetLinearVel(Body); - - float movementdivisor = 1f; - - if (!m_alwaysRun) - { - movementdivisor = walkDivisor; - } - else - { - movementdivisor = runDivisor; - } - - // if velocity is zero, use position control; otherwise, velocity control - if (_target_velocity.X == 0.0f && _target_velocity.Y == 0.0f && _target_velocity.Z == 0.0f && m_iscolliding) - { - // keep track of where we stopped. No more slippin' & slidin' - if (!_zeroFlag) - { - _zeroFlag = true; - _zeroPosition = d.BodyGetPosition(Body); - } - if (m_pidControllerActive) - { - // We only want to deactivate the PID Controller if we think we want to have our surrogate - // react to the physics scene by moving it's position. - // Avatar to Avatar collisions - // Prim to avatar collisions - - d.Vector3 pos = d.BodyGetPosition(Body); - float errX = _zeroPosition.X - pos.X; - float errY = _zeroPosition.Y - pos.Y; - if( (Math.Abs(errX) > 0.1f) || (Math.Abs(errY) > 0.1f) ) - { - vec.X = (_target_velocity.X - vel.X) * (PID_D) + (errX) * (PID_P * 2); - vec.Y = (_target_velocity.Y - vel.Y) * (PID_D) + (errY) * (PID_P * 2); - } - else - { // close, jump to lateral destination - d.BodySetPosition(Body, _zeroPosition.X, _zeroPosition.Y, pos.Z); - } -// if (flying) - if (flying || jumping) // add for jumping - { - vec.Z = (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P; - } - } - //PidStatus = true; - } - else - { - m_pidControllerActive = true; - _zeroFlag = false; - if (m_iscolliding && !flying) - { - // We're standing on something - vec.X = ((_target_velocity.X / movementdivisor) - vel.X) * (PID_D); - vec.Y = ((_target_velocity.Y / movementdivisor) - vel.Y) * (PID_D); - } - else if (m_iscolliding && flying) - { - // We're flying and colliding with something - vec.X = ((_target_velocity.X/movementdivisor) - vel.X)*(PID_D / 16); - vec.Y = ((_target_velocity.Y/movementdivisor) - vel.Y)*(PID_D / 16); - } - else if (!m_iscolliding && flying) - { - // we're in mid air suspended - vec.X = ((_target_velocity.X / movementdivisor) - vel.X) * (PID_D/6); - vec.Y = ((_target_velocity.Y / movementdivisor) - vel.Y) * (PID_D/6); - } - - if (m_iscolliding && !flying && _target_velocity.Z > 0.0f) - { - // We're colliding with something and we're not flying but we're moving - // This means we're walking or running. - d.Vector3 pos = d.BodyGetPosition(Body); - vec.Z = (_target_velocity.Z - vel.Z)*PID_D + (_zeroPosition.Z - pos.Z)*PID_P; - if (_target_velocity.X > 0) - { - vec.X = ((_target_velocity.X - vel.X)/1.2f)*PID_D; - } - if (_target_velocity.Y > 0) - { - vec.Y = ((_target_velocity.Y - vel.Y)/1.2f)*PID_D; - } - } - else if (!m_iscolliding && !flying) - { - // we're not colliding and we're not flying so that means we're falling! - // m_iscolliding includes collisions with the ground. - - // d.Vector3 pos = d.BodyGetPosition(Body); - if (Math.Abs(_target_velocity.X) > 0) - { - vec.X = ((_target_velocity.X - vel.X)/1.2f)*PID_D; - } - if (Math.Abs(_target_velocity.Y) > 0) - { - vec.Y = ((_target_velocity.Y - vel.Y)/1.2f)*PID_D; - } - } - - if (flying) - { - vec.Z = (_target_velocity.Z - vel.Z) * (PID_D); - } - } - if (flying) - { - vec.Z += ((-1 * _parent_scene.gravityz)*m_mass); - - //Added for auto fly height. Kitto Flora - //d.Vector3 pos = d.BodyGetPosition(Body); - float target_altitude = _parent_scene.GetTerrainHeightAtXY(_position.X, _position.Y) + MinimumGroundFlightOffset; - - if (_position.Z < target_altitude) - { - vec.Z += (target_altitude - _position.Z) * PID_P * 5.0f; - } - // end add Kitto Flora - } - - if (vel.X * vel.X + vel.Y * vel.Y + vel.Z * vel.Z > 2500.0f) // 50ms apply breaks - { - float breakfactor = 0.16f * m_mass; // will give aprox 60m/s terminal velocity at free fall - vec.X -= breakfactor * vel.X; - vec.Y -= breakfactor * vel.Y; - vec.Z -= breakfactor * vel.Z; - } - - if (vec.IsFinite()) - { - if (vec.LengthSquared() > 0.0004f) // 0.01 allows 0.002 !! - { -//Console.WriteLine("DF 2"); // ## - - doForce(vec); - if (!_zeroFlag) - { -// AlignAvatarTiltWithCurrentDirectionOfMovement(vec); - } - } - } - else - { - m_log.Warn("[PHYSICS]: Got a NaN force vector in Move()"); - m_log.Warn("[PHYSICS]: Avatar Position is non-finite!"); - defects.Add(this); - // _parent_scene.RemoveCharacter(this); - // destroy avatar capsule and related ODE data - if (Amotor != IntPtr.Zero) - { - // Kill the Amotor - d.JointDestroy(Amotor); - Amotor = IntPtr.Zero; - } - //kill the Geometry - _parent_scene.waitForSpaceUnlock(_parent_scene.space); - - if (Body != IntPtr.Zero) - { - //kill the body - d.BodyDestroy(Body); - - Body = IntPtr.Zero; - } - - if(Shell != IntPtr.Zero) - { - try - { - d.GeomDestroy(Shell); - } - catch (System.AccessViolationException) - { - m_log.Error("[PHYSICS]: PrimGeom dead"); - } - // Remove any old entries -//string tShell; -//_parent_scene.geom_name_map.TryGetValue(Shell, out tShell); -//Console.WriteLine("**** Remove {0}", tShell); - - if(_parent_scene.geom_name_map.ContainsKey(Shell)) _parent_scene.geom_name_map.Remove(Shell); - if(_parent_scene.actor_name_map.ContainsKey(Shell)) _parent_scene.actor_name_map.Remove(Shell); - Shell = IntPtr.Zero; - } - } - } - - /// - /// Updates the reported position and velocity. This essentially sends the data up to ScenePresence. - /// - public void UpdatePositionAndVelocity() - { - // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! - d.Vector3 vec; - try - { - vec = d.BodyGetPosition(Body); - } - catch (NullReferenceException) - { - bad = true; - _parent_scene.BadCharacter(this); - vec = new d.Vector3(_position.X, _position.Y, _position.Z); - base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem! - m_log.WarnFormat("[ODEPLUGIN]: Avatar Null reference for Avatar {0}, physical actor {1}", m_name, m_uuid); - } - - - // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) - if (vec.X < 0.0f) vec.X = 0.0f; - if (vec.Y < 0.0f) vec.Y = 0.0f; - if (vec.X > (int)_parent_scene.WorldExtents.X - 0.05f) vec.X = (int)_parent_scene.WorldExtents.X - 0.05f; - if (vec.Y > (int)_parent_scene.WorldExtents.Y - 0.05f) vec.Y = (int)_parent_scene.WorldExtents.Y - 0.05f; - - _position.X = vec.X; - _position.Y = vec.Y; - _position.Z = vec.Z; - - // Did we move last? = zeroflag - // This helps keep us from sliding all over - - if (_zeroFlag) - { - _velocity.X = 0.0f; - _velocity.Y = 0.0f; - _velocity.Z = 0.0f; - - // Did we send out the 'stopped' message? - if (!m_lastUpdateSent) - { - m_lastUpdateSent = true; - //base.RequestPhysicsterseUpdate(); - - } - } - else - { - m_lastUpdateSent = false; - try - { - vec = d.BodyGetLinearVel(Body); - } - catch (NullReferenceException) - { - vec.X = _velocity.X; - vec.Y = _velocity.Y; - vec.Z = _velocity.Z; - } - _velocity.X = (vec.X); - _velocity.Y = (vec.Y); - - _velocity.Z = (vec.Z); - - if (_velocity.Z < -6 && !m_hackSentFall) - { - m_hackSentFall = true; - m_pidControllerActive = false; - } - else if (flying && !m_hackSentFly) - { - //m_hackSentFly = true; - //base.SendCollisionUpdate(new CollisionEventUpdate()); - } - else - { - m_hackSentFly = false; - m_hackSentFall = false; - } - } - } - - /// - /// Cleanup the things we use in the scene. - /// - public void Destroy() - { - m_tainted_isPhysical = false; - _parent_scene.AddPhysicsActorTaint(this); - } - - public override void CrossingFailure() - { - } - - public override Vector3 PIDTarget { set { return; } } - public override bool PIDActive { get { return m_pidControllerActive; } set { return; } } - public override float PIDTau { set { return; } } - - public override float PIDHoverHeight { set { return; } } - public override bool PIDHoverActive { set { return; } } - public override PIDHoverType PIDHoverType { set { return; } } - public override float PIDHoverTau { set { return; } } - - public override Quaternion APIDTarget{ set { return; } } - - public override bool APIDActive{ set { return; } } - - public override float APIDStrength{ set { return; } } - - public override float APIDDamping{ set { return; } } - - - public override void SubscribeEvents(int ms) - { - m_requestedUpdateFrequency = ms; - m_eventsubscription = ms; - _parent_scene.addCollisionEventReporting(this); - } - public override void UnSubscribeEvents() - { - _parent_scene.remCollisionEventReporting(this); - m_requestedUpdateFrequency = 0; - m_eventsubscription = 0; - } - public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) - { - if (m_eventsubscription > 0) - { - CollisionEventsThisFrame.AddCollider(CollidedWith, contact); - } - } - - public void SendCollisions() - { - if (m_eventsubscription > m_requestedUpdateFrequency) - { - if (CollisionEventsThisFrame != null) - { - base.SendCollisionUpdate(CollisionEventsThisFrame); - } - CollisionEventsThisFrame = new CollisionEventUpdate(); - m_eventsubscription = 0; - } - } - public override bool SubscribedEvents() - { - if (m_eventsubscription > 0) - return true; - return false; - } - - public void ProcessTaints(float timestep) - { - lock (m_syncRoot) - { - if (m_tainted_isPhysical != m_isPhysical) - { - if (m_tainted_isPhysical) - { - // Create avatar capsule and related ODE data - if (!(Shell == IntPtr.Zero && Body == IntPtr.Zero && Amotor == IntPtr.Zero)) - { - m_log.Warn("[PHYSICS]: re-creating the following avatar ODE data, even though it already exists - " - + (Shell!=IntPtr.Zero ? "Shell ":"") - + (Body!=IntPtr.Zero ? "Body ":"") - + (Amotor!=IntPtr.Zero ? "Amotor ":"")); - } - AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z, m_tensor); - _parent_scene.AddCharacter(this); - } - else - { - _parent_scene.RemoveCharacter(this); - // destroy avatar capsule and related ODE data - if (Amotor != IntPtr.Zero) - { - // Kill the Amotor - d.JointDestroy(Amotor); - Amotor = IntPtr.Zero; - } - //kill the Geometry - _parent_scene.waitForSpaceUnlock(_parent_scene.space); - - if (Body != IntPtr.Zero) - { - //kill the body - d.BodyDestroy(Body); - Body = IntPtr.Zero; - } - - if(Shell != IntPtr.Zero) - { - try - { - d.GeomDestroy(Shell); - } - catch (Exception e) - { - m_log.ErrorFormat("[PHYSICS]: Failed to destroy character shell {0}",e.Message); - } - // Remove any old entries - //string tShell; - //_parent_scene.geom_name_map.TryGetValue(Shell, out tShell); - //Console.WriteLine("**** Remove {0}", tShell); - - if(_parent_scene.geom_name_map.ContainsKey(Shell)) _parent_scene.geom_name_map.Remove(Shell); - if(_parent_scene.actor_name_map.ContainsKey(Shell)) _parent_scene.actor_name_map.Remove(Shell); - Shell = IntPtr.Zero; - } - } - - m_isPhysical = m_tainted_isPhysical; - } - - if (m_tainted_CAPSULE_LENGTH != CAPSULE_LENGTH) - { - if (Shell != IntPtr.Zero && Body != IntPtr.Zero && Amotor != IntPtr.Zero) - { - - m_pidControllerActive = true; - // no lock needed on _parent_scene.OdeLock because we are called from within the thread lock in OdePlugin's simulate() - d.JointDestroy(Amotor); - float prevCapsule = CAPSULE_LENGTH; - CAPSULE_LENGTH = m_tainted_CAPSULE_LENGTH; - //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); - d.BodyDestroy(Body); - AvatarGeomAndBodyCreation(_position.X, _position.Y, - _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor); - Velocity = Vector3.Zero; - } - else - { - m_log.Warn("[PHYSICS]: trying to change capsule size, but the following ODE data is missing - " - + (Shell==IntPtr.Zero ? "Shell ":"") - + (Body==IntPtr.Zero ? "Body ":"") - + (Amotor==IntPtr.Zero ? "Amotor ":"")); - } - } - - if (!m_taintPosition.ApproxEquals(_position, 0.05f)) - { - if (Body != IntPtr.Zero) - { - d.BodySetPosition(Body, m_taintPosition.X, m_taintPosition.Y, m_taintPosition.Z); - - } - _position.X = m_taintPosition.X; - _position.Y = m_taintPosition.Y; - _position.Z = m_taintPosition.Z; - } - - if (m_haveTaintMomentum) - { - m_haveTaintMomentum = false; - _velocity = m_taintMomentum; - _target_velocity = m_taintMomentum; - m_pidControllerActive = true; - if (Body != IntPtr.Zero) - d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); - } - } - } - - internal void AddCollisionFrameTime(int p) - { - // protect it from overflow crashing - if (m_eventsubscription + p >= int.MaxValue) - m_eventsubscription = 0; - m_eventsubscription += p; - } - } -} diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs deleted file mode 100644 index b283152f74..0000000000 --- a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs +++ /dev/null @@ -1,4124 +0,0 @@ -/* Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Revised March 5th 2010 by Kitto Flora. ODEDynamics.cs - * Ubit 2012 - * rolled into ODEPrim.cs - */ - -using System; -using System.IO; -using System.Collections.Generic; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Threading; -using log4net; -using OpenMetaverse; -using Ode.NET; -using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; - -namespace OpenSim.Region.Physics.OdePlugin -{ - /// - /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. - /// - - public class OdePrim : PhysicsActor - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public class SerialControl - { - public object alock = new object(); - public byte[] data = new byte[0]; - } - private Vector3 _position; - private Vector3 _velocity; - private Vector3 _torque; - private Vector3 m_lastVelocity; - private Vector3 m_lastposition; - private Quaternion m_lastorientation = new Quaternion(); - private Vector3 m_rotationalVelocity; - private Vector3 _size; - private Vector3 _acceleration; - // private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f); - private Quaternion _orientation; - private Vector3 m_taintposition; - private Vector3 m_taintsize; - private Vector3 m_taintVelocity; - private Vector3 m_taintTorque; - private Quaternion m_taintrot; - private Vector3 m_rotateEnable = Vector3.One; // Current setting - private Vector3 m_rotateEnableRequest = Vector3.One; // Request from LSL - private bool m_rotateEnableUpdate = false; - private Vector3 m_lockX; - private Vector3 m_lockY; - private Vector3 m_lockZ; - private IntPtr Amotor = IntPtr.Zero; - private IntPtr AmotorX = IntPtr.Zero; - private IntPtr AmotorY = IntPtr.Zero; - private IntPtr AmotorZ = IntPtr.Zero; - - private Vector3 m_PIDTarget; - private float m_PIDTau; - private float PID_D = 35f; - private float PID_G = 25f; - private bool m_usePID = false; - - private Quaternion m_APIDTarget = new Quaternion(); - private float m_APIDStrength = 0.5f; - private float m_APIDDamping = 0.5f; - private bool m_useAPID = false; - private float m_APIDdamper = 1.0f; - - // These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), - // do not confuse with VEHICLE HOVER - - private float m_PIDHoverHeight; - private float m_PIDHoverTau; - private bool m_useHoverPID; - private PIDHoverType m_PIDHoverType = PIDHoverType.Ground; - private float m_targetHoverHeight; - private float m_groundHeight; - private float m_waterHeight; - private float m_buoyancy; //m_buoyancy set by llSetBuoyancy() - - // private float m_tensor = 5f; - private int body_autodisable_frames = 20; - - - private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom - | CollisionCategories.Space - | CollisionCategories.Body - | CollisionCategories.Character - ); - private bool m_taintshape; - private bool m_taintPhysics; - private bool m_collidesLand = true; - private bool m_collidesWater; - // public bool m_returnCollisions; - - // Default we're a Geometry - private CollisionCategories m_collisionCategories = (CollisionCategories.Geom); - - // Default, Collide with Other Geometries, spaces and Bodies - private CollisionCategories m_collisionFlags = m_default_collisionFlags; - - public bool m_taintremove; - public bool m_taintdisable; - public bool m_disabled; - public bool m_taintadd; - public bool m_taintselected; - public bool m_taintphantom; - public bool m_taintCollidesWater; - - public uint m_localID; - - //public GCHandle gc; - private CollisionLocker ode; - - private bool m_meshfailed = false; - private bool m_taintforce = false; - private bool m_taintaddangularforce = false; - private Vector3 m_force; - private List m_forcelist = new List(); - private List m_angularforcelist = new List(); - - private IMesh _mesh; - private PrimitiveBaseShape _pbs; - private OdeScene _parent_scene; - public IntPtr m_targetSpace = IntPtr.Zero; - public IntPtr prim_geom; - // public IntPtr prev_geom; - public IntPtr _triMeshData; - - private IntPtr _linkJointGroup = IntPtr.Zero; - private PhysicsActor _parent; - private PhysicsActor m_taintparent; - - private List childrenPrim = new List(); - - private bool iscolliding; - private bool m_isphysical; - private bool m_isphantom; - private bool m_isSelected; - - private bool m_NoColide; // for now only for internal use for bad meshs - - internal bool m_isVolumeDetect; // If true, this prim only detects collisions but doesn't collide actively - - private bool m_throttleUpdates; - private int throttleCounter; - public int m_interpenetrationcount; - public float m_collisionscore; - // public int m_roundsUnderMotionThreshold; - // private int m_crossingfailures; - - public bool m_outofBounds; - private float m_density = 10.000006836f; // Aluminum g/cm3; - - private float m_primMass = 10.000006836f; // Aluminum g/cm3; - - private byte m_shapetype; - private byte m_taintshapetype; - - public bool _zeroFlag; // if body has been stopped - private bool m_lastUpdateSent; - - public IntPtr Body = IntPtr.Zero; - public String m_primName; - private Vector3 _target_velocity; - public d.Mass pMass; - - public int m_eventsubscription; - private CollisionEventUpdate CollisionEventsThisFrame; - - private IntPtr m_linkJoint = IntPtr.Zero; - - public volatile bool childPrim; - - internal int m_material = (int)Material.Wood; - - private IntPtr m_body = IntPtr.Zero; - - // Vehicle properties ============================================================================================ - private Vehicle m_type = Vehicle.TYPE_NONE; // If a 'VEHICLE', and what kind - // private Quaternion m_referenceFrame = Quaternion.Identity; // Axis modifier - private VehicleFlag m_flags = (VehicleFlag)0; // Bit settings: - // HOVER_TERRAIN_ONLY - // HOVER_GLOBAL_HEIGHT - // NO_DEFLECTION_UP - // HOVER_WATER_ONLY - // HOVER_UP_ONLY - // LIMIT_MOTOR_UP - // LIMIT_ROLL_ONLY - - // Linear properties - private Vector3 m_linearMotorDirection = Vector3.Zero; // (was m_linearMotorDirectionLASTSET) the (local) Velocity - //requested by LSL - private float m_linearMotorTimescale = 0; // Motor Attack rate set by LSL - private float m_linearMotorDecayTimescale = 0; // Motor Decay rate set by LSL - private Vector3 m_linearFrictionTimescale = Vector3.Zero; // General Friction set by LSL - - private Vector3 m_lLinMotorDVel = Vector3.Zero; // decayed motor - private Vector3 m_lLinObjectVel = Vector3.Zero; // local frame object velocity - private Vector3 m_wLinObjectVel = Vector3.Zero; // world frame object velocity - - //Angular properties - private Vector3 m_angularMotorDirection = Vector3.Zero; // angular velocity requested by LSL motor - - private float m_angularMotorTimescale = 0; // motor angular Attack rate set by LSL - private float m_angularMotorDecayTimescale = 0; // motor angular Decay rate set by LSL - private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular Friction set by LSL - - private Vector3 m_angularMotorDVel = Vector3.Zero; // decayed angular motor - // private Vector3 m_angObjectVel = Vector3.Zero; // current body angular velocity - private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body - - //Deflection properties - // private float m_angularDeflectionEfficiency = 0; - // private float m_angularDeflectionTimescale = 0; - // private float m_linearDeflectionEfficiency = 0; - // private float m_linearDeflectionTimescale = 0; - - //Banking properties - // private float m_bankingEfficiency = 0; - // private float m_bankingMix = 0; - // private float m_bankingTimescale = 0; - - //Hover and Buoyancy properties - private float m_VhoverHeight = 0f; - // private float m_VhoverEfficiency = 0f; - private float m_VhoverTimescale = 0f; - private float m_VhoverTargetHeight = -1.0f; // if <0 then no hover, else its the current target height - private float m_VehicleBuoyancy = 0f; // Set by VEHICLE_BUOYANCY, for a vehicle. - // Modifies gravity. Slider between -1 (double-gravity) and 1 (full anti-gravity) - // KF: So far I have found no good method to combine a script-requested .Z velocity and gravity. - // Therefore only m_VehicleBuoyancy=1 (0g) will use the script-requested .Z velocity. - - //Attractor properties - private float m_verticalAttractionEfficiency = 1.0f; // damped - private float m_verticalAttractionTimescale = 500f; // Timescale > 300 means no vert attractor. - -// SerialControl m_taintserial = null; - object m_taintvehicledata = null; - - public void DoSetVehicle() - { - VehicleData vd = (VehicleData)m_taintvehicledata; - - m_type = vd.m_type; - m_flags = vd.m_flags; - - // Linear properties - m_linearMotorDirection = vd.m_linearMotorDirection; - m_linearFrictionTimescale = vd.m_linearFrictionTimescale; - m_linearMotorDecayTimescale = vd.m_linearMotorDecayTimescale; - m_linearMotorTimescale = vd.m_linearMotorTimescale; -// m_linearMotorOffset = vd.m_linearMotorOffset; - - //Angular properties - m_angularMotorDirection = vd.m_angularMotorDirection; - m_angularMotorTimescale = vd.m_angularMotorTimescale; - m_angularMotorDecayTimescale = vd.m_angularMotorDecayTimescale; - m_angularFrictionTimescale = vd.m_angularFrictionTimescale; - - //Deflection properties -// m_angularDeflectionEfficiency = vd.m_angularDeflectionEfficiency; -// m_angularDeflectionTimescale = vd.m_angularDeflectionTimescale; -// m_linearDeflectionEfficiency = vd.m_linearDeflectionEfficiency; -// m_linearDeflectionTimescale = vd.m_linearDeflectionTimescale; - - //Banking properties -// m_bankingEfficiency = vd.m_bankingEfficiency; -// m_bankingMix = vd.m_bankingMix; -// m_bankingTimescale = vd.m_bankingTimescale; - - //Hover and Buoyancy properties - m_VhoverHeight = vd.m_VhoverHeight; -// m_VhoverEfficiency = vd.m_VhoverEfficiency; - m_VhoverTimescale = vd.m_VhoverTimescale; - m_VehicleBuoyancy = vd.m_VehicleBuoyancy; - - //Attractor properties - m_verticalAttractionEfficiency = vd.m_verticalAttractionEfficiency; - m_verticalAttractionTimescale = vd.m_verticalAttractionTimescale; - - // Axis -// m_referenceFrame = vd.m_referenceFrame; - - - m_taintvehicledata = null; - } - - public override void SetVehicle(object vdata) - { - m_taintvehicledata = vdata; - _parent_scene.AddPhysicsActorTaint(this); - } - - public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, - Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, - bool pisPhantom,byte shapetype, CollisionLocker dode, uint localid) - { - m_localID = localid; - ode = dode; - if (!pos.IsFinite()) - { - pos = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), - parent_scene.GetTerrainHeightAtXY(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f)) + 0.5f); - m_log.Warn("[PHYSICS]: Got nonFinite Object create Position"); - } - - _position = pos; - m_taintposition = pos; - PID_D = parent_scene.bodyPIDD; - PID_G = parent_scene.bodyPIDG; - m_density = parent_scene.geomDefaultDensity; - // m_tensor = parent_scene.bodyMotorJointMaxforceTensor; - body_autodisable_frames = parent_scene.bodyFramesAutoDisable; - - prim_geom = IntPtr.Zero; - // prev_geom = IntPtr.Zero; - - if (!pos.IsFinite()) - { - size = new Vector3(0.5f, 0.5f, 0.5f); - m_log.Warn("[PHYSICS]: Got nonFinite Object create Size"); - } - - if (size.X <= 0) size.X = 0.01f; - if (size.Y <= 0) size.Y = 0.01f; - if (size.Z <= 0) size.Z = 0.01f; - - _size = size; - m_taintsize = _size; - - if (!QuaternionIsFinite(rotation)) - { - rotation = Quaternion.Identity; - m_log.Warn("[PHYSICS]: Got nonFinite Object create Rotation"); - } - - _orientation = rotation; - m_taintrot = _orientation; - _mesh = mesh; - _pbs = pbs; - m_shapetype = shapetype; - m_taintshapetype = shapetype; - - _parent_scene = parent_scene; - m_targetSpace = (IntPtr)0; - - // if (pos.Z < 0) - if (pos.Z < parent_scene.GetTerrainHeightAtXY(pos.X, pos.Y)) - m_isphysical = false; - else - { - m_isphysical = pisPhysical; - // If we're physical, we need to be in the master space for now. - // linksets *should* be in a space together.. but are not currently - if (m_isphysical) - m_targetSpace = _parent_scene.space; - } - - m_isphantom = pisPhantom; - m_taintphantom = pisPhantom; - - _triMeshData = IntPtr.Zero; - m_NoColide = false; - -// m_taintserial = null; - m_primName = primName; - m_taintadd = true; - _parent_scene.AddPhysicsActorTaint(this); - // don't do .add() here; old geoms get recycled with the same hash - } - - public override int PhysicsActorType - { - get { return (int)ActorTypes.Prim; } - set { return; } - } - - public override bool SetAlwaysRun - { - get { return false; } - set { return; } - } - - public override uint LocalID - { - set - { - //m_log.Info("[PHYSICS]: Setting TrackerID: " + value); - m_localID = value; - } - } - - public override bool Grabbed - { - set { return; } - } - - public override bool Selected - { - set - { - //Console.WriteLine("Sel {0} {1} {2}", m_primName, value, m_isphysical); - // This only makes the object not collidable if the object - // is physical or the object is modified somehow *IN THE FUTURE* - // without this, if an avatar selects prim, they can walk right - // through it while it's selected - m_collisionscore = 0; - if ((m_isphysical && !_zeroFlag) || !value) - { - m_taintselected = value; - _parent_scene.AddPhysicsActorTaint(this); - } - else - { - m_taintselected = value; - m_isSelected = value; - } - if (m_isSelected) disableBodySoft(); - } - } - - public override bool IsPhysical - { - get { return m_isphysical; } - set - { - m_isphysical = value; - if (!m_isphysical) - { // Zero the remembered last velocity - m_lastVelocity = Vector3.Zero; - if (m_type != Vehicle.TYPE_NONE) Halt(); - } - } - } - - public override bool IsVolumeDtc - { - set { return; } - get { return m_isVolumeDetect; } - - } - - public override bool Phantom - { - get { return m_isphantom; } - set - { - m_isphantom = value; - } - } - - public void setPrimForRemoval() - { - m_taintremove = true; - } - - public override bool Flying - { - // no flying prims for you - get { return false; } - set { } - } - - public override bool IsColliding - { - get { return iscolliding; } - set { iscolliding = value; } - } - - public override bool CollidingGround - { - get { return false; } - set { return; } - } - - public override bool CollidingObj - { - get { return false; } - set { return; } - } - - public override bool ThrottleUpdates - { - get { return m_throttleUpdates; } - set { m_throttleUpdates = value; } - } - - public override bool Stopped - { - get { return _zeroFlag; } - } - - public override Vector3 Position - { - get { return _position; } - - set - { - _position = value; - //m_log.Info("[PHYSICS]: " + _position.ToString()); - } - } - - public override Vector3 Size - { - get { return _size; } - set - { - if (value.IsFinite()) - { - _size = value; - } - else - { - m_log.Warn("[PHYSICS]: Got NaN Size on object"); - } - } - } - - public override float Mass - { - get - { - CalculateMass(); - return m_primMass; - } - } - - public override Vector3 Force - { - //get { return Vector3.Zero; } - get { return m_force; } - set - { - if (value.IsFinite()) - { - m_force = value; - } - else - { - m_log.Warn("[PHYSICS]: NaN in Force Applied to an Object"); - } - } - } - - public override int VehicleType - { - get { return (int)m_type; } - set { ProcessTypeChange((Vehicle)value); } - } - - public override void VehicleFloatParam(int param, float value) - { - ProcessFloatVehicleParam((Vehicle)param, value); - } - - public override void VehicleVectorParam(int param, Vector3 value) - { - ProcessVectorVehicleParam((Vehicle)param, value); - } - - public override void VehicleRotationParam(int param, Quaternion rotation) - { - ProcessRotationVehicleParam((Vehicle)param, rotation); - } - - public override void VehicleFlags(int param, bool remove) - { - ProcessVehicleFlags(param, remove); - } - - public override void SetVolumeDetect(int param) - { - lock (_parent_scene.OdeLock) - { - m_isVolumeDetect = (param != 0); - } - } - - - public override Vector3 CenterOfMass - { - get { return Vector3.Zero; } - } - - public override Vector3 GeometricCenter - { - get { return Vector3.Zero; } - } - - public override PrimitiveBaseShape Shape - { - set - { - _pbs = value; - m_taintshape = true; - } - } - - public override byte PhysicsShapeType - { - get - { - return m_shapetype; - } - set - { - m_taintshapetype = value; - _parent_scene.AddPhysicsActorTaint(this); - } - } - - public override Vector3 Velocity - { - get - { - // Averate previous velocity with the new one so - // client object interpolation works a 'little' better - if (_zeroFlag) - return Vector3.Zero; - - Vector3 returnVelocity = Vector3.Zero; - returnVelocity.X = (m_lastVelocity.X + _velocity.X) / 2; - returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y) / 2; - returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z) / 2; - return returnVelocity; - } - set - { - if (value.IsFinite()) - { - _velocity = value; - if (_velocity.ApproxEquals(Vector3.Zero, 0.001f)) - _acceleration = Vector3.Zero; - - m_taintVelocity = value; - _parent_scene.AddPhysicsActorTaint(this); - } - else - { - m_log.Warn("[PHYSICS]: Got NaN Velocity in Object"); - } - - } - } - - public override Vector3 Torque - { - get - { - if (!m_isphysical || Body == IntPtr.Zero) - return Vector3.Zero; - - return _torque; - } - - set - { - if (value.IsFinite()) - { - m_taintTorque = value; - _parent_scene.AddPhysicsActorTaint(this); - } - else - { - m_log.Warn("[PHYSICS]: Got NaN Torque in Object"); - } - } - } - - public override float CollisionScore - { - get { return m_collisionscore; } - set { m_collisionscore = value; } - } - - public override bool Kinematic - { - get { return false; } - set { } - } - - public override Quaternion Orientation - { - get { return _orientation; } - set - { - if (QuaternionIsFinite(value)) - { - _orientation = value; - } - else - m_log.Warn("[PHYSICS]: Got NaN quaternion Orientation from Scene in Object"); - - } - } - - public override bool FloatOnWater - { - set - { - m_taintCollidesWater = value; - _parent_scene.AddPhysicsActorTaint(this); - } - } - - public override void SetMomentum(Vector3 momentum) - { - } - - public override Vector3 PIDTarget - { - set - { - if (value.IsFinite()) - { - m_PIDTarget = value; - } - else - m_log.Warn("[PHYSICS]: Got NaN PIDTarget from Scene on Object"); - } - } - public override bool PIDActive { get { return m_usePID; } set { m_usePID = value; } } - public override float PIDTau { set { m_PIDTau = value; } } - - // For RotLookAt - public override Quaternion APIDTarget { set { m_APIDTarget = value; } } - public override bool APIDActive { set { m_useAPID = value; } } - public override float APIDStrength { set { m_APIDStrength = value; } } - public override float APIDDamping { set { m_APIDDamping = value; } } - - public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } } - public override bool PIDHoverActive { set { m_useHoverPID = value; } } - public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } - public override float PIDHoverTau { set { m_PIDHoverTau = value; } } - - internal static bool QuaternionIsFinite(Quaternion q) - { - if (Single.IsNaN(q.X) || Single.IsInfinity(q.X)) - return false; - if (Single.IsNaN(q.Y) || Single.IsInfinity(q.Y)) - return false; - if (Single.IsNaN(q.Z) || Single.IsInfinity(q.Z)) - return false; - if (Single.IsNaN(q.W) || Single.IsInfinity(q.W)) - return false; - return true; - } - - public override Vector3 Acceleration // client updates read data via here - { - get - { - if (_zeroFlag) - { - return Vector3.Zero; - } - return _acceleration; - } - set { _acceleration = value; } - } - - - public void SetAcceleration(Vector3 accel) // No one calls this, and it would not do anything. - { - _acceleration = accel; - } - - public override void AddForce(Vector3 force, bool pushforce) - { - if (force.IsFinite()) - { - lock (m_forcelist) - m_forcelist.Add(force); - - m_taintforce = true; - } - else - { - m_log.Warn("[PHYSICS]: Got Invalid linear force vector from Scene in Object"); - } - //m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString()); - } - - public override void AddAngularForce(Vector3 force, bool pushforce) - { - if (force.IsFinite()) - { - m_angularforcelist.Add(force); - m_taintaddangularforce = true; - } - else - { - m_log.Warn("[PHYSICS]: Got Invalid Angular force vector from Scene in Object"); - } - } - - public override Vector3 RotationalVelocity - { - get - { - return m_rotationalVelocity; - } - set - { - if (value.IsFinite()) - { - m_rotationalVelocity = value; - } - else - { - m_log.Warn("[PHYSICS]: Got NaN RotationalVelocity in Object"); - } - } - } - - public override void CrossingFailure() - { - if (m_outofBounds) - { - _position.X = Util.Clip(_position.X, 0.5f, _parent_scene.WorldExtents.X - 0.5f); - _position.Y = Util.Clip(_position.Y, 0.5f, _parent_scene.WorldExtents.Y - 0.5f); - _position.Z = Util.Clip(_position.Z, -100f, 50000f); - d.BodySetPosition(Body, _position.X, _position.Y, _position.Z); - - m_lastposition = _position; - - _velocity = Vector3.Zero; - m_lastVelocity = _velocity; - - - if (m_type != Vehicle.TYPE_NONE) - Halt(); - - d.BodySetLinearVel(Body, 0, 0, 0); - base.RequestPhysicsterseUpdate(); - m_outofBounds = false; - } - /* - int tmp = Interlocked.Increment(ref m_crossingfailures); - if (tmp > _parent_scene.geomCrossingFailuresBeforeOutofbounds) - { - base.RaiseOutOfBounds(_position); - return; - } - else if (tmp == _parent_scene.geomCrossingFailuresBeforeOutofbounds) - { - m_log.Warn("[PHYSICS]: Too many crossing failures for: " + m_primName); - } - */ - } - - public override float Buoyancy - { - get { return m_buoyancy; } - set { m_buoyancy = value; } - } - - public override void link(PhysicsActor obj) - { - m_taintparent = obj; - } - - public override void delink() - { - m_taintparent = null; - } - - public override void LockAngularMotion(Vector3 axis) - { - // This is actually ROTATION ENABLE, not a lock. - // default is <1,1,1> which is all enabled. - // The lock value is updated inside Move(), no point in using the taint system. - // OS 'm_taintAngularLock' etc change to m_rotateEnable. - if (axis.IsFinite()) - { - axis.X = (axis.X > 0) ? 1f : 0f; - axis.Y = (axis.Y > 0) ? 1f : 0f; - axis.Z = (axis.Z > 0) ? 1f : 0f; - m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z); - m_rotateEnableRequest = axis; - m_rotateEnableUpdate = true; - } - else - { - m_log.Warn("[PHYSICS]: Got NaN locking axis from Scene on Object"); - } - } - - public void SetGeom(IntPtr geom) - { - if (prim_geom != IntPtr.Zero) - { - // Remove any old entries - //string tPA; - //_parent_scene.geom_name_map.TryGetValue(prim_geom, out tPA); - //Console.WriteLine("**** Remove {0}", tPA); - if (_parent_scene.geom_name_map.ContainsKey(prim_geom)) _parent_scene.geom_name_map.Remove(prim_geom); - if (_parent_scene.actor_name_map.ContainsKey(prim_geom)) _parent_scene.actor_name_map.Remove(prim_geom); - d.GeomDestroy(prim_geom); - } - - prim_geom = geom; - //Console.WriteLine("SetGeom to " + prim_geom + " for " + m_primName); - if (prim_geom != IntPtr.Zero) - { - _parent_scene.geom_name_map[prim_geom] = this.m_primName; - _parent_scene.actor_name_map[prim_geom] = (PhysicsActor)this; - //Console.WriteLine("**** Create {2} Dicts: actor={0} name={1}", _parent_scene.actor_name_map.Count, _parent_scene.geom_name_map.Count, this.m_primName); - if (m_NoColide) - { - d.GeomSetCategoryBits(prim_geom, 0); - if (m_isphysical && !m_isVolumeDetect) - { - d.GeomSetCollideBits(prim_geom, (int)CollisionCategories.Land); - } - else - { - d.GeomSetCollideBits(prim_geom, 0); - d.GeomDisable(prim_geom); - } - } - else - { - d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); - d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); - } - } - - if (childPrim) - { - if (_parent != null && _parent is OdePrim) - { - OdePrim parent = (OdePrim)_parent; - //Console.WriteLine("SetGeom calls ChildSetGeom"); - parent.ChildSetGeom(this); - } - } - //m_log.Warn("Setting Geom to: " + prim_geom); - } - - public void enableBodySoft() - { - if (!childPrim) - { - if (m_isphysical && Body != IntPtr.Zero) - { - d.BodyEnable(Body); - if (m_type != Vehicle.TYPE_NONE) - Enable(Body, _parent_scene); - } - - m_disabled = false; - } - } - - public void disableBodySoft() - { - m_disabled = true; - - if (m_isphysical && Body != IntPtr.Zero) - { - d.BodyDisable(Body); - Halt(); - } - } - - public void enableBody() - { - // Don't enable this body if we're a child prim - // this should be taken care of in the parent function not here - if (!childPrim) - { - // Sets the geom to a body - Body = d.BodyCreate(_parent_scene.world); - - setMass(); - d.BodySetPosition(Body, _position.X, _position.Y, _position.Z); - d.Quaternion myrot = new d.Quaternion(); - myrot.X = _orientation.X; - myrot.Y = _orientation.Y; - myrot.Z = _orientation.Z; - myrot.W = _orientation.W; - d.BodySetQuaternion(Body, ref myrot); - d.GeomSetBody(prim_geom, Body); - - m_collisionCategories |= CollisionCategories.Body; - m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); - - if (m_NoColide) - { - d.GeomSetCategoryBits(prim_geom, 0); - d.GeomSetCollideBits(prim_geom, (int)CollisionCategories.Land); - } - else - { - d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); - d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); - } - - d.BodySetAutoDisableFlag(Body, true); - d.BodySetAutoDisableSteps(Body, body_autodisable_frames); - - // disconnect from world gravity so we can apply buoyancy - d.BodySetGravityMode(Body, false); - - m_interpenetrationcount = 0; - m_collisionscore = 0; - m_disabled = false; - - if (m_type != Vehicle.TYPE_NONE) - { - Enable(Body, _parent_scene); - } - - _parent_scene.addActivePrim(this); - } - } - - #region Mass Calculation - - private float CalculateMass() - { - float volume = _size.X * _size.Y * _size.Z; // default - float tmp; - - float returnMass = 0; - float hollowAmount = (float)_pbs.ProfileHollow * 2.0e-5f; - float hollowVolume = hollowAmount * hollowAmount; - - switch (_pbs.ProfileShape) - { - case ProfileShape.Square: - // default box - - if (_pbs.PathCurve == (byte)Extrusion.Straight) - { - if (hollowAmount > 0.0) - { - switch (_pbs.HollowShape) - { - case HollowShape.Square: - case HollowShape.Same: - break; - - case HollowShape.Circle: - - hollowVolume *= 0.78539816339f; - break; - - case HollowShape.Triangle: - - hollowVolume *= (0.5f * .5f); - break; - - default: - hollowVolume = 0; - break; - } - volume *= (1.0f - hollowVolume); - } - } - - else if (_pbs.PathCurve == (byte)Extrusion.Curve1) - { - //a tube - - volume *= 0.78539816339e-2f * (float)(200 - _pbs.PathScaleX); - tmp = 1.0f - 2.0e-2f * (float)(200 - _pbs.PathScaleY); - volume -= volume * tmp * tmp; - - if (hollowAmount > 0.0) - { - hollowVolume *= hollowAmount; - - switch (_pbs.HollowShape) - { - case HollowShape.Square: - case HollowShape.Same: - break; - - case HollowShape.Circle: - hollowVolume *= 0.78539816339f; ; - break; - - case HollowShape.Triangle: - hollowVolume *= 0.5f * 0.5f; - break; - default: - hollowVolume = 0; - break; - } - volume *= (1.0f - hollowVolume); - } - } - - break; - - case ProfileShape.Circle: - - if (_pbs.PathCurve == (byte)Extrusion.Straight) - { - volume *= 0.78539816339f; // elipse base - - if (hollowAmount > 0.0) - { - switch (_pbs.HollowShape) - { - case HollowShape.Same: - case HollowShape.Circle: - break; - - case HollowShape.Square: - hollowVolume *= 0.5f * 2.5984480504799f; - break; - - case HollowShape.Triangle: - hollowVolume *= .5f * 1.27323954473516f; - break; - - default: - hollowVolume = 0; - break; - } - volume *= (1.0f - hollowVolume); - } - } - - else if (_pbs.PathCurve == (byte)Extrusion.Curve1) - { - volume *= 0.61685027506808491367715568749226e-2f * (float)(200 - _pbs.PathScaleX); - tmp = 1.0f - .02f * (float)(200 - _pbs.PathScaleY); - volume *= (1.0f - tmp * tmp); - - if (hollowAmount > 0.0) - { - - // calculate the hollow volume by it's shape compared to the prim shape - hollowVolume *= hollowAmount; - - switch (_pbs.HollowShape) - { - case HollowShape.Same: - case HollowShape.Circle: - break; - - case HollowShape.Square: - hollowVolume *= 0.5f * 2.5984480504799f; - break; - - case HollowShape.Triangle: - hollowVolume *= .5f * 1.27323954473516f; - break; - - default: - hollowVolume = 0; - break; - } - volume *= (1.0f - hollowVolume); - } - } - break; - - case ProfileShape.HalfCircle: - if (_pbs.PathCurve == (byte)Extrusion.Curve1) - { - volume *= 0.52359877559829887307710723054658f; - } - break; - - case ProfileShape.EquilateralTriangle: - - if (_pbs.PathCurve == (byte)Extrusion.Straight) - { - volume *= 0.32475953f; - - if (hollowAmount > 0.0) - { - - // calculate the hollow volume by it's shape compared to the prim shape - switch (_pbs.HollowShape) - { - case HollowShape.Same: - case HollowShape.Triangle: - hollowVolume *= .25f; - break; - - case HollowShape.Square: - hollowVolume *= 0.499849f * 3.07920140172638f; - break; - - case HollowShape.Circle: - // Hollow shape is a perfect cyllinder in respect to the cube's scale - // Cyllinder hollow volume calculation - - hollowVolume *= 0.1963495f * 3.07920140172638f; - break; - - default: - hollowVolume = 0; - break; - } - volume *= (1.0f - hollowVolume); - } - } - else if (_pbs.PathCurve == (byte)Extrusion.Curve1) - { - volume *= 0.32475953f; - volume *= 0.01f * (float)(200 - _pbs.PathScaleX); - tmp = 1.0f - .02f * (float)(200 - _pbs.PathScaleY); - volume *= (1.0f - tmp * tmp); - - if (hollowAmount > 0.0) - { - - hollowVolume *= hollowAmount; - - switch (_pbs.HollowShape) - { - case HollowShape.Same: - case HollowShape.Triangle: - hollowVolume *= .25f; - break; - - case HollowShape.Square: - hollowVolume *= 0.499849f * 3.07920140172638f; - break; - - case HollowShape.Circle: - - hollowVolume *= 0.1963495f * 3.07920140172638f; - break; - - default: - hollowVolume = 0; - break; - } - volume *= (1.0f - hollowVolume); - } - } - break; - - default: - break; - } - - - - float taperX1; - float taperY1; - float taperX; - float taperY; - float pathBegin; - float pathEnd; - float profileBegin; - float profileEnd; - - if (_pbs.PathCurve == (byte)Extrusion.Straight || _pbs.PathCurve == (byte)Extrusion.Flexible) - { - taperX1 = _pbs.PathScaleX * 0.01f; - if (taperX1 > 1.0f) - taperX1 = 2.0f - taperX1; - taperX = 1.0f - taperX1; - - taperY1 = _pbs.PathScaleY * 0.01f; - if (taperY1 > 1.0f) - taperY1 = 2.0f - taperY1; - taperY = 1.0f - taperY1; - } - else - { - taperX = _pbs.PathTaperX * 0.01f; - if (taperX < 0.0f) - taperX = -taperX; - taperX1 = 1.0f - taperX; - - taperY = _pbs.PathTaperY * 0.01f; - if (taperY < 0.0f) - taperY = -taperY; - taperY1 = 1.0f - taperY; - - } - - - volume *= (taperX1 * taperY1 + 0.5f * (taperX1 * taperY + taperX * taperY1) + 0.3333333333f * taperX * taperY); - - pathBegin = (float)_pbs.PathBegin * 2.0e-5f; - pathEnd = 1.0f - (float)_pbs.PathEnd * 2.0e-5f; - volume *= (pathEnd - pathBegin); - - // this is crude aproximation - profileBegin = (float)_pbs.ProfileBegin * 2.0e-5f; - profileEnd = 1.0f - (float)_pbs.ProfileEnd * 2.0e-5f; - volume *= (profileEnd - profileBegin); - - returnMass = m_density * volume; - - if (returnMass <= 0) - returnMass = 0.0001f;//ckrinke: Mass must be greater then zero. - // else if (returnMass > _parent_scene.maximumMassObject) - // returnMass = _parent_scene.maximumMassObject; - - - - m_primMass = returnMass; - if (m_primMass > _parent_scene.maximumMassObject) - m_primMass = _parent_scene.maximumMassObject; - - // Recursively calculate mass - bool HasChildPrim = false; - lock (childrenPrim) - { - if (childrenPrim.Count > 0) - { - HasChildPrim = true; - } - - } - if (HasChildPrim) - { - OdePrim[] childPrimArr = new OdePrim[0]; - - lock (childrenPrim) - childPrimArr = childrenPrim.ToArray(); - - for (int i = 0; i < childPrimArr.Length; i++) - { - if (childPrimArr[i] != null && !childPrimArr[i].m_taintremove) - returnMass += childPrimArr[i].CalculateMass(); - // failsafe, this shouldn't happen but with OpenSim, you never know :) - if (i > 256) - break; - } - } - if (returnMass > _parent_scene.maximumMassObject) - returnMass = _parent_scene.maximumMassObject; - return returnMass; - }// end CalculateMass - - #endregion - - public void setMass() - { - if (Body != (IntPtr)0) - { - float newmass = CalculateMass(); - - //m_log.Info("[PHYSICS]: New Mass: " + newmass.ToString()); - - d.MassSetBoxTotal(out pMass, newmass, _size.X, _size.Y, _size.Z); - d.BodySetMass(Body, ref pMass); - } - } - - - private void UpdateDataFromGeom() - { - if (prim_geom != IntPtr.Zero) - { - d.Quaternion qtmp; - d.GeomCopyQuaternion(prim_geom, out qtmp); - _orientation.W = qtmp.W; - _orientation.X = qtmp.X; - _orientation.Y = qtmp.Y; - _orientation.Z = qtmp.Z; - - d.Vector3 lpos = d.GeomGetPosition(prim_geom); - _position.X = lpos.X; - _position.Y = lpos.Y; - _position.Z = lpos.Z; - } - } - - public void disableBody() - { - //this kills the body so things like 'mesh' can re-create it. - lock (this) - { - if (!childPrim) - { - if (Body != IntPtr.Zero) - { - _parent_scene.remActivePrim(this); - m_collisionCategories &= ~CollisionCategories.Body; - m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); - - if (prim_geom != IntPtr.Zero) - { - if (m_NoColide) - { - d.GeomSetCategoryBits(prim_geom, 0); - d.GeomSetCollideBits(prim_geom, 0); - d.GeomDisable(prim_geom); - } - else - { - d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); - d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); - } - } - - UpdateDataFromGeom(); - - lock (childrenPrim) - { - if (childrenPrim.Count > 0) - { - foreach (OdePrim prm in childrenPrim) - { - if (prm.prim_geom != IntPtr.Zero) - { - if (prm.m_NoColide) - { - d.GeomSetCategoryBits(prm.prim_geom, 0); - d.GeomSetCollideBits(prm.prim_geom, 0); - d.GeomDisable(prm.prim_geom); - - } - prm.UpdateDataFromGeom(); - } - _parent_scene.remActivePrim(prm); - prm.Body = IntPtr.Zero; - } - } - } - d.BodyDestroy(Body); - Body = IntPtr.Zero; - } - } - else - { - _parent_scene.remActivePrim(this); - - m_collisionCategories &= ~CollisionCategories.Body; - m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); - - if (prim_geom != IntPtr.Zero) - { - if (m_NoColide) - { - d.GeomSetCategoryBits(prim_geom, 0); - d.GeomSetCollideBits(prim_geom, 0); - d.GeomDisable(prim_geom); - } - else - { - d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); - d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); - } - } - - Body = IntPtr.Zero; - } - } - m_disabled = true; - m_collisionscore = 0; - } - -// private static Dictionary m_MeshToTriMeshMap = new Dictionary(); - - public bool setMesh(OdeScene parent_scene, IMesh mesh) - { - //Kill Body so that mesh can re-make the geom - if (IsPhysical && Body != IntPtr.Zero) - { - if (childPrim) - { - if (_parent != null) - { - OdePrim parent = (OdePrim)_parent; - parent.ChildDelink(this); - } - } - else - { - disableBody(); - } - } - - IntPtr vertices, indices; - int vertexCount, indexCount; - int vertexStride, triStride; - mesh.getVertexListAsPtrToFloatArray(out vertices, out vertexStride, out vertexCount); // Note, that vertices are fixed in unmanaged heap - mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage - - // warning this destroys the mesh for eventual future use. Only pinned float arrays stay valid - mesh.releaseSourceMeshData(); // free up the original mesh data to save memory - - if (vertexCount == 0 || indexCount == 0) - { - m_log.WarnFormat("[PHYSICS]: Got invalid mesh on prim {0} at <{1},{2},{3}>. mesh UUID {4}", Name, _position.X, _position.Y, _position.Z, _pbs.SculptTexture.ToString()); - return false; - } - - IntPtr geo = IntPtr.Zero; - try - { - _triMeshData = d.GeomTriMeshDataCreate(); - d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride); - d.GeomTriMeshDataPreprocess(_triMeshData); - - _parent_scene.waitForSpaceUnlock(m_targetSpace); - - geo = d.CreateTriMesh(m_targetSpace, _triMeshData, null, null, null); - } - catch (Exception e) - { - m_log.ErrorFormat("[PHYSICS]: Create trimesh failed on prim {0} : {1}",Name,e.Message); - - if (_triMeshData != IntPtr.Zero) - { - d.GeomTriMeshDataDestroy(_triMeshData); - _triMeshData = IntPtr.Zero; - } - return false; - } - - SetGeom(geo); - - return true; - } - - public void ProcessTaints(float timestep) //============================================================================= - { - if (m_taintadd) - { - changeadd(timestep); - } - - if (m_taintremove) - return; - - if (prim_geom != IntPtr.Zero) - { - if (!_position.ApproxEquals(m_taintposition, 0f)) - { - changemove(timestep); - } - if (m_taintrot != _orientation) - { - if (childPrim && IsPhysical) // For physical child prim... - { - rotate(timestep); - // KF: ODE will also rotate the parent prim! - // so rotate the root back to where it was - OdePrim parent = (OdePrim)_parent; - parent.rotate(timestep); - } - else - { - //Just rotate the prim - rotate(timestep); - } - } - // - if (m_taintphantom != m_isphantom ) - { - changePhantomStatus(); - }// - - if (m_taintPhysics != m_isphysical && !(m_taintparent != _parent)) - { - changePhysicsStatus(timestep); - }// - - - if (!_size.ApproxEquals(m_taintsize, 0f)) - changesize(timestep); - // - - if(m_taintshapetype != m_shapetype) - { - m_shapetype = m_taintshapetype; - changeshape(timestep); - } - - if (m_taintshape) - changeshape(timestep); - // - - if (m_taintforce) - changeAddForce(timestep); - - if (m_taintaddangularforce) - changeAddAngularForce(timestep); - - if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f)) - changeSetTorque(timestep); - - if (m_taintdisable) - changedisable(timestep); - - if (m_taintselected != m_isSelected) - changeSelectedStatus(); - - if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f)) - changevelocity(timestep); - - if (m_taintparent != _parent) - changelink(timestep); - - if (m_taintCollidesWater != m_collidesWater) - changefloatonwater(timestep); - - if (m_taintvehicledata != null) - DoSetVehicle(); - - /* obsolete - if (!m_angularLock.ApproxEquals(m_taintAngularLock,0f)) - changeAngularLock(timestep); - */ - } - - else - { - m_log.Error("[PHYSICS]: prim {0} at <{1},{2},{3}> as invalid geom"); - - // not sure this will not flame... - m_taintremove = true; - _parent_scene.AddPhysicsActorTaint(this); - } - - } - - private void changelink(float timestep) - { - // If the newly set parent is not null - // create link - if (_parent == null && m_taintparent != null) - { - if (m_taintparent.PhysicsActorType == (int)ActorTypes.Prim) - { - OdePrim obj = (OdePrim)m_taintparent; - obj.ParentPrim(this); - } - } - // If the newly set parent is null - // destroy link - else if (_parent != null && m_taintparent == null) - { - if (_parent is OdePrim) - { - OdePrim obj = (OdePrim)_parent; - obj.ChildDelink(this); - childPrim = false; - } - } - - _parent = m_taintparent; - m_taintPhysics = m_isphysical; - } - - // I'm the parent - // prim is the child - public void ParentPrim(OdePrim prim) - { - if (this.m_localID != prim.m_localID) - { - if (Body == IntPtr.Zero) - { - Body = d.BodyCreate(_parent_scene.world); - // disconnect from world gravity so we can apply buoyancy - d.BodySetGravityMode(Body, false); - - setMass(); - } - if (Body != IntPtr.Zero) - { - lock (childrenPrim) - { - if (!childrenPrim.Contains(prim)) - { - childrenPrim.Add(prim); - - foreach (OdePrim prm in childrenPrim) - { - d.Mass m2; - d.MassSetZero(out m2); - d.MassSetBoxTotal(out m2, prim.CalculateMass(), prm._size.X, prm._size.Y, prm._size.Z); - - - d.Quaternion quat = new d.Quaternion(); - quat.W = prm._orientation.W; - quat.X = prm._orientation.X; - quat.Y = prm._orientation.Y; - quat.Z = prm._orientation.Z; - - d.Matrix3 mat = new d.Matrix3(); - d.RfromQ(out mat, ref quat); - d.MassRotate(ref m2, ref mat); - d.MassTranslate(ref m2, Position.X - prm.Position.X, Position.Y - prm.Position.Y, Position.Z - prm.Position.Z); - d.MassAdd(ref pMass, ref m2); - } - foreach (OdePrim prm in childrenPrim) - { - if (m_isphantom && !prm.m_isVolumeDetect) - { - prm.m_collisionCategories = 0; - prm.m_collisionFlags = CollisionCategories.Land; - } - else - { - prm.m_collisionCategories |= CollisionCategories.Body; - prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); - } - if (prm.prim_geom == IntPtr.Zero) - { - m_log.Warn("[PHYSICS]: Unable to link one of the linkset elements. No geom yet"); - continue; - } - - if (prm.m_NoColide) - { - d.GeomSetCategoryBits(prm.prim_geom, 0); - d.GeomSetCollideBits(prm.prim_geom, (int)CollisionCategories.Land); - } - else - { - d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories); - d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags); - } - - d.Quaternion quat = new d.Quaternion(); - quat.W = prm._orientation.W; - quat.X = prm._orientation.X; - quat.Y = prm._orientation.Y; - quat.Z = prm._orientation.Z; - - d.Matrix3 mat = new d.Matrix3(); - d.RfromQ(out mat, ref quat); - if (Body != IntPtr.Zero) - { - d.GeomSetBody(prm.prim_geom, Body); - prm.childPrim = true; - d.GeomSetOffsetWorldPosition(prm.prim_geom, prm.Position.X, prm.Position.Y, prm.Position.Z); - //d.GeomSetOffsetPosition(prim.prim_geom, - // (Position.X - prm.Position.X) - pMass.c.X, - // (Position.Y - prm.Position.Y) - pMass.c.Y, - // (Position.Z - prm.Position.Z) - pMass.c.Z); - d.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat); - //d.GeomSetOffsetRotation(prm.prim_geom, ref mat); - d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z); - d.BodySetMass(Body, ref pMass); - } - else - { - m_log.Debug("[PHYSICS]:I ain't got no boooooooooddy, no body"); - } - - prm.m_interpenetrationcount = 0; - prm.m_collisionscore = 0; - prm.m_disabled = false; - - prm.Body = Body; - - _parent_scene.addActivePrim(prm); - } - - if (m_isphantom && !m_isVolumeDetect) - { - m_collisionCategories = 0; - m_collisionFlags = CollisionCategories.Land; - } - else - { - m_collisionCategories |= CollisionCategories.Body; - m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); - } - - if (m_NoColide) - { - d.GeomSetCategoryBits(prim_geom, 0); - d.GeomSetCollideBits(prim_geom, (int)CollisionCategories.Land); - } - else - { - d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); - d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); - } - - d.Quaternion quat2 = new d.Quaternion(); - quat2.W = _orientation.W; - quat2.X = _orientation.X; - quat2.Y = _orientation.Y; - quat2.Z = _orientation.Z; - - d.Matrix3 mat2 = new d.Matrix3(); - d.RfromQ(out mat2, ref quat2); - d.GeomSetBody(prim_geom, Body); - d.GeomSetOffsetWorldPosition(prim_geom, Position.X - pMass.c.X, Position.Y - pMass.c.Y, Position.Z - pMass.c.Z); - //d.GeomSetOffsetPosition(prim.prim_geom, - // (Position.X - prm.Position.X) - pMass.c.X, - // (Position.Y - prm.Position.Y) - pMass.c.Y, - // (Position.Z - prm.Position.Z) - pMass.c.Z); - //d.GeomSetOffsetRotation(prim_geom, ref mat2); - d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z); - d.BodySetMass(Body, ref pMass); - - d.BodySetAutoDisableFlag(Body, true); - d.BodySetAutoDisableSteps(Body, body_autodisable_frames); - - m_interpenetrationcount = 0; - m_collisionscore = 0; - m_disabled = false; - - d.BodySetPosition(Body, Position.X, Position.Y, Position.Z); - if (m_type != Vehicle.TYPE_NONE) Enable(Body, _parent_scene); - - _parent_scene.addActivePrim(this); - } - } - } - } - } - - private void ChildSetGeom(OdePrim odePrim) - { - lock (childrenPrim) - { - foreach (OdePrim prm in childrenPrim) - { - prm.disableBody(); - } - } - disableBody(); - - if (Body != IntPtr.Zero) - { - _parent_scene.remActivePrim(this); - } - - lock (childrenPrim) - { - foreach (OdePrim prm in childrenPrim) - { - ParentPrim(prm); - } - } - } - - private void ChildDelink(OdePrim odePrim) - { - // Okay, we have a delinked child.. need to rebuild the body. - lock (childrenPrim) - { - foreach (OdePrim prm in childrenPrim) - { - prm.childPrim = true; - prm.disableBody(); - } - } - disableBody(); - - lock (childrenPrim) - { - childrenPrim.Remove(odePrim); - } - - if (Body != IntPtr.Zero) - { - _parent_scene.remActivePrim(this); - } - - lock (childrenPrim) - { - foreach (OdePrim prm in childrenPrim) - { - ParentPrim(prm); - } - } - } - - private void changePhantomStatus() - { - m_taintphantom = m_isphantom; - changeSelectedStatus(); - } - -/* not in use - private void SetCollider() - { - SetCollider(m_isSelected, m_isphysical, m_isphantom, m_isSelected); - } - - private void SetCollider(bool sel, bool phys, bool phan, bool vdtc) - { - if (sel) - { - m_collisionCategories = CollisionCategories.Selected; - m_collisionFlags = (CollisionCategories.Sensor | CollisionCategories.Space); - } - else - { - if (phan && !vdtc) - { - m_collisionCategories = 0; - if (phys) - m_collisionFlags = CollisionCategories.Land; - else - m_collisionFlags = 0; // this case should not happen non physical phantoms should not have physics - } - else - { - m_collisionCategories = CollisionCategories.Geom; - if (phys) - m_collisionCategories |= CollisionCategories.Body; - - m_collisionFlags = m_default_collisionFlags; - - if (m_collidesLand) - m_collisionFlags |= CollisionCategories.Land; - if (m_collidesWater) - m_collisionFlags |= CollisionCategories.Water; - } - } - - if (prim_geom != IntPtr.Zero) - { - if (m_NoColide) - { - d.GeomSetCategoryBits(prim_geom, 0); - if (phys) - d.GeomSetCollideBits(prim_geom, (int)CollisionCategories.Land); - else - { - d.GeomSetCollideBits(prim_geom, 0); - d.GeomDisable(prim_geom); - } - } - else - { - d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); - d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); - } - } - } -*/ - - private void changeSelectedStatus() - { - if (m_taintselected) - { - m_collisionCategories = CollisionCategories.Selected; - m_collisionFlags = (CollisionCategories.Sensor | CollisionCategories.Space); - - // We do the body disable soft twice because 'in theory' a collision could have happened - // in between the disabling and the collision properties setting - // which would wake the physical body up from a soft disabling and potentially cause it to fall - // through the ground. - - // NOTE FOR JOINTS: this doesn't always work for jointed assemblies because if you select - // just one part of the assembly, the rest of the assembly is non-selected and still simulating, - // so that causes the selected part to wake up and continue moving. - - // even if you select all parts of a jointed assembly, it is not guaranteed that the entire - // assembly will stop simulating during the selection, because of the lack of atomicity - // of select operations (their processing could be interrupted by a thread switch, causing - // simulation to continue before all of the selected object notifications trickle down to - // the physics engine). - - // e.g. we select 100 prims that are connected by joints. non-atomically, the first 50 are - // selected and disabled. then, due to a thread switch, the selection processing is - // interrupted and the physics engine continues to simulate, so the last 50 items, whose - // selection was not yet processed, continues to simulate. this wakes up ALL of the - // first 50 again. then the last 50 are disabled. then the first 50, which were just woken - // up, start simulating again, which in turn wakes up the last 50. - - if (m_isphysical) - { - disableBodySoft(); - } - - if (prim_geom != IntPtr.Zero) - { - d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); - d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); - if (m_NoColide) - d.GeomDisable(prim_geom); - } - - if (m_isphysical) - { - disableBodySoft(); - } - if (Body != IntPtr.Zero) - { - d.BodySetLinearVel(Body, 0f, 0f, 0f); - d.BodySetForce(Body, 0f, 0f, 0f); - d.BodySetAngularVel(Body, 0.0f, 0.0f, 0.0f); - d.BodySetTorque(Body, 0.0f, 0.0f, 0.0f); - } - } - else - { - if (m_isphantom && !m_isVolumeDetect) - { - m_collisionCategories = 0; - if (m_isphysical) - m_collisionFlags = CollisionCategories.Land; - else - m_collisionFlags = 0; // this case should not happen non physical phantoms should not have physics - } - else - { - m_collisionCategories = CollisionCategories.Geom; - if (m_isphysical) - m_collisionCategories |= CollisionCategories.Body; - - m_collisionFlags = m_default_collisionFlags; - - if (m_collidesLand) - m_collisionFlags |= CollisionCategories.Land; - if (m_collidesWater) - m_collisionFlags |= CollisionCategories.Water; - } - - if (prim_geom != IntPtr.Zero) - { - if (m_NoColide) - { - d.GeomSetCategoryBits(prim_geom, 0); - if (m_isphysical) - d.GeomSetCollideBits(prim_geom, (int)CollisionCategories.Land); - else - { - d.GeomSetCollideBits(prim_geom, 0); - d.GeomDisable(prim_geom); - } - } - else - { - d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); - d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); - } - } - if (Body != IntPtr.Zero) - { - d.BodySetLinearVel(Body, 0f, 0f, 0f); - d.BodySetForce(Body, 0f, 0f, 0f); - d.BodySetAngularVel(Body, 0.0f, 0.0f, 0.0f); - d.BodySetTorque(Body, 0.0f, 0.0f, 0.0f); - } - - if (m_isphysical) - { - if (Body != IntPtr.Zero) - { - enableBodySoft(); - } - } - } - - resetCollisionAccounting(); - m_isSelected = m_taintselected; - }//end changeSelectedStatus - - public void ResetTaints() - { - m_taintposition = _position; - m_taintrot = _orientation; - m_taintPhysics = m_isphysical; - m_taintselected = m_isSelected; - m_taintsize = _size; - m_taintshape = false; - m_taintforce = false; - m_taintdisable = false; - m_taintVelocity = Vector3.Zero; - } - - public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh) - { - bool gottrimesh = false; - - m_NoColide = false; // assume all will go well - - if (_triMeshData != IntPtr.Zero) - { - d.GeomTriMeshDataDestroy(_triMeshData); - _triMeshData = IntPtr.Zero; - } - - if (_mesh != null) - { - gottrimesh = setMesh(_parent_scene, _mesh); - if (!gottrimesh) - { - // getting a mesh failed, - // lets go on having a basic box or sphere, with prim size but not coliding - // physical colides with land, non with nothing - - m_NoColide = true; - } - } - - if (!gottrimesh) - { // we will have a basic box or sphere - IntPtr geo = IntPtr.Zero; - - if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1 - && _size.X == _size.Y && _size.X == _size.Z) - { - // its a sphere - _parent_scene.waitForSpaceUnlock(m_targetSpace); - try - { - geo = d.CreateSphere(m_targetSpace, _size.X * 0.5f); - } - catch (Exception e) - { - m_log.WarnFormat("[PHYSICS]: Unable to create basic sphere for object {0}", e.Message); - geo = IntPtr.Zero; - ode.dunlock(_parent_scene.world); - } - } - else // make it a box - { - _parent_scene.waitForSpaceUnlock(m_targetSpace); - try - { - geo = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); - } - catch (Exception e) - { - m_log.WarnFormat("[PHYSICS]: Unable to create basic sphere for object {0}", e.Message); - geo = IntPtr.Zero; - ode.dunlock(_parent_scene.world); - } - } - - if (geo == IntPtr.Zero) // if this happens it must be fixed - { - // if it does lets stop what we can - // not sure this will not flame... - - m_taintremove = true; - _parent_scene.AddPhysicsActorTaint(this); - return; - } - - SetGeom(geo); // this processes the m_NoColide - } - } - - public void changeadd(float timestep) - { - int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); - IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); - - if (targetspace == IntPtr.Zero) - targetspace = _parent_scene.createprimspace(iprimspaceArrItem[0], iprimspaceArrItem[1]); - - m_targetSpace = targetspace; - - if (_mesh == null) // && m_meshfailed == false) - { - if (_parent_scene.needsMeshing(_pbs)) - { - bool convex; - if (m_shapetype == 2) - convex = true; - else - convex = false; - try - { - _mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, (int)LevelOfDetail.High, true,false,convex,false); - } - catch - { - //Don't continuously try to mesh prims when meshing has failed - m_meshfailed = true; - _mesh = null; - m_log.WarnFormat("[PHYSICS]: changeAdd CreateMesh fail on prim {0} at <{1},{2},{3}>", Name, _position.X, _position.Y, _position.Z); - } - } - } - - lock (_parent_scene.OdeLock) - { - CreateGeom(m_targetSpace, _mesh); - - if (prim_geom != IntPtr.Zero) - { - d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); - d.Quaternion myrot = new d.Quaternion(); - myrot.X = _orientation.X; - myrot.Y = _orientation.Y; - myrot.Z = _orientation.Z; - myrot.W = _orientation.W; - d.GeomSetQuaternion(prim_geom, ref myrot); - } - - if (m_isphysical && Body == IntPtr.Zero) - { - enableBody(); - } - } - - changeSelectedStatus(); - - m_taintadd = false; - } - - public void changemove(float timestep) - { - if (m_isphysical) - { - // if (!m_disabled && !m_taintremove && !childPrim) After one edit m_disabled is sometimes set, disabling further edits! - if (!m_taintremove && !childPrim) - { - if (Body == IntPtr.Zero) - enableBody(); - //Prim auto disable after 20 frames, - //if you move it, re-enable the prim manually. - if (_parent != null) - { - if (m_linkJoint != IntPtr.Zero) - { - d.JointDestroy(m_linkJoint); - m_linkJoint = IntPtr.Zero; - } - } - if (Body != IntPtr.Zero) - { - d.BodySetPosition(Body, _position.X, _position.Y, _position.Z); - - if (_parent != null) - { - OdePrim odParent = (OdePrim)_parent; - if (Body != (IntPtr)0 && odParent.Body != (IntPtr)0 && Body != odParent.Body) - { - // KF: Fixed Joints were removed? Anyway - this Console.WriteLine does not show up, so routine is not used?? - Console.WriteLine("ODEPrim JointCreateFixed !!!"); - m_linkJoint = d.JointCreateFixed(_parent_scene.world, _linkJointGroup); - d.JointAttach(m_linkJoint, Body, odParent.Body); - d.JointSetFixed(m_linkJoint); - } - } - d.BodyEnable(Body); - if (m_type != Vehicle.TYPE_NONE) - { - Enable(Body, _parent_scene); - } - } - else - { - m_log.Warn("[PHYSICS]: Body Still null after enableBody(). This is a crash scenario."); - } - } - //else - // { - //m_log.Debug("[BUG]: race!"); - //} - } - else - { - // string primScenAvatarIn = _parent_scene.whichspaceamIin(_position); - // int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position); - _parent_scene.waitForSpaceUnlock(m_targetSpace); - - IntPtr tempspace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace); - m_targetSpace = tempspace; - - _parent_scene.waitForSpaceUnlock(m_targetSpace); - if (prim_geom != IntPtr.Zero) - { - d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); - - _parent_scene.waitForSpaceUnlock(m_targetSpace); - d.SpaceAdd(m_targetSpace, prim_geom); - } - } - - changeSelectedStatus(); - - resetCollisionAccounting(); - m_taintposition = _position; - } - - public void rotate(float timestep) - { - d.Quaternion myrot = new d.Quaternion(); - myrot.X = _orientation.X; - myrot.Y = _orientation.Y; - myrot.Z = _orientation.Z; - myrot.W = _orientation.W; - if (Body != IntPtr.Zero) - { - // KF: If this is a root prim do BodySet - d.BodySetQuaternion(Body, ref myrot); - } - else - { - // daughter prim, do Geom set - d.GeomSetQuaternion(prim_geom, ref myrot); - } - - resetCollisionAccounting(); - m_taintrot = _orientation; - } - - private void resetCollisionAccounting() - { - m_collisionscore = 0; - m_interpenetrationcount = 0; - m_disabled = false; - } - - public void changedisable(float timestep) - { - m_disabled = true; - if (Body != IntPtr.Zero) - { - d.BodyDisable(Body); - Body = IntPtr.Zero; - } - - m_taintdisable = false; - } - - public void changePhysicsStatus(float timestep) - { - if (m_isphysical == true) - { - if (Body == IntPtr.Zero) - { - if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim) - { - changeshape(2f); - } - else - { - enableBody(); - } - } - } - else - { - if (Body != IntPtr.Zero) - { - if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim) - { - _mesh = null; - changeadd(2f); - } - if (childPrim) - { - if (_parent != null) - { - OdePrim parent = (OdePrim)_parent; - parent.ChildDelink(this); - } - } - else - { - disableBody(); - } - } - } - - changeSelectedStatus(); - - resetCollisionAccounting(); - m_taintPhysics = m_isphysical; - } - - public void changesize(float timestamp) - { - - string oldname = _parent_scene.geom_name_map[prim_geom]; - - if (_size.X <= 0) _size.X = 0.01f; - if (_size.Y <= 0) _size.Y = 0.01f; - if (_size.Z <= 0) _size.Z = 0.01f; - - // Cleanup of old prim geometry - if (_mesh != null) - { - // Cleanup meshing here - } - //kill body to rebuild - if (IsPhysical && Body != IntPtr.Zero) - { - if (childPrim) - { - if (_parent != null) - { - OdePrim parent = (OdePrim)_parent; - parent.ChildDelink(this); - } - } - else - { - disableBody(); - } - } - if (d.SpaceQuery(m_targetSpace, prim_geom)) - { - _parent_scene.waitForSpaceUnlock(m_targetSpace); - d.SpaceRemove(m_targetSpace, prim_geom); - } - // we don't need to do space calculation because the client sends a position update also. - - // Construction of new prim - if (_parent_scene.needsMeshing(_pbs))// && m_meshfailed == false) - { - float meshlod = _parent_scene.meshSculptLOD; - - if (IsPhysical) - meshlod = _parent_scene.MeshSculptphysicalLOD; - // Don't need to re-enable body.. it's done in SetMesh - - IMesh mesh = null; - - try - { - if (_parent_scene.needsMeshing(_pbs)) - mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, (int)LevelOfDetail.High, true); - } - catch - { - m_meshfailed = true; - mesh = null; - m_log.WarnFormat("[PHYSICS]: changeSize CreateMesh fail on prim {0} at <{1},{2},{3}>", Name, _position.X, _position.Y, _position.Z); - } - - //IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); - CreateGeom(m_targetSpace, mesh); - } - else - { - _mesh = null; - CreateGeom(m_targetSpace, _mesh); - } - - d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); - d.Quaternion myrot = new d.Quaternion(); - myrot.X = _orientation.X; - myrot.Y = _orientation.Y; - myrot.Z = _orientation.Z; - myrot.W = _orientation.W; - d.GeomSetQuaternion(prim_geom, ref myrot); - - //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); - if (IsPhysical && Body == IntPtr.Zero && !childPrim) - { - // Re creates body on size. - // EnableBody also does setMass() - enableBody(); - d.BodyEnable(Body); - } - - _parent_scene.geom_name_map[prim_geom] = oldname; - - changeSelectedStatus(); - if (childPrim) - { - if (_parent is OdePrim) - { - OdePrim parent = (OdePrim)_parent; - parent.ChildSetGeom(this); - } - } - resetCollisionAccounting(); - m_taintsize = _size; - } - - - - public void changefloatonwater(float timestep) - { - m_collidesWater = m_taintCollidesWater; - - if (prim_geom != IntPtr.Zero) - { - if (m_collidesWater) - { - m_collisionFlags |= CollisionCategories.Water; - } - else - { - m_collisionFlags &= ~CollisionCategories.Water; - } - d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); - } - } - - public void changeshape(float timestamp) - { - string oldname = _parent_scene.geom_name_map[prim_geom]; - - // Cleanup of old prim geometry and Bodies - if (IsPhysical && Body != IntPtr.Zero) - { - if (childPrim) - { - if (_parent != null) - { - OdePrim parent = (OdePrim)_parent; - parent.ChildDelink(this); - } - } - else - { - disableBody(); - } - } - - - // we don't need to do space calculation because the client sends a position update also. - if (_size.X <= 0) _size.X = 0.01f; - if (_size.Y <= 0) _size.Y = 0.01f; - if (_size.Z <= 0) _size.Z = 0.01f; - // Construction of new prim - - if (_parent_scene.needsMeshing(_pbs))// && m_meshfailed == false) - { - // Don't need to re-enable body.. it's done in SetMesh - float meshlod = _parent_scene.meshSculptLOD; - IMesh mesh; - - if (IsPhysical) - meshlod = _parent_scene.MeshSculptphysicalLOD; - - bool convex; - if (m_shapetype == 2) - convex = true; - else - convex = false; - - try - { - mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, (int)LevelOfDetail.High, true, false,convex,false); - } - catch - { - mesh = null; - m_meshfailed = true; - m_log.WarnFormat("[PHYSICS]: changeAdd CreateMesh fail on prim {0} at <{1},{2},{3}>", Name, _position.X, _position.Y, _position.Z); - } - - CreateGeom(m_targetSpace, mesh); - - // createmesh returns null when it doesn't mesh. - } - else - { - _mesh = null; - CreateGeom(m_targetSpace, null); - } - - d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); - d.Quaternion myrot = new d.Quaternion(); - //myrot.W = _orientation.w; - myrot.W = _orientation.W; - myrot.X = _orientation.X; - myrot.Y = _orientation.Y; - myrot.Z = _orientation.Z; - d.GeomSetQuaternion(prim_geom, ref myrot); - - //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); - if (IsPhysical && Body == IntPtr.Zero) - { - // Re creates body on size. - // EnableBody also does setMass() - enableBody(); - if (Body != IntPtr.Zero) - { - d.BodyEnable(Body); - } - } - _parent_scene.geom_name_map[prim_geom] = oldname; - - changeSelectedStatus(); - if (childPrim) - { - if (_parent is OdePrim) - { - OdePrim parent = (OdePrim)_parent; - parent.ChildSetGeom(this); - } - } - resetCollisionAccounting(); - m_taintshape = false; - } - - public void changeAddForce(float timestamp) - { - if (!m_isSelected) - { - lock (m_forcelist) - { - //m_log.Info("[PHYSICS]: dequeing forcelist"); - if (IsPhysical) - { - Vector3 iforce = Vector3.Zero; - int i = 0; - try - { - for (i = 0; i < m_forcelist.Count; i++) - { - - iforce = iforce + (m_forcelist[i] * 100); - } - } - catch (IndexOutOfRangeException) - { - m_forcelist = new List(); - m_collisionscore = 0; - m_interpenetrationcount = 0; - m_taintforce = false; - return; - } - catch (ArgumentOutOfRangeException) - { - m_forcelist = new List(); - m_collisionscore = 0; - m_interpenetrationcount = 0; - m_taintforce = false; - return; - } - d.BodyEnable(Body); - - d.BodyAddForce(Body, iforce.X, iforce.Y, iforce.Z); - } - m_forcelist.Clear(); - } - - m_collisionscore = 0; - m_interpenetrationcount = 0; - } - - m_taintforce = false; - - } - - - - public void changeSetTorque(float timestamp) - { - if (!m_isSelected) - { - if (IsPhysical && Body != IntPtr.Zero) - { - d.BodySetTorque(Body, m_taintTorque.X, m_taintTorque.Y, m_taintTorque.Z); - } - } - - m_taintTorque = Vector3.Zero; - } - - public void changeAddAngularForce(float timestamp) - { - if (!m_isSelected) - { - lock (m_angularforcelist) - { - //m_log.Info("[PHYSICS]: dequeing forcelist"); - if (IsPhysical) - { - Vector3 iforce = Vector3.Zero; - for (int i = 0; i < m_angularforcelist.Count; i++) - { - iforce = iforce + (m_angularforcelist[i] * 100); - } - d.BodyEnable(Body); - d.BodyAddTorque(Body, iforce.X, iforce.Y, iforce.Z); - - } - m_angularforcelist.Clear(); - } - - m_collisionscore = 0; - m_interpenetrationcount = 0; - } - - m_taintaddangularforce = false; - } - - private void changevelocity(float timestep) - { - if (!m_isSelected) - { - Thread.Sleep(20); - if (IsPhysical) - { - if (Body != IntPtr.Zero) - d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z); - } - - //resetCollisionAccounting(); - } - m_taintVelocity = Vector3.Zero; - } - - public void UpdatePositionAndVelocity() - { - return; // moved to the Move () method - } - - public d.Mass FromMatrix4(Matrix4 pMat, ref d.Mass obj) - { - obj.I.M00 = pMat[0, 0]; - obj.I.M01 = pMat[0, 1]; - obj.I.M02 = pMat[0, 2]; - obj.I.M10 = pMat[1, 0]; - obj.I.M11 = pMat[1, 1]; - obj.I.M12 = pMat[1, 2]; - obj.I.M20 = pMat[2, 0]; - obj.I.M21 = pMat[2, 1]; - obj.I.M22 = pMat[2, 2]; - return obj; - } - - public override void SubscribeEvents(int ms) - { - m_eventsubscription = ms; - _parent_scene.addCollisionEventReporting(this); - } - - public override void UnSubscribeEvents() - { - _parent_scene.remCollisionEventReporting(this); - m_eventsubscription = 0; - } - - public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) - { - if (CollisionEventsThisFrame == null) - CollisionEventsThisFrame = new CollisionEventUpdate(); - CollisionEventsThisFrame.AddCollider(CollidedWith, contact); - } - - public void SendCollisions() - { - if (CollisionEventsThisFrame == null) - return; - - base.SendCollisionUpdate(CollisionEventsThisFrame); - - if (CollisionEventsThisFrame.m_objCollisionList.Count == 0) - CollisionEventsThisFrame = null; - else - CollisionEventsThisFrame = new CollisionEventUpdate(); - } - - public override bool SubscribedEvents() - { - if (m_eventsubscription > 0) - return true; - return false; - } - - public static Matrix4 Inverse(Matrix4 pMat) - { - if (determinant3x3(pMat) == 0) - { - return Matrix4.Identity; // should probably throw an error. singluar matrix inverse not possible - } - - - - return (Adjoint(pMat) / determinant3x3(pMat)); - } - - public static Matrix4 Adjoint(Matrix4 pMat) - { - Matrix4 adjointMatrix = new Matrix4(); - for (int i = 0; i < 4; i++) - { - for (int j = 0; j < 4; j++) - { - Matrix4SetValue(ref adjointMatrix, i, j, (float)(Math.Pow(-1, i + j) * (determinant3x3(Minor(pMat, i, j))))); - } - } - - adjointMatrix = Transpose(adjointMatrix); - return adjointMatrix; - } - - public static Matrix4 Minor(Matrix4 matrix, int iRow, int iCol) - { - Matrix4 minor = new Matrix4(); - int m = 0, n = 0; - for (int i = 0; i < 4; i++) - { - if (i == iRow) - continue; - n = 0; - for (int j = 0; j < 4; j++) - { - if (j == iCol) - continue; - Matrix4SetValue(ref minor, m, n, matrix[i, j]); - n++; - } - m++; - } - return minor; - } - - public static Matrix4 Transpose(Matrix4 pMat) - { - Matrix4 transposeMatrix = new Matrix4(); - for (int i = 0; i < 4; i++) - for (int j = 0; j < 4; j++) - Matrix4SetValue(ref transposeMatrix, i, j, pMat[j, i]); - return transposeMatrix; - } - - public static void Matrix4SetValue(ref Matrix4 pMat, int r, int c, float val) - { - switch (r) - { - case 0: - switch (c) - { - case 0: - pMat.M11 = val; - break; - case 1: - pMat.M12 = val; - break; - case 2: - pMat.M13 = val; - break; - case 3: - pMat.M14 = val; - break; - } - - break; - case 1: - switch (c) - { - case 0: - pMat.M21 = val; - break; - case 1: - pMat.M22 = val; - break; - case 2: - pMat.M23 = val; - break; - case 3: - pMat.M24 = val; - break; - } - - break; - case 2: - switch (c) - { - case 0: - pMat.M31 = val; - break; - case 1: - pMat.M32 = val; - break; - case 2: - pMat.M33 = val; - break; - case 3: - pMat.M34 = val; - break; - } - - break; - case 3: - switch (c) - { - case 0: - pMat.M41 = val; - break; - case 1: - pMat.M42 = val; - break; - case 2: - pMat.M43 = val; - break; - case 3: - pMat.M44 = val; - break; - } - - break; - } - } - private static float determinant3x3(Matrix4 pMat) - { - float det = 0; - float diag1 = pMat[0, 0] * pMat[1, 1] * pMat[2, 2]; - float diag2 = pMat[0, 1] * pMat[2, 1] * pMat[2, 0]; - float diag3 = pMat[0, 2] * pMat[1, 0] * pMat[2, 1]; - float diag4 = pMat[2, 0] * pMat[1, 1] * pMat[0, 2]; - float diag5 = pMat[2, 1] * pMat[1, 2] * pMat[0, 0]; - float diag6 = pMat[2, 2] * pMat[1, 0] * pMat[0, 1]; - - det = diag1 + diag2 + diag3 - (diag4 + diag5 + diag6); - return det; - - } - - private static void DMassCopy(ref d.Mass src, ref d.Mass dst) - { - dst.c.W = src.c.W; - dst.c.X = src.c.X; - dst.c.Y = src.c.Y; - dst.c.Z = src.c.Z; - dst.mass = src.mass; - dst.I.M00 = src.I.M00; - dst.I.M01 = src.I.M01; - dst.I.M02 = src.I.M02; - dst.I.M10 = src.I.M10; - dst.I.M11 = src.I.M11; - dst.I.M12 = src.I.M12; - dst.I.M20 = src.I.M20; - dst.I.M21 = src.I.M21; - dst.I.M22 = src.I.M22; - } - - public override void SetMaterial(int pMaterial) - { - m_material = pMaterial; - } - - internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue) - { - switch (pParam) - { - case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY: - if (pValue < 0.01f) pValue = 0.01f; - // m_angularDeflectionEfficiency = pValue; - break; - case Vehicle.ANGULAR_DEFLECTION_TIMESCALE: - if (pValue < 0.1f) pValue = 0.1f; - // m_angularDeflectionTimescale = pValue; - break; - case Vehicle.ANGULAR_MOTOR_DECAY_TIMESCALE: - if (pValue < 0.3f) pValue = 0.3f; - m_angularMotorDecayTimescale = pValue; - break; - case Vehicle.ANGULAR_MOTOR_TIMESCALE: - if (pValue < 0.3f) pValue = 0.3f; - m_angularMotorTimescale = pValue; - break; - case Vehicle.BANKING_EFFICIENCY: - if (pValue < 0.01f) pValue = 0.01f; - // m_bankingEfficiency = pValue; - break; - case Vehicle.BANKING_MIX: - if (pValue < 0.01f) pValue = 0.01f; - // m_bankingMix = pValue; - break; - case Vehicle.BANKING_TIMESCALE: - if (pValue < 0.01f) pValue = 0.01f; - // m_bankingTimescale = pValue; - break; - case Vehicle.BUOYANCY: - if (pValue < -1f) pValue = -1f; - if (pValue > 1f) pValue = 1f; - m_VehicleBuoyancy = pValue; - break; - // case Vehicle.HOVER_EFFICIENCY: - // if (pValue < 0f) pValue = 0f; - // if (pValue > 1f) pValue = 1f; - // m_VhoverEfficiency = pValue; - // break; - case Vehicle.HOVER_HEIGHT: - m_VhoverHeight = pValue; - break; - case Vehicle.HOVER_TIMESCALE: - if (pValue < 0.1f) pValue = 0.1f; - m_VhoverTimescale = pValue; - break; - case Vehicle.LINEAR_DEFLECTION_EFFICIENCY: - if (pValue < 0.01f) pValue = 0.01f; - // m_linearDeflectionEfficiency = pValue; - break; - case Vehicle.LINEAR_DEFLECTION_TIMESCALE: - if (pValue < 0.01f) pValue = 0.01f; - // m_linearDeflectionTimescale = pValue; - break; - case Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE: - if (pValue < 0.3f) pValue = 0.3f; - m_linearMotorDecayTimescale = pValue; - break; - case Vehicle.LINEAR_MOTOR_TIMESCALE: - if (pValue < 0.1f) pValue = 0.1f; - m_linearMotorTimescale = pValue; - break; - case Vehicle.VERTICAL_ATTRACTION_EFFICIENCY: - if (pValue < 0.1f) pValue = 0.1f; // Less goes unstable - if (pValue > 1.0f) pValue = 1.0f; - m_verticalAttractionEfficiency = pValue; - break; - case Vehicle.VERTICAL_ATTRACTION_TIMESCALE: - if (pValue < 0.1f) pValue = 0.1f; - m_verticalAttractionTimescale = pValue; - break; - - // These are vector properties but the engine lets you use a single float value to - // set all of the components to the same value - case Vehicle.ANGULAR_FRICTION_TIMESCALE: - if (pValue > 30f) pValue = 30f; - if (pValue < 0.1f) pValue = 0.1f; - m_angularFrictionTimescale = new Vector3(pValue, pValue, pValue); - break; - case Vehicle.ANGULAR_MOTOR_DIRECTION: - m_angularMotorDirection = new Vector3(pValue, pValue, pValue); - UpdateAngDecay(); - break; - case Vehicle.LINEAR_FRICTION_TIMESCALE: - if (pValue < 0.1f) pValue = 0.1f; - m_linearFrictionTimescale = new Vector3(pValue, pValue, pValue); - break; - case Vehicle.LINEAR_MOTOR_DIRECTION: - m_linearMotorDirection = new Vector3(pValue, pValue, pValue); - UpdateLinDecay(); - break; - case Vehicle.LINEAR_MOTOR_OFFSET: - // m_linearMotorOffset = new Vector3(pValue, pValue, pValue); - break; - - } - - }//end ProcessFloatVehicleParam - - internal void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue) - { - switch (pParam) - { - case Vehicle.ANGULAR_FRICTION_TIMESCALE: - if (pValue.X > 30f) pValue.X = 30f; - if (pValue.X < 0.1f) pValue.X = 0.1f; - if (pValue.Y > 30f) pValue.Y = 30f; - if (pValue.Y < 0.1f) pValue.Y = 0.1f; - if (pValue.Z > 30f) pValue.Z = 30f; - if (pValue.Z < 0.1f) pValue.Z = 0.1f; - m_angularFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z); - break; - case Vehicle.ANGULAR_MOTOR_DIRECTION: - m_angularMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z); - // Limit requested angular speed to 2 rps= 4 pi rads/sec - if (m_angularMotorDirection.X > 12.56f) m_angularMotorDirection.X = 12.56f; - if (m_angularMotorDirection.X < -12.56f) m_angularMotorDirection.X = -12.56f; - if (m_angularMotorDirection.Y > 12.56f) m_angularMotorDirection.Y = 12.56f; - if (m_angularMotorDirection.Y < -12.56f) m_angularMotorDirection.Y = -12.56f; - if (m_angularMotorDirection.Z > 12.56f) m_angularMotorDirection.Z = 12.56f; - if (m_angularMotorDirection.Z < -12.56f) m_angularMotorDirection.Z = -12.56f; - UpdateAngDecay(); - break; - case Vehicle.LINEAR_FRICTION_TIMESCALE: - if (pValue.X < 0.1f) pValue.X = 0.1f; - if (pValue.Y < 0.1f) pValue.Y = 0.1f; - if (pValue.Z < 0.1f) pValue.Z = 0.1f; - m_linearFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z); - break; - case Vehicle.LINEAR_MOTOR_DIRECTION: - m_linearMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z); // velocity requested by LSL, for max limiting - UpdateLinDecay(); - break; - case Vehicle.LINEAR_MOTOR_OFFSET: - // m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z); - break; - } - - }//end ProcessVectorVehicleParam - - internal void ProcessRotationVehicleParam(Vehicle pParam, Quaternion pValue) - { - switch (pParam) - { - case Vehicle.REFERENCE_FRAME: - // m_referenceFrame = pValue; - break; - } - - }//end ProcessRotationVehicleParam - - internal void ProcessVehicleFlags(int pParam, bool remove) - { - if (remove) - { - m_flags &= ~((VehicleFlag)pParam); - } - else - { - m_flags |= (VehicleFlag)pParam; - } - } - - internal void ProcessTypeChange(Vehicle pType) - { - // Set Defaults For Type - m_type = pType; - switch (pType) - { - case Vehicle.TYPE_SLED: - m_linearFrictionTimescale = new Vector3(30, 1, 1000); - m_angularFrictionTimescale = new Vector3(30, 30, 30); - // m_lLinMotorVel = Vector3.Zero; - m_linearMotorTimescale = 1000; - m_linearMotorDecayTimescale = 120; - m_angularMotorDirection = Vector3.Zero; - m_angularMotorDVel = Vector3.Zero; - m_angularMotorTimescale = 1000; - m_angularMotorDecayTimescale = 120; - m_VhoverHeight = 0; - // m_VhoverEfficiency = 1; - m_VhoverTimescale = 10; - m_VehicleBuoyancy = 0; - // m_linearDeflectionEfficiency = 1; - // m_linearDeflectionTimescale = 1; - // m_angularDeflectionEfficiency = 1; - // m_angularDeflectionTimescale = 1000; - // m_bankingEfficiency = 0; - // m_bankingMix = 1; - // m_bankingTimescale = 10; - // m_referenceFrame = Quaternion.Identity; - m_flags &= - ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | - VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY); - m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.LIMIT_MOTOR_UP); - break; - case Vehicle.TYPE_CAR: - m_linearFrictionTimescale = new Vector3(100, 2, 1000); - m_angularFrictionTimescale = new Vector3(30, 30, 30); // was 1000, but sl max frict time is 30. - // m_lLinMotorVel = Vector3.Zero; - m_linearMotorTimescale = 1; - m_linearMotorDecayTimescale = 60; - m_angularMotorDirection = Vector3.Zero; - m_angularMotorDVel = Vector3.Zero; - m_angularMotorTimescale = 1; - m_angularMotorDecayTimescale = 0.8f; - m_VhoverHeight = 0; - // m_VhoverEfficiency = 0; - m_VhoverTimescale = 1000; - m_VehicleBuoyancy = 0; - // // m_linearDeflectionEfficiency = 1; - // // m_linearDeflectionTimescale = 2; - // // m_angularDeflectionEfficiency = 0; - // m_angularDeflectionTimescale = 10; - m_verticalAttractionEfficiency = 1f; - m_verticalAttractionTimescale = 10f; - // m_bankingEfficiency = -0.2f; - // m_bankingMix = 1; - // m_bankingTimescale = 1; - // m_referenceFrame = Quaternion.Identity; - m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT); - m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.HOVER_UP_ONLY | - VehicleFlag.LIMIT_MOTOR_UP); - break; - case Vehicle.TYPE_BOAT: - m_linearFrictionTimescale = new Vector3(10, 3, 2); - m_angularFrictionTimescale = new Vector3(10, 10, 10); - // m_lLinMotorVel = Vector3.Zero; - m_linearMotorTimescale = 5; - m_linearMotorDecayTimescale = 60; - m_angularMotorDirection = Vector3.Zero; - m_angularMotorDVel = Vector3.Zero; - m_angularMotorTimescale = 4; - m_angularMotorDecayTimescale = 4; - m_VhoverHeight = 0; - // m_VhoverEfficiency = 0.5f; - m_VhoverTimescale = 2; - m_VehicleBuoyancy = 1; - // m_linearDeflectionEfficiency = 0.5f; - // m_linearDeflectionTimescale = 3; - // m_angularDeflectionEfficiency = 0.5f; - // m_angularDeflectionTimescale = 5; - m_verticalAttractionEfficiency = 0.5f; - m_verticalAttractionTimescale = 5f; - // m_bankingEfficiency = -0.3f; - // m_bankingMix = 0.8f; - // m_bankingTimescale = 1; - // m_referenceFrame = Quaternion.Identity; - m_flags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.LIMIT_ROLL_ONLY | - VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY); - m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.HOVER_WATER_ONLY | - VehicleFlag.LIMIT_MOTOR_UP); - break; - case Vehicle.TYPE_AIRPLANE: - m_linearFrictionTimescale = new Vector3(200, 10, 5); - m_angularFrictionTimescale = new Vector3(20, 20, 20); - // m_lLinMotorVel = Vector3.Zero; - m_linearMotorTimescale = 2; - m_linearMotorDecayTimescale = 60; - m_angularMotorDirection = Vector3.Zero; - m_angularMotorDVel = Vector3.Zero; - m_angularMotorTimescale = 4; - m_angularMotorDecayTimescale = 4; - m_VhoverHeight = 0; - // m_VhoverEfficiency = 0.5f; - m_VhoverTimescale = 1000; - m_VehicleBuoyancy = 0; - // m_linearDeflectionEfficiency = 0.5f; - // m_linearDeflectionTimescale = 3; - // m_angularDeflectionEfficiency = 1; - // m_angularDeflectionTimescale = 2; - m_verticalAttractionEfficiency = 0.9f; - m_verticalAttractionTimescale = 2f; - // m_bankingEfficiency = 1; - // m_bankingMix = 0.7f; - // m_bankingTimescale = 2; - // m_referenceFrame = Quaternion.Identity; - m_flags &= ~(VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | - VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY | VehicleFlag.LIMIT_MOTOR_UP); - m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY); - break; - case Vehicle.TYPE_BALLOON: - m_linearFrictionTimescale = new Vector3(5, 5, 5); - m_angularFrictionTimescale = new Vector3(10, 10, 10); - m_linearMotorTimescale = 5; - m_linearMotorDecayTimescale = 60; - m_angularMotorDirection = Vector3.Zero; - m_angularMotorDVel = Vector3.Zero; - m_angularMotorTimescale = 6; - m_angularMotorDecayTimescale = 10; - m_VhoverHeight = 5; - // m_VhoverEfficiency = 0.8f; - m_VhoverTimescale = 10; - m_VehicleBuoyancy = 1; - // m_linearDeflectionEfficiency = 0; - // m_linearDeflectionTimescale = 5; - // m_angularDeflectionEfficiency = 0; - // m_angularDeflectionTimescale = 5; - m_verticalAttractionEfficiency = 1f; - m_verticalAttractionTimescale = 100f; - // m_bankingEfficiency = 0; - // m_bankingMix = 0.7f; - // m_bankingTimescale = 5; - // m_referenceFrame = Quaternion.Identity; - m_flags &= ~(VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | - VehicleFlag.HOVER_UP_ONLY | VehicleFlag.LIMIT_MOTOR_UP); - m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT); - break; - - } - }//end SetDefaultsForType - - internal void Enable(IntPtr pBody, OdeScene pParentScene) - { - if (m_type == Vehicle.TYPE_NONE) - return; - - m_body = pBody; - } - - - internal void Halt() - { // Kill all motions, when non-physical - // m_linearMotorDirection = Vector3.Zero; - m_lLinMotorDVel = Vector3.Zero; - m_lLinObjectVel = Vector3.Zero; - m_wLinObjectVel = Vector3.Zero; - m_angularMotorDirection = Vector3.Zero; - m_lastAngularVelocity = Vector3.Zero; - m_angularMotorDVel = Vector3.Zero; - _acceleration = Vector3.Zero; - } - - private void UpdateLinDecay() - { - m_lLinMotorDVel.X = m_linearMotorDirection.X; - m_lLinMotorDVel.Y = m_linearMotorDirection.Y; - m_lLinMotorDVel.Z = m_linearMotorDirection.Z; - } // else let the motor decay on its own - - private void UpdateAngDecay() - { - m_angularMotorDVel.X = m_angularMotorDirection.X; - m_angularMotorDVel.Y = m_angularMotorDirection.Y; - m_angularMotorDVel.Z = m_angularMotorDirection.Z; - } // else let the motor decay on its own - - public void Move(float timestep) - { - float fx = 0; - float fy = 0; - float fz = 0; - Vector3 linvel; // velocity applied, including any reversal - - // If geomCrossingFailuresBeforeOutofbounds is set to 0 in OpenSim.ini then phys objects bounce off region borders. - // This is a temp patch until proper region crossing is developed. - - - if (IsPhysical && (Body != IntPtr.Zero) && !m_isSelected && !childPrim && !m_outofBounds) // Only move root prims. - { - // Old public void UpdatePositionAndVelocity(), more accuratley calculated here - bool lastZeroFlag = _zeroFlag; // was it stopped - - d.Vector3 vec = d.BodyGetPosition(Body); - Vector3 l_position = Vector3.Zero; - l_position.X = vec.X; - l_position.Y = vec.Y; - l_position.Z = vec.Z; - m_lastposition = _position; - _position = l_position; - - d.Quaternion ori = d.BodyGetQuaternion(Body); - // Quaternion l_orientation = Quaternion.Identity; - _orientation.X = ori.X; - _orientation.Y = ori.Y; - _orientation.Z = ori.Z; - _orientation.W = ori.W; - m_lastorientation = _orientation; - - d.Vector3 vel = d.BodyGetLinearVel(Body); - m_lastVelocity = _velocity; - _velocity.X = vel.X; - _velocity.Y = vel.Y; - _velocity.Z = vel.Z; - _acceleration = ((_velocity - m_lastVelocity) / timestep); - - d.Vector3 torque = d.BodyGetTorque(Body); - _torque = new Vector3(torque.X, torque.Y, torque.Z); - - - if (_position.X < 0f || _position.X > _parent_scene.WorldExtents.X - || _position.Y < 0f || _position.Y > _parent_scene.WorldExtents.Y - ) - { - // we are outside current region - // clip position to a stop just outside region and stop it only internally - // do it only once using m_crossingfailures as control - _position.X = Util.Clip(l_position.X, -0.2f, _parent_scene.WorldExtents.X + .2f); - _position.Y = Util.Clip(l_position.Y, -0.2f, _parent_scene.WorldExtents.Y + .2f); - _position.Z = Util.Clip(l_position.Z, -100f, 50000f); - d.BodySetPosition(Body, _position.X, _position.Y, _position.Z); - d.BodySetLinearVel(Body, 0, 0, 0); - m_outofBounds = true; - base.RequestPhysicsterseUpdate(); - return; - } - - base.RequestPhysicsterseUpdate(); - - if (l_position.Z < 0) - { - // This is so prim that get lost underground don't fall forever and suck up - // - // Sim resources and memory. - // Disables the prim's movement physics.... - // It's a hack and will generate a console message if it fails. - - //IsPhysical = false; - if (_parent == null) base.RaiseOutOfBounds(_position); - - - _acceleration.X = 0; // This stuff may stop client display but it has no - _acceleration.Y = 0; // effect on the object in phys engine! - _acceleration.Z = 0; - - _velocity.X = 0; - _velocity.Y = 0; - _velocity.Z = 0; - m_lastVelocity = Vector3.Zero; - m_rotationalVelocity.X = 0; - m_rotationalVelocity.Y = 0; - m_rotationalVelocity.Z = 0; - - if (_parent == null) base.RequestPhysicsterseUpdate(); - - m_throttleUpdates = false; - throttleCounter = 0; - _zeroFlag = true; - //outofBounds = true; - } // end neg Z check - - // Is it moving? - /* if ((Math.Abs(m_lastposition.X - l_position.X) < 0.02) - && (Math.Abs(m_lastposition.Y - l_position.Y) < 0.02) - && (Math.Abs(m_lastposition.Z - l_position.Z) < 0.02) */ - if ((Vector3.Mag(_velocity) < 0.01) && // moving very slowly - (Vector3.Mag(_velocity) < Vector3.Mag(m_lastVelocity)) && // decelerating - (1.0 - Math.Abs(Quaternion.Dot(m_lastorientation, _orientation)) < 0.0001)) // spinning very slowly - { - _zeroFlag = true; - m_throttleUpdates = false; - } - else - { - //m_log.Debug(Math.Abs(m_lastposition.X - l_position.X).ToString()); - _zeroFlag = false; - m_lastUpdateSent = false; - //m_throttleUpdates = false; - } - - if (_zeroFlag) - { // Its stopped - _velocity.X = 0.0f; - _velocity.Y = 0.0f; - // _velocity.Z = 0.0f; - - _acceleration.X = 0; - _acceleration.Y = 0; - // _acceleration.Z = 0; - - m_rotationalVelocity.X = 0; - m_rotationalVelocity.Y = 0; - m_rotationalVelocity.Z = 0; - // Stop it in the phys engine - d.BodySetLinearVel(Body, 0.0f, 0.0f, _velocity.Z); - d.BodySetAngularVel(Body, 0.0f, 0.0f, 0.0f); - d.BodySetForce(Body, 0f, 0f, 0f); - - if (!m_lastUpdateSent) - { - m_throttleUpdates = false; - throttleCounter = 0; - if (_parent == null) - { - base.RequestPhysicsterseUpdate(); - } - - m_lastUpdateSent = true; - } - } - else - { // Its moving - if (lastZeroFlag != _zeroFlag) - { - if (_parent == null) - { - base.RequestPhysicsterseUpdate(); - } - } - m_lastUpdateSent = false; - if (!m_throttleUpdates || throttleCounter > _parent_scene.geomUpdatesPerThrottledUpdate) - { - if (_parent == null) - { - base.RequestPhysicsterseUpdate(); - } - } - else - { - throttleCounter++; - } - } - m_lastposition = l_position; - - /// End UpdatePositionAndVelocity insert - - - // Rotation lock ===================================== - if (m_rotateEnableUpdate) - { - // Snapshot current angles, set up Amotor(s) - m_rotateEnableUpdate = false; - m_rotateEnable = m_rotateEnableRequest; - //Console.WriteLine("RotEnable {0} = {1}",m_primName, m_rotateEnable); - - if (Amotor != IntPtr.Zero) - { - d.JointDestroy(Amotor); - Amotor = IntPtr.Zero; - //Console.WriteLine("Old Amotor Destroyed"); - } - - if (!m_rotateEnable.ApproxEquals(Vector3.One, 0.003f)) - { // not all are enabled - d.Quaternion r = d.BodyGetQuaternion(Body); - Quaternion locrot = new Quaternion(r.X, r.Y, r.Z, r.W); - // extract the axes vectors - Vector3 vX = new Vector3(1f, 0f, 0f); - Vector3 vY = new Vector3(0f, 1f, 0f); - Vector3 vZ = new Vector3(0f, 0f, 1f); - vX = vX * locrot; - vY = vY * locrot; - vZ = vZ * locrot; - // snapshot the current angle vectors - m_lockX = vX; - m_lockY = vY; - m_lockZ = vZ; - // m_lockRot = locrot; - Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero); - d.JointAttach(Amotor, Body, IntPtr.Zero); - d.JointSetAMotorMode(Amotor, 0); // User mode?? - //Console.WriteLine("New Amotor Created for {0}", m_primName); - - float axisnum = 3; // how many to lock - axisnum = (axisnum - (m_rotateEnable.X + m_rotateEnable.Y + m_rotateEnable.Z)); - d.JointSetAMotorNumAxes(Amotor, (int)axisnum); - //Console.WriteLine("AxisNum={0}",(int)axisnum); - - int i = 0; - - if (m_rotateEnable.X == 0) - { - d.JointSetAMotorAxis(Amotor, i, 0, m_lockX.X, m_lockX.Y, m_lockX.Z); - //Console.WriteLine("AxisX {0} set to {1}", i, m_lockX); - i++; - } - - if (m_rotateEnable.Y == 0) - { - d.JointSetAMotorAxis(Amotor, i, 0, m_lockY.X, m_lockY.Y, m_lockY.Z); - //Console.WriteLine("AxisY {0} set to {1}", i, m_lockY); - i++; - } - - if (m_rotateEnable.Z == 0) - { - d.JointSetAMotorAxis(Amotor, i, 0, m_lockZ.X, m_lockZ.Y, m_lockZ.Z); - //Console.WriteLine("AxisZ {0} set to {1}", i, m_lockZ); - i++; - } - - // These lowstops and high stops are effectively (no wiggle room) - d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0f); - d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, 0f); - d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0f); - d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0f); - d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); - d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0f); - d.JointSetAMotorParam(Amotor, (int)dParam.Vel, 0f); - d.JointSetAMotorParam(Amotor, (int)dParam.Vel3, 0f); - d.JointSetAMotorParam(Amotor, (int)dParam.Vel2, 0f); - d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM, 0f); - d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM3, 0f); - d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM2, 0f); - } // else none are locked - } // end Rotation Update - - - // VEHICLE processing ========================================== - if (m_type != Vehicle.TYPE_NONE) - { - // get body attitude - d.Quaternion rot = d.BodyGetQuaternion(Body); - Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object - Quaternion irotq = Quaternion.Inverse(rotq); - - // VEHICLE Linear Motion - d.Vector3 velnow = d.BodyGetLinearVel(Body); // this is in world frame - Vector3 vel_now = new Vector3(velnow.X, velnow.Y, velnow.Z); - m_lLinObjectVel = vel_now * irotq; - if (m_linearMotorDecayTimescale < 300.0f) //setting of 300 or more disables decay rate - { - if (Vector3.Mag(m_lLinMotorDVel) < 1.0f) - { - float decayfactor = m_linearMotorDecayTimescale / timestep; - Vector3 decayAmount = (m_lLinMotorDVel / decayfactor); - m_lLinMotorDVel -= decayAmount; - } - else - { - float decayfactor = 3.0f - (0.57f * (float)Math.Log((double)(m_linearMotorDecayTimescale))); - Vector3 decel = Vector3.Normalize(m_lLinMotorDVel) * decayfactor * timestep; - m_lLinMotorDVel -= decel; - } - if (m_lLinMotorDVel.ApproxEquals(Vector3.Zero, 0.01f)) - { - m_lLinMotorDVel = Vector3.Zero; - } - - /* else - { - if (Math.Abs(m_lLinMotorDVel.X) < Math.Abs(m_lLinObjectVel.X)) m_lLinObjectVel.X = m_lLinMotorDVel.X; - if (Math.Abs(m_lLinMotorDVel.Y) < Math.Abs(m_lLinObjectVel.Y)) m_lLinObjectVel.Y = m_lLinMotorDVel.Y; - if (Math.Abs(m_lLinMotorDVel.Z) < Math.Abs(m_lLinObjectVel.Z)) m_lLinObjectVel.Z = m_lLinMotorDVel.Z; - } */ - } // end linear motor decay - - if ((!m_lLinMotorDVel.ApproxEquals(Vector3.Zero, 0.01f)) || (!m_lLinObjectVel.ApproxEquals(Vector3.Zero, 0.01f))) - { - if (!d.BodyIsEnabled(Body)) d.BodyEnable(Body); - if (m_linearMotorTimescale < 300.0f) - { - Vector3 attack_error = m_lLinMotorDVel - m_lLinObjectVel; - float linfactor = m_linearMotorTimescale / timestep; - Vector3 attackAmount = (attack_error / linfactor) * 1.3f; - m_lLinObjectVel += attackAmount; - } - if (m_linearFrictionTimescale.X < 300.0f) - { - float fricfactor = m_linearFrictionTimescale.X / timestep; - float fricX = m_lLinObjectVel.X / fricfactor; - m_lLinObjectVel.X -= fricX; - } - if (m_linearFrictionTimescale.Y < 300.0f) - { - float fricfactor = m_linearFrictionTimescale.Y / timestep; - float fricY = m_lLinObjectVel.Y / fricfactor; - m_lLinObjectVel.Y -= fricY; - } - if (m_linearFrictionTimescale.Z < 300.0f) - { - float fricfactor = m_linearFrictionTimescale.Z / timestep; - float fricZ = m_lLinObjectVel.Z / fricfactor; - m_lLinObjectVel.Z -= fricZ; - } - } - m_wLinObjectVel = m_lLinObjectVel * rotq; - - // Gravity and Buoyancy - Vector3 grav = Vector3.Zero; - if (m_VehicleBuoyancy < 1.0f) - { - // There is some gravity, make a gravity force vector - // that is applied after object velocity. - d.Mass objMass; - d.BodyGetMass(Body, out objMass); - // m_VehicleBuoyancy: -1=2g; 0=1g; 1=0g; - grav.Z = _parent_scene.gravityz * objMass.mass * (1f - m_VehicleBuoyancy); // Applied later as a force - } // else its 1.0, no gravity. - - // Hovering - if ((m_flags & (VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT)) != 0) - { - // We should hover, get the target height - d.Vector3 pos = d.BodyGetPosition(Body); - if ((m_flags & VehicleFlag.HOVER_WATER_ONLY) == VehicleFlag.HOVER_WATER_ONLY) - { - m_VhoverTargetHeight = _parent_scene.GetWaterLevel() + m_VhoverHeight; - } - else if ((m_flags & VehicleFlag.HOVER_TERRAIN_ONLY) == VehicleFlag.HOVER_TERRAIN_ONLY) - { - m_VhoverTargetHeight = _parent_scene.GetTerrainHeightAtXY(pos.X, pos.Y) + m_VhoverHeight; - } - else if ((m_flags & VehicleFlag.HOVER_GLOBAL_HEIGHT) == VehicleFlag.HOVER_GLOBAL_HEIGHT) - { - m_VhoverTargetHeight = m_VhoverHeight; - } - - if ((m_flags & VehicleFlag.HOVER_UP_ONLY) == VehicleFlag.HOVER_UP_ONLY) - { - // If body is aready heigher, use its height as target height - if (pos.Z > m_VhoverTargetHeight) m_VhoverTargetHeight = pos.Z; - } - - // m_VhoverEfficiency = 0f; // 0=boucy, 1=Crit.damped - // m_VhoverTimescale = 0f; // time to acheive height - // timestep is time since last frame,in secs - float herr0 = pos.Z - m_VhoverTargetHeight; - // Replace Vertical speed with correction figure if significant - if (Math.Abs(herr0) > 0.01f) - { - //? d.Mass objMass; - //? d.BodyGetMass(Body, out objMass); - m_wLinObjectVel.Z = -((herr0 * timestep * 50.0f) / m_VhoverTimescale); - //KF: m_VhoverEfficiency is not yet implemented - } - else - { - m_wLinObjectVel.Z = 0f; - } - } - else - { // not hovering - if (m_wLinObjectVel.Z == 0f) - { // Gravity rules - m_wLinObjectVel.Z = vel_now.Z; - } // else the motor has it - } - linvel = m_wLinObjectVel; - - // Vehicle Linear Motion done ======================================= - // Apply velocity - d.BodySetLinearVel(Body, linvel.X, linvel.Y, linvel.Z); - // apply gravity force - d.BodyAddForce(Body, grav.X, grav.Y, grav.Z); - //if(frcount == 0) Console.WriteLine("Vel={0} Force={1}",linvel , grav); - // end MoveLinear() - - - // MoveAngular - /* - private Vector3 m_angularMotorDirection = Vector3.Zero; // angular velocity requested by LSL motor - - private float m_angularMotorTimescale = 0; // motor angular Attack rate set by LSL - private float m_angularMotorDecayTimescale = 0; // motor angular Decay rate set by LSL - private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular Friction set by LSL - - private Vector3 m_angularMotorDVel = Vector3.Zero; // decayed angular motor - private Vector3 m_angObjectVel = Vector3.Zero; // what was last applied to body - */ - //if(frcount == 0) Console.WriteLine("MoveAngular "); - - d.Vector3 angularObjectVel = d.BodyGetAngularVel(Body); - Vector3 angObjectVel = new Vector3(angularObjectVel.X, angularObjectVel.Y, angularObjectVel.Z); - angObjectVel = angObjectVel * irotq; // ============ Converts to LOCAL rotation - - //if(frcount == 0) Console.WriteLine("V0 = {0}", angObjectVel); - - // Decay Angular Motor 1. In SL this also depends on attack rate! decay ~= 23/Attack. - float atk_decayfactor = 23.0f / (m_angularMotorTimescale * timestep); - m_angularMotorDVel -= m_angularMotorDVel / atk_decayfactor; - // Decay Angular Motor 2. - if (m_angularMotorDecayTimescale < 300.0f) - { - if (Vector3.Mag(m_angularMotorDVel) < 1.0f) - { - float decayfactor = (m_angularMotorDecayTimescale) / timestep; - Vector3 decayAmount = (m_angularMotorDVel / decayfactor); - m_angularMotorDVel -= decayAmount; - } - else - { - Vector3 decel = Vector3.Normalize(m_angularMotorDVel) * timestep / m_angularMotorDecayTimescale; - m_angularMotorDVel -= decel; - } - - if (m_angularMotorDVel.ApproxEquals(Vector3.Zero, 0.01f)) - { - m_angularMotorDVel = Vector3.Zero; - } - else - { - if (Math.Abs(m_angularMotorDVel.X) < Math.Abs(angObjectVel.X)) angObjectVel.X = m_angularMotorDVel.X; - if (Math.Abs(m_angularMotorDVel.Y) < Math.Abs(angObjectVel.Y)) angObjectVel.Y = m_angularMotorDVel.Y; - if (Math.Abs(m_angularMotorDVel.Z) < Math.Abs(angObjectVel.Z)) angObjectVel.Z = m_angularMotorDVel.Z; - } - } // end decay angular motor - //if(frcount == 0) Console.WriteLine("MotorDvel {0} Obj {1}", m_angularMotorDVel, angObjectVel); - - //if(frcount == 0) Console.WriteLine("VA = {0}", angObjectVel); - - if ((!m_angularMotorDVel.ApproxEquals(Vector3.Zero, 0.01f)) || (!angObjectVel.ApproxEquals(Vector3.Zero, 0.01f))) - { // if motor or object have motion - if (!d.BodyIsEnabled(Body)) d.BodyEnable(Body); - - if (m_angularMotorTimescale < 300.0f) - { - Vector3 attack_error = m_angularMotorDVel - angObjectVel; - float angfactor = m_angularMotorTimescale / timestep; - Vector3 attackAmount = (attack_error / angfactor); - angObjectVel += attackAmount; - //if(frcount == 0) Console.WriteLine("Accel {0} Attk {1}",FrAaccel, attackAmount); - //if(frcount == 0) Console.WriteLine("V2+= {0}", angObjectVel); - } - - angObjectVel.X -= angObjectVel.X / (m_angularFrictionTimescale.X * 0.7f / timestep); - angObjectVel.Y -= angObjectVel.Y / (m_angularFrictionTimescale.Y * 0.7f / timestep); - angObjectVel.Z -= angObjectVel.Z / (m_angularFrictionTimescale.Z * 0.7f / timestep); - } // else no signif. motion - - //if(frcount == 0) Console.WriteLine("Dmotor {0} Obj {1}", m_angularMotorDVel, angObjectVel); - // Bank section tba - // Deflection section tba - //if(frcount == 0) Console.WriteLine("V3 = {0}", angObjectVel); - - - /* // Rotation Axis Disables: - if (!m_angularEnable.ApproxEquals(Vector3.One, 0.003f)) - { - if (m_angularEnable.X == 0) - angObjectVel.X = 0f; - if (m_angularEnable.Y == 0) - angObjectVel.Y = 0f; - if (m_angularEnable.Z == 0) - angObjectVel.Z = 0f; - } - */ - angObjectVel = angObjectVel * rotq; // ================ Converts to WORLD rotation - - // Vertical attractor section - Vector3 vertattr = Vector3.Zero; - - if (m_verticalAttractionTimescale < 300) - { - float VAservo = 1.0f / (m_verticalAttractionTimescale * timestep); - // make a vector pointing up - Vector3 verterr = Vector3.Zero; - verterr.Z = 1.0f; - // rotate it to Body Angle - verterr = verterr * rotq; - // verterr.X and .Y are the World error ammounts. They are 0 when there is no error (Vehicle Body is 'vertical'), and .Z will be 1. - // As the body leans to its side |.X| will increase to 1 and .Z fall to 0. As body inverts |.X| will fall and .Z will go - // negative. Similar for tilt and |.Y|. .X and .Y must be modulated to prevent a stable inverted body. - - if (verterr.Z < 0.0f) - { // Deflection from vertical exceeds 90-degrees. This method will ensure stable return to - // vertical, BUT for some reason a z-rotation is imparted to the object. TBI. - //Console.WriteLine("InvertFlip"); - verterr.X = 2.0f - verterr.X; - verterr.Y = 2.0f - verterr.Y; - } - verterr *= 0.5f; - // verterror is 0 (no error) to +/- 1 (max error at 180-deg tilt) - Vector3 xyav = angObjectVel; - xyav.Z = 0.0f; - if ((!xyav.ApproxEquals(Vector3.Zero, 0.001f)) || (verterr.Z < 0.49f)) - { - // As the body rotates around the X axis, then verterr.Y increases; Rotated around Y then .X increases, so - // Change Body angular velocity X based on Y, and Y based on X. Z is not changed. - vertattr.X = verterr.Y; - vertattr.Y = -verterr.X; - vertattr.Z = 0f; - //if(frcount == 0) Console.WriteLine("VAerr=" + verterr); - - // scaling appears better usingsquare-law - float damped = m_verticalAttractionEfficiency * m_verticalAttractionEfficiency; - float bounce = 1.0f - damped; - // 0 = crit damp, 1 = bouncy - float oavz = angObjectVel.Z; // retain z velocity - // time-scaled correction, which sums, therefore is bouncy: - angObjectVel = (angObjectVel + (vertattr * VAservo * 0.0333f)) * bounce; - // damped, good @ < 90: - angObjectVel = angObjectVel + (vertattr * VAservo * 0.0667f * damped); - angObjectVel.Z = oavz; - //if(frcount == 0) Console.WriteLine("VA+"); - //Console.WriteLine("VAttr {0} OAvel {1}", vertattr, angObjectVel); - } - else - { - // else error is very small - angObjectVel.X = 0f; - angObjectVel.Y = 0f; - //if(frcount == 0) Console.WriteLine("VA0"); - } - } // else vertical attractor is off - //if(frcount == 0) Console.WriteLine("V1 = {0}", angObjectVel); - - - m_lastAngularVelocity = angObjectVel; - // apply Angular Velocity to body - d.BodySetAngularVel(Body, m_lastAngularVelocity.X, m_lastAngularVelocity.Y, m_lastAngularVelocity.Z); - //if(frcount == 0) Console.WriteLine("V4 = {0}", m_lastAngularVelocity); - - } // end VEHICLES - else - { - // Dyamics (NON-'VEHICLES') are dealt with here ================================================================ - - if (!d.BodyIsEnabled(Body)) d.BodyEnable(Body); // KF add 161009 - - /// Dynamics Buoyancy - //KF: m_buoyancy is set by llSetBuoyancy() and is for non-vehicle. - // m_buoyancy: (unlimited value) <0=Falls fast; 0=1g; 1=0g; >1 = floats up - // NB Prims in ODE are no subject to global gravity - // This should only affect gravity operations - - float m_mass = CalculateMass(); - // calculate z-force due togravity on object. - fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; // force = acceleration * mass - if ((m_usePID) && (m_PIDTau > 0.0f)) // Dynamics llMoveToTarget. - { - fz = 0; // llMoveToTarget ignores gravity. - // it also ignores mass of object, and any physical resting on it. - // Vector3 m_PIDTarget is where we are going - // float m_PIDTau is time to get there - fx = 0; - fy = 0; - d.Vector3 pos = d.BodyGetPosition(Body); - Vector3 error = new Vector3( - (m_PIDTarget.X - pos.X), - (m_PIDTarget.Y - pos.Y), - (m_PIDTarget.Z - pos.Z)); - if (error.ApproxEquals(Vector3.Zero, 0.01f)) - { // Very close, Jump there and quit move - - d.BodySetPosition(Body, m_PIDTarget.X, m_PIDTarget.Y, m_PIDTarget.Z); - _target_velocity = Vector3.Zero; - d.BodySetLinearVel(Body, _target_velocity.X, _target_velocity.Y, _target_velocity.Z); - d.BodySetForce(Body, 0f, 0f, 0f); - } - else - { - float scale = 50.0f * timestep / m_PIDTau; - if ((error.ApproxEquals(Vector3.Zero, 0.5f)) && (_target_velocity != Vector3.Zero)) - { - // Nearby, quit update of velocity - } - else - { // Far, calc damped velocity - _target_velocity = error * scale; - } - d.BodySetLinearVel(Body, _target_velocity.X, _target_velocity.Y, _target_velocity.Z); - } - } // end PID MoveToTarget - - - /// Dynamics Hover =================================================================================== - // Hover PID Controller can only run if the PIDcontroller is not in use. - if (m_useHoverPID && !m_usePID) - { - //Console.WriteLine("Hover " + m_primName); - - // If we're using the PID controller, then we have no gravity - fz = (-1 * _parent_scene.gravityz) * m_mass; - - // no lock; for now it's only called from within Simulate() - - // If the PID Controller isn't active then we set our force - // calculating base velocity to the current position - - if ((m_PIDTau < 1)) - { - PID_G = PID_G / m_PIDTau; - } - - if ((PID_G - m_PIDTau) <= 0) - { - PID_G = m_PIDTau + 1; - } - - - // Where are we, and where are we headed? - d.Vector3 pos = d.BodyGetPosition(Body); - // d.Vector3 vel = d.BodyGetLinearVel(Body); - - - // Non-Vehicles have a limited set of Hover options. - // determine what our target height really is based on HoverType - switch (m_PIDHoverType) - { - case PIDHoverType.Ground: - m_groundHeight = _parent_scene.GetTerrainHeightAtXY(pos.X, pos.Y); - m_targetHoverHeight = m_groundHeight + m_PIDHoverHeight; - break; - case PIDHoverType.GroundAndWater: - m_groundHeight = _parent_scene.GetTerrainHeightAtXY(pos.X, pos.Y); - m_waterHeight = _parent_scene.GetWaterLevel(); - if (m_groundHeight > m_waterHeight) - { - m_targetHoverHeight = m_groundHeight + m_PIDHoverHeight; - } - else - { - m_targetHoverHeight = m_waterHeight + m_PIDHoverHeight; - } - break; - - } // end switch (m_PIDHoverType) - - - _target_velocity = - new Vector3(0.0f, 0.0f, - (m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep) - ); - - // if velocity is zero, use position control; otherwise, velocity control - - if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f)) - { - // keep track of where we stopped. No more slippin' & slidin' - - // We only want to deactivate the PID Controller if we think we want to have our surrogate - // react to the physics scene by moving it's position. - // Avatar to Avatar collisions - // Prim to avatar collisions - d.Vector3 dlinvel = vel; - d.BodySetPosition(Body, pos.X, pos.Y, m_targetHoverHeight); - d.BodySetLinearVel(Body, dlinvel.X, dlinvel.Y, dlinvel.Z); - d.BodyAddForce(Body, 0, 0, fz); - //KF this prevents furthur motions return; - } - else - { - _zeroFlag = false; - - // We're flying and colliding with something - fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); - } - } // end m_useHoverPID && !m_usePID - - - /// Dynamics Apply Forces =================================================================================== - fx *= m_mass; - fy *= m_mass; - //fz *= m_mass; - fx += m_force.X; - fy += m_force.Y; - fz += m_force.Z; - - //m_log.Info("[OBJPID]: X:" + fx.ToString() + " Y:" + fy.ToString() + " Z:" + fz.ToString()); - if (fx != 0 || fy != 0 || fz != 0) - { - //m_taintdisable = true; - //base.RaiseOutOfBounds(Position); - //d.BodySetLinearVel(Body, fx, fy, 0f); - if (!d.BodyIsEnabled(Body)) - { - // A physical body at rest on a surface will auto-disable after a while, - // this appears to re-enable it incase the surface it is upon vanishes, - // and the body should fall again. - d.BodySetLinearVel(Body, 0f, 0f, 0f); - d.BodySetForce(Body, 0f, 0f, 0f); - enableBodySoft(); - } - - // 35x10 = 350n times the mass per second applied maximum. - float nmax = 35f * m_mass; - float nmin = -35f * m_mass; - - - if (fx > nmax) - fx = nmax; - if (fx < nmin) - fx = nmin; - if (fy > nmax) - fy = nmax; - if (fy < nmin) - fy = nmin; - d.BodyAddForce(Body, fx, fy, fz); - } // end apply forces - } // end Vehicle/Dynamics - - /// RotLookAt / LookAt ================================================================================= - if (m_useAPID) - { - // RotLookAt, apparently overrides all other rotation sources. Inputs: - // Quaternion m_APIDTarget - // float m_APIDStrength // From SL experiments, this is the time to get there - // float m_APIDDamping // From SL experiments, this is damping, 1.0 = damped, 0.1 = wobbly - // Also in SL the mass of the object has no effect on time to get there. - // Factors: - // get present body rotation - float limit = 1.0f; - float rscaler = 50f; // adjusts rotation damping time - float lscaler = 10f; // adjusts linear damping time in llLookAt - float RLAservo = 0f; - Vector3 diff_axis; - float diff_angle; - d.Quaternion rot = d.BodyGetQuaternion(Body); // prim present rotation - Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); - Quaternion rtarget = new Quaternion(); - - if (m_APIDTarget.W == -99.9f) - { - // this is really a llLookAt(), x,y,z is the target vector - Vector3 target = new Vector3(m_APIDTarget.X, m_APIDTarget.Y, m_APIDTarget.Z); - Vector3 ospin = new Vector3(1.0f, 0.0f, 0.0f) * rotq; - Vector3 error = new Vector3(0.0f, 0.0f, 0.0f); - float twopi = 2.0f * (float)Math.PI; - Vector3 dir = target - _position; - dir.Normalize(); - float tzrot = (float)Math.Atan2(dir.Y, dir.X); - float txy = (float)Math.Sqrt((dir.X * dir.X) + (dir.Y * dir.Y)); - float terot = (float)Math.Atan2(dir.Z, txy); - float ozrot = (float)Math.Atan2(ospin.Y, ospin.X); - float oxy = (float)Math.Sqrt((ospin.X * ospin.X) + (ospin.Y * ospin.Y)); - float oerot = (float)Math.Atan2(ospin.Z, oxy); - float ra = 2.0f * ((rotq.W * rotq.X) + (rotq.Y * rotq.Z)); - float rb = 1.0f - 2.0f * ((rotq.Y * rotq.Y) + (rotq.X * rotq.X)); - float roll = (float)Math.Atan2(ra, rb); - float errorz = tzrot - ozrot; - if (errorz > (float)Math.PI) errorz -= twopi; - else if (errorz < -(float)Math.PI) errorz += twopi; - float errory = oerot - terot; - if (errory > (float)Math.PI) errory -= twopi; - else if (errory < -(float)Math.PI) errory += twopi; - diff_angle = Math.Abs(errorz) + Math.Abs(errory) + Math.Abs(roll); - if (diff_angle > 0.01f * m_APIDdamper) - { - m_APIDdamper = 1.0f; - RLAservo = timestep / m_APIDStrength * rscaler; - errorz *= RLAservo; - errory *= RLAservo; - error.X = -roll * 8.0f; - error.Y = errory; - error.Z = errorz; - error *= rotq; - d.BodySetAngularVel(Body, error.X, error.Y, error.Z); - } - else - { - d.BodySetAngularVel(Body, 0.0f, 0.0f, 0.0f); - m_APIDdamper = 2.0f; - } - } - else - { - // this is a llRotLookAt() - rtarget = m_APIDTarget; - - Quaternion rot_diff = Quaternion.Inverse(rotq) * rtarget; // difference to desired rot - rot_diff.GetAxisAngle(out diff_axis, out diff_angle); // convert to axis to point at & error angle - //if(frcount == 0) Console.WriteLine("axis {0} angle {1}",diff_axis * 57.3f, diff_angle); - - // diff_axis.Normalize(); it already is! - if (diff_angle > 0.01f * m_APIDdamper) // diff_angle is always +ve // if there is enough error - { - m_APIDdamper = 1.0f; - Vector3 rotforce = new Vector3(diff_axis.X, diff_axis.Y, diff_axis.Z); - rotforce = rotforce * rotq; - if (diff_angle > limit) diff_angle = limit; // cap the rotate rate - RLAservo = timestep / m_APIDStrength * lscaler; - rotforce = rotforce * RLAservo * diff_angle; - d.BodySetAngularVel(Body, rotforce.X, rotforce.Y, rotforce.Z); - //Console.WriteLine("axis= " + diff_axis + " angle= " + diff_angle + "servo= " + RLAservo); - } - else - { // close enough - d.BodySetAngularVel(Body, 0.0f, 0.0f, 0.0f); - m_APIDdamper = 2.0f; - } - } // end llLookAt/llRotLookAt - //if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + " angle= " + diff_angle); - } // end m_useAPID - } // end root prims - } // end Move() - } // end class -} diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/Physics/ChOdePlugin/ODERayCastRequestManager.cs deleted file mode 100644 index 712029e0d1..0000000000 --- a/OpenSim/Region/Physics/ChOdePlugin/ODERayCastRequestManager.cs +++ /dev/null @@ -1,384 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Text; -using OpenMetaverse; -using OpenSim.Region.Physics.Manager; -using Ode.NET; -using log4net; - -namespace OpenSim.Region.Physics.OdePlugin -{ - /// - /// Processes raycast requests as ODE is in a state to be able to do them. - /// This ensures that it's thread safe and there will be no conflicts. - /// Requests get returned by a different thread then they were requested by. - /// - public class ODERayCastRequestManager - { - /// - /// Pending Raycast Requests - /// - protected List m_PendingRequests = new List(); - - /// - /// Scene that created this object. - /// - private OdeScene m_scene; - - /// - /// ODE contact array to be filled by the collision testing - /// - d.ContactGeom[] contacts = new d.ContactGeom[5]; - - /// - /// ODE near callback delegate - /// - private d.NearCallback nearCallback; - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private List m_contactResults = new List(); - - - public ODERayCastRequestManager(OdeScene pScene) - { - m_scene = pScene; - nearCallback = near; - - } - - /// - /// Queues a raycast - /// - /// Origin of Ray - /// Ray normal - /// Ray length - /// Return method to send the results - public void QueueRequest(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod) - { - lock (m_PendingRequests) - { - ODERayCastRequest req = new ODERayCastRequest(); - req.callbackMethod = retMethod; - req.length = length; - req.Normal = direction; - req.Origin = position; - - m_PendingRequests.Add(req); - } - } - - /// - /// Process all queued raycast requests - /// - /// Time in MS the raycasts took to process. - public int ProcessQueuedRequests() - { - int time = System.Environment.TickCount; - lock (m_PendingRequests) - { - if (m_PendingRequests.Count > 0) - { - ODERayCastRequest[] reqs = m_PendingRequests.ToArray(); - for (int i = 0; i < reqs.Length; i++) - { - try - { - if (reqs[i].callbackMethod != null) // quick optimization here, don't raycast - RayCast(reqs[i]); // if there isn't anyone to send results - } - catch - { - //Fail silently - //This can genuinely happen because raycast requests are queued, and the actor may have - //been removed from the scene since it was queued - } - } - /* - foreach (ODERayCastRequest req in m_PendingRequests) - { - if (req.callbackMethod != null) // quick optimization here, don't raycast - RayCast(req); // if there isn't anyone to send results to - - } - */ - m_PendingRequests.Clear(); - } - } - - lock (m_contactResults) - m_contactResults.Clear(); - - return System.Environment.TickCount - time; - } - - /// - /// Method that actually initiates the raycast - /// - /// - private void RayCast(ODERayCastRequest req) - { - // Create the ray - IntPtr ray = d.CreateRay(m_scene.space, req.length); - d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); - - // Collide test - d.SpaceCollide2(m_scene.space, ray, IntPtr.Zero, nearCallback); - - // Remove Ray - d.GeomDestroy(ray); - - - // Define default results - bool hitYN = false; - uint hitConsumerID = 0; - float distance = 999999999999f; - Vector3 closestcontact = new Vector3(99999f, 99999f, 99999f); - Vector3 snormal = Vector3.Zero; - - // Find closest contact and object. - lock (m_contactResults) - { - foreach (ContactResult cResult in m_contactResults) - { - if (Vector3.Distance(req.Origin, cResult.Pos) < Vector3.Distance(req.Origin, closestcontact)) - { - closestcontact = cResult.Pos; - hitConsumerID = cResult.ConsumerID; - distance = cResult.Depth; - hitYN = true; - snormal = cResult.Normal; - } - } - - m_contactResults.Clear(); - } - - // Return results - if (req.callbackMethod != null) - req.callbackMethod(hitYN, closestcontact, hitConsumerID, distance, snormal); - } - - // This is the standard Near. Uses space AABBs to speed up detection. - private void near(IntPtr space, IntPtr g1, IntPtr g2) - { - - //Don't test against heightfield Geom, or you'll be sorry! - - /* - terminate called after throwing an instance of 'std::bad_alloc' - what(): std::bad_alloc - Stacktrace: - - at (wrapper managed-to-native) Ode.NET.d.Collide (intptr,intptr,int,Ode.NET.d/ContactGeom[],int) <0x00004> - at (wrapper managed-to-native) Ode.NET.d.Collide (intptr,intptr,int,Ode.NET.d/ContactGeom[],int) <0xffffffff> - at OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.near (intptr,intptr,intptr) <0x00280> - at (wrapper native-to-managed) OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.near (intptr,intptr,intptr) <0xfff - fffff> - at (wrapper managed-to-native) Ode.NET.d.SpaceCollide2 (intptr,intptr,intptr,Ode.NET.d/NearCallback) <0x00004> - at (wrapper managed-to-native) Ode.NET.d.SpaceCollide2 (intptr,intptr,intptr,Ode.NET.d/NearCallback) <0xffffffff> - at OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.RayCast (OpenSim.Region.Physics.OdePlugin.ODERayCastRequest) < - 0x00114> - at OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.ProcessQueuedRequests () <0x000eb> - at OpenSim.Region.Physics.OdePlugin.OdeScene.Simulate (single) <0x017e6> - at OpenSim.Region.Framework.Scenes.SceneGraph.UpdatePhysics (double) <0x00042> - at OpenSim.Region.Framework.Scenes.Scene.Update () <0x0039e> - at OpenSim.Region.Framework.Scenes.Scene.Heartbeat (object) <0x00019> - at (wrapper runtime-invoke) object.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0xffffffff> - - Native stacktrace: - - mono [0x80d2a42] - [0xb7f5840c] - /lib/i686/cmov/libc.so.6(abort+0x188) [0xb7d1a018] - /usr/lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x158) [0xb45fc988] - /usr/lib/libstdc++.so.6 [0xb45fa865] - /usr/lib/libstdc++.so.6 [0xb45fa8a2] - /usr/lib/libstdc++.so.6 [0xb45fa9da] - /usr/lib/libstdc++.so.6(_Znwj+0x83) [0xb45fb033] - /usr/lib/libstdc++.so.6(_Znaj+0x1d) [0xb45fb11d] - libode.so(_ZN13dxHeightfield23dCollideHeightfieldZoneEiiiiP6dxGeomiiP12dContactGeomi+0xd04) [0xb46678e4] - libode.so(_Z19dCollideHeightfieldP6dxGeomS0_iP12dContactGeomi+0x54b) [0xb466832b] - libode.so(dCollide+0x102) [0xb46571b2] - [0x95cfdec9] - [0x8ea07fe1] - [0xab260146] - libode.so [0xb465a5c4] - libode.so(_ZN11dxHashSpace8collide2EPvP6dxGeomPFvS0_S2_S2_E+0x75) [0xb465bcf5] - libode.so(dSpaceCollide2+0x177) [0xb465ac67] - [0x95cf978e] - [0x8ea07945] - [0x95cf2bbc] - [0xab2787e7] - [0xab419fb3] - [0xab416657] - [0xab415bda] - [0xb609b08e] - mono(mono_runtime_delegate_invoke+0x34) [0x8192534] - mono [0x81a2f0f] - mono [0x81d28b6] - mono [0x81ea2c6] - /lib/i686/cmov/libpthread.so.0 [0xb7e744c0] - /lib/i686/cmov/libc.so.6(clone+0x5e) [0xb7dcd6de] - */ - - // Exclude heightfield geom - - if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) - return; - if (d.GeomGetClass(g1) == d.GeomClassID.HeightfieldClass || d.GeomGetClass(g2) == d.GeomClassID.HeightfieldClass) - return; - - // Raytest against AABBs of spaces first, then dig into the spaces it hits for actual geoms. - if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2)) - { - if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) - return; - - // Separating static prim geometry spaces. - // We'll be calling near recursivly if one - // of them is a space to find all of the - // contact points in the space - try - { - d.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback); - } - catch (AccessViolationException) - { - m_log.Warn("[PHYSICS]: Unable to collide test a space"); - return; - } - //Colliding a space or a geom with a space or a geom. so drill down - - //Collide all geoms in each space.. - //if (d.GeomIsSpace(g1)) d.SpaceCollide(g1, IntPtr.Zero, nearCallback); - //if (d.GeomIsSpace(g2)) d.SpaceCollide(g2, IntPtr.Zero, nearCallback); - return; - } - - if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) - return; - - int count = 0; - try - { - - if (g1 == g2) - return; // Can't collide with yourself - - lock (contacts) - { - count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf); - } - } - catch (SEHException) - { - m_log.Error("[PHYSICS]: The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim."); - } - catch (Exception e) - { - m_log.WarnFormat("[PHYSICS]: Unable to collide test an object: {0}", e.Message); - return; - } - - PhysicsActor p1 = null; - PhysicsActor p2 = null; - - if (g1 != IntPtr.Zero) - m_scene.actor_name_map.TryGetValue(g1, out p1); - - if (g2 != IntPtr.Zero) - m_scene.actor_name_map.TryGetValue(g1, out p2); - - // Loop over contacts, build results. - for (int i = 0; i < count; i++) - { - if (p1 != null) { - if (p1 is OdePrim) - { - ContactResult collisionresult = new ContactResult(); - - collisionresult.ConsumerID = ((OdePrim)p1).m_localID; - collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z); - collisionresult.Depth = contacts[i].depth; - collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y, - contacts[i].normal.Z); - lock (m_contactResults) - m_contactResults.Add(collisionresult); - } - } - - if (p2 != null) - { - if (p2 is OdePrim) - { - ContactResult collisionresult = new ContactResult(); - - collisionresult.ConsumerID = ((OdePrim)p2).m_localID; - collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z); - collisionresult.Depth = contacts[i].depth; - collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y, - contacts[i].normal.Z); - - lock (m_contactResults) - m_contactResults.Add(collisionresult); - } - } - - - } - - } - - /// - /// Dereference the creator scene so that it can be garbage collected if needed. - /// - internal void Dispose() - { - m_scene = null; - } - } - - public struct ODERayCastRequest - { - public Vector3 Origin; - public Vector3 Normal; - public float length; - public RaycastCallback callbackMethod; - } - - public struct ContactResult - { - public Vector3 Pos; - public float Depth; - public uint ConsumerID; - public Vector3 Normal; - } -} diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdePhysicsJoint.cs b/OpenSim/Region/Physics/ChOdePlugin/OdePhysicsJoint.cs deleted file mode 100644 index b4a3c48650..0000000000 --- a/OpenSim/Region/Physics/ChOdePlugin/OdePhysicsJoint.cs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using OpenMetaverse; -using Ode.NET; -using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.OdePlugin; - -namespace OpenSim.Region.Physics.OdePlugin -{ - class OdePhysicsJoint : PhysicsJoint - { - public override bool IsInPhysicsEngine - { - get - { - return (jointID != IntPtr.Zero); - } - } - public IntPtr jointID; - } -} diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs deleted file mode 100644 index 6cad285f76..0000000000 --- a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs +++ /dev/null @@ -1,3887 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -//#define USE_DRAWSTUFF - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Threading; -using System.IO; -using System.Diagnostics; -using log4net; -using Nini.Config; -using Ode.NET; -#if USE_DRAWSTUFF -using Drawstuff.NET; -#endif -using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenMetaverse; - -//using OpenSim.Region.Physics.OdePlugin.Meshing; - -namespace OpenSim.Region.Physics.OdePlugin -{ - /// - /// ODE plugin - /// - public class OdePlugin : IPhysicsPlugin - { - //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - - private CollisionLocker ode; - private OdeScene _mScene; - - public OdePlugin() - { - ode = new CollisionLocker(); - } - - public bool Init() - { - return true; - } - - public PhysicsScene GetScene(String sceneIdentifier) - { - if (_mScene == null) - { - if (Util.IsWindows()) - Util.LoadArchSpecificWindowsDll("ode.dll"); - - // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to - // http://opensimulator.org/mantis/view.php?id=2750). - d.InitODE(); - - _mScene = new OdeScene(ode, sceneIdentifier); - } - return (_mScene); - } - - public string GetName() - { - return ("ChODE"); - } - - public void Dispose() - { - } - } - - public enum StatusIndicators : int - { - Generic = 0, - Start = 1, - End = 2 - } - - public struct sCollisionData - { - public uint ColliderLocalId; - public uint CollidedWithLocalId; - public int NumberOfCollisions; - public int CollisionType; - public int StatusIndicator; - public int lastframe; - } - - [Flags] - public enum CollisionCategories : int - { - Disabled = 0, - Geom = 0x00000001, - Body = 0x00000002, - Space = 0x00000004, - Character = 0x00000008, - Land = 0x00000010, - Water = 0x00000020, - Wind = 0x00000040, - Sensor = 0x00000080, - Selected = 0x00000100 - } - - /// - /// Material type for a primitive - /// - public enum Material : int - { - /// - Stone = 0, - /// - Metal = 1, - /// - Glass = 2, - /// - Wood = 3, - /// - Flesh = 4, - /// - Plastic = 5, - /// - Rubber = 6 - - } - - public sealed class OdeScene : PhysicsScene - { - private readonly ILog m_log; - // private Dictionary m_storedCollisions = new Dictionary(); - - CollisionLocker ode; - - private Random fluidRandomizer = new Random(Environment.TickCount); - - private const uint m_regionWidth = Constants.RegionSize; - private const uint m_regionHeight = Constants.RegionSize; - - private float ODE_STEPSIZE = 0.020f; - private float metersInSpace = 29.9f; - private float m_timeDilation = 1.0f; - - public float gravityx = 0f; - public float gravityy = 0f; - public float gravityz = -9.8f; - - private float contactsurfacelayer = 0.001f; - - private int worldHashspaceLow = -4; - private int worldHashspaceHigh = 128; - - private int smallHashspaceLow = -4; - private int smallHashspaceHigh = 66; - - private float waterlevel = 0f; - private int framecount = 0; - //private int m_returncollisions = 10; - - private readonly IntPtr contactgroup; - - internal IntPtr LandGeom; - internal IntPtr WaterGeom; - - private float nmTerrainContactFriction = 255.0f; - private float nmTerrainContactBounce = 0.1f; - private float nmTerrainContactERP = 0.1025f; - - private float mTerrainContactFriction = 75f; - private float mTerrainContactBounce = 0.1f; - private float mTerrainContactERP = 0.05025f; - - private float nmAvatarObjectContactFriction = 250f; - private float nmAvatarObjectContactBounce = 0.1f; - - private float mAvatarObjectContactFriction = 75f; - private float mAvatarObjectContactBounce = 0.1f; - - private float avPIDD = 3200f; - private float avPIDP = 1400f; - private float avCapRadius = 0.37f; - private float avStandupTensor = 2000000f; - private bool avCapsuleTilted = true; // true = old compatibility mode with leaning capsule; false = new corrected mode - public bool IsAvCapsuleTilted { get { return avCapsuleTilted; } set { avCapsuleTilted = value; } } - private float avDensity = 80f; - private float avHeightFudgeFactor = 0.52f; - private float avMovementDivisorWalk = 1.3f; - private float avMovementDivisorRun = 0.8f; - private float minimumGroundFlightOffset = 3f; - public float maximumMassObject = 10000.01f; - - public bool meshSculptedPrim = true; - public bool forceSimplePrimMeshing = false; - - public float meshSculptLOD = 32; - public float MeshSculptphysicalLOD = 16; - - public float geomDefaultDensity = 10.000006836f; - - public int geomContactPointsStartthrottle = 3; - public int geomUpdatesPerThrottledUpdate = 15; - - public float bodyPIDD = 35f; - public float bodyPIDG = 25; - - public int geomCrossingFailuresBeforeOutofbounds = 5; - public float geomRegionFence = 0.0f; - - public float bodyMotorJointMaxforceTensor = 2; - - public int bodyFramesAutoDisable = 20; - - private DateTime m_lastframe = DateTime.UtcNow; - - private float[] _watermap; - private bool m_filterCollisions = true; - - private d.NearCallback nearCallback; - public d.TriCallback triCallback; - public d.TriArrayCallback triArrayCallback; - private readonly HashSet _characters = new HashSet(); - private readonly HashSet _prims = new HashSet(); - private readonly HashSet _activeprims = new HashSet(); - private readonly HashSet _taintedPrimH = new HashSet(); - private readonly Object _taintedPrimLock = new Object(); - private readonly List _taintedPrimL = new List(); - private readonly HashSet _taintedActors = new HashSet(); - private readonly List _perloopContact = new List(); - private readonly List _collisionEventPrim = new List(); - private readonly HashSet _badCharacter = new HashSet(); - public Dictionary geom_name_map = new Dictionary(); - public Dictionary actor_name_map = new Dictionary(); - private bool m_NINJA_physics_joints_enabled = false; - //private Dictionary jointpart_name_map = new Dictionary(); - private readonly Dictionary> joints_connecting_actor = new Dictionary>(); - private d.ContactGeom[] contacts; - private readonly List requestedJointsToBeCreated = new List(); // lock only briefly. accessed by external code (to request new joints) and by OdeScene.Simulate() to move those joints into pending/active - private readonly List pendingJoints = new List(); // can lock for longer. accessed only by OdeScene. - private readonly List activeJoints = new List(); // can lock for longer. accessed only by OdeScene. - private readonly List requestedJointsToBeDeleted = new List(); // lock only briefly. accessed by external code (to request deletion of joints) and by OdeScene.Simulate() to move those joints out of pending/active - private Object externalJointRequestsLock = new Object(); - private readonly Dictionary SOPName_to_activeJoint = new Dictionary(); - private readonly Dictionary SOPName_to_pendingJoint = new Dictionary(); - private readonly DoubleDictionary RegionTerrain = new DoubleDictionary(); - private readonly Dictionary TerrainHeightFieldHeights = new Dictionary(); - - private d.Contact ContactCopy; // local copy that can be modified - private d.Contact TerrainContact; - private d.Contact AvatarStaticprimContact; // was 'contact' - private d.Contact AvatarMovementprimContact; - private d.Contact AvatarMovementTerrainContact; - private d.Contact WaterContact; - private d.Contact[,] m_materialContacts; - -//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it -//Ckrinke private int m_randomizeWater = 200; - private int m_physicsiterations = 10; - private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag - private readonly PhysicsActor PANull = new NullPhysicsActor(); - private float step_time = 0.0f; -//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it -//Ckrinke private int ms = 0; - public IntPtr world; - //private bool returncollisions = false; - // private uint obj1LocalID = 0; - private uint obj2LocalID = 0; - //private int ctype = 0; - private OdeCharacter cc1; - private OdePrim cp1; - private OdeCharacter cc2; - private OdePrim cp2; - //private int cStartStop = 0; - //private string cDictKey = ""; - - public IntPtr space; - - //private IntPtr tmpSpace; - // split static geometry collision handling into spaces of 30 meters - public IntPtr[,] staticPrimspace; - - public Object OdeLock; - - public IMesher mesher; - - private IConfigSource m_config; - - public bool physics_logging = false; - public int physics_logging_interval = 0; - public bool physics_logging_append_existing_logfile = false; - - public d.Vector3 xyz = new d.Vector3(128.1640f, 128.3079f, 25.7600f); - public d.Vector3 hpr = new d.Vector3(125.5000f, -17.0000f, 0.0000f); - - // TODO: unused: private uint heightmapWidth = m_regionWidth + 1; - // TODO: unused: private uint heightmapHeight = m_regionHeight + 1; - // TODO: unused: private uint heightmapWidthSamples; - // TODO: unused: private uint heightmapHeightSamples; - - private volatile int m_global_contactcount = 0; - - private Vector3 m_worldOffset = Vector3.Zero; - public Vector2 WorldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize); - private PhysicsScene m_parentScene = null; - - private ODERayCastRequestManager m_rayCastManager; - - /// - /// Initiailizes the scene - /// Sets many properties that ODE requires to be stable - /// These settings need to be tweaked 'exactly' right or weird stuff happens. - /// - public OdeScene(CollisionLocker dode, string sceneIdentifier) - { - m_log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + sceneIdentifier); - - OdeLock = new Object(); - ode = dode; - nearCallback = near; - triCallback = TriCallback; - triArrayCallback = TriArrayCallback; - m_rayCastManager = new ODERayCastRequestManager(this); - lock (OdeLock) - { - // Create the world and the first space - world = d.WorldCreate(); - space = d.HashSpaceCreate(IntPtr.Zero); - - - contactgroup = d.JointGroupCreate(0); - //contactgroup - - d.WorldSetAutoDisableFlag(world, false); - #if USE_DRAWSTUFF - - Thread viewthread = new Thread(new ParameterizedThreadStart(startvisualization)); - viewthread.Start(); - #endif - } - - - _watermap = new float[258 * 258]; - - // Zero out the prim spaces array (we split our space into smaller spaces so - // we can hit test less. - } - -#if USE_DRAWSTUFF - public void startvisualization(object o) - { - ds.Functions fn; - fn.version = ds.VERSION; - fn.start = new ds.CallbackFunction(start); - fn.step = new ds.CallbackFunction(step); - fn.command = new ds.CallbackFunction(command); - fn.stop = null; - fn.path_to_textures = "./textures"; - string[] args = new string[0]; - ds.SimulationLoop(args.Length, args, 352, 288, ref fn); - } -#endif - - // Initialize the mesh plugin - public override void Initialise(IMesher meshmerizer, IConfigSource config) - { - mesher = meshmerizer; - m_config = config; - // Defaults - - if (Environment.OSVersion.Platform == PlatformID.Unix) - { - avPIDD = 3200.0f; - avPIDP = 1400.0f; - avStandupTensor = 2000000f; - } - else - { - avPIDD = 2200.0f; - avPIDP = 900.0f; - avStandupTensor = 550000f; - } - - int contactsPerCollision = 80; - - if (m_config != null) - { - IConfig physicsconfig = m_config.Configs["ODEPhysicsSettings"]; - if (physicsconfig != null) - { - gravityx = physicsconfig.GetFloat("world_gravityx", 0f); - gravityy = physicsconfig.GetFloat("world_gravityy", 0f); - gravityz = physicsconfig.GetFloat("world_gravityz", -9.8f); - - worldHashspaceLow = physicsconfig.GetInt("world_hashspace_size_low", -4); - worldHashspaceHigh = physicsconfig.GetInt("world_hashspace_size_high", 128); - - metersInSpace = physicsconfig.GetFloat("meters_in_small_space", 29.9f); - smallHashspaceLow = physicsconfig.GetInt("small_hashspace_size_low", -4); - smallHashspaceHigh = physicsconfig.GetInt("small_hashspace_size_high", 66); - - contactsurfacelayer = physicsconfig.GetFloat("world_contact_surface_layer", 0.001f); - - nmTerrainContactFriction = physicsconfig.GetFloat("nm_terraincontact_friction", 255.0f); - nmTerrainContactBounce = physicsconfig.GetFloat("nm_terraincontact_bounce", 0.1f); - nmTerrainContactERP = physicsconfig.GetFloat("nm_terraincontact_erp", 0.1025f); - - mTerrainContactFriction = physicsconfig.GetFloat("m_terraincontact_friction", 75f); - mTerrainContactBounce = physicsconfig.GetFloat("m_terraincontact_bounce", 0.05f); - mTerrainContactERP = physicsconfig.GetFloat("m_terraincontact_erp", 0.05025f); - - nmAvatarObjectContactFriction = physicsconfig.GetFloat("objectcontact_friction", 250f); - nmAvatarObjectContactBounce = physicsconfig.GetFloat("objectcontact_bounce", 0.2f); - - mAvatarObjectContactFriction = physicsconfig.GetFloat("m_avatarobjectcontact_friction", 75f); - mAvatarObjectContactBounce = physicsconfig.GetFloat("m_avatarobjectcontact_bounce", 0.1f); - - ODE_STEPSIZE = physicsconfig.GetFloat("world_stepsize", 0.020f); - m_physicsiterations = physicsconfig.GetInt("world_internal_steps_without_collisions", 10); - - avDensity = physicsconfig.GetFloat("av_density", 80f); - avHeightFudgeFactor = physicsconfig.GetFloat("av_height_fudge_factor", 0.52f); - avMovementDivisorWalk = physicsconfig.GetFloat("av_movement_divisor_walk", 1.3f); - avMovementDivisorRun = physicsconfig.GetFloat("av_movement_divisor_run", 0.8f); - avCapRadius = physicsconfig.GetFloat("av_capsule_radius", 0.37f); - avCapsuleTilted = physicsconfig.GetBoolean("av_capsule_tilted", false); - - contactsPerCollision = physicsconfig.GetInt("contacts_per_collision", 80); - - geomContactPointsStartthrottle = physicsconfig.GetInt("geom_contactpoints_start_throttling", 3); - geomUpdatesPerThrottledUpdate = physicsconfig.GetInt("geom_updates_before_throttled_update", 15); - geomCrossingFailuresBeforeOutofbounds = physicsconfig.GetInt("geom_crossing_failures_before_outofbounds", 5); - geomRegionFence = physicsconfig.GetFloat("region_border_fence", 0.0f); - - geomDefaultDensity = physicsconfig.GetFloat("geometry_default_density", 10.000006836f); - bodyFramesAutoDisable = physicsconfig.GetInt("body_frames_auto_disable", 20); - - bodyPIDD = physicsconfig.GetFloat("body_pid_derivative", 35f); - bodyPIDG = physicsconfig.GetFloat("body_pid_gain", 25f); - - forceSimplePrimMeshing = physicsconfig.GetBoolean("force_simple_prim_meshing", forceSimplePrimMeshing); - meshSculptedPrim = physicsconfig.GetBoolean("mesh_sculpted_prim", true); - meshSculptLOD = physicsconfig.GetFloat("mesh_lod", 32f); - MeshSculptphysicalLOD = physicsconfig.GetFloat("mesh_physical_lod", 16f); - m_filterCollisions = physicsconfig.GetBoolean("filter_collisions", false); - - if (Environment.OSVersion.Platform == PlatformID.Unix) - { - avPIDD = physicsconfig.GetFloat("av_pid_derivative_linux", 2200.0f); - avPIDP = physicsconfig.GetFloat("av_pid_proportional_linux", 900.0f); - avStandupTensor = physicsconfig.GetFloat("av_capsule_standup_tensor_linux", 550000f); - bodyMotorJointMaxforceTensor = physicsconfig.GetFloat("body_motor_joint_maxforce_tensor_linux", 5f); - } - else - { - avPIDD = physicsconfig.GetFloat("av_pid_derivative_win", 2200.0f); - avPIDP = physicsconfig.GetFloat("av_pid_proportional_win", 900.0f); - avStandupTensor = physicsconfig.GetFloat("av_capsule_standup_tensor_win", 550000f); - bodyMotorJointMaxforceTensor = physicsconfig.GetFloat("body_motor_joint_maxforce_tensor_win", 5f); - } - - physics_logging = physicsconfig.GetBoolean("physics_logging", false); - physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0); - physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false); - - m_NINJA_physics_joints_enabled = physicsconfig.GetBoolean("use_NINJA_physics_joints", false); - minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", 3f); - maximumMassObject = physicsconfig.GetFloat("maximum_mass_object", 10000.01f); - } - } - - contacts = new d.ContactGeom[contactsPerCollision]; - - staticPrimspace = new IntPtr[(int)(300 / metersInSpace), (int)(300 / metersInSpace)]; - - // Avatar static on a Prim parameters - AvatarStaticprimContact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; - AvatarStaticprimContact.surface.mu = 255.0f; - AvatarStaticprimContact.surface.bounce = 0.0f; - AvatarStaticprimContact.surface.soft_cfm = 0.0f; - AvatarStaticprimContact.surface.soft_erp = 0.30f; // If this is too small static Av will fall through a sloping prim. 1.0 prevents fall-thru - - // Avatar moving on a Prim parameters - AvatarMovementprimContact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; - AvatarMovementprimContact.surface.mu = 255.0f; - AvatarMovementprimContact.surface.bounce = 0.0f; - AvatarMovementprimContact.surface.soft_cfm = 0.0f; // if this is 0.01 then prims become phantom to Avs! - AvatarMovementprimContact.surface.soft_erp = 0.3f; - - // Static Avatar on Terrain parameters - // Keeps Avatar in place better - TerrainContact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; - TerrainContact.surface.mu = 255.0f; - TerrainContact.surface.bounce = 0.0f; - TerrainContact.surface.soft_cfm = 0.0f; - TerrainContact.surface.soft_erp = 0.05f; - - // Moving Avatar on Terrain parameters - AvatarMovementTerrainContact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; - AvatarMovementTerrainContact.surface.mu = 75f; - AvatarMovementTerrainContact.surface.bounce = 0.0f; - AvatarMovementTerrainContact.surface.soft_cfm = 0.0f; - AvatarMovementTerrainContact.surface.soft_erp = 0.05f; - - // Avatar or prim the the water, this may not be used, possibly water is same as air? - WaterContact.surface.mode |= (d.ContactFlags.SoftERP | d.ContactFlags.SoftCFM); - WaterContact.surface.mu = 0.0f; // No friction - WaterContact.surface.bounce = 0.0f; // No bounce - WaterContact.surface.soft_cfm = 0.010f; - WaterContact.surface.soft_erp = 0.010f; - - - // Prim static or moving on a prim, depends on material type - m_materialContacts = new d.Contact[7,2]; - // V 1 = Sliding; 0 = static or fell onto - m_materialContacts[(int)Material.Stone, 0] = new d.Contact(); - m_materialContacts[(int)Material.Stone, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; - m_materialContacts[(int)Material.Stone, 0].surface.mu = 60f; // friction, 1 = slippery, 255 = no slip - m_materialContacts[(int)Material.Stone, 0].surface.bounce = 0.0f; - m_materialContacts[(int)Material.Stone, 0].surface.soft_cfm = 0.0f; - m_materialContacts[(int)Material.Stone, 0].surface.soft_erp = 0.50f; // erp also changes friction, more erp=less friction - - m_materialContacts[(int)Material.Stone, 1] = new d.Contact(); - m_materialContacts[(int)Material.Stone, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; - m_materialContacts[(int)Material.Stone, 1].surface.mu = 40f; - m_materialContacts[(int)Material.Stone, 1].surface.bounce = 0.0f; - m_materialContacts[(int)Material.Stone, 1].surface.soft_cfm = 0.0f; - m_materialContacts[(int)Material.Stone, 1].surface.soft_erp = 0.50f; - - m_materialContacts[(int)Material.Metal, 0] = new d.Contact(); - m_materialContacts[(int)Material.Metal, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; - m_materialContacts[(int)Material.Metal, 0].surface.mu = 15f; - m_materialContacts[(int)Material.Metal, 0].surface.bounce = 0.2f; - m_materialContacts[(int)Material.Metal, 0].surface.soft_cfm = 0.0f; - m_materialContacts[(int)Material.Metal, 0].surface.soft_erp = 0.50f; - - m_materialContacts[(int)Material.Metal, 1] = new d.Contact(); - m_materialContacts[(int)Material.Metal, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; - m_materialContacts[(int)Material.Metal, 1].surface.mu = 10f; - m_materialContacts[(int)Material.Metal, 1].surface.bounce = 0.2f; - m_materialContacts[(int)Material.Metal, 1].surface.soft_cfm = 0.0f; - m_materialContacts[(int)Material.Metal, 1].surface.soft_erp = 0.50f; - - m_materialContacts[(int)Material.Glass, 0] = new d.Contact(); - m_materialContacts[(int)Material.Glass, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; - m_materialContacts[(int)Material.Glass, 0].surface.mu = 7.5f; - m_materialContacts[(int)Material.Glass, 0].surface.bounce = 0.0f; - m_materialContacts[(int)Material.Glass, 0].surface.soft_cfm = 0.0f; - m_materialContacts[(int)Material.Glass, 0].surface.soft_erp = 0.50f; - - m_materialContacts[(int)Material.Glass, 1] = new d.Contact(); - m_materialContacts[(int)Material.Glass, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; - m_materialContacts[(int)Material.Glass, 1].surface.mu = 5f; - m_materialContacts[(int)Material.Glass, 1].surface.bounce = 0.0f; - m_materialContacts[(int)Material.Glass, 1].surface.soft_cfm = 0.0f; - m_materialContacts[(int)Material.Glass, 1].surface.soft_erp = 0.50f; - - m_materialContacts[(int)Material.Wood, 0] = new d.Contact(); - m_materialContacts[(int)Material.Wood, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; - m_materialContacts[(int)Material.Wood, 0].surface.mu = 45f; - m_materialContacts[(int)Material.Wood, 0].surface.bounce = 0.1f; - m_materialContacts[(int)Material.Wood, 0].surface.soft_cfm = 0.0f; - m_materialContacts[(int)Material.Wood, 0].surface.soft_erp = 0.50f; - - m_materialContacts[(int)Material.Wood, 1] = new d.Contact(); - m_materialContacts[(int)Material.Wood, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; - m_materialContacts[(int)Material.Wood, 1].surface.mu = 30f; - m_materialContacts[(int)Material.Wood, 1].surface.bounce = 0.1f; - m_materialContacts[(int)Material.Wood, 1].surface.soft_cfm = 0.0f; - m_materialContacts[(int)Material.Wood, 1].surface.soft_erp = 0.50f; - - m_materialContacts[(int)Material.Flesh, 0] = new d.Contact(); - m_materialContacts[(int)Material.Flesh, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; - m_materialContacts[(int)Material.Flesh, 0].surface.mu = 150f; - m_materialContacts[(int)Material.Flesh, 0].surface.bounce = 0.0f; - m_materialContacts[(int)Material.Flesh, 0].surface.soft_cfm = 0.0f; - m_materialContacts[(int)Material.Flesh, 0].surface.soft_erp = 0.50f; - - m_materialContacts[(int)Material.Flesh, 1] = new d.Contact(); - m_materialContacts[(int)Material.Flesh, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; - m_materialContacts[(int)Material.Flesh, 1].surface.mu = 100f; - m_materialContacts[(int)Material.Flesh, 1].surface.bounce = 0.0f; - m_materialContacts[(int)Material.Flesh, 1].surface.soft_cfm = 0.0f; - m_materialContacts[(int)Material.Flesh, 1].surface.soft_erp = 0.50f; - - m_materialContacts[(int)Material.Plastic, 0] = new d.Contact(); - m_materialContacts[(int)Material.Plastic, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; - m_materialContacts[(int)Material.Plastic, 0].surface.mu = 30f; - m_materialContacts[(int)Material.Plastic, 0].surface.bounce = 0.2f; - m_materialContacts[(int)Material.Plastic, 0].surface.soft_cfm = 0.0f; - m_materialContacts[(int)Material.Plastic, 0].surface.soft_erp = 0.50f; - - m_materialContacts[(int)Material.Plastic, 1] = new d.Contact(); - m_materialContacts[(int)Material.Plastic, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; - m_materialContacts[(int)Material.Plastic, 1].surface.mu = 20f; - m_materialContacts[(int)Material.Plastic, 1].surface.bounce = 0.2f; - m_materialContacts[(int)Material.Plastic, 1].surface.soft_cfm = 0.0f; - m_materialContacts[(int)Material.Plastic, 1].surface.soft_erp = 0.50f; - - m_materialContacts[(int)Material.Rubber, 0] = new d.Contact(); - m_materialContacts[(int)Material.Rubber, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; - m_materialContacts[(int)Material.Rubber, 0].surface.mu = 150f; - m_materialContacts[(int)Material.Rubber, 0].surface.bounce = 0.7f; - m_materialContacts[(int)Material.Rubber, 0].surface.soft_cfm = 0.0f; - m_materialContacts[(int)Material.Rubber, 0].surface.soft_erp = 0.50f; - - m_materialContacts[(int)Material.Rubber, 1] = new d.Contact(); - m_materialContacts[(int)Material.Rubber, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; - m_materialContacts[(int)Material.Rubber, 1].surface.mu = 100f; - m_materialContacts[(int)Material.Rubber, 1].surface.bounce = 0.7f; - m_materialContacts[(int)Material.Rubber, 1].surface.soft_cfm = 0.0f; - m_materialContacts[(int)Material.Rubber, 1].surface.soft_erp = 0.50f; - - d.HashSpaceSetLevels(space, worldHashspaceLow, worldHashspaceHigh); - - // Set the gravity,, don't disable things automatically (we set it explicitly on some things) - - d.WorldSetGravity(world, gravityx, gravityy, gravityz); - d.WorldSetContactSurfaceLayer(world, contactsurfacelayer); - - - d.WorldSetLinearDampingThreshold(world, 256f); - d.WorldSetLinearDamping(world, 256f); -// d.WorldSetLinearDampingThreshold(world, 0.01f); -// d.WorldSetLinearDamping(world, 0.1f); - d.WorldSetAngularDampingThreshold(world, 256f); - d.WorldSetAngularDamping(world, 256f); - d.WorldSetMaxAngularSpeed(world, 256f); - - // Set how many steps we go without running collision testing - // This is in addition to the step size. - // Essentially Steps * m_physicsiterations - d.WorldSetQuickStepNumIterations(world, m_physicsiterations); - //d.WorldSetContactMaxCorrectingVel(world, 1000.0f); - - - - for (int i = 0; i < staticPrimspace.GetLength(0); i++) - { - for (int j = 0; j < staticPrimspace.GetLength(1); j++) - { - staticPrimspace[i, j] = IntPtr.Zero; - } - } - } - - internal void waitForSpaceUnlock(IntPtr space) - { - //if (space != IntPtr.Zero) - //while (d.SpaceLockQuery(space)) { } // Wait and do nothing - } - - /// - /// Debug space message for printing the space that a prim/avatar is in. - /// - /// - /// Returns which split up space the given position is in. - public string whichspaceamIin(Vector3 pos) - { - return calculateSpaceForGeom(pos).ToString(); - } - - #region Collision Detection - - /// - /// This is our near callback. A geometry is near a body - /// - /// The space that contains the geoms. Remember, spaces are also geoms - /// a geometry or space - /// another geometry or space - private void near(IntPtr space, IntPtr g1, IntPtr g2) - { - // no lock here! It's invoked from within Simulate(), which is thread-locked - - // Test if we're colliding a geom with a space. - // If so we have to drill down into the space recursively -//Console.WriteLine("near -----------"); //## - if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2)) - { - if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) - return; - - // Separating static prim geometry spaces. - // We'll be calling near recursivly if one - // of them is a space to find all of the - // contact points in the space - try - { - d.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback); - } - catch (AccessViolationException) - { - m_log.Warn("[PHYSICS]: Unable to collide test a space"); - return; - } - //Colliding a space or a geom with a space or a geom. so drill down - - //Collide all geoms in each space.. - //if (d.GeomIsSpace(g1)) d.SpaceCollide(g1, IntPtr.Zero, nearCallback); - //if (d.GeomIsSpace(g2)) d.SpaceCollide(g2, IntPtr.Zero, nearCallback); - return; - } - - if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) - return; - - IntPtr b1 = d.GeomGetBody(g1); - IntPtr b2 = d.GeomGetBody(g2); - - // d.GeomClassID id = d.GeomGetClass(g1); - - String name1 = null; - String name2 = null; - - if (!geom_name_map.TryGetValue(g1, out name1)) - { - name1 = "null"; - } - if (!geom_name_map.TryGetValue(g2, out name2)) - { - name2 = "null"; - } - - //if (id == d.GeomClassId.TriMeshClass) - //{ - // m_log.InfoFormat("near: A collision was detected between {1} and {2}", 0, name1, name2); - //m_log.Debug("near: A collision was detected between {1} and {2}", 0, name1, name2); - //} - - // Figure out how many contact points we have - int count = 0; - try - { - // Colliding Geom To Geom - // This portion of the function 'was' blatantly ripped off from BoxStack.cs - - if (g1 == g2) - return; // Can't collide with yourself - - if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) - return; - - lock (contacts) - { - count = d.Collide(g1, g2, contacts.Length, contacts, d.ContactGeom.SizeOf); - if (count > contacts.Length) - m_log.Error("[PHYSICS]: Got " + count + " contacts when we asked for a maximum of " + contacts.Length); - } - } - catch (SEHException) - { - m_log.Error("[PHYSICS]: The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim."); - ode.drelease(world); - base.TriggerPhysicsBasedRestart(); - } - catch (Exception e) - { - m_log.WarnFormat("[PHYSICS]: Unable to collide test an object: {0}", e.Message); - return; - } - - PhysicsActor p1; - PhysicsActor p2; - - if (!actor_name_map.TryGetValue(g1, out p1)) - { - p1 = PANull; - } - - if (!actor_name_map.TryGetValue(g2, out p2)) - { - p2 = PANull; - } - - ContactPoint maxDepthContact = new ContactPoint(); - if (p1.CollisionScore + count >= float.MaxValue) - p1.CollisionScore = 0; - p1.CollisionScore += count; - - if (p2.CollisionScore + count >= float.MaxValue) - p2.CollisionScore = 0; - p2.CollisionScore += count; - for (int i = 0; i < count; i++) - { - d.ContactGeom curContact = contacts[i]; - - if (curContact.depth > maxDepthContact.PenetrationDepth) - { - maxDepthContact = new ContactPoint( - new Vector3(curContact.pos.X, curContact.pos.Y, curContact.pos.Z), - new Vector3(curContact.normal.X, curContact.normal.Y, curContact.normal.Z), - curContact.depth - ); - } - - //m_log.Warn("[CCOUNT]: " + count); - IntPtr joint; - // If we're colliding with terrain, use 'TerrainContact' instead of AvatarStaticprimContact. - // allows us to have different settings - - // We only need to test p2 for 'jump crouch purposes' - if (p2 is OdeCharacter && p1.PhysicsActorType == (int)ActorTypes.Prim) - { - // Testing if the collision is at the feet of the avatar - - //m_log.DebugFormat("[PHYSICS]: {0} - {1} - {2} - {3}", curContact.pos.Z, p2.Position.Z, (p2.Position.Z - curContact.pos.Z), (p2.Size.Z * 0.6f)); -//#@ if ((p2.Position.Z - curContact.pos.Z) > (p2.Size.Z * 0.6f)) -//#@ p2.IsColliding = true; - if ((p2.Position.Z - curContact.pos.Z) > (p2.Size.Z * 0.6f)){ //## - p2.IsColliding = true; //## - }else{ - - } //## - } - else - { - p2.IsColliding = true; - } - - //if ((framecount % m_returncollisions) == 0) - - switch (p1.PhysicsActorType) - { - case (int)ActorTypes.Agent: - p2.CollidingObj = true; - break; - case (int)ActorTypes.Prim: - if (p2.Velocity.LengthSquared() > 0.0f) - p2.CollidingObj = true; - break; - case (int)ActorTypes.Unknown: - p2.CollidingGround = true; - break; - default: - p2.CollidingGround = true; - break; - } - - // we don't want prim or avatar to explode - - #region InterPenetration Handling - Unintended physics explosions -# region disabled code1 - - if (curContact.depth >= 0.08f) - { - //This is disabled at the moment only because it needs more tweaking - //It will eventually be uncommented - /* - if (AvatarStaticprimContact.depth >= 1.00f) - { - //m_log.Debug("[PHYSICS]: " + AvatarStaticprimContact.depth.ToString()); - } - - //If you interpenetrate a prim with an agent - if ((p2.PhysicsActorType == (int) ActorTypes.Agent && - p1.PhysicsActorType == (int) ActorTypes.Prim) || - (p1.PhysicsActorType == (int) ActorTypes.Agent && - p2.PhysicsActorType == (int) ActorTypes.Prim)) - { - - //AvatarStaticprimContact.depth = AvatarStaticprimContact.depth * 4.15f; - /* - if (p2.PhysicsActorType == (int) ActorTypes.Agent) - { - p2.CollidingObj = true; - AvatarStaticprimContact.depth = 0.003f; - p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f); - OdeCharacter character = (OdeCharacter) p2; - character.SetPidStatus(true); - AvatarStaticprimContact.pos = new d.Vector3(AvatarStaticprimContact.pos.X + (p1.Size.X / 2), AvatarStaticprimContact.pos.Y + (p1.Size.Y / 2), AvatarStaticprimContact.pos.Z + (p1.Size.Z / 2)); - - } - else - { - - //AvatarStaticprimContact.depth = 0.0000000f; - } - if (p1.PhysicsActorType == (int) ActorTypes.Agent) - { - - p1.CollidingObj = true; - AvatarStaticprimContact.depth = 0.003f; - p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f); - AvatarStaticprimContact.pos = new d.Vector3(AvatarStaticprimContact.pos.X + (p2.Size.X / 2), AvatarStaticprimContact.pos.Y + (p2.Size.Y / 2), AvatarStaticprimContact.pos.Z + (p2.Size.Z / 2)); - OdeCharacter character = (OdeCharacter)p1; - character.SetPidStatus(true); - } - else - { - - //AvatarStaticprimContact.depth = 0.0000000f; - } - - - - } -*/ - // If you interpenetrate a prim with another prim - /* - if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim) - { - #region disabledcode2 - //OdePrim op1 = (OdePrim)p1; - //OdePrim op2 = (OdePrim)p2; - //op1.m_collisionscore++; - //op2.m_collisionscore++; - - //if (op1.m_collisionscore > 8000 || op2.m_collisionscore > 8000) - //{ - //op1.m_taintdisable = true; - //AddPhysicsActorTaint(p1); - //op2.m_taintdisable = true; - //AddPhysicsActorTaint(p2); - //} - - //if (AvatarStaticprimContact.depth >= 0.25f) - //{ - // Don't collide, one or both prim will expld. - - //op1.m_interpenetrationcount++; - //op2.m_interpenetrationcount++; - //interpenetrations_before_disable = 200; - //if (op1.m_interpenetrationcount >= interpenetrations_before_disable) - //{ - //op1.m_taintdisable = true; - //AddPhysicsActorTaint(p1); - //} - //if (op2.m_interpenetrationcount >= interpenetrations_before_disable) - //{ - // op2.m_taintdisable = true; - //AddPhysicsActorTaint(p2); - //} - - //AvatarStaticprimContact.depth = AvatarStaticprimContact.depth / 8f; - //AvatarStaticprimContact.normal = new d.Vector3(0, 0, 1); - //} - //if (op1.m_disabled || op2.m_disabled) - //{ - //Manually disabled objects stay disabled - //AvatarStaticprimContact.depth = 0f; - //} - #endregion - } - */ -#endregion - if (curContact.depth >= 1.00f) - { - //m_log.Info("[P]: " + AvatarStaticprimContact.depth.ToString()); - if ((p2.PhysicsActorType == (int) ActorTypes.Agent && - p1.PhysicsActorType == (int) ActorTypes.Unknown) || - (p1.PhysicsActorType == (int) ActorTypes.Agent && - p2.PhysicsActorType == (int) ActorTypes.Unknown)) - { - if (p2.PhysicsActorType == (int) ActorTypes.Agent) - { - if (p2 is OdeCharacter) - { - OdeCharacter character = (OdeCharacter) p2; - - //p2.CollidingObj = true; - curContact.depth = 0.00000003f; - p2.Velocity = p2.Velocity + new Vector3(0f, 0f, 0.5f); - curContact.pos = - new d.Vector3(curContact.pos.X + (p1.Size.X/2), - curContact.pos.Y + (p1.Size.Y/2), - curContact.pos.Z + (p1.Size.Z/2)); - character.SetPidStatus(true); - } - } - - - if (p1.PhysicsActorType == (int) ActorTypes.Agent) - { - if (p1 is OdeCharacter) - { - OdeCharacter character = (OdeCharacter) p1; - - //p2.CollidingObj = true; - curContact.depth = 0.00000003f; - p1.Velocity = p1.Velocity + new Vector3(0f, 0f, 0.5f); - curContact.pos = - new d.Vector3(curContact.pos.X + (p1.Size.X/2), - curContact.pos.Y + (p1.Size.Y/2), - curContact.pos.Z + (p1.Size.Z/2)); - character.SetPidStatus(true); - } - } - } - } - } - - #endregion - - // Logic for collision handling - // Note, that if *all* contacts are skipped (VolumeDetect) - // The prim still detects (and forwards) collision events but - // appears to be phantom for the world - Boolean skipThisContact = false; - - if ((p1 is OdePrim) && (((OdePrim)p1).m_isVolumeDetect)) - skipThisContact = true; // No collision on volume detect prims - - if (!skipThisContact && (p2 is OdePrim) && (((OdePrim)p2).m_isVolumeDetect)) - skipThisContact = true; // No collision on volume detect prims - - if (!skipThisContact && curContact.depth < 0f) - skipThisContact = true; - - if (!skipThisContact && checkDupe(curContact, p2.PhysicsActorType)) - skipThisContact = true; - - const int maxContactsbeforedeath = 4000; - joint = IntPtr.Zero; - - if (!skipThisContact) - { - // Add contact joints with materials params---------------------------------- - // p1 is what is being hit, p2 is the physical object doing the hitting - int material = (int) Material.Wood; - int movintYN = 0; // 1 = Sliding; 0 = static or fell onto - if (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f) movintYN = 1; - - // If we're colliding against terrain - if (name1 == "Terrain" || name2 == "Terrain") - { - // If we're moving - if ((p2.PhysicsActorType == (int) ActorTypes.Agent) && (movintYN == 1)) - { - //$ Av walk/run on terrain (not falling) Use the Avatar movement terrain contact - AvatarMovementTerrainContact.geom = curContact; - _perloopContact.Add(curContact); - if (m_global_contactcount < maxContactsbeforedeath) - { - joint = d.JointCreateContact(world, contactgroup, ref AvatarMovementTerrainContact); - m_global_contactcount++; - } - } - else - { - if (p2.PhysicsActorType == (int)ActorTypes.Agent) - { - //$ Av standing on terrain, Use the non moving Avata terrain contact - TerrainContact.geom = curContact; - _perloopContact.Add(curContact); - if (m_global_contactcount < maxContactsbeforedeath) - { - joint = d.JointCreateContact(world, contactgroup, ref TerrainContact); - m_global_contactcount++; - } - } - else - { - if (p2.PhysicsActorType == (int)ActorTypes.Prim && p1.PhysicsActorType == (int)ActorTypes.Prim) - { - //& THIS NEVER HAPPENS? prim prim contact In terrain contact? - // int pj294950 = 0; - // prim terrain contact - - if (p2 is OdePrim) - material = ((OdePrim)p2).m_material; - //m_log.DebugFormat("Material: {0}", material); - m_materialContacts[material, movintYN].geom = curContact; - _perloopContact.Add(curContact); - - if (m_global_contactcount < maxContactsbeforedeath) - { - joint = d.JointCreateContact(world, contactgroup, ref m_materialContacts[material, movintYN]); - m_global_contactcount++; - - } - - } - else - { - //$ prim on terrain contact - if (p2 is OdePrim) - material = ((OdePrim)p2).m_material; - //m_log.DebugFormat("Material: {0}", material); - m_materialContacts[material, movintYN].geom = curContact; - _perloopContact.Add(curContact); - - ContactCopy = m_materialContacts[material, movintYN]; - if(movintYN == 1) - { - // prevent excessive slide on terrain - ContactCopy.surface.mu = m_materialContacts[material, movintYN].surface.mu * 30.0f; - } - - if (m_global_contactcount < maxContactsbeforedeath) - { - joint = d.JointCreateContact(world, contactgroup, ref ContactCopy); - m_global_contactcount++; - } - } - } - } - } - else if (name1 == "Water" || name2 == "Water") - { - //$ This never happens! Perhaps water is treated like air? - /* - if ((p2.PhysicsActorType == (int) ActorTypes.Prim)) - { - } - else - { - } - */ - //WaterContact.surface.soft_cfm = 0.0000f; - //WaterContact.surface.soft_erp = 0.00000f; - if (curContact.depth > 0.1f) - { - curContact.depth *= 52; - //AvatarStaticprimContact.normal = new d.Vector3(0, 0, 1); - //AvatarStaticprimContact.pos = new d.Vector3(0, 0, contact.pos.Z - 5f); - } - WaterContact.geom = curContact; - _perloopContact.Add(curContact); - if (m_global_contactcount < maxContactsbeforedeath) - { - joint = d.JointCreateContact(world, contactgroup, ref WaterContact); - m_global_contactcount++; - } - //m_log.Info("[PHYSICS]: Prim Water Contact" + AvatarStaticprimContact.depth); - } - else - { - - // no terrain and no water, we're colliding with prim or avatar - // check if we're moving - if ((p2.PhysicsActorType == (int)ActorTypes.Agent)) - { - //$ Avatar on Prim or other Avatar - if (movintYN == 1) - { - // Use the AV Movement / prim contact - AvatarMovementprimContact.geom = curContact; - _perloopContact.Add(curContact); - if (m_global_contactcount < maxContactsbeforedeath) - { - joint = d.JointCreateContact(world, contactgroup, ref AvatarMovementprimContact); - m_global_contactcount++; - } - } - else - { - // Use the Av non movement / prim contact - AvatarStaticprimContact.geom = curContact; - _perloopContact.Add(curContact); - ContactCopy = AvatarStaticprimContact; // local copy so we can change locally - - if (m_global_contactcount < maxContactsbeforedeath) - { - if (curContact.depth > 0.2) - { // embedded, eject slowly - ContactCopy.surface.soft_erp = 0.1f; - ContactCopy.surface.soft_cfm = 0.1f; - } - else - { // keep on the surface - ContactCopy.surface.soft_erp = 0.3f; - ContactCopy.surface.soft_cfm = 0.0f; - } - joint = d.JointCreateContact(world, contactgroup, ref ContactCopy); - m_global_contactcount++; - } - } - } - else if (p2.PhysicsActorType == (int)ActorTypes.Prim) - { - //$ Prim on Prim - //p1.PhysicsActorType - - if (p2 is OdePrim) material = ((OdePrim)p2).m_material; - //m_log.DebugFormat("Material: {0}", material); - - m_materialContacts[material, movintYN].geom = curContact; - _perloopContact.Add(curContact); - - if (m_global_contactcount < maxContactsbeforedeath) - { - joint = d.JointCreateContact(world, contactgroup, ref m_materialContacts[material, movintYN]); - m_global_contactcount++; - } - } - } - - if (m_global_contactcount < maxContactsbeforedeath && joint != IntPtr.Zero) // stack collide! - { - d.JointAttach(joint, b1, b2); - m_global_contactcount++; - } - - } - collision_accounting_events(p1, p2, maxDepthContact); - if (count > geomContactPointsStartthrottle) - { - // If there are more then 3 contact points, it's likely - // that we've got a pile of objects, so ... - // We don't want to send out hundreds of terse updates over and over again - // so lets throttle them and send them again after it's somewhat sorted out. - p2.ThrottleUpdates = true; - } - //m_log.Debug(count.ToString()); - //m_log.Debug("near: A collision was detected between {1} and {2}", 0, name1, name2); - } // end for i.. loop - } // end near - - private bool checkDupe(d.ContactGeom contactGeom, int atype) - { - bool result = false; - //return result; - if (!m_filterCollisions) - return false; - - ActorTypes at = (ActorTypes)atype; - lock (_perloopContact) - { - foreach (d.ContactGeom contact in _perloopContact) - { - //if ((contact.g1 == contactGeom.g1 && contact.g2 == contactGeom.g2)) - //{ - // || (contact.g2 == contactGeom.g1 && contact.g1 == contactGeom.g2) - if (at == ActorTypes.Agent) - { - if (((Math.Abs(contactGeom.normal.X - contact.normal.X) < 1.026f) && (Math.Abs(contactGeom.normal.Y - contact.normal.Y) < 0.303f) && (Math.Abs(contactGeom.normal.Z - contact.normal.Z) < 0.065f)) && contactGeom.g1 != LandGeom && contactGeom.g2 != LandGeom) - { - - if (Math.Abs(contact.depth - contactGeom.depth) < 0.052f) - { - //contactGeom.depth *= .00005f; - //m_log.DebugFormat("[Collsion]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth)); - // m_log.DebugFormat("[Collision]: <{0},{1},{2}>", Math.Abs(contactGeom.normal.X - contact.normal.X), Math.Abs(contactGeom.normal.Y - contact.normal.Y), Math.Abs(contactGeom.normal.Z - contact.normal.Z)); - result = true; - break; - } - else - { - //m_log.DebugFormat("[Collsion]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth)); - } - } - else - { - //m_log.DebugFormat("[Collision]: <{0},{1},{2}>", Math.Abs(contactGeom.normal.X - contact.normal.X), Math.Abs(contactGeom.normal.Y - contact.normal.Y), Math.Abs(contactGeom.normal.Z - contact.normal.Z)); - //int i = 0; - } - } - else if (at == ActorTypes.Prim) - { - //d.AABB aabb1 = new d.AABB(); - //d.AABB aabb2 = new d.AABB(); - - //d.GeomGetAABB(contactGeom.g2, out aabb2); - //d.GeomGetAABB(contactGeom.g1, out aabb1); - //aabb1. - if (((Math.Abs(contactGeom.normal.X - contact.normal.X) < 1.026f) && (Math.Abs(contactGeom.normal.Y - contact.normal.Y) < 0.303f) && (Math.Abs(contactGeom.normal.Z - contact.normal.Z) < 0.065f)) && contactGeom.g1 != LandGeom && contactGeom.g2 != LandGeom) - { - if (contactGeom.normal.X == contact.normal.X && contactGeom.normal.Y == contact.normal.Y && contactGeom.normal.Z == contact.normal.Z) - { - if (Math.Abs(contact.depth - contactGeom.depth) < 0.272f) - { - result = true; - break; - } - } - //m_log.DebugFormat("[Collsion]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth)); - //m_log.DebugFormat("[Collision]: <{0},{1},{2}>", Math.Abs(contactGeom.normal.X - contact.normal.X), Math.Abs(contactGeom.normal.Y - contact.normal.Y), Math.Abs(contactGeom.normal.Z - contact.normal.Z)); - } - - } - - //} - - } - } - return result; - } - - private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, ContactPoint contact) - { - // obj1LocalID = 0; - //returncollisions = false; - obj2LocalID = 0; - //ctype = 0; - //cStartStop = 0; - if (!p2.SubscribedEvents() && !p1.SubscribedEvents()) - return; - - switch ((ActorTypes)p2.PhysicsActorType) - { - case ActorTypes.Agent: - cc2 = (OdeCharacter)p2; - - // obj1LocalID = cc2.m_localID; - switch ((ActorTypes)p1.PhysicsActorType) - { - case ActorTypes.Agent: - cc1 = (OdeCharacter)p1; - obj2LocalID = cc1.m_localID; - cc1.AddCollisionEvent(cc2.m_localID, contact); - //ctype = (int)CollisionCategories.Character; - - //if (cc1.CollidingObj) - //cStartStop = (int)StatusIndicators.Generic; - //else - //cStartStop = (int)StatusIndicators.Start; - - //returncollisions = true; - break; - case ActorTypes.Prim: - if (p1 is OdePrim) - { - cp1 = (OdePrim) p1; - obj2LocalID = cp1.m_localID; - cp1.AddCollisionEvent(cc2.m_localID, contact); - } - //ctype = (int)CollisionCategories.Geom; - - //if (cp1.CollidingObj) - //cStartStop = (int)StatusIndicators.Generic; - //else - //cStartStop = (int)StatusIndicators.Start; - - //returncollisions = true; - break; - - case ActorTypes.Ground: - case ActorTypes.Unknown: - obj2LocalID = 0; - //ctype = (int)CollisionCategories.Land; - //returncollisions = true; - break; - } - - cc2.AddCollisionEvent(obj2LocalID, contact); - break; - case ActorTypes.Prim: - - if (p2 is OdePrim) - { - cp2 = (OdePrim) p2; - - // obj1LocalID = cp2.m_localID; - switch ((ActorTypes) p1.PhysicsActorType) - { - case ActorTypes.Agent: - if (p1 is OdeCharacter) - { - cc1 = (OdeCharacter) p1; - obj2LocalID = cc1.m_localID; - cc1.AddCollisionEvent(cp2.m_localID, contact); - //ctype = (int)CollisionCategories.Character; - - //if (cc1.CollidingObj) - //cStartStop = (int)StatusIndicators.Generic; - //else - //cStartStop = (int)StatusIndicators.Start; - //returncollisions = true; - } - break; - case ActorTypes.Prim: - - if (p1 is OdePrim) - { - cp1 = (OdePrim) p1; - obj2LocalID = cp1.m_localID; - cp1.AddCollisionEvent(cp2.m_localID, contact); - //ctype = (int)CollisionCategories.Geom; - - //if (cp1.CollidingObj) - //cStartStop = (int)StatusIndicators.Generic; - //else - //cStartStop = (int)StatusIndicators.Start; - - //returncollisions = true; - } - break; - - case ActorTypes.Ground: - case ActorTypes.Unknown: - obj2LocalID = 0; - //ctype = (int)CollisionCategories.Land; - - //returncollisions = true; - break; - } - - cp2.AddCollisionEvent(obj2LocalID, contact); - } - break; - } - //if (returncollisions) - //{ - - //lock (m_storedCollisions) - //{ - //cDictKey = obj1LocalID.ToString() + obj2LocalID.ToString() + cStartStop.ToString() + ctype.ToString(); - //if (m_storedCollisions.ContainsKey(cDictKey)) - //{ - //sCollisionData objd = m_storedCollisions[cDictKey]; - //objd.NumberOfCollisions += 1; - //objd.lastframe = framecount; - //m_storedCollisions[cDictKey] = objd; - //} - //else - //{ - //sCollisionData objd = new sCollisionData(); - //objd.ColliderLocalId = obj1LocalID; - //objd.CollidedWithLocalId = obj2LocalID; - //objd.CollisionType = ctype; - //objd.NumberOfCollisions = 1; - //objd.lastframe = framecount; - //objd.StatusIndicator = cStartStop; - //m_storedCollisions.Add(cDictKey, objd); - //} - //} - // } - } - - public int TriArrayCallback(IntPtr trimesh, IntPtr refObject, int[] triangleIndex, int triCount) - { - /* String name1 = null; - String name2 = null; - - if (!geom_name_map.TryGetValue(trimesh, out name1)) - { - name1 = "null"; - } - if (!geom_name_map.TryGetValue(refObject, out name2)) - { - name2 = "null"; - } - - m_log.InfoFormat("TriArrayCallback: A collision was detected between {1} and {2}", 0, name1, name2); - */ - return 1; - } - - public int TriCallback(IntPtr trimesh, IntPtr refObject, int triangleIndex) - { - String name1 = null; - String name2 = null; - - if (!geom_name_map.TryGetValue(trimesh, out name1)) - { - name1 = "null"; - } - - if (!geom_name_map.TryGetValue(refObject, out name2)) - { - name2 = "null"; - } - - // m_log.InfoFormat("TriCallback: A collision was detected between {1} and {2}. Index was {3}", 0, name1, name2, triangleIndex); - - d.Vector3 v0 = new d.Vector3(); - d.Vector3 v1 = new d.Vector3(); - d.Vector3 v2 = new d.Vector3(); - - d.GeomTriMeshGetTriangle(trimesh, 0, ref v0, ref v1, ref v2); - // m_log.DebugFormat("Triangle {0} is <{1},{2},{3}>, <{4},{5},{6}>, <{7},{8},{9}>", triangleIndex, v0.X, v0.Y, v0.Z, v1.X, v1.Y, v1.Z, v2.X, v2.Y, v2.Z); - - return 1; - } - - /// - /// This is our collision testing routine in ODE - /// - /// - private void collision_optimized(float timeStep) - { - _perloopContact.Clear(); - - lock (_characters) - { - foreach (OdeCharacter chr in _characters) - { - // Reset the collision values to false - // since we don't know if we're colliding yet - - // For some reason this can happen. Don't ask... - // - if (chr == null) - continue; - - if (chr.Shell == IntPtr.Zero || chr.Body == IntPtr.Zero) - continue; - - chr.IsColliding = false; - chr.CollidingGround = false; - chr.CollidingObj = false; - - // test the avatar's geometry for collision with the space - // This will return near and the space that they are the closest to - // And we'll run this again against the avatar and the space segment - // This will return with a bunch of possible objects in the space segment - // and we'll run it again on all of them. - try - { - d.SpaceCollide2(space, chr.Shell, IntPtr.Zero, nearCallback); - } - catch (AccessViolationException) - { - m_log.Warn("[PHYSICS]: Unable to space collide"); - } - //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); - //if (chr.Position.Z + (chr.Velocity.Z * timeStep) < terrainheight + 10) - //{ - //chr.Position.Z = terrainheight + 10.0f; - //forcedZ = true; - //} - } - } - - lock (_activeprims) - { - List removeprims = null; - foreach (OdePrim chr in _activeprims) - { - if (chr.Body != IntPtr.Zero && d.BodyIsEnabled(chr.Body) && (!chr.m_disabled) && !chr.m_outofBounds) - { - try - { - lock (chr) - { - if (space != IntPtr.Zero && chr.prim_geom != IntPtr.Zero && chr.m_taintremove == false) - { - d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback); - } - else - { - if (removeprims == null) - { - removeprims = new List(); - } - removeprims.Add(chr); - /// Commented this because it triggers on every bullet - //m_log.Debug("[PHYSICS]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed. Removed it from the active prim list. This needs to be fixed!"); - } - } - } - catch (AccessViolationException) - { - m_log.Warn("[PHYSICS]: Unable to space collide"); - } - } - } - if (removeprims != null) - { - foreach (OdePrim chr in removeprims) - { - _activeprims.Remove(chr); - } - } - } - - _perloopContact.Clear(); - } - - #endregion - - public override void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) - { - m_worldOffset = offset; - WorldExtents = new Vector2(extents.X, extents.Y); - m_parentScene = pScene; - - } - - // Recovered for use by fly height. Kitto Flora - public float GetTerrainHeightAtXY(float x, float y) - { - - int offsetX = ((int)(x / (int)Constants.RegionSize)) * (int)Constants.RegionSize; - int offsetY = ((int)(y / (int)Constants.RegionSize)) * (int)Constants.RegionSize; - - IntPtr heightFieldGeom = IntPtr.Zero; - - if (RegionTerrain.TryGetValue(new Vector3(offsetX,offsetY,0), out heightFieldGeom)) - { - if (heightFieldGeom != IntPtr.Zero) - { - if (TerrainHeightFieldHeights.ContainsKey(heightFieldGeom)) - { - - int index; - - - if ((int)x > WorldExtents.X || (int)y > WorldExtents.Y || - (int)x < 0.001f || (int)y < 0.001f) - return 0; - - x = x - offsetX; - y = y - offsetY; - - index = (int)((int)x * ((int)Constants.RegionSize + 2) + (int)y); - - if (index < TerrainHeightFieldHeights[heightFieldGeom].Length) - { - //m_log.DebugFormat("x{0} y{1} = {2}", x, y, (float)TerrainHeightFieldHeights[heightFieldGeom][index]); - return (float)TerrainHeightFieldHeights[heightFieldGeom][index]; - } - - else - return 0f; - } - else - { - return 0f; - } - - } - else - { - return 0f; - } - - } - else - { - return 0f; - } - - - } -// End recovered. Kitto Flora - - public void addCollisionEventReporting(PhysicsActor obj) - { - lock (_collisionEventPrim) - { - if (!_collisionEventPrim.Contains(obj)) - _collisionEventPrim.Add(obj); - } - } - - public void remCollisionEventReporting(PhysicsActor obj) - { - lock (_collisionEventPrim) - { - if (!_collisionEventPrim.Contains(obj)) - _collisionEventPrim.Remove(obj); - } - } - - #region Add/Remove Entities - - public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) - { - Vector3 pos; - pos.X = position.X; - pos.Y = position.Y; - pos.Z = position.Z; - OdeCharacter newAv = new OdeCharacter(avName, this, pos, ode, size, avPIDD, avPIDP, avCapRadius, avStandupTensor, avDensity, avHeightFudgeFactor, avMovementDivisorWalk, avMovementDivisorRun); - newAv.Flying = isFlying; - newAv.MinimumGroundFlightOffset = minimumGroundFlightOffset; - - return newAv; - } - - public void AddCharacter(OdeCharacter chr) - { - lock (_characters) - { - if (!_characters.Contains(chr)) - { - _characters.Add(chr); - if (chr.bad) - m_log.DebugFormat("[PHYSICS] Added BAD actor {0} to characters list", chr.m_uuid); - } - } - } - - public void RemoveCharacter(OdeCharacter chr) - { - lock (_characters) - { - if (_characters.Contains(chr)) - { - _characters.Remove(chr); - } - } - } - public void BadCharacter(OdeCharacter chr) - { - lock (_badCharacter) - { - if (!_badCharacter.Contains(chr)) - _badCharacter.Add(chr); - } - } - - public override void RemoveAvatar(PhysicsActor actor) - { - //m_log.Debug("[PHYSICS]:ODELOCK"); - ((OdeCharacter) actor).Destroy(); - - } - - private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, - IMesh mesh, PrimitiveBaseShape pbs, bool isphysical, bool isphantom, byte shapetype, uint localid) - { - - Vector3 pos = position; - Vector3 siz = size; - Quaternion rot = rotation; - - OdePrim newPrim; - lock (OdeLock) - { - newPrim = new OdePrim(name, this, pos, siz, rot, mesh, pbs, isphysical, isphantom, shapetype, ode, localid); - - lock (_prims) - _prims.Add(newPrim); - } - - return newPrim; - } - - - public void addActivePrim(OdePrim activatePrim) - { - // adds active prim.. (ones that should be iterated over in collisions_optimized - lock (_activeprims) - { - if (!_activeprims.Contains(activatePrim)) - _activeprims.Add(activatePrim); - //else - // m_log.Warn("[PHYSICS]: Double Entry in _activeprims detected, potential crash immenent"); - } - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical, uint localid) - { - PhysicsActor result; - IMesh mesh = null; - - if (needsMeshing(pbs)) - mesh = mesher.CreateMesh(primName, pbs, size, (int)LevelOfDetail.High, true); - - result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical,false,0, localid); - - return result; - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, uint localid) - { - PhysicsActor result; - IMesh mesh = null; - - if (needsMeshing(pbs)) - mesh = mesher.CreateMesh(primName, pbs, size, (int)LevelOfDetail.High, true); - - result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, isPhantom,0, localid); - - return result; - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapetype, uint localid) - { - PhysicsActor result; - IMesh mesh = null; - - if (needsMeshing(pbs)) - mesh = mesher.CreateMesh(primName, pbs, size, (int)LevelOfDetail.High, true); - - result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, isPhantom, shapetype, localid); - - return result; - } - - public override float TimeDilation - { - get { return m_timeDilation; } - } - - public override bool SupportsNINJAJoints - { - get { return m_NINJA_physics_joints_enabled; } - } - - // internal utility function: must be called within a lock (OdeLock) - private void InternalAddActiveJoint(PhysicsJoint joint) - { - activeJoints.Add(joint); - SOPName_to_activeJoint.Add(joint.ObjectNameInScene, joint); - } - - // internal utility function: must be called within a lock (OdeLock) - private void InternalAddPendingJoint(OdePhysicsJoint joint) - { - pendingJoints.Add(joint); - SOPName_to_pendingJoint.Add(joint.ObjectNameInScene, joint); - } - - // internal utility function: must be called within a lock (OdeLock) - private void InternalRemovePendingJoint(PhysicsJoint joint) - { - pendingJoints.Remove(joint); - SOPName_to_pendingJoint.Remove(joint.ObjectNameInScene); - } - - // internal utility function: must be called within a lock (OdeLock) - private void InternalRemoveActiveJoint(PhysicsJoint joint) - { - activeJoints.Remove(joint); - SOPName_to_activeJoint.Remove(joint.ObjectNameInScene); - } - - public override void DumpJointInfo() - { - string hdr = "[NINJA] JOINTINFO: "; - foreach (PhysicsJoint j in pendingJoints) - { - m_log.Debug(hdr + " pending joint, Name: " + j.ObjectNameInScene + " raw parms:" + j.RawParams); - } - m_log.Debug(hdr + pendingJoints.Count + " total pending joints"); - foreach (string jointName in SOPName_to_pendingJoint.Keys) - { - m_log.Debug(hdr + " pending joints dict contains Name: " + jointName); - } - m_log.Debug(hdr + SOPName_to_pendingJoint.Keys.Count + " total pending joints dict entries"); - foreach (PhysicsJoint j in activeJoints) - { - m_log.Debug(hdr + " active joint, Name: " + j.ObjectNameInScene + " raw parms:" + j.RawParams); - } - m_log.Debug(hdr + activeJoints.Count + " total active joints"); - foreach (string jointName in SOPName_to_activeJoint.Keys) - { - m_log.Debug(hdr + " active joints dict contains Name: " + jointName); - } - m_log.Debug(hdr + SOPName_to_activeJoint.Keys.Count + " total active joints dict entries"); - - m_log.Debug(hdr + " Per-body joint connectivity information follows."); - m_log.Debug(hdr + joints_connecting_actor.Keys.Count + " bodies are connected by joints."); - foreach (string actorName in joints_connecting_actor.Keys) - { - m_log.Debug(hdr + " Actor " + actorName + " has the following joints connecting it"); - foreach (PhysicsJoint j in joints_connecting_actor[actorName]) - { - m_log.Debug(hdr + " * joint Name: " + j.ObjectNameInScene + " raw parms:" + j.RawParams); - } - m_log.Debug(hdr + joints_connecting_actor[actorName].Count + " connecting joints total for this actor"); - } - } - - public override void RequestJointDeletion(string ObjectNameInScene) - { - lock (externalJointRequestsLock) - { - if (!requestedJointsToBeDeleted.Contains(ObjectNameInScene)) // forbid same deletion request from entering twice to prevent spurious deletions processed asynchronously - { - requestedJointsToBeDeleted.Add(ObjectNameInScene); - } - } - } - - private void DeleteRequestedJoints() - { - List myRequestedJointsToBeDeleted; - lock (externalJointRequestsLock) - { - // make a local copy of the shared list for processing (threading issues) - myRequestedJointsToBeDeleted = new List(requestedJointsToBeDeleted); - } - - foreach (string jointName in myRequestedJointsToBeDeleted) - { - lock (OdeLock) - { - //m_log.Debug("[NINJA] trying to deleting requested joint " + jointName); - if (SOPName_to_activeJoint.ContainsKey(jointName) || SOPName_to_pendingJoint.ContainsKey(jointName)) - { - OdePhysicsJoint joint = null; - if (SOPName_to_activeJoint.ContainsKey(jointName)) - { - joint = SOPName_to_activeJoint[jointName] as OdePhysicsJoint; - InternalRemoveActiveJoint(joint); - } - else if (SOPName_to_pendingJoint.ContainsKey(jointName)) - { - joint = SOPName_to_pendingJoint[jointName] as OdePhysicsJoint; - InternalRemovePendingJoint(joint); - } - - if (joint != null) - { - //m_log.Debug("joint.BodyNames.Count is " + joint.BodyNames.Count + " and contents " + joint.BodyNames); - for (int iBodyName = 0; iBodyName < 2; iBodyName++) - { - string bodyName = joint.BodyNames[iBodyName]; - if (bodyName != "NULL") - { - joints_connecting_actor[bodyName].Remove(joint); - if (joints_connecting_actor[bodyName].Count == 0) - { - joints_connecting_actor.Remove(bodyName); - } - } - } - - DoJointDeactivated(joint); - if (joint.jointID != IntPtr.Zero) - { - d.JointDestroy(joint.jointID); - joint.jointID = IntPtr.Zero; - //DoJointErrorMessage(joint, "successfully destroyed joint " + jointName); - } - else - { - //m_log.Warn("[NINJA] Ignoring re-request to destroy joint " + jointName); - } - } - else - { - // DoJointErrorMessage(joint, "coult not find joint to destroy based on name " + jointName); - } - } - else - { - // DoJointErrorMessage(joint, "WARNING - joint removal failed, joint " + jointName); - } - } - } - - // remove processed joints from the shared list - lock (externalJointRequestsLock) - { - foreach (string jointName in myRequestedJointsToBeDeleted) - { - requestedJointsToBeDeleted.Remove(jointName); - } - } - } - - // for pending joints we don't know if their associated bodies exist yet or not. - // the joint is actually created during processing of the taints - private void CreateRequestedJoints() - { - List myRequestedJointsToBeCreated; - lock (externalJointRequestsLock) - { - // make a local copy of the shared list for processing (threading issues) - myRequestedJointsToBeCreated = new List(requestedJointsToBeCreated); - } - - foreach (PhysicsJoint joint in myRequestedJointsToBeCreated) - { - lock (OdeLock) - { - if (SOPName_to_pendingJoint.ContainsKey(joint.ObjectNameInScene) && SOPName_to_pendingJoint[joint.ObjectNameInScene] != null) - { - DoJointErrorMessage(joint, "WARNING: ignoring request to re-add already pending joint Name:" + joint.ObjectNameInScene + " type:" + joint.Type + " parms: " + joint.RawParams + " pos: " + joint.Position + " rot:" + joint.Rotation); - continue; - } - if (SOPName_to_activeJoint.ContainsKey(joint.ObjectNameInScene) && SOPName_to_activeJoint[joint.ObjectNameInScene] != null) - { - DoJointErrorMessage(joint, "WARNING: ignoring request to re-add already active joint Name:" + joint.ObjectNameInScene + " type:" + joint.Type + " parms: " + joint.RawParams + " pos: " + joint.Position + " rot:" + joint.Rotation); - continue; - } - - InternalAddPendingJoint(joint as OdePhysicsJoint); - - if (joint.BodyNames.Count >= 2) - { - for (int iBodyName = 0; iBodyName < 2; iBodyName++) - { - string bodyName = joint.BodyNames[iBodyName]; - if (bodyName != "NULL") - { - if (!joints_connecting_actor.ContainsKey(bodyName)) - { - joints_connecting_actor.Add(bodyName, new List()); - } - joints_connecting_actor[bodyName].Add(joint); - } - } - } - } - } - - // remove processed joints from shared list - lock (externalJointRequestsLock) - { - foreach (PhysicsJoint joint in myRequestedJointsToBeCreated) - { - requestedJointsToBeCreated.Remove(joint); - } - } - - } - - // public function to add an request for joint creation - // this joint will just be added to a waiting list that is NOT processed during the main - // Simulate() loop (to avoid deadlocks). After Simulate() is finished, we handle unprocessed joint requests. - - public override PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, Vector3 position, - Quaternion rotation, string parms, List bodyNames, string trackedBodyName, Quaternion localRotation) - - { - - OdePhysicsJoint joint = new OdePhysicsJoint(); - joint.ObjectNameInScene = objectNameInScene; - joint.Type = jointType; - joint.Position = position; - joint.Rotation = rotation; - joint.RawParams = parms; - joint.BodyNames = new List(bodyNames); - joint.TrackedBodyName = trackedBodyName; - joint.LocalRotation = localRotation; - joint.jointID = IntPtr.Zero; - joint.ErrorMessageCount = 0; - - lock (externalJointRequestsLock) - { - if (!requestedJointsToBeCreated.Contains(joint)) // forbid same creation request from entering twice - { - requestedJointsToBeCreated.Add(joint); - } - } - return joint; - } - - private void RemoveAllJointsConnectedToActor(PhysicsActor actor) - { - //m_log.Debug("RemoveAllJointsConnectedToActor: start"); - if (actor.SOPName != null && joints_connecting_actor.ContainsKey(actor.SOPName) && joints_connecting_actor[actor.SOPName] != null) - { - - List jointsToRemove = new List(); - //TODO: merge these 2 loops (originally it was needed to avoid altering a list being iterated over, but it is no longer needed due to the joint request queue mechanism) - foreach (PhysicsJoint j in joints_connecting_actor[actor.SOPName]) - { - jointsToRemove.Add(j); - } - foreach (PhysicsJoint j in jointsToRemove) - { - //m_log.Debug("RemoveAllJointsConnectedToActor: about to request deletion of " + j.ObjectNameInScene); - RequestJointDeletion(j.ObjectNameInScene); - //m_log.Debug("RemoveAllJointsConnectedToActor: done request deletion of " + j.ObjectNameInScene); - j.TrackedBodyName = null; // *IMMEDIATELY* prevent any further movement of this joint (else a deleted actor might cause spurious tracking motion of the joint for a few frames, leading to the joint proxy object disappearing) - } - } - } - - public override void RemoveAllJointsConnectedToActorThreadLocked(PhysicsActor actor) - { - //m_log.Debug("RemoveAllJointsConnectedToActorThreadLocked: start"); - lock (OdeLock) - { - //m_log.Debug("RemoveAllJointsConnectedToActorThreadLocked: got lock"); - RemoveAllJointsConnectedToActor(actor); - } - } - - // normally called from within OnJointMoved, which is called from within a lock (OdeLock) - public override Vector3 GetJointAnchor(PhysicsJoint joint) - { - Debug.Assert(joint.IsInPhysicsEngine); - d.Vector3 pos = new d.Vector3(); - - if (!(joint is OdePhysicsJoint)) - { - DoJointErrorMessage(joint, "warning: non-ODE joint requesting anchor: " + joint.ObjectNameInScene); - } - else - { - OdePhysicsJoint odeJoint = (OdePhysicsJoint)joint; - switch (odeJoint.Type) - { - case PhysicsJointType.Ball: - d.JointGetBallAnchor(odeJoint.jointID, out pos); - break; - case PhysicsJointType.Hinge: - d.JointGetHingeAnchor(odeJoint.jointID, out pos); - break; - } - } - return new Vector3(pos.X, pos.Y, pos.Z); - } - - // normally called from within OnJointMoved, which is called from within a lock (OdeLock) - // WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function - // appears to be unreliable. Fortunately we can compute the joint axis ourselves by - // keeping track of the joint's original orientation relative to one of the involved bodies. - public override Vector3 GetJointAxis(PhysicsJoint joint) - { - Debug.Assert(joint.IsInPhysicsEngine); - d.Vector3 axis = new d.Vector3(); - - if (!(joint is OdePhysicsJoint)) - { - DoJointErrorMessage(joint, "warning: non-ODE joint requesting anchor: " + joint.ObjectNameInScene); - } - else - { - OdePhysicsJoint odeJoint = (OdePhysicsJoint)joint; - switch (odeJoint.Type) - { - case PhysicsJointType.Ball: - DoJointErrorMessage(joint, "warning - axis requested for ball joint: " + joint.ObjectNameInScene); - break; - case PhysicsJointType.Hinge: - d.JointGetHingeAxis(odeJoint.jointID, out axis); - break; - } - } - return new Vector3(axis.X, axis.Y, axis.Z); - } - - - public void remActivePrim(OdePrim deactivatePrim) - { - lock (_activeprims) - { - _activeprims.Remove(deactivatePrim); - } - } - - public override void RemovePrim(PhysicsActor prim) - { - if (prim is OdePrim) - { - lock (OdeLock) - { - OdePrim p = (OdePrim) prim; - - p.setPrimForRemoval(); - AddPhysicsActorTaint(prim); - //RemovePrimThreadLocked(p); - } - } - } - - /// - /// This is called from within simulate but outside the locked portion - /// We need to do our own locking here - /// Essentially, we need to remove the prim from our space segment, whatever segment it's in. - /// - /// If there are no more prim in the segment, we need to empty (spacedestroy)the segment and reclaim memory - /// that the space was using. - /// - /// - public void RemovePrimThreadLocked(OdePrim prim) - { -//Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName); - lock (prim) - { - remCollisionEventReporting(prim); - lock (ode) - { - if (prim.prim_geom != IntPtr.Zero) - { - prim.ResetTaints(); - - try - { - if (prim._triMeshData != IntPtr.Zero) - { - d.GeomTriMeshDataDestroy(prim._triMeshData); - prim._triMeshData = IntPtr.Zero; - } - } - catch { }; - - if (prim.IsPhysical) - { - prim.disableBody(); - if (prim.childPrim) - { - prim.childPrim = false; - prim.Body = IntPtr.Zero; - prim.m_disabled = true; - prim.IsPhysical = false; - } - - } - // we don't want to remove the main space - - // If the geometry is in the targetspace, remove it from the target space - //m_log.Warn(prim.m_targetSpace); - - //if (prim.m_targetSpace != IntPtr.Zero) - //{ - //if (d.SpaceQuery(prim.m_targetSpace, prim.prim_geom)) - //{ - - //if (d.GeomIsSpace(prim.m_targetSpace)) - //{ - //waitForSpaceUnlock(prim.m_targetSpace); - //d.SpaceRemove(prim.m_targetSpace, prim.prim_geom); - prim.m_targetSpace = IntPtr.Zero; - //} - //else - //{ - // m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" + - //((OdePrim)prim).m_targetSpace.ToString()); - //} - - //} - //} - //m_log.Warn(prim.prim_geom); - try - { - if (prim.prim_geom != IntPtr.Zero) - { - -//string tPA; -//geom_name_map.TryGetValue(prim.prim_geom, out tPA); -//Console.WriteLine("**** Remove {0}", tPA); - if(geom_name_map.ContainsKey(prim.prim_geom)) geom_name_map.Remove(prim.prim_geom); - if(actor_name_map.ContainsKey(prim.prim_geom)) actor_name_map.Remove(prim.prim_geom); - d.GeomDestroy(prim.prim_geom); - prim.prim_geom = IntPtr.Zero; - } - else - { - m_log.Warn("[PHYSICS]: Unable to remove prim from physics scene"); - } - } - catch (AccessViolationException) - { - m_log.Info("[PHYSICS]: Couldn't remove prim from physics scene, it was already be removed."); - } - lock (_prims) - _prims.Remove(prim); - - //If there are no more geometries in the sub-space, we don't need it in the main space anymore - //if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0) - //{ - //if (prim.m_targetSpace != null) - //{ - //if (d.GeomIsSpace(prim.m_targetSpace)) - //{ - //waitForSpaceUnlock(prim.m_targetSpace); - //d.SpaceRemove(space, prim.m_targetSpace); - // free up memory used by the space. - //d.SpaceDestroy(prim.m_targetSpace); - //int[] xyspace = calculateSpaceArrayItemFromPos(prim.Position); - //resetSpaceArrayItemToZero(xyspace[0], xyspace[1]); - //} - //else - //{ - //m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" + - //((OdePrim) prim).m_targetSpace.ToString()); - //} - //} - //} - - if (SupportsNINJAJoints) - { - RemoveAllJointsConnectedToActorThreadLocked(prim); - } - } - } - } - } - - #endregion - - #region Space Separation Calculation - - /// - /// Takes a space pointer and zeros out the array we're using to hold the spaces - /// - /// - public void resetSpaceArrayItemToZero(IntPtr pSpace) - { - for (int x = 0; x < staticPrimspace.GetLength(0); x++) - { - for (int y = 0; y < staticPrimspace.GetLength(1); y++) - { - if (staticPrimspace[x, y] == pSpace) - staticPrimspace[x, y] = IntPtr.Zero; - } - } - } - - public void resetSpaceArrayItemToZero(int arrayitemX, int arrayitemY) - { - staticPrimspace[arrayitemX, arrayitemY] = IntPtr.Zero; - } - - /// - /// Called when a static prim moves. Allocates a space for the prim based on its position - /// - /// the pointer to the geom that moved - /// the position that the geom moved to - /// a pointer to the space it was in before it was moved. - /// a pointer to the new space it's in - public IntPtr recalculateSpaceForGeom(IntPtr geom, Vector3 pos, IntPtr currentspace) - { - // Called from setting the Position and Size of an ODEPrim so - // it's already in locked space. - - // we don't want to remove the main space - // we don't need to test physical here because this function should - // never be called if the prim is physical(active) - - // All physical prim end up in the root space - //Thread.Sleep(20); - if (currentspace != space) - { - //m_log.Info("[SPACE]: C:" + currentspace.ToString() + " g:" + geom.ToString()); - //if (currentspace == IntPtr.Zero) - //{ - //int adfadf = 0; - //} - if (d.SpaceQuery(currentspace, geom) && currentspace != IntPtr.Zero) - { - if (d.GeomIsSpace(currentspace)) - { - waitForSpaceUnlock(currentspace); - d.SpaceRemove(currentspace, geom); - } - else - { - m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + currentspace + - " Geom:" + geom); - } - } - else - { - IntPtr sGeomIsIn = d.GeomGetSpace(geom); - if (sGeomIsIn != IntPtr.Zero) - { - if (d.GeomIsSpace(currentspace)) - { - waitForSpaceUnlock(sGeomIsIn); - d.SpaceRemove(sGeomIsIn, geom); - } - else - { - m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + - sGeomIsIn + " Geom:" + geom); - } - } - } - - //If there are no more geometries in the sub-space, we don't need it in the main space anymore - if (d.SpaceGetNumGeoms(currentspace) == 0) - { - if (currentspace != IntPtr.Zero) - { - if (d.GeomIsSpace(currentspace)) - { - waitForSpaceUnlock(currentspace); - waitForSpaceUnlock(space); - d.SpaceRemove(space, currentspace); - // free up memory used by the space. - - //d.SpaceDestroy(currentspace); - resetSpaceArrayItemToZero(currentspace); - } - else - { - m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + - currentspace + " Geom:" + geom); - } - } - } - } - else - { - // this is a physical object that got disabled. ;.; - if (currentspace != IntPtr.Zero && geom != IntPtr.Zero) - { - if (d.SpaceQuery(currentspace, geom)) - { - if (d.GeomIsSpace(currentspace)) - { - waitForSpaceUnlock(currentspace); - d.SpaceRemove(currentspace, geom); - } - else - { - m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + - currentspace + " Geom:" + geom); - } - } - else - { - IntPtr sGeomIsIn = d.GeomGetSpace(geom); - if (sGeomIsIn != IntPtr.Zero) - { - if (d.GeomIsSpace(sGeomIsIn)) - { - waitForSpaceUnlock(sGeomIsIn); - d.SpaceRemove(sGeomIsIn, geom); - } - else - { - m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + - sGeomIsIn + " Geom:" + geom); - } - } - } - } - } - - // The routines in the Position and Size sections do the 'inserting' into the space, - // so all we have to do is make sure that the space that we're putting the prim into - // is in the 'main' space. - int[] iprimspaceArrItem = calculateSpaceArrayItemFromPos(pos); - IntPtr newspace = calculateSpaceForGeom(pos); - - if (newspace == IntPtr.Zero) - { - newspace = createprimspace(iprimspaceArrItem[0], iprimspaceArrItem[1]); - d.HashSpaceSetLevels(newspace, smallHashspaceLow, smallHashspaceHigh); - } - - return newspace; - } - - /// - /// Creates a new space at X Y - /// - /// - /// - /// A pointer to the created space - public IntPtr createprimspace(int iprimspaceArrItemX, int iprimspaceArrItemY) - { - // creating a new space for prim and inserting it into main space. - staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = d.HashSpaceCreate(IntPtr.Zero); - d.GeomSetCategoryBits(staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY], (int)CollisionCategories.Space); - waitForSpaceUnlock(space); - d.SpaceSetSublevel(space, 1); - d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]); - return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]; - } - - /// - /// Calculates the space the prim should be in by its position - /// - /// - /// a pointer to the space. This could be a new space or reused space. - public IntPtr calculateSpaceForGeom(Vector3 pos) - { - int[] xyspace = calculateSpaceArrayItemFromPos(pos); - //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); - return staticPrimspace[xyspace[0], xyspace[1]]; - } - - /// - /// Holds the space allocation logic - /// - /// - /// an array item based on the position - public int[] calculateSpaceArrayItemFromPos(Vector3 pos) - { - int[] returnint = new int[2]; - - returnint[0] = (int) (pos.X/metersInSpace); - - if (returnint[0] > ((int) (259f/metersInSpace))) - returnint[0] = ((int) (259f/metersInSpace)); - if (returnint[0] < 0) - returnint[0] = 0; - - returnint[1] = (int) (pos.Y/metersInSpace); - if (returnint[1] > ((int) (259f/metersInSpace))) - returnint[1] = ((int) (259f/metersInSpace)); - if (returnint[1] < 0) - returnint[1] = 0; - - return returnint; - } - - #endregion - - /// - /// Routine to figure out if we need to mesh this prim with our mesher - /// - /// - /// - public bool needsMeshing(PrimitiveBaseShape pbs) - { - // most of this is redundant now as the mesher will return null if it cant mesh a prim - // but we still need to check for sculptie meshing being enabled so this is the most - // convenient place to do it for now... - - // //if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle && pbs.ProfileCurve == (byte)Primitive.ProfileCurve.Circle && pbs.PathScaleY <= 0.75f) - // //m_log.Debug("needsMeshing: " + " pathCurve: " + pbs.PathCurve.ToString() + " profileCurve: " + pbs.ProfileCurve.ToString() + " pathScaleY: " + Primitive.UnpackPathScale(pbs.PathScaleY).ToString()); - int iPropertiesNotSupportedDefault = 0; - - if (pbs.SculptEntry && !meshSculptedPrim) - { -#if SPAM - m_log.Warn("NonMesh"); -#endif - return false; - } - - // if it's a standard box or sphere with no cuts, hollows, twist or top shear, return false since ODE can use an internal representation for the prim - if (!forceSimplePrimMeshing && !pbs.SculptEntry) - { - if ((pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight) - || (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1 - && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z)) - { - - if (pbs.ProfileBegin == 0 && pbs.ProfileEnd == 0 - && pbs.ProfileHollow == 0 - && pbs.PathTwist == 0 && pbs.PathTwistBegin == 0 - && pbs.PathBegin == 0 && pbs.PathEnd == 0 - && pbs.PathTaperX == 0 && pbs.PathTaperY == 0 - && pbs.PathScaleX == 100 && pbs.PathScaleY == 100 - && pbs.PathShearX == 0 && pbs.PathShearY == 0) - { -#if SPAM - m_log.Warn("NonMesh"); -#endif - return false; - } - } - } - - if (forceSimplePrimMeshing) - return true; - - if (pbs.ProfileHollow != 0) - iPropertiesNotSupportedDefault++; - - if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0)) - iPropertiesNotSupportedDefault++; - - if ((pbs.ProfileBegin != 0) || pbs.ProfileEnd != 0) - iPropertiesNotSupportedDefault++; - - if ((pbs.PathScaleX != 100) || (pbs.PathScaleY != 100)) - iPropertiesNotSupportedDefault++; - - if ((pbs.PathShearX != 0) || (pbs.PathShearY != 0)) - iPropertiesNotSupportedDefault++; - - if (pbs.ProfileShape == ProfileShape.Circle && pbs.PathCurve == (byte)Extrusion.Straight) - iPropertiesNotSupportedDefault++; - - if (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1 && (pbs.Scale.X != pbs.Scale.Y || pbs.Scale.Y != pbs.Scale.Z || pbs.Scale.Z != pbs.Scale.X)) - iPropertiesNotSupportedDefault++; - - if (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte) Extrusion.Curve1) - iPropertiesNotSupportedDefault++; - - // test for torus - if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.Square) - { - if (pbs.PathCurve == (byte)Extrusion.Curve1) - { - iPropertiesNotSupportedDefault++; - } - } - else if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) - { - if (pbs.PathCurve == (byte)Extrusion.Straight) - { - iPropertiesNotSupportedDefault++; - } - - // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits - else if (pbs.PathCurve == (byte)Extrusion.Curve1) - { - iPropertiesNotSupportedDefault++; - } - } - else if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) - { - if (pbs.PathCurve == (byte)Extrusion.Curve1 || pbs.PathCurve == (byte)Extrusion.Curve2) - { - iPropertiesNotSupportedDefault++; - } - } - else if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle) - { - if (pbs.PathCurve == (byte)Extrusion.Straight) - { - iPropertiesNotSupportedDefault++; - } - else if (pbs.PathCurve == (byte)Extrusion.Curve1) - { - iPropertiesNotSupportedDefault++; - } - } - - if (pbs.SculptEntry && meshSculptedPrim) - iPropertiesNotSupportedDefault++; - - if (iPropertiesNotSupportedDefault == 0) - { -#if SPAM - m_log.Warn("NonMesh"); -#endif - return false; - } -#if SPAM - m_log.Debug("Mesh"); -#endif - return true; - } - - /// - /// Called after our prim properties are set Scale, position etc. - /// We use this event queue like method to keep changes to the physical scene occuring in the threadlocked mutex - /// This assures us that we have no race conditions - /// - /// - public override void AddPhysicsActorTaint(PhysicsActor prim) - { - - if (prim is OdePrim) - { - OdePrim taintedprim = ((OdePrim) prim); - lock (_taintedPrimLock) - { - if (!(_taintedPrimH.Contains(taintedprim))) - { -//Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.m_primName); - _taintedPrimH.Add(taintedprim); // HashSet for searching - _taintedPrimL.Add(taintedprim); // List for ordered readout - } - } - return; - } - else if (prim is OdeCharacter) - { - OdeCharacter taintedchar = ((OdeCharacter)prim); - lock (_taintedActors) - { - if (!(_taintedActors.Contains(taintedchar))) - { - _taintedActors.Add(taintedchar); - if (taintedchar.bad) - m_log.DebugFormat("[PHYSICS]: Added BAD actor {0} to tainted actors", taintedchar.m_uuid); - } - } - } - } - - /// - /// This is our main simulate loop - /// It's thread locked by a Mutex in the scene. - /// It holds Collisions, it instructs ODE to step through the physical reactions - /// It moves the objects around in memory - /// It calls the methods that report back to the object owners.. (scenepresence, SceneObjectGroup) - /// - /// - /// - public override float Simulate(float timeStep) - { - if (framecount >= int.MaxValue) - framecount = 0; - //if (m_worldOffset != Vector3.Zero) - // return 0; - - framecount++; - - DateTime now = DateTime.UtcNow; - TimeSpan SinceLastFrame = now - m_lastframe; - m_lastframe = now; - float realtime = (float)SinceLastFrame.TotalSeconds; -// Console.WriteLine("ts={0} rt={1}", timeStep, realtime); - timeStep = realtime; - - // float fps = 1.0f / realtime; - float fps = 0.0f; // number of ODE steps in this Simulate step - //m_log.Info(timeStep.ToString()); - step_time += timeStep; - - // If We're loaded down by something else, - // or debugging with the Visual Studio project on pause - // skip a few frames to catch up gracefully. - // without shooting the physicsactors all over the place - - if (step_time >= m_SkipFramesAtms) - { - // Instead of trying to catch up, it'll do 5 physics frames only - step_time = ODE_STEPSIZE; - m_physicsiterations = 5; - } - else - { - m_physicsiterations = 10; - } - - if (SupportsNINJAJoints) - { - DeleteRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks - CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks - } - - lock (OdeLock) - { - // Process 10 frames if the sim is running normal.. - // process 5 frames if the sim is running slow - //try - //{ - //d.WorldSetQuickStepNumIterations(world, m_physicsiterations); - //} - //catch (StackOverflowException) - //{ - // m_log.Error("[PHYSICS]: The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim."); - // ode.drelease(world); - //base.TriggerPhysicsBasedRestart(); - //} - - int i = 0; - - // Figure out the Frames Per Second we're going at. - //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size - - // fps = (step_time / ODE_STEPSIZE) * 1000; - // HACK: Using a time dilation of 1.0 to debug rubberbanding issues - //m_timeDilation = Math.Min((step_time / ODE_STEPSIZE) / (0.09375f / ODE_STEPSIZE), 1.0f); - - // step_time = 0.09375f; - - while (step_time > 0.0f) - { - //lock (ode) - //{ - //if (!ode.lockquery()) - //{ - // ode.dlock(world); - try - { - // Insert, remove Characters - bool processedtaints = false; - - lock (_taintedActors) - { - if (_taintedActors.Count > 0) - { - foreach (OdeCharacter character in _taintedActors) - { - - character.ProcessTaints(ODE_STEPSIZE); - - processedtaints = true; - //character.m_collisionscore = 0; - } - - if (processedtaints) - _taintedActors.Clear(); - } - } // end lock _taintedActors - - // Modify other objects in the scene. - processedtaints = false; - - lock (_taintedPrimLock) - { - foreach (OdePrim prim in _taintedPrimL) - { - if (prim.m_taintremove) - { - //Console.WriteLine("Simulate calls RemovePrimThreadLocked"); - RemovePrimThreadLocked(prim); - } - else - { - //Console.WriteLine("Simulate calls ProcessTaints"); - prim.ProcessTaints(ODE_STEPSIZE); - } - processedtaints = true; - prim.m_collisionscore = 0; - - // This loop can block up the Heartbeat for a very long time on large regions. - // We need to let the Watchdog know that the Heartbeat is not dead - // NOTE: This is currently commented out, but if things like OAR loading are - // timing the heartbeat out we will need to uncomment it - //Watchdog.UpdateThread(); - } - - if (SupportsNINJAJoints) - { - // Create pending joints, if possible - - // joints can only be processed after ALL bodies are processed (and exist in ODE), since creating - // a joint requires specifying the body id of both involved bodies - if (pendingJoints.Count > 0) - { - List successfullyProcessedPendingJoints = new List(); - //DoJointErrorMessage(joints_connecting_actor, "taint: " + pendingJoints.Count + " pending joints"); - foreach (PhysicsJoint joint in pendingJoints) - { - //DoJointErrorMessage(joint, "taint: time to create joint with parms: " + joint.RawParams); - string[] jointParams = joint.RawParams.Split(" ".ToCharArray(), - System.StringSplitOptions.RemoveEmptyEntries); - List jointBodies = new List(); - bool allJointBodiesAreReady = true; - foreach (string jointParam in jointParams) - { - if (jointParam == "NULL") - { - //DoJointErrorMessage(joint, "attaching NULL joint to world"); - jointBodies.Add(IntPtr.Zero); - } - else - { - //DoJointErrorMessage(joint, "looking for prim name: " + jointParam); - bool foundPrim = false; - lock (_prims) - { - foreach (OdePrim prim in _prims) // FIXME: inefficient - { - if (prim.SOPName == jointParam) - { - //DoJointErrorMessage(joint, "found for prim name: " + jointParam); - if (prim.IsPhysical && prim.Body != IntPtr.Zero) - { - jointBodies.Add(prim.Body); - foundPrim = true; - break; - } - else - { - DoJointErrorMessage(joint, "prim name " + jointParam + - " exists but is not (yet) physical; deferring joint creation. " + - "IsPhysical property is " + prim.IsPhysical + - " and body is " + prim.Body); - foundPrim = false; - break; - } - } - } - } - if (foundPrim) - { - // all is fine - } - else - { - allJointBodiesAreReady = false; - break; - } - } - } - if (allJointBodiesAreReady) - { - //DoJointErrorMessage(joint, "allJointBodiesAreReady for " + joint.ObjectNameInScene + " with parms " + joint.RawParams); - if (jointBodies[0] == jointBodies[1]) - { - DoJointErrorMessage(joint, "ERROR: joint cannot be created; the joint bodies are the same, body1==body2. Raw body is " + jointBodies[0] + ". raw parms: " + joint.RawParams); - } - else - { - switch (joint.Type) - { - case PhysicsJointType.Ball: - { - IntPtr odeJoint; - //DoJointErrorMessage(joint, "ODE creating ball joint "); - odeJoint = d.JointCreateBall(world, IntPtr.Zero); - //DoJointErrorMessage(joint, "ODE attaching ball joint: " + odeJoint + " with b1:" + jointBodies[0] + " b2:" + jointBodies[1]); - d.JointAttach(odeJoint, jointBodies[0], jointBodies[1]); - //DoJointErrorMessage(joint, "ODE setting ball anchor: " + odeJoint + " to vec:" + joint.Position); - d.JointSetBallAnchor(odeJoint, - joint.Position.X, - joint.Position.Y, - joint.Position.Z); - //DoJointErrorMessage(joint, "ODE joint setting OK"); - //DoJointErrorMessage(joint, "The ball joint's bodies are here: b0: "); - //DoJointErrorMessage(joint, "" + (jointBodies[0] != IntPtr.Zero ? "" + d.BodyGetPosition(jointBodies[0]) : "fixed environment")); - //DoJointErrorMessage(joint, "The ball joint's bodies are here: b1: "); - //DoJointErrorMessage(joint, "" + (jointBodies[1] != IntPtr.Zero ? "" + d.BodyGetPosition(jointBodies[1]) : "fixed environment")); - - if (joint is OdePhysicsJoint) - { - ((OdePhysicsJoint)joint).jointID = odeJoint; - } - else - { - DoJointErrorMessage(joint, "WARNING: non-ode joint in ODE!"); - } - } - break; - case PhysicsJointType.Hinge: - { - IntPtr odeJoint; - //DoJointErrorMessage(joint, "ODE creating hinge joint "); - odeJoint = d.JointCreateHinge(world, IntPtr.Zero); - //DoJointErrorMessage(joint, "ODE attaching hinge joint: " + odeJoint + " with b1:" + jointBodies[0] + " b2:" + jointBodies[1]); - d.JointAttach(odeJoint, jointBodies[0], jointBodies[1]); - //DoJointErrorMessage(joint, "ODE setting hinge anchor: " + odeJoint + " to vec:" + joint.Position); - d.JointSetHingeAnchor(odeJoint, - joint.Position.X, - joint.Position.Y, - joint.Position.Z); - // We use the orientation of the x-axis of the joint's coordinate frame - // as the axis for the hinge. - - // Therefore, we must get the joint's coordinate frame based on the - // joint.Rotation field, which originates from the orientation of the - // joint's proxy object in the scene. - - // The joint's coordinate frame is defined as the transformation matrix - // that converts a vector from joint-local coordinates into world coordinates. - // World coordinates are defined as the XYZ coordinate system of the sim, - // as shown in the top status-bar of the viewer. - - // Once we have the joint's coordinate frame, we extract its X axis (AtAxis) - // and use that as the hinge axis. - - //joint.Rotation.Normalize(); - Matrix4 proxyFrame = Matrix4.CreateFromQuaternion(joint.Rotation); - - // Now extract the X axis of the joint's coordinate frame. - - // Do not try to use proxyFrame.AtAxis or you will become mired in the - // tar pit of transposed, inverted, and generally messed-up orientations. - // (In other words, Matrix4.AtAxis() is borked.) - // Vector3 jointAxis = proxyFrame.AtAxis; <--- this path leadeth to madness - - // Instead, compute the X axis of the coordinate frame by transforming - // the (1,0,0) vector. At least that works. - - //m_log.Debug("PHY: making axis: complete matrix is " + proxyFrame); - Vector3 jointAxis = Vector3.Transform(Vector3.UnitX, proxyFrame); - //m_log.Debug("PHY: making axis: hinge joint axis is " + jointAxis); - //DoJointErrorMessage(joint, "ODE setting hinge axis: " + odeJoint + " to vec:" + jointAxis); - d.JointSetHingeAxis(odeJoint, - jointAxis.X, - jointAxis.Y, - jointAxis.Z); - //d.JointSetHingeParam(odeJoint, (int)dParam.CFM, 0.1f); - if (joint is OdePhysicsJoint) - { - ((OdePhysicsJoint)joint).jointID = odeJoint; - } - else - { - DoJointErrorMessage(joint, "WARNING: non-ode joint in ODE!"); - } - } - break; - } - successfullyProcessedPendingJoints.Add(joint); - } - } - else - { - DoJointErrorMessage(joint, "joint could not yet be created; still pending"); - } - } - foreach (PhysicsJoint successfullyProcessedJoint in successfullyProcessedPendingJoints) - { - //DoJointErrorMessage(successfullyProcessedJoint, "finalizing succesfully procsssed joint " + successfullyProcessedJoint.ObjectNameInScene + " parms " + successfullyProcessedJoint.RawParams); - //DoJointErrorMessage(successfullyProcessedJoint, "removing from pending"); - InternalRemovePendingJoint(successfullyProcessedJoint); - //DoJointErrorMessage(successfullyProcessedJoint, "adding to active"); - InternalAddActiveJoint(successfullyProcessedJoint); - //DoJointErrorMessage(successfullyProcessedJoint, "done"); - } - } - } // end SupportsNINJAJoints - - if (processedtaints) -//Console.WriteLine("Simulate calls Clear of _taintedPrim list"); - _taintedPrimH.Clear(); // ??? if this only ??? - _taintedPrimL.Clear(); - } // end lock _taintedPrimLock - - // Move characters - lock (_characters) - { - List defects = new List(); - foreach (OdeCharacter actor in _characters) - { - if (actor != null) - actor.Move(ODE_STEPSIZE, defects); - } - if (0 != defects.Count) - { - foreach (OdeCharacter defect in defects) - { - RemoveCharacter(defect); - } - } - } // end lock _characters - - // Move other active objects - lock (_activeprims) - { - foreach (OdePrim prim in _activeprims) - { - prim.m_collisionscore = 0; - prim.Move(ODE_STEPSIZE); - } - } // end lock _activeprims - - //if ((framecount % m_randomizeWater) == 0) - // randomizeWater(waterlevel); - - //int RayCastTimeMS = m_rayCastManager.ProcessQueuedRequests(); - m_rayCastManager.ProcessQueuedRequests(); - - collision_optimized(ODE_STEPSIZE); - - lock (_collisionEventPrim) - { - foreach (PhysicsActor obj in _collisionEventPrim) - { - if (obj == null) - continue; - - switch ((ActorTypes)obj.PhysicsActorType) - { - case ActorTypes.Agent: - OdeCharacter cobj = (OdeCharacter)obj; - cobj.AddCollisionFrameTime(100); - cobj.SendCollisions(); - break; - case ActorTypes.Prim: - OdePrim pobj = (OdePrim)obj; - pobj.SendCollisions(); - break; - } - } - } // end lock _collisionEventPrim - - //if (m_global_contactcount > 5) - //{ - // m_log.DebugFormat("[PHYSICS]: Contacts:{0}", m_global_contactcount); - //} - - m_global_contactcount = 0; - - d.WorldQuickStep(world, ODE_STEPSIZE); - d.JointGroupEmpty(contactgroup); - fps++; - //ode.dunlock(world); - } // end try - catch (Exception e) - { - m_log.ErrorFormat("[PHYSICS]: {0}, {1}, {2}", e.Message, e.TargetSite, e); - ode.dunlock(world); - } - - step_time -= ODE_STEPSIZE; - i++; - //} - //else - //{ - //fps = 0; - //} - //} - } // end while (step_time > 0.0f) - - lock (_characters) - { - foreach (OdeCharacter actor in _characters) - { - if (actor != null) - { - if (actor.bad) - m_log.WarnFormat("[PHYSICS]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid); - actor.UpdatePositionAndVelocity(); - } - } - } - - lock (_badCharacter) - { - if (_badCharacter.Count > 0) - { - foreach (OdeCharacter chr in _badCharacter) - { - RemoveCharacter(chr); - } - _badCharacter.Clear(); - } - } - - lock (_activeprims) - { - //if (timeStep < 0.2f) - { - foreach (OdePrim actor in _activeprims) - { - if (actor.IsPhysical && (d.BodyIsEnabled(actor.Body) || !actor._zeroFlag)) - { - actor.UpdatePositionAndVelocity(); - - if (SupportsNINJAJoints) - { - // If an actor moved, move its joint proxy objects as well. - // There seems to be an event PhysicsActor.OnPositionUpdate that could be used - // for this purpose but it is never called! So we just do the joint - // movement code here. - - if (actor.SOPName != null && - joints_connecting_actor.ContainsKey(actor.SOPName) && - joints_connecting_actor[actor.SOPName] != null && - joints_connecting_actor[actor.SOPName].Count > 0) - { - foreach (PhysicsJoint affectedJoint in joints_connecting_actor[actor.SOPName]) - { - if (affectedJoint.IsInPhysicsEngine) - { - DoJointMoved(affectedJoint); - } - else - { - DoJointErrorMessage(affectedJoint, "a body connected to a joint was moved, but the joint doesn't exist yet! this will lead to joint error. joint was: " + affectedJoint.ObjectNameInScene + " parms:" + affectedJoint.RawParams); - } - } - } - } - } - } - } - } // end lock _activeprims - - //DumpJointInfo(); - - // Finished with all sim stepping. If requested, dump world state to file for debugging. - // TODO: This call to the export function is already inside lock (OdeLock) - but is an extra lock needed? - // TODO: This overwrites all dump files in-place. Should this be a growing logfile, or separate snapshots? - if (physics_logging && (physics_logging_interval>0) && (framecount % physics_logging_interval == 0)) - { - string fname = "state-" + world.ToString() + ".DIF"; // give each physics world a separate filename - string prefix = "world" + world.ToString(); // prefix for variable names in exported .DIF file - - if (physics_logging_append_existing_logfile) - { - string header = "-------------- START OF PHYSICS FRAME " + framecount.ToString() + " --------------"; - TextWriter fwriter = File.AppendText(fname); - fwriter.WriteLine(header); - fwriter.Close(); - } - d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix); - } - } // end lock OdeLock - - return fps * (float)ODE_STEPSIZE / timeStep; - } // end Simulate - - public override void GetResults() - { - } - - public override bool IsThreaded - { - // for now we won't be multithreaded - get { return (false); } - } - - #region ODE Specific Terrain Fixes - public float[] ResizeTerrain512NearestNeighbour(float[] heightMap) - { - float[] returnarr = new float[262144]; - float[,] resultarr = new float[(int)WorldExtents.X, (int)WorldExtents.Y]; - - // Filling out the array into its multi-dimensional components - for (int y = 0; y < WorldExtents.Y; y++) - { - for (int x = 0; x < WorldExtents.X; x++) - { - resultarr[y, x] = heightMap[y * (int)WorldExtents.Y + x]; - } - } - - // Resize using Nearest Neighbour - - // This particular way is quick but it only works on a multiple of the original - - // The idea behind this method can be described with the following diagrams - // second pass and third pass happen in the same loop really.. just separated - // them to show what this does. - - // First Pass - // ResultArr: - // 1,1,1,1,1,1 - // 1,1,1,1,1,1 - // 1,1,1,1,1,1 - // 1,1,1,1,1,1 - // 1,1,1,1,1,1 - // 1,1,1,1,1,1 - - // Second Pass - // ResultArr2: - // 1,,1,,1,,1,,1,,1, - // ,,,,,,,,,, - // 1,,1,,1,,1,,1,,1, - // ,,,,,,,,,, - // 1,,1,,1,,1,,1,,1, - // ,,,,,,,,,, - // 1,,1,,1,,1,,1,,1, - // ,,,,,,,,,, - // 1,,1,,1,,1,,1,,1, - // ,,,,,,,,,, - // 1,,1,,1,,1,,1,,1, - - // Third pass fills in the blanks - // ResultArr2: - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - - // X,Y = . - // X+1,y = ^ - // X,Y+1 = * - // X+1,Y+1 = # - - // Filling in like this; - // .* - // ^# - // 1st . - // 2nd * - // 3rd ^ - // 4th # - // on single loop. - - float[,] resultarr2 = new float[512, 512]; - for (int y = 0; y < WorldExtents.Y; y++) - { - for (int x = 0; x < WorldExtents.X; x++) - { - resultarr2[y * 2, x * 2] = resultarr[y, x]; - - if (y < WorldExtents.Y) - { - resultarr2[(y * 2) + 1, x * 2] = resultarr[y, x]; - } - if (x < WorldExtents.X) - { - resultarr2[y * 2, (x * 2) + 1] = resultarr[y, x]; - } - if (x < WorldExtents.X && y < WorldExtents.Y) - { - resultarr2[(y * 2) + 1, (x * 2) + 1] = resultarr[y, x]; - } - } - } - - //Flatten out the array - int i = 0; - for (int y = 0; y < 512; y++) - { - for (int x = 0; x < 512; x++) - { - if (resultarr2[y, x] <= 0) - returnarr[i] = 0.0000001f; - else - returnarr[i] = resultarr2[y, x]; - - i++; - } - } - - return returnarr; - } - - public float[] ResizeTerrain512Interpolation(float[] heightMap) - { - float[] returnarr = new float[262144]; - float[,] resultarr = new float[512,512]; - - // Filling out the array into its multi-dimensional components - for (int y = 0; y < 256; y++) - { - for (int x = 0; x < 256; x++) - { - resultarr[y, x] = heightMap[y * 256 + x]; - } - } - - // Resize using interpolation - - // This particular way is quick but it only works on a multiple of the original - - // The idea behind this method can be described with the following diagrams - // second pass and third pass happen in the same loop really.. just separated - // them to show what this does. - - // First Pass - // ResultArr: - // 1,1,1,1,1,1 - // 1,1,1,1,1,1 - // 1,1,1,1,1,1 - // 1,1,1,1,1,1 - // 1,1,1,1,1,1 - // 1,1,1,1,1,1 - - // Second Pass - // ResultArr2: - // 1,,1,,1,,1,,1,,1, - // ,,,,,,,,,, - // 1,,1,,1,,1,,1,,1, - // ,,,,,,,,,, - // 1,,1,,1,,1,,1,,1, - // ,,,,,,,,,, - // 1,,1,,1,,1,,1,,1, - // ,,,,,,,,,, - // 1,,1,,1,,1,,1,,1, - // ,,,,,,,,,, - // 1,,1,,1,,1,,1,,1, - - // Third pass fills in the blanks - // ResultArr2: - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - // 1,1,1,1,1,1,1,1,1,1,1,1 - - // X,Y = . - // X+1,y = ^ - // X,Y+1 = * - // X+1,Y+1 = # - - // Filling in like this; - // .* - // ^# - // 1st . - // 2nd * - // 3rd ^ - // 4th # - // on single loop. - - float[,] resultarr2 = new float[512,512]; - for (int y = 0; y < (int)Constants.RegionSize; y++) - { - for (int x = 0; x < (int)Constants.RegionSize; x++) - { - resultarr2[y*2, x*2] = resultarr[y, x]; - - if (y < (int)Constants.RegionSize) - { - if (y + 1 < (int)Constants.RegionSize) - { - if (x + 1 < (int)Constants.RegionSize) - { - resultarr2[(y*2) + 1, x*2] = ((resultarr[y, x] + resultarr[y + 1, x] + - resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4); - } - else - { - resultarr2[(y*2) + 1, x*2] = ((resultarr[y, x] + resultarr[y + 1, x])/2); - } - } - else - { - resultarr2[(y*2) + 1, x*2] = resultarr[y, x]; - } - } - if (x < (int)Constants.RegionSize) - { - if (x + 1 < (int)Constants.RegionSize) - { - if (y + 1 < (int)Constants.RegionSize) - { - resultarr2[y*2, (x*2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] + - resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4); - } - else - { - resultarr2[y*2, (x*2) + 1] = ((resultarr[y, x] + resultarr[y, x + 1])/2); - } - } - else - { - resultarr2[y*2, (x*2) + 1] = resultarr[y, x]; - } - } - if (x < (int)Constants.RegionSize && y < (int)Constants.RegionSize) - { - if ((x + 1 < (int)Constants.RegionSize) && (y + 1 < (int)Constants.RegionSize)) - { - resultarr2[(y*2) + 1, (x*2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] + - resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4); - } - else - { - resultarr2[(y*2) + 1, (x*2) + 1] = resultarr[y, x]; - } - } - } - } - //Flatten out the array - int i = 0; - for (int y = 0; y < 512; y++) - { - for (int x = 0; x < 512; x++) - { - if (Single.IsNaN(resultarr2[y, x]) || Single.IsInfinity(resultarr2[y, x])) - { - m_log.Warn("[PHYSICS]: Non finite heightfield element detected. Setting it to 0"); - resultarr2[y, x] = 0; - } - returnarr[i] = resultarr2[y, x]; - i++; - } - } - - return returnarr; - } - - #endregion - - public override void SetTerrain(float[] heightMap) - { - if (m_worldOffset != Vector3.Zero && m_parentScene != null) - { - if (m_parentScene is OdeScene) - { - ((OdeScene)m_parentScene).SetTerrain(heightMap, m_worldOffset); - } - } - else - { - SetTerrain(heightMap, m_worldOffset); - } - } - - public void SetTerrain(float[] heightMap, Vector3 pOffset) - { - - int regionsize = (int) Constants.RegionSize; // visible region size eg. 256(M) - - int heightmapWidth = regionsize + 2; // ODE map size 257 x 257 (Meters) (1 extra - int heightmapHeight = regionsize + 2; - - int heightmapWidthSamples = (int)regionsize + 2; // Sample file size, 258 x 258 samples - int heightmapHeightSamples = (int)regionsize + 2; - - // Array of height samples for ODE - float[] _heightmap; - _heightmap = new float[(heightmapWidthSamples * heightmapHeightSamples)]; // loaded samples 258 x 258 - - // Other ODE parameters - const float scale = 1.0f; - const float offset = 0.0f; - const float thickness = 2.0f; // Was 0.2f, Larger appears to prevent Av fall-through - const int wrap = 0; - - float hfmin = 2000f; - float hfmax = -2000f; - float minele = 0.0f; // Dont allow -ve heights - - int x = 0; - int y = 0; - int xx = 0; - int yy = 0; - - // load the height samples array from the heightMap - for ( x = 0; x < heightmapWidthSamples; x++) // 0 to 257 - { - for ( y = 0; y < heightmapHeightSamples; y++) // 0 to 257 - { - xx = x - 1; - if (xx < 0) xx = 0; - if (xx > (regionsize - 1)) xx = regionsize - 1; - - yy = y - 1; - if (yy < 0) yy = 0; - if (yy > (regionsize - 1)) yy = regionsize - 1; - // Input xx = 0 0 1 2 ..... 254 255 255 256 total in - // Output x = 0 1 2 3 ..... 255 256 257 258 total out - float val= heightMap[(yy * regionsize) + xx]; // input from heightMap, <0-255 * 256> <0-255> - if (val < minele) val = minele; - _heightmap[x * (regionsize + 2) + y] = val; // samples output to _heightmap, <0-257 * 258> <0-257> - hfmin = (val < hfmin) ? val : hfmin; - hfmax = (val > hfmax) ? val : hfmax; - } - } - - lock (OdeLock) - { - IntPtr GroundGeom = IntPtr.Zero; - if (RegionTerrain.TryGetValue(pOffset, out GroundGeom)) - { - RegionTerrain.Remove(pOffset); - if (GroundGeom != IntPtr.Zero) - { - if (TerrainHeightFieldHeights.ContainsKey(GroundGeom)) - { - TerrainHeightFieldHeights.Remove(GroundGeom); - } - d.SpaceRemove(space, GroundGeom); - d.GeomDestroy(GroundGeom); - } - } - IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); - d.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmap, 0, - heightmapWidth, heightmapHeight, (int)heightmapWidthSamples, - (int)heightmapHeightSamples, scale, offset, thickness, wrap); - d.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1); - GroundGeom = d.CreateHeightfield(space, HeightmapData, 1); - if (GroundGeom != IntPtr.Zero) - { - d.GeomSetCategoryBits(GroundGeom, (int)(CollisionCategories.Land)); - d.GeomSetCollideBits(GroundGeom, (int)(CollisionCategories.Space)); - } - geom_name_map[GroundGeom] = "Terrain"; - - d.Matrix3 R = new d.Matrix3(); - - Quaternion q1 = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), 1.5707f); - Quaternion q2 = Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), 1.5707f); - //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1)); - - q1 = q1 * q2; - //q1 = q1 * q3; - Vector3 v3; - float angle; - q1.GetAxisAngle(out v3, out angle); - - d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); - d.GeomSetRotation(GroundGeom, ref R); - d.GeomSetPosition(GroundGeom, (pOffset.X + (regionsize * 0.5f)) - 0.5f, (pOffset.Y + (regionsize * 0.5f)) - 0.5f, 0); - IntPtr testGround = IntPtr.Zero; - if (RegionTerrain.TryGetValue(pOffset, out testGround)) - { - RegionTerrain.Remove(pOffset); - } - RegionTerrain.Add(pOffset, GroundGeom, GroundGeom); - TerrainHeightFieldHeights.Add(GroundGeom,_heightmap); - } - } - - public override void DeleteTerrain() - { - } - - public float GetWaterLevel() - { - return waterlevel; - } - - public override bool SupportsCombining() - { - return true; - } - - public override void UnCombine(PhysicsScene pScene) - { - IntPtr localGround = IntPtr.Zero; -// float[] localHeightfield; - bool proceed = false; - List geomDestroyList = new List(); - - lock (OdeLock) - { - if (RegionTerrain.TryGetValue(Vector3.Zero, out localGround)) - { - foreach (IntPtr geom in TerrainHeightFieldHeights.Keys) - { - if (geom == localGround) - { -// localHeightfield = TerrainHeightFieldHeights[geom]; - proceed = true; - } - else - { - geomDestroyList.Add(geom); - } - } - - if (proceed) - { - m_worldOffset = Vector3.Zero; - WorldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize); - m_parentScene = null; - - foreach (IntPtr g in geomDestroyList) - { - // removingHeightField needs to be done or the garbage collector will - // collect the terrain data before we tell ODE to destroy it causing - // memory corruption - if (TerrainHeightFieldHeights.ContainsKey(g)) - { -// float[] removingHeightField = TerrainHeightFieldHeights[g]; - TerrainHeightFieldHeights.Remove(g); - - if (RegionTerrain.ContainsKey(g)) - { - RegionTerrain.Remove(g); - } - - d.GeomDestroy(g); - //removingHeightField = new float[0]; - } - } - - } - else - { - m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data."); - - } - } - } - } - - public override void SetWaterLevel(float baseheight) - { - waterlevel = baseheight; - randomizeWater(waterlevel); - } - - public void randomizeWater(float baseheight) - { - const uint heightmapWidth = m_regionWidth + 2; - const uint heightmapHeight = m_regionHeight + 2; - const uint heightmapWidthSamples = m_regionWidth + 2; - const uint heightmapHeightSamples = m_regionHeight + 2; - const float scale = 1.0f; - const float offset = 0.0f; - const float thickness = 2.9f; - const int wrap = 0; - - for (int i = 0; i < (258 * 258); i++) - { - _watermap[i] = (baseheight-0.1f) + ((float)fluidRandomizer.Next(1,9) / 10f); - // m_log.Info((baseheight - 0.1f) + ((float)fluidRandomizer.Next(1, 9) / 10f)); - } - - lock (OdeLock) - { - if (WaterGeom != IntPtr.Zero) - { - d.SpaceRemove(space, WaterGeom); - } - IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); - d.GeomHeightfieldDataBuildSingle(HeightmapData, _watermap, 0, heightmapWidth, heightmapHeight, - (int)heightmapWidthSamples, (int)heightmapHeightSamples, scale, - offset, thickness, wrap); - d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight); - WaterGeom = d.CreateHeightfield(space, HeightmapData, 1); - if (WaterGeom != IntPtr.Zero) - { - d.GeomSetCategoryBits(WaterGeom, (int)(CollisionCategories.Water)); - d.GeomSetCollideBits(WaterGeom, (int)(CollisionCategories.Space)); - - } - geom_name_map[WaterGeom] = "Water"; - - d.Matrix3 R = new d.Matrix3(); - - Quaternion q1 = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), 1.5707f); - Quaternion q2 = Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), 1.5707f); - //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1)); - - q1 = q1 * q2; - //q1 = q1 * q3; - Vector3 v3; - float angle; - q1.GetAxisAngle(out v3, out angle); - - d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); - d.GeomSetRotation(WaterGeom, ref R); - d.GeomSetPosition(WaterGeom, 128, 128, 0); - - } - - } - - public override void Dispose() - { - m_rayCastManager.Dispose(); - m_rayCastManager = null; - - lock (OdeLock) - { - lock (_prims) - { - foreach (OdePrim prm in _prims) - { - RemovePrim(prm); - } - } - - //foreach (OdeCharacter act in _characters) - //{ - //RemoveAvatar(act); - //} - d.WorldDestroy(world); - //d.CloseODE(); - } - } - public override Dictionary GetTopColliders() - { - Dictionary returncolliders = new Dictionary(); - int cnt = 0; - lock (_prims) - { - foreach (OdePrim prm in _prims) - { - if (prm.CollisionScore > 0) - { - returncolliders.Add(prm.m_localID, prm.CollisionScore); - cnt++; - prm.CollisionScore = 0f; - if (cnt > 25) - { - break; - } - } - } - } - return returncolliders; - } - - public override bool SupportsRayCast() - { - return true; - } - - public override void RaycastWorld(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod) - { - if (retMethod != null) - { - m_rayCastManager.QueueRequest(position, direction, length, retMethod); - } - } - -#if USE_DRAWSTUFF - // Keyboard callback - public void command(int cmd) - { - IntPtr geom; - d.Mass mass; - d.Vector3 sides = new d.Vector3(d.RandReal() * 0.5f + 0.1f, d.RandReal() * 0.5f + 0.1f, d.RandReal() * 0.5f + 0.1f); - - - - Char ch = Char.ToLower((Char)cmd); - switch ((Char)ch) - { - case 'w': - try - { - Vector3 rotate = (new Vector3(1, 0, 0) * Quaternion.CreateFromEulers(hpr.Z * Utils.DEG_TO_RAD, hpr.Y * Utils.DEG_TO_RAD, hpr.X * Utils.DEG_TO_RAD)); - - xyz.X += rotate.X; xyz.Y += rotate.Y; xyz.Z += rotate.Z; - ds.SetViewpoint(ref xyz, ref hpr); - } - catch (ArgumentException) - { hpr.X = 0; } - break; - - case 'a': - hpr.X++; - ds.SetViewpoint(ref xyz, ref hpr); - break; - - case 's': - try - { - Vector3 rotate2 = (new Vector3(-1, 0, 0) * Quaternion.CreateFromEulers(hpr.Z * Utils.DEG_TO_RAD, hpr.Y * Utils.DEG_TO_RAD, hpr.X * Utils.DEG_TO_RAD)); - - xyz.X += rotate2.X; xyz.Y += rotate2.Y; xyz.Z += rotate2.Z; - ds.SetViewpoint(ref xyz, ref hpr); - } - catch (ArgumentException) - { hpr.X = 0; } - break; - case 'd': - hpr.X--; - ds.SetViewpoint(ref xyz, ref hpr); - break; - case 'r': - xyz.Z++; - ds.SetViewpoint(ref xyz, ref hpr); - break; - case 'f': - xyz.Z--; - ds.SetViewpoint(ref xyz, ref hpr); - break; - case 'e': - xyz.Y++; - ds.SetViewpoint(ref xyz, ref hpr); - break; - case 'q': - xyz.Y--; - ds.SetViewpoint(ref xyz, ref hpr); - break; - } - } - - public void step(int pause) - { - - ds.SetColor(1.0f, 1.0f, 0.0f); - ds.SetTexture(ds.Texture.Wood); - lock (_prims) - { - foreach (OdePrim prm in _prims) - { - //IntPtr body = d.GeomGetBody(prm.prim_geom); - if (prm.prim_geom != IntPtr.Zero) - { - d.Vector3 pos; - d.GeomCopyPosition(prm.prim_geom, out pos); - //d.BodyCopyPosition(body, out pos); - - d.Matrix3 R; - d.GeomCopyRotation(prm.prim_geom, out R); - //d.BodyCopyRotation(body, out R); - - - d.Vector3 sides = new d.Vector3(); - sides.X = prm.Size.X; - sides.Y = prm.Size.Y; - sides.Z = prm.Size.Z; - - ds.DrawBox(ref pos, ref R, ref sides); - } - } - } - ds.SetColor(1.0f, 0.0f, 0.0f); - lock (_characters) - { - foreach (OdeCharacter chr in _characters) - { - if (chr.Shell != IntPtr.Zero) - { - IntPtr body = d.GeomGetBody(chr.Shell); - - d.Vector3 pos; - d.GeomCopyPosition(chr.Shell, out pos); - //d.BodyCopyPosition(body, out pos); - - d.Matrix3 R; - d.GeomCopyRotation(chr.Shell, out R); - //d.BodyCopyRotation(body, out R); - - ds.DrawCapsule(ref pos, ref R, chr.Size.Z, 0.35f); - d.Vector3 sides = new d.Vector3(); - sides.X = 0.5f; - sides.Y = 0.5f; - sides.Z = 0.5f; - - ds.DrawBox(ref pos, ref R, ref sides); - } - } - } - } - - public void start(int unused) - { - ds.SetViewpoint(ref xyz, ref hpr); - } -#endif - } -} diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdeUtils.cs b/OpenSim/Region/Physics/ChOdePlugin/OdeUtils.cs deleted file mode 100644 index e7e7bb3623..0000000000 --- a/OpenSim/Region/Physics/ChOdePlugin/OdeUtils.cs +++ /dev/null @@ -1,353 +0,0 @@ -/* Ubit 2012 - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -// no endian conversion. So can't be use to pass information around diferent cpus with diferent endian - -using System; -using System.IO; -using OpenMetaverse; - -namespace OpenSim.Region.Physics.OdePlugin -{ - - unsafe public class wstreamer - { - byte[] buf; - int index; - byte* src; - - public wstreamer() - { - buf = new byte[1024]; - index = 0; - } - public wstreamer(int size) - { - buf = new byte[size]; - index = 0; - } - - public byte[] close() - { - byte[] data = new byte[index]; - Buffer.BlockCopy(buf, 0, data, 0, index); - return data; - } - - public void Seek(int pos) - { - index = pos; - } - - public void Seekrel(int pos) - { - index += pos; - } - - public void Wbyte(byte value) - { - buf[index++] = value; - } - public void Wshort(short value) - { - src = (byte*)&value; - buf[index++] = *src++; - buf[index++] = *src; - } - public void Wushort(ushort value) - { - src = (byte*)&value; - buf[index++] = *src++; - buf[index++] = *src; - } - public void Wint(int value) - { - src = (byte*)&value; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src; - } - public void Wuint(uint value) - { - src = (byte*)&value; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src; - } - public void Wlong(long value) - { - src = (byte*)&value; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src; - } - public void Wulong(ulong value) - { - src = (byte*)&value; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src; - } - - public void Wfloat(float value) - { - src = (byte*)&value; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src; - } - - public void Wdouble(double value) - { - src = (byte*)&value; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src; - } - - public void Wvector3(Vector3 value) - { - src = (byte*)&value.X; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src; - src = (byte*)&value.Y; // it may have padding ?? - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src; - src = (byte*)&value.Z; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src; - } - public void Wquat(Quaternion value) - { - src = (byte*)&value.X; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src; - src = (byte*)&value.Y; // it may have padding ?? - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src; - src = (byte*)&value.Z; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src; - src = (byte*)&value.W; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src++; - buf[index++] = *src; - } - } - - unsafe public class rstreamer - { - private byte[] rbuf; - private int ptr; - private byte* dst; - - public rstreamer(byte[] data) - { - rbuf = data; - ptr = 0; - } - - public void close() - { - } - - public void Seek(int pos) - { - ptr = pos; - } - - public void Seekrel(int pos) - { - ptr += pos; - } - - public byte Rbyte() - { - return (byte)rbuf[ptr++]; - } - - public short Rshort() - { - short v; - dst = (byte*)&v; - *dst++ = rbuf[ptr++]; - *dst = rbuf[ptr++]; - return v; - } - public ushort Rushort() - { - ushort v; - dst = (byte*)&v; - *dst++ = rbuf[ptr++]; - *dst = rbuf[ptr++]; - return v; - } - public int Rint() - { - int v; - dst = (byte*)&v; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst = rbuf[ptr++]; - return v; - } - public uint Ruint() - { - uint v; - dst = (byte*)&v; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst = rbuf[ptr++]; - return v; - } - public long Rlong() - { - long v; - dst = (byte*)&v; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst = rbuf[ptr++]; - return v; - } - public ulong Rulong() - { - ulong v; - dst = (byte*)&v; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst = rbuf[ptr++]; - return v; - } - public float Rfloat() - { - float v; - dst = (byte*)&v; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst = rbuf[ptr++]; - return v; - } - - public double Rdouble() - { - double v; - dst = (byte*)&v; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst = rbuf[ptr++]; - return v; - } - - public Vector3 Rvector3() - { - Vector3 v; - dst = (byte*)&v.X; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst = rbuf[ptr++]; - - dst = (byte*)&v.Y; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst = rbuf[ptr++]; - - dst = (byte*)&v.Z; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst = rbuf[ptr++]; - return v; - } - - public Quaternion Rquat() - { - Quaternion v; - dst = (byte*)&v.X; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst = rbuf[ptr++]; - - dst = (byte*)&v.Y; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst = rbuf[ptr++]; - - dst = (byte*)&v.Z; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst = rbuf[ptr++]; - - dst = (byte*)&v.W; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst++ = rbuf[ptr++]; - *dst = rbuf[ptr++]; - - return v; - } - } -} diff --git a/OpenSim/Region/Physics/ChOdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/Physics/ChOdePlugin/Tests/ODETestClass.cs deleted file mode 100644 index 69e2d03482..0000000000 --- a/OpenSim/Region/Physics/ChOdePlugin/Tests/ODETestClass.cs +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using Nini.Config; -using NUnit.Framework; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using log4net; -using System.Reflection; - -namespace OpenSim.Region.Physics.OdePlugin -{ - [TestFixture] - public class ODETestClass - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private OdePlugin cbt; - private PhysicsScene ps; - private IMeshingPlugin imp; - - [SetUp] - public void Initialize() - { - // Loading ODEPlugin - cbt = new OdePlugin(); - // Loading Zero Mesher - imp = new ZeroMesherPlugin(); - // Getting Physics Scene - ps = cbt.GetScene("test"); - // Initializing Physics Scene. - ps.Initialise(imp.GetMesher(),null); - float[] _heightmap = new float[(int)Constants.RegionSize * (int)Constants.RegionSize]; - for (int i = 0; i < ((int)Constants.RegionSize * (int)Constants.RegionSize); i++) - { - _heightmap[i] = 21f; - } - ps.SetTerrain(_heightmap); - } - - [TearDown] - public void Terminate() - { - ps.DeleteTerrain(); - ps.Dispose(); - - } - - [Test] - public void CreateAndDropPhysicalCube() - { - PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox(); - Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f); - Vector3 size = new Vector3(0.5f, 0.5f, 0.5f); - Quaternion rot = Quaternion.Identity; - PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true); - OdePrim oprim = (OdePrim)prim; - OdeScene pscene = (OdeScene) ps; - - Assert.That(oprim.m_taintadd); - - prim.LocalID = 5; - - for (int i = 0; i < 58; i++) - { - ps.Simulate(0.133f); - - Assert.That(oprim.prim_geom != (IntPtr)0); - - Assert.That(oprim.m_targetSpace != (IntPtr)0); - - //Assert.That(oprim.m_targetSpace == pscene.space); - m_log.Info("TargetSpace: " + oprim.m_targetSpace + " - SceneMainSpace: " + pscene.space); - - Assert.That(!oprim.m_taintadd); - m_log.Info("Prim Position (" + oprim.m_localID + "): " + prim.Position.ToString()); - - // Make sure we're above the ground - //Assert.That(prim.Position.Z > 20f); - //m_log.Info("PrimCollisionScore (" + oprim.m_localID + "): " + oprim.m_collisionscore); - - // Make sure we've got a Body - Assert.That(oprim.Body != (IntPtr)0); - //m_log.Info( - } - - // Make sure we're not somewhere above the ground - Assert.That(prim.Position.Z < 21.5f); - - ps.RemovePrim(prim); - Assert.That(oprim.m_taintremove); - ps.Simulate(0.133f); - Assert.That(oprim.Body == (IntPtr)0); - } - } -} diff --git a/OpenSim/Region/Physics/ChOdePlugin/drawstuff.cs b/OpenSim/Region/Physics/ChOdePlugin/drawstuff.cs deleted file mode 100644 index 87ca4464dc..0000000000 --- a/OpenSim/Region/Physics/ChOdePlugin/drawstuff.cs +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright ODE - * Ode.NET - .NET bindings for ODE - * Jason Perkins (starkos@industriousone.com) - * Licensed under the New BSD - * Part of the OpenDynamicsEngine -Open Dynamics Engine -Copyright (c) 2001-2007, Russell L. Smith. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. - -Neither the names of ODE's copyright owner nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - */ - -using System; -using System.Runtime.InteropServices; -using Ode.NET; - -namespace Drawstuff.NET -{ -#if dDOUBLE - using dReal = System.Double; -#else - using dReal = System.Single; -#endif - - public static class ds - { - public const int VERSION = 2; - - public enum Texture - { - None, - Wood - } - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void CallbackFunction(int arg); - - [StructLayout(LayoutKind.Sequential)] - public struct Functions - { - public int version; - public CallbackFunction start; - public CallbackFunction step; - public CallbackFunction command; - public CallbackFunction stop; - public string path_to_textures; - } - - [DllImport("drawstuff", EntryPoint = "dsDrawBox")] - public static extern void DrawBox(ref d.Vector3 pos, ref d.Matrix3 R, ref d.Vector3 sides); - - [DllImport("drawstuff", EntryPoint = "dsDrawCapsule")] - public static extern void DrawCapsule(ref d.Vector3 pos, ref d.Matrix3 R, dReal length, dReal radius); - - [DllImport("drawstuff", EntryPoint = "dsDrawConvex")] - public static extern void DrawConvex(ref d.Vector3 pos, ref d.Matrix3 R, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons); - - [DllImport("drawstuff", EntryPoint = "dsSetColor")] - public static extern void SetColor(float red, float green, float blue); - - [DllImport("drawstuff", EntryPoint = "dsSetTexture")] - public static extern void SetTexture(Texture texture); - - [DllImport("drawstuff", EntryPoint = "dsSetViewpoint")] - public static extern void SetViewpoint(ref d.Vector3 xyz, ref d.Vector3 hpr); - - [DllImport("drawstuff", EntryPoint = "dsSimulationLoop")] - public static extern void SimulationLoop(int argc, string[] argv, int window_width, int window_height, ref Functions fn); - } -} diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdePlugin.cs deleted file mode 100644 index d32188edb9..0000000000 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdePlugin.cs +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Threading; -using System.IO; -using System.Diagnostics; -using log4net; -using Nini.Config; -using OdeAPI; -using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenMetaverse; - -namespace OpenSim.Region.Physics.OdePlugin -{ - /// - /// ODE plugin - /// - public class OdePlugin : IPhysicsPlugin - { - //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - - private OdeScene m_scene; - - public bool Init() - { - if (Util.IsWindows()) - Util.LoadArchSpecificWindowsDll("ode.dll"); - - if (d.InitODE2(0) != 0) - { - if (d.AllocateODEDataForThread(~0U) == 0) - { - d.CloseODE(); - return false; - } - return true; - } - return false; - } - - public PhysicsScene GetScene(String sceneIdentifier) - { - if (m_scene == null) - { - - m_scene = new OdeScene(sceneIdentifier); - } - return (m_scene); - } - - public string GetName() - { - return ("UbitODE"); - } - - public void Dispose() - { - d.CloseODE(); - } - } -} \ No newline at end of file diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index 26210d61ce..b00a5ab352 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs @@ -671,7 +671,7 @@ namespace OpenSim.Region.PhysicsModule.ODE } #endif - public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) + public void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) { WorldExtents.X = regionExtent.X; m_regionWidth = (uint)regionExtent.X; @@ -682,7 +682,7 @@ namespace OpenSim.Region.PhysicsModule.ODE } // Initialize the mesh plugin - public override void Initialise(IMesher meshmerizer, IConfigSource config) + public void Initialise(IMesher meshmerizer, IConfigSource config) { InitializeExtraStats(); diff --git a/OpenSim/Region/Physics/UbitMeshing/HelperTypes.cs b/OpenSim/Region/PhysicsModules/UbitMeshing/HelperTypes.cs similarity index 100% rename from OpenSim/Region/Physics/UbitMeshing/HelperTypes.cs rename to OpenSim/Region/PhysicsModules/UbitMeshing/HelperTypes.cs diff --git a/OpenSim/Region/Physics/UbitMeshing/Mesh.cs b/OpenSim/Region/PhysicsModules/UbitMeshing/Mesh.cs similarity index 100% rename from OpenSim/Region/Physics/UbitMeshing/Mesh.cs rename to OpenSim/Region/PhysicsModules/UbitMeshing/Mesh.cs diff --git a/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/UbitMeshing/Meshmerizer.cs similarity index 100% rename from OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs rename to OpenSim/Region/PhysicsModules/UbitMeshing/Meshmerizer.cs diff --git a/OpenSim/Region/Physics/UbitMeshing/PrimMesher.cs b/OpenSim/Region/PhysicsModules/UbitMeshing/PrimMesher.cs similarity index 100% rename from OpenSim/Region/Physics/UbitMeshing/PrimMesher.cs rename to OpenSim/Region/PhysicsModules/UbitMeshing/PrimMesher.cs diff --git a/OpenSim/Region/Physics/UbitMeshing/SculptMap.cs b/OpenSim/Region/PhysicsModules/UbitMeshing/SculptMap.cs similarity index 100% rename from OpenSim/Region/Physics/UbitMeshing/SculptMap.cs rename to OpenSim/Region/PhysicsModules/UbitMeshing/SculptMap.cs diff --git a/OpenSim/Region/Physics/UbitMeshing/SculptMesh.cs b/OpenSim/Region/PhysicsModules/UbitMeshing/SculptMesh.cs similarity index 100% rename from OpenSim/Region/Physics/UbitMeshing/SculptMesh.cs rename to OpenSim/Region/PhysicsModules/UbitMeshing/SculptMesh.cs diff --git a/OpenSim/Region/Physics/UbitOdePlugin/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/UbitOdePlugin/AssemblyInfo.cs similarity index 100% rename from OpenSim/Region/Physics/UbitOdePlugin/AssemblyInfo.cs rename to OpenSim/Region/PhysicsModules/UbitOdePlugin/AssemblyInfo.cs diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODECharacter.cs similarity index 99% rename from OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs rename to OpenSim/Region/PhysicsModules/UbitOdePlugin/ODECharacter.cs index 0e2cbd2435..ba3813620d 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODECharacter.cs @@ -34,10 +34,10 @@ using System.Reflection; using OpenMetaverse; using OdeAPI; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using log4net; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModules.OdePlugin { /// /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODEDynamics.cs similarity index 99% rename from OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs rename to OpenSim/Region/PhysicsModules/UbitOdePlugin/ODEDynamics.cs index 3c952ae7fe..36bb1e9579 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs +++ b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODEDynamics.cs @@ -48,9 +48,9 @@ using log4net; using OpenMetaverse; using OdeAPI; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModules.OdePlugin { public class ODEDynamics { diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODEMeshWorker.cs similarity index 99% rename from OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs rename to OpenSim/Region/PhysicsModules/UbitOdePlugin/ODEMeshWorker.cs index a6bdaa0727..918c9db13f 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs +++ b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODEMeshWorker.cs @@ -10,13 +10,13 @@ using System.Reflection; using System.Runtime.InteropServices; using System.Text; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OdeAPI; using log4net; using Nini.Config; using OpenMetaverse; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModules.OdePlugin { public enum MeshState : byte { @@ -930,4 +930,4 @@ namespace OpenSim.Region.Physics.OdePlugin repData.actor.Name); } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODEPrim.cs similarity index 96% rename from OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs rename to OpenSim/Region/PhysicsModules/UbitOdePlugin/ODEPrim.cs index 8bcdd89e6f..b52a242f26 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODEPrim.cs @@ -55,9 +55,9 @@ using log4net; using OpenMetaverse; using OdeAPI; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModules.OdePlugin { public class OdePrim : PhysicsActor { diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODERayCastRequestManager.cs similarity index 99% rename from OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs rename to OpenSim/Region/PhysicsModules/UbitOdePlugin/ODERayCastRequestManager.cs index 73ababac21..3ad9a472a5 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs +++ b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODERayCastRequestManager.cs @@ -31,12 +31,12 @@ using System.Reflection; using System.Runtime.InteropServices; using System.Text; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OdeAPI; using log4net; using OpenMetaverse; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModules.OdePlugin { /// /// Processes raycast requests as ODE is in a state to be able to do them. @@ -680,4 +680,4 @@ namespace OpenSim.Region.Physics.OdePlugin public RayFilterFlags filter; public Quaternion orientation; } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODESitAvatar.cs similarity index 99% rename from OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs rename to OpenSim/Region/PhysicsModules/UbitOdePlugin/ODESitAvatar.cs index 672212ffac..d934d3e504 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs +++ b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODESitAvatar.cs @@ -31,12 +31,12 @@ using System.Reflection; using System.Runtime.InteropServices; using System.Text; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OdeAPI; using log4net; using OpenMetaverse; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModules.OdePlugin { /// /// @@ -353,4 +353,4 @@ namespace OpenSim.Region.Physics.OdePlugin return; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeApi.cs b/OpenSim/Region/PhysicsModules/UbitOdePlugin/OdeApi.cs similarity index 100% rename from OpenSim/Region/Physics/UbitOdePlugin/OdeApi.cs rename to OpenSim/Region/PhysicsModules/UbitOdePlugin/OdeApi.cs diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/PhysicsModules/UbitOdePlugin/OdeScene.cs similarity index 97% rename from OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs rename to OpenSim/Region/PhysicsModules/UbitOdePlugin/OdeScene.cs index e8c219cc4d..9373d2b230 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/UbitOdePlugin/OdeScene.cs @@ -39,10 +39,11 @@ using log4net; using Nini.Config; using OdeAPI; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenMetaverse; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModules.OdePlugin { // colision flags of things others can colide with // rays, sensors, probes removed since can't be colided with @@ -164,9 +165,9 @@ namespace OpenSim.Region.Physics.OdePlugin - public class OdeScene : PhysicsScene + public class OdeScene : PhysicsScene, INonSharedRegionModule { - private readonly ILog m_log; + private readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + sceneIdentifier); // private Dictionary m_storedCollisions = new Dictionary(); public bool OdeUbitLib = false; @@ -324,18 +325,85 @@ namespace OpenSim.Region.Physics.OdePlugin } } */ + #region INonSharedRegionModule + public string Name + { + get { return "UbitODE"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) + { + // TODO: Move this out of Startup + IConfig config = source.Configs["Startup"]; + if (config != null) + { + string physics = config.GetString("physics", string.Empty); + if (physics == Name) + { + m_Enabled = true; + m_Config = source; + } + } + + } + + public void Close() + { + } + + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + + EngineType = Name; + RegionName = scene.RegionInfo.RegionName; + PhysicsSceneName = EngineType + "/" + RegionName; + + scene.RegisterModuleInterface(this); + Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); + RawInitialization(); + Initialise(m_Config, extent); + + base.Initialise(scene.PhysicsRequestAsset, + (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[scene.RegionInfo.RegionSizeX * scene.RegionInfo.RegionSizeY]), + (float)scene.RegionInfo.RegionSettings.WaterHeight); + + } + + public void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + } + + public void RegionLoaded(Scene scene) + { + if (!m_Enabled) + return; + + mesher = scene.RequestModuleInterface(); + if (mesher == null) + m_log.WarnFormat("{0} No mesher. Things will not work well.", LogHeader); + + scene.PhysicsEnabled = true; + } + #endregion + /// /// Initiailizes the scene /// Sets many properties that ODE requires to be stable /// These settings need to be tweaked 'exactly' right or weird stuff happens. /// - public OdeScene(string sceneIdentifier) + private void RawInitialization() { - m_log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + sceneIdentifier); // checkThread(); - Name = sceneIdentifier; OdeLock = new Object(); SimulationLock = new Object(); @@ -415,7 +483,7 @@ namespace OpenSim.Region.Physics.OdePlugin } } - public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) + public void Initialise(IConfigSource config, Vector3 regionExtent) { WorldExtents.X = regionExtent.X; m_regionWidth = (uint)regionExtent.X; @@ -423,14 +491,7 @@ namespace OpenSim.Region.Physics.OdePlugin m_regionHeight = (uint)regionExtent.Y; m_suportCombine = false; - Initialise(meshmerizer, config); - } - - - public override void Initialise(IMesher meshmerizer, IConfigSource config) - { // checkThread(); - mesher = meshmerizer; m_config = config; string ode_config = d.GetConfiguration(); diff --git a/prebuild.xml b/prebuild.xml index d82f802c5b..a9b9336bca 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -359,38 +359,7 @@ - - - - ../../../../bin/Physics/ - - - - - ../../../../bin/Physics/ - - - - ../../../../bin/ - - - - - - - - - - - - - - - - - - - + ../../../../bin/Physics/ @@ -410,8 +379,9 @@ - - + + + @@ -421,7 +391,7 @@ - + ../../../../bin/Physics/ @@ -443,8 +413,8 @@ - - + +