aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS.txt4
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/IRegionLoader.cs (renamed from OpenSim/Framework/IRegionLoader.cs)3
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs2
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs (renamed from OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs)3
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderWebServer.cs (renamed from OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs)3
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs1
-rw-r--r--OpenSim/Framework/Communications/GenericAsyncResult.cs185
-rw-r--r--OpenSim/Framework/Communications/IUserService.cs157
-rw-r--r--OpenSim/Framework/Communications/Limit/IRequestLimitStrategy.cs66
-rw-r--r--OpenSim/Framework/Communications/Limit/NullLimitStrategy.cs40
-rw-r--r--OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs109
-rw-r--r--OpenSim/Framework/Communications/Limit/TimeLimitStrategy.cs140
-rw-r--r--OpenSim/Framework/Communications/Properties/AssemblyInfo.cs65
-rw-r--r--OpenSim/Framework/Communications/XMPP/XmppError.cs39
-rw-r--r--OpenSim/Framework/Communications/XMPP/XmppIqStanza.cs60
-rw-r--r--OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs93
-rw-r--r--OpenSim/Framework/Communications/XMPP/XmppPresenceStanza.cs69
-rw-r--r--OpenSim/Framework/Communications/XMPP/XmppSerializer.cs79
-rw-r--r--OpenSim/Framework/Communications/XMPP/XmppStanza.cs70
-rw-r--r--OpenSim/Framework/Communications/XMPP/XmppWriter.cs57
-rw-r--r--OpenSim/Framework/ForeignUserProfileData.cs77
-rwxr-xr-xOpenSim/Framework/LogWriter.cs (renamed from OpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs)2
-rw-r--r--OpenSim/Framework/OutboundUrlFilter.cs (renamed from OpenSim/Framework/Communications/OutboundUrlFilter.cs)4
-rw-r--r--OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Framework/RestClient.cs (renamed from OpenSim/Framework/Communications/RestClient.cs)156
-rw-r--r--OpenSim/Region/Application/OpenSimBackground.cs2
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs125
-rw-r--r--OpenSim/Region/Application/RegionApplicationBase.cs (renamed from OpenSim/Region/ClientStack/RegionApplicationBase.cs)36
-rw-r--r--OpenSim/Region/ClientStack/ClientStackManager.cs147
-rw-r--r--OpenSim/Region/ClientStack/IClientNetworkServer.cs59
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs49
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs3
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs1
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs8
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Land/DwellModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs2
-rw-r--r--OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/KeyframeMotion.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/SOPVehicle.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs1
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs1
-rwxr-xr-xOpenSim/Region/Framework/Scenes/SceneGraph.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs1
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs1
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs1
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs1
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs1
-rw-r--r--OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs (renamed from OpenSim/Region/DataSnapshot/DataRequestHandler.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs (renamed from OpenSim/Region/DataSnapshot/DataSnapshotManager.cs)4
-rw-r--r--OpenSim/Region/OptionalModules/DataSnapshot/EstateSnapshot.cs (renamed from OpenSim/Region/DataSnapshot/EstateSnapshot.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/DataSnapshot/Interfaces/IDataSnapshot.cs (renamed from OpenSim/Region/DataSnapshot/Interfaces/IDataSnapshot.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/DataSnapshot/Interfaces/IDataSnapshotProvider.cs (renamed from OpenSim/Region/DataSnapshot/Interfaces/IDataSnapshotProvider.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/DataSnapshot/LLSDDiscovery.cs (renamed from OpenSim/Region/DataSnapshot/LLSDDiscovery.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/DataSnapshot/LandSnapshot.cs (renamed from OpenSim/Region/DataSnapshot/LandSnapshot.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs (renamed from OpenSim/Region/DataSnapshot/ObjectSnapshot.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/DataSnapshot/SnapshotStore.cs (renamed from OpenSim/Region/DataSnapshot/SnapshotStore.cs)0
-rwxr-xr-xOpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs2
-rw-r--r--OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerClientEventForwarder.cs (renamed from OpenSim/Region/RegionCombinerModule/RegionCombinerClientEventForwarder.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs (renamed from OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerLargeLandChannel.cs (renamed from OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs (renamed from OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs)2
-rw-r--r--OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerPermissionModule.cs (renamed from OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/RegionCombinerModule/RegionConnections.cs (renamed from OpenSim/Region/RegionCombinerModule/RegionConnections.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCourseLocation.cs (renamed from OpenSim/Region/RegionCombinerModule/RegionCourseLocation.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/RegionCombinerModule/RegionData.cs (renamed from OpenSim/Region/RegionCombinerModule/RegionData.cs)0
-rwxr-xr-xOpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs623
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs1
-rw-r--r--OpenSim/Region/OptionalModules/UserStatistics/ActiveConnectionsAJAX.cs (renamed from OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/UserStatistics/Clients_report.cs (renamed from OpenSim/Region/UserStatistics/Clients_report.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/UserStatistics/Default_Report.cs (renamed from OpenSim/Region/UserStatistics/Default_Report.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/UserStatistics/HTMLUtil.cs (renamed from OpenSim/Region/UserStatistics/HTMLUtil.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/UserStatistics/IStatsReport.cs (renamed from OpenSim/Region/UserStatistics/IStatsReport.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/UserStatistics/LogLinesAJAX.cs (renamed from OpenSim/Region/UserStatistics/LogLinesAJAX.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/UserStatistics/Prototype_distributor.cs (renamed from OpenSim/Region/UserStatistics/Prototype_distributor.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/UserStatistics/Sessions_Report.cs (renamed from OpenSim/Region/UserStatistics/Sessions_Report.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/UserStatistics/SimStatsAJAX.cs (renamed from OpenSim/Region/UserStatistics/SimStatsAJAX.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/UserStatistics/Updater_distributor.cs (renamed from OpenSim/Region/UserStatistics/Updater_distributor.cs)0
-rw-r--r--OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs (renamed from OpenSim/Region/UserStatistics/WebStatsModule.cs)3
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs1
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs64
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs76
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs1283
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/AssemblyInfo.cs58
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs1467
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs4124
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/ODERayCastRequestManager.cs384
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/OdePhysicsJoint.cs48
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs3887
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/OdeUtils.cs353
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/Tests/ODETestClass.cs122
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs250
-rw-r--r--OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs90
-rw-r--r--OpenSim/Region/Physics/OdePlugin/drawstuff.cs98
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSPlugin.cs64
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdePlugin.cs90
-rw-r--r--OpenSim/Region/PhysicsModules/BasicPhysics/AssemblyInfo.cs (renamed from OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs)8
-rw-r--r--OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsActor.cs (renamed from OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs)4
-rw-r--r--OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPrim.cs (renamed from OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs)4
-rw-r--r--OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs (renamed from OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs)72
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSAPIUnman.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs)2
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSAPIXNA.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs)2
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs)4
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSActorHover.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs)4
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSActorLockAxis.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs)2
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs)4
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSActorSetForce.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSActorSetForce.cs)4
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSActorSetTorque.cs)4
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSActors.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSActors.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/BulletS/BSApiTemplate.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs)4
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSConstraint.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs)2
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSConstraint6Dof.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs)2
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSConstraintCollection.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs)2
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSConstraintConeTwist.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSConstraintConeTwist.cs)2
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSConstraintHinge.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSConstraintHinge.cs)2
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSConstraintSlider.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSConstraintSlider.cs)2
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSConstraintSpring.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSConstraintSpring.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs)4
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSLinkset.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs)2
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSLinksetCompound.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs)2
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSLinksetConstraints.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs)4
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSMaterials.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs)2
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSMotors.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs)2
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSParam.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSParam.cs)4
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs)4
-rw-r--r--OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs)7
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSPrimDisplaced.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs)4
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs)5
-rw-r--r--OpenSim/Region/PhysicsModules/BulletS/BSScene.cs1333
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSShapeCollection.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs)6
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSShapes.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs)12
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs)5
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs)5
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs)5
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs)2
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BulletSimTODO.txt (renamed from OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt)0
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/ExtendedPhysics.cs622
-rw-r--r--OpenSim/Region/PhysicsModules/BulletS/Properties/AssemblyInfo.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs)3
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/Tests/BasicVehicles.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs)6
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTests.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTests.cs)2
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTestsUtil.cs)31
-rw-r--r--OpenSim/Region/PhysicsModules/BulletS/Tests/HullCreation.cs (renamed from OpenSim/Region/Physics/BulletSPlugin/Tests/HullCreation.cs)6
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/CTri.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/CTri.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Concavity.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/Concavity.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexBuilder.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexBuilder.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexDecomposition.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexDecomposition.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexResult.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexResult.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullClasses.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/HullClasses.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullTriangle.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/HullTriangle.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullUtils.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/HullUtils.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/LICENSE.txt (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/LICENSE.txt)0
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Plane.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/Plane.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/PlaneTri.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/PlaneTri.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs)0
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Quaternion.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/Quaternion.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/README.txt (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/README.txt)0
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/SplitPlane.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/SplitPlane.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/VertexLookup.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/VertexLookup.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float2.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/float2.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/float3.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3x3.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/float3x3.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/float4.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4x4.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/float4x4.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int3.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/int3.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int4.cs (renamed from OpenSim/Region/Physics/ConvexDecompositionDotNet/int4.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/HelperTypes.cs (renamed from OpenSim/Region/Physics/Meshing/HelperTypes.cs)4
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Mesh.cs (renamed from OpenSim/Region/Physics/Meshing/Mesh.cs)4
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs (renamed from OpenSim/Region/Physics/Meshing/Meshmerizer.cs)116
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/PrimMesher.cs (renamed from OpenSim/Region/Physics/Meshing/PrimMesher.cs)0
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMap.cs (renamed from OpenSim/Region/Physics/Meshing/SculptMap.cs)0
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMesh.cs (renamed from OpenSim/Region/Physics/Meshing/SculptMesh.cs)0
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs (renamed from OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs)6
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/ZeroMesher.cs (renamed from OpenSim/Region/Physics/Manager/ZeroMesher.cs)68
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs (renamed from OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs)4
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs (renamed from OpenSim/Region/Physics/OdePlugin/ODECharacter.cs)6
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/ODEDynamics.c_comments (renamed from OpenSim/Region/Physics/OdePlugin/ODEDynamics.c_comments)0
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs (renamed from OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs)4
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs (renamed from OpenSim/Region/Physics/OdePlugin/ODEPrim.cs)6
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs (renamed from OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs)10
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs (renamed from OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs)6
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/OdeScene.cs (renamed from OpenSim/Region/Physics/OdePlugin/OdeScene.cs)145
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs (renamed from OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs)67
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/drawstuff.cs (renamed from OpenSim/Region/Physics/ChOdePlugin/drawstuff.cs)0
-rw-r--r--OpenSim/Region/PhysicsModules/POS/AssemblyInfo.cs (renamed from OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs)4
-rw-r--r--OpenSim/Region/PhysicsModules/POS/POSCharacter.cs (renamed from OpenSim/Region/Physics/POSPlugin/POSCharacter.cs)4
-rw-r--r--OpenSim/Region/PhysicsModules/POS/POSPrim.cs (renamed from OpenSim/Region/Physics/POSPlugin/POSPrim.cs)4
-rw-r--r--OpenSim/Region/PhysicsModules/POS/POSScene.cs (renamed from OpenSim/Region/Physics/POSPlugin/POSScene.cs)66
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/AssemblyInfo.cs (renamed from OpenSim/Region/Physics/Manager/AssemblyInfo.cs)0
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs (renamed from OpenSim/Region/Physics/Manager/CollisionLocker.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs (renamed from OpenSim/Region/Physics/Manager/IMesher.cs)2
-rwxr-xr-xOpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs (renamed from OpenSim/Region/Physics/Manager/IPhysicsParameters.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs (renamed from OpenSim/Region/Physics/Manager/NullPhysicsScene.cs)7
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs (renamed from OpenSim/Region/Physics/Manager/PhysicsActor.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs (renamed from OpenSim/Region/Physics/Manager/PhysicsJoint.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs (renamed from OpenSim/Region/Physics/Manager/PhysicsScene.cs)23
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs (renamed from OpenSim/Region/Physics/Manager/PhysicsSensor.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs (renamed from OpenSim/Region/Physics/Manager/PhysicsVector.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs (renamed from OpenSim/Region/Physics/Manager/VehicleConstants.cs)2
-rw-r--r--OpenSim/Region/PhysicsModules/UbitMeshing/HelperTypes.cs (renamed from OpenSim/Region/Physics/UbitMeshing/HelperTypes.cs)0
-rw-r--r--OpenSim/Region/PhysicsModules/UbitMeshing/Mesh.cs (renamed from OpenSim/Region/Physics/UbitMeshing/Mesh.cs)0
-rw-r--r--OpenSim/Region/PhysicsModules/UbitMeshing/Meshmerizer.cs (renamed from OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs)0
-rw-r--r--OpenSim/Region/PhysicsModules/UbitMeshing/PrimMesher.cs (renamed from OpenSim/Region/Physics/UbitMeshing/PrimMesher.cs)0
-rw-r--r--OpenSim/Region/PhysicsModules/UbitMeshing/SculptMap.cs (renamed from OpenSim/Region/Physics/UbitMeshing/SculptMap.cs)0
-rw-r--r--OpenSim/Region/PhysicsModules/UbitMeshing/SculptMesh.cs (renamed from OpenSim/Region/Physics/UbitMeshing/SculptMesh.cs)0
-rw-r--r--OpenSim/Region/PhysicsModules/UbitOdePlugin/AssemblyInfo.cs (renamed from OpenSim/Region/Physics/UbitOdePlugin/AssemblyInfo.cs)0
-rw-r--r--OpenSim/Region/PhysicsModules/UbitOdePlugin/ODECharacter.cs (renamed from OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs)4
-rw-r--r--OpenSim/Region/PhysicsModules/UbitOdePlugin/ODEDynamics.cs (renamed from OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs)4
-rw-r--r--OpenSim/Region/PhysicsModules/UbitOdePlugin/ODEMeshWorker.cs (renamed from OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs)6
-rw-r--r--OpenSim/Region/PhysicsModules/UbitOdePlugin/ODEPrim.cs (renamed from OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs)4
-rw-r--r--OpenSim/Region/PhysicsModules/UbitOdePlugin/ODERayCastRequestManager.cs (renamed from OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs)6
-rw-r--r--OpenSim/Region/PhysicsModules/UbitOdePlugin/ODESitAvatar.cs (renamed from OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs)6
-rw-r--r--OpenSim/Region/PhysicsModules/UbitOdePlugin/OdeApi.cs (renamed from OpenSim/Region/Physics/UbitOdePlugin/OdeApi.cs)0
-rw-r--r--OpenSim/Region/PhysicsModules/UbitOdePlugin/OdeScene.cs (renamed from OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs)93
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs2
-rw-r--r--OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs1
-rw-r--r--OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs1
-rw-r--r--OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Grid/GridServicesConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Land/LandServicesConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs2
-rw-r--r--OpenSim/Services/HypergridService/GatekeeperService.cs7
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs8
-rw-r--r--OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs2
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs28
-rw-r--r--OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs2
-rw-r--r--OpenSim/Tests/Common/Mock/TestScene.cs10
-rw-r--r--OpenSim/Tests/Common/OpenSimTestCase.cs2
-rw-r--r--OpenSim/Tests/Performance/NPCPerformanceTests.cs2
-rwxr-xr-xbin/OpenSim.Region.PhysicsModule.BulletS.dll.config (renamed from bin/Physics/OpenSim.Region.Physics.BulletSPlugin.dll.config)0
-rw-r--r--bin/OpenSim.ini.example7
-rw-r--r--bin/OpenSimDefaults.ini8
-rw-r--r--bin/Robust.HG.ini.example54
-rw-r--r--bin/Robust.ini.example38
-rw-r--r--bin/config-include/StandaloneCommon.ini.example17
-rw-r--r--prebuild.xml658
296 files changed, 3205 insertions, 15924 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index e14e5ef..41c22b8 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -4,8 +4,7 @@ The following people have contributed to OpenSim (Thank you for your effort!)
4These folks represent the current core team for OpenSim, and are the 4These folks represent the current core team for OpenSim, and are the
5people that make the day to day of OpenSim happen. 5people that make the day to day of OpenSim happen.
6 6
7* justincc (OSVW Consulting, justincc.org) 7* justincc (OSVW Consulting, justincc.org)
8* dahlia
9* Melanie Thielker 8* Melanie Thielker
10* Diva (Crista Lopes, University of California, Irvine) 9* Diva (Crista Lopes, University of California, Irvine)
11* BlueWall (James Hughes) 10* BlueWall (James Hughes)
@@ -56,6 +55,7 @@ where we are today.
56* nlin (3Di) 55* nlin (3Di)
57* John Hurliman 56* John Hurliman
58* chi11ken (Genkii) 57* chi11ken (Genkii)
58* dahlia
59 59
60 60
61= Additional OpenSim Contributors = 61= Additional OpenSim Contributors =
diff --git a/OpenSim/Framework/IRegionLoader.cs b/OpenSim/ApplicationPlugins/LoadRegions/IRegionLoader.cs
index c566fc7..2d1505d 100644
--- a/OpenSim/Framework/IRegionLoader.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/IRegionLoader.cs
@@ -26,8 +26,9 @@
26 */ 26 */
27 27
28using Nini.Config; 28using Nini.Config;
29using OpenSim.Framework;
29 30
30namespace OpenSim.Framework 31namespace OpenSim.ApplicationPlugins.LoadRegions
31{ 32{
32 public interface IRegionLoader 33 public interface IRegionLoader
33 { 34 {
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
index 74d9ae4..89224a6 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
@@ -32,8 +32,6 @@ using System.Threading;
32using log4net; 32using log4net;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.RegionLoader.Filesystem;
36using OpenSim.Framework.RegionLoader.Web;
37using OpenSim.Region.CoreModules.Agent.AssetTransaction; 35using OpenSim.Region.CoreModules.Agent.AssetTransaction;
38using OpenSim.Region.CoreModules.Avatar.InstantMessage; 36using OpenSim.Region.CoreModules.Avatar.InstantMessage;
39using OpenSim.Region.CoreModules.Scripting.DynamicTexture; 37using OpenSim.Region.CoreModules.Scripting.DynamicTexture;
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs
index 8332c14..1873a06 100644
--- a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs
@@ -31,8 +31,9 @@ using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Reflection; 32using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework;
34 35
35namespace OpenSim.Framework.RegionLoader.Filesystem 36namespace OpenSim.ApplicationPlugins.LoadRegions
36{ 37{
37 public class RegionLoaderFileSystem : IRegionLoader 38 public class RegionLoaderFileSystem : IRegionLoader
38 { 39 {
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderWebServer.cs
index 098c4b9..13d7a8a 100644
--- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderWebServer.cs
@@ -32,8 +32,9 @@ using System.Reflection;
32using System.Xml; 32using System.Xml;
33using log4net; 33using log4net;
34using Nini.Config; 34using Nini.Config;
35using OpenSim.Framework;
35 36
36namespace OpenSim.Framework.RegionLoader.Web 37namespace OpenSim.ApplicationPlugins.LoadRegions
37{ 38{
38 public class RegionLoaderWebServer : IRegionLoader 39 public class RegionLoaderWebServer : IRegionLoader
39 { 40 {
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 9664433..bae1582 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -42,7 +42,6 @@ using OpenMetaverse;
42using Mono.Addins; 42using Mono.Addins;
43using OpenSim; 43using OpenSim;
44using OpenSim.Framework; 44using OpenSim.Framework;
45using OpenSim.Framework.Communications;
46using OpenSim.Framework.Console; 45using OpenSim.Framework.Console;
47using OpenSim.Framework.Servers; 46using OpenSim.Framework.Servers;
48using OpenSim.Framework.Servers.HttpServer; 47using OpenSim.Framework.Servers.HttpServer;
diff --git a/OpenSim/Framework/Communications/GenericAsyncResult.cs b/OpenSim/Framework/Communications/GenericAsyncResult.cs
deleted file mode 100644
index 8e3f62b..0000000
--- a/OpenSim/Framework/Communications/GenericAsyncResult.cs
+++ /dev/null
@@ -1,185 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Threading;
30
31namespace OpenSim.Framework.Communications
32{
33 internal class SimpleAsyncResult : IAsyncResult
34 {
35 private readonly AsyncCallback m_callback;
36
37 /// <summary>
38 /// Is process completed?
39 /// </summary>
40 /// <remarks>Should really be boolean, but VolatileRead has no boolean method</remarks>
41 private byte m_completed;
42
43 /// <summary>
44 /// Did process complete synchronously?
45 /// </summary>
46 /// <remarks>I have a hard time imagining a scenario where this is the case, again, same issue about
47 /// booleans and VolatileRead as m_completed
48 /// </remarks>
49 private byte m_completedSynchronously;
50
51 private readonly object m_asyncState;
52 private ManualResetEvent m_waitHandle;
53 private Exception m_exception;
54
55 internal SimpleAsyncResult(AsyncCallback cb, object state)
56 {
57 m_callback = cb;
58 m_asyncState = state;
59 m_completed = 0;
60 m_completedSynchronously = 1;
61 }
62
63 #region IAsyncResult Members
64
65 public object AsyncState
66 {
67 get { return m_asyncState; }
68 }
69
70 public WaitHandle AsyncWaitHandle
71 {
72 get
73 {
74 if (m_waitHandle == null)
75 {
76 bool done = IsCompleted;
77 ManualResetEvent mre = new ManualResetEvent(done);
78 if (Interlocked.CompareExchange(ref m_waitHandle, mre, null) != null)
79 {
80 mre.Close();
81 }
82 else
83 {
84 if (!done && IsCompleted)
85 {
86 m_waitHandle.Set();
87 }
88 }
89 }
90
91 return m_waitHandle;
92 }
93 }
94
95
96 public bool CompletedSynchronously
97 {
98 get { return Thread.VolatileRead(ref m_completedSynchronously) == 1; }
99 }
100
101
102 public bool IsCompleted
103 {
104 get { return Thread.VolatileRead(ref m_completed) == 1; }
105 }
106
107 #endregion
108
109 #region class Methods
110
111 internal void SetAsCompleted(bool completedSynchronously)
112 {
113 m_completed = 1;
114 if (completedSynchronously)
115 m_completedSynchronously = 1;
116 else
117 m_completedSynchronously = 0;
118
119 SignalCompletion();
120 }
121
122 internal void HandleException(Exception e, bool completedSynchronously)
123 {
124 m_completed = 1;
125 if (completedSynchronously)
126 m_completedSynchronously = 1;
127 else
128 m_completedSynchronously = 0;
129 m_exception = e;
130
131 SignalCompletion();
132 }
133
134 private void SignalCompletion()
135 {
136 if (m_waitHandle != null) m_waitHandle.Set();
137
138 if (m_callback != null) m_callback(this);
139 }
140
141 public void EndInvoke()
142 {
143 // This method assumes that only 1 thread calls EndInvoke
144 if (!IsCompleted)
145 {
146 // If the operation isn't done, wait for it
147 AsyncWaitHandle.WaitOne();
148 AsyncWaitHandle.Close();
149 m_waitHandle.Close();
150 m_waitHandle = null; // Allow early GC
151 }
152
153 // Operation is done: if an exception occured, throw it
154 if (m_exception != null) throw m_exception;
155 }
156
157 #endregion
158 }
159
160 internal class AsyncResult<T> : SimpleAsyncResult
161 {
162 private T m_result = default(T);
163
164 public AsyncResult(AsyncCallback asyncCallback, Object state) :
165 base(asyncCallback, state)
166 {
167 }
168
169 public void SetAsCompleted(T result, bool completedSynchronously)
170 {
171 // Save the asynchronous operation's result
172 m_result = result;
173
174 // Tell the base class that the operation completed
175 // sucessfully (no exception)
176 base.SetAsCompleted(completedSynchronously);
177 }
178
179 public new T EndInvoke()
180 {
181 base.EndInvoke();
182 return m_result;
183 }
184 }
185} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs
deleted file mode 100644
index dfa059d..0000000
--- a/OpenSim/Framework/Communications/IUserService.cs
+++ /dev/null
@@ -1,157 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Services.Interfaces;
32
33namespace OpenSim.Framework.Communications
34{
35 public interface IUserService
36 {
37 /// <summary>
38 /// Add a temporary user profile.
39 /// </summary>
40 /// A temporary user profile is one that should exist only for the lifetime of the process.
41 /// <param name="userProfile"></param>
42 void AddTemporaryUserProfile(UserProfileData userProfile);
43
44 /// <summary>
45 /// Loads a user profile by name
46 /// </summary>
47 /// <param name="firstName">First name</param>
48 /// <param name="lastName">Last name</param>
49 /// <returns>A user profile. Returns null if no profile is found</returns>
50 UserProfileData GetUserProfile(string firstName, string lastName);
51
52 /// <summary>
53 /// Loads a user profile from a database by UUID
54 /// </summary>
55 /// <param name="userId">The target UUID</param>
56 /// <returns>A user profile. Returns null if no user profile is found.</returns>
57 UserProfileData GetUserProfile(UUID userId);
58
59 UserProfileData GetUserProfile(Uri uri);
60
61 Uri GetUserUri(UserProfileData userProfile);
62
63 UserAgentData GetAgentByUUID(UUID userId);
64
65 void ClearUserAgent(UUID avatarID);
66 List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID QueryID, string Query);
67
68 UserProfileData SetupMasterUser(string firstName, string lastName);
69 UserProfileData SetupMasterUser(string firstName, string lastName, string password);
70 UserProfileData SetupMasterUser(UUID userId);
71
72 /// <summary>
73 /// Update the user's profile.
74 /// </summary>
75 /// <param name="data">UserProfileData object with updated data. Should be obtained
76 /// via a call to GetUserProfile().</param>
77 /// <returns>true if the update could be applied, false if it could not be applied.</returns>
78 bool UpdateUserProfile(UserProfileData data);
79
80 /// <summary>
81 /// Adds a new friend to the database for XUser
82 /// </summary>
83 /// <param name="friendlistowner">The agent that who's friends list is being added to</param>
84 /// <param name="friend">The agent that being added to the friends list of the friends list owner</param>
85 /// <param name="perms">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 </param>
86 void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms);
87
88 /// <summary>
89 /// Delete friend on friendlistowner's friendlist.
90 /// </summary>
91 /// <param name="friendlistowner">The agent that who's friends list is being updated</param>
92 /// <param name="friend">The Ex-friend agent</param>
93 void RemoveUserFriend(UUID friendlistowner, UUID friend);
94
95 /// <summary>
96 /// Update permissions for friend on friendlistowner's friendlist.
97 /// </summary>
98 /// <param name="friendlistowner">The agent that who's friends list is being updated</param>
99 /// <param name="friend">The agent that is getting or loosing permissions</param>
100 /// <param name="perms">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 </param>
101 void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms);
102
103 /// <summary>
104 /// Logs off a user on the user server
105 /// </summary>
106 /// <param name="userid">UUID of the user</param>
107 /// <param name="regionid">UUID of the Region</param>
108 /// <param name="regionhandle">regionhandle</param>
109 /// <param name="position">final position</param>
110 /// <param name="lookat">final lookat</param>
111 void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat);
112
113 /// <summary>
114 /// Logs off a user on the user server (deprecated as of 2008-08-27)
115 /// </summary>
116 /// <param name="userid">UUID of the user</param>
117 /// <param name="regionid">UUID of the Region</param>
118 /// <param name="regionhandle">regionhandle</param>
119 /// <param name="posx">final position x</param>
120 /// <param name="posy">final position y</param>
121 /// <param name="posz">final position z</param>
122 void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz);
123
124 /// <summary>
125 /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship
126 /// for UUID friendslistowner
127 /// </summary>
128 ///
129 /// <param name="friendlistowner">The agent for whom we're retreiving the friends Data.</param>
130 /// <returns>
131 /// A List of FriendListItems that contains info about the user's friends.
132 /// Always returns a list even if the user has no friends
133 /// </returns>
134 List<FriendListItem> GetUserFriendList(UUID friendlistowner);
135
136 // This probably shouldn't be here, it belongs to IAuthentication
137 // But since Scenes only have IUserService references, I'm placing it here for now.
138 bool VerifySession(UUID userID, UUID sessionID);
139
140 /// <summary>
141 /// Authenticate a user by their password.
142 /// </summary>
143 ///
144 /// This is used by callers outside the login process that want to
145 /// verify a user who has given their password.
146 ///
147 /// This should probably also be in IAuthentication but is here for the same reasons as VerifySession() is
148 ///
149 /// <param name="userID"></param>
150 /// <param name="password"></param>
151 /// <returns></returns>
152 bool AuthenticateUserByPassword(UUID userID, string password);
153
154 // Temporary Hack until we move everything to the new service model
155 void SetInventoryService(IInventoryService invService);
156 }
157}
diff --git a/OpenSim/Framework/Communications/Limit/IRequestLimitStrategy.cs b/OpenSim/Framework/Communications/Limit/IRequestLimitStrategy.cs
deleted file mode 100644
index 070d106..0000000
--- a/OpenSim/Framework/Communications/Limit/IRequestLimitStrategy.cs
+++ /dev/null
@@ -1,66 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28namespace OpenSim.Framework.Communications.Limit
29{
30 /// <summary>
31 /// Interface for strategies that can limit requests from the client. Currently only used in the
32 /// texture modules to deal with repeated requests for certain textures. However, limiting strategies
33 /// could be used with other requests.
34 /// </summary>
35 public interface IRequestLimitStrategy<TId>
36 {
37 /// <summary>
38 /// Should the request be allowed? If the id is not monitored, then the request is always allowed.
39 /// Otherwise, the strategy criteria will be applied.
40 /// </summary>
41 /// <param name="id"></param>
42 /// <returns></returns>
43 bool AllowRequest(TId id);
44
45 /// <summary>
46 /// Has the request been refused just once?
47 /// </summary>
48 /// <returns>False if the request has not yet been refused, or if the request has been refused more
49 /// than once.</returns>
50 bool IsFirstRefusal(TId id);
51
52 /// <summary>
53 /// Start monitoring for future AllowRequest calls. If the id is already monitored, then monitoring
54 /// continues.
55 /// </summary>
56 /// <param name="id"></param>
57 void MonitorRequests(TId id);
58
59 /// <summary>
60 /// Is the id being monitored?
61 /// </summary>
62 /// <param name="uuid"> </param>
63 /// <returns></returns>
64 bool IsMonitoringRequests(TId id);
65 }
66}
diff --git a/OpenSim/Framework/Communications/Limit/NullLimitStrategy.cs b/OpenSim/Framework/Communications/Limit/NullLimitStrategy.cs
deleted file mode 100644
index 7672653..0000000
--- a/OpenSim/Framework/Communications/Limit/NullLimitStrategy.cs
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28namespace OpenSim.Framework.Communications.Limit
29{
30 /// <summary>
31 /// Strategy which polices no limits
32 /// </summary>
33 public class NullLimitStrategy<TId> : IRequestLimitStrategy<TId>
34 {
35 public bool AllowRequest(TId id) { return true; }
36 public bool IsFirstRefusal(TId id) { return false; }
37 public void MonitorRequests(TId id) { /* intentionally blank */ }
38 public bool IsMonitoringRequests(TId id) { return false; }
39 }
40}
diff --git a/OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs b/OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs
deleted file mode 100644
index 44dd592..0000000
--- a/OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs
+++ /dev/null
@@ -1,109 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Collections.Generic;
29
30namespace OpenSim.Framework.Communications.Limit
31{
32 /// <summary>
33 /// Limit requests by discarding them after they've been repeated a certain number of times.
34 /// </summary>
35 public class RepeatLimitStrategy<TId> : IRequestLimitStrategy<TId>
36 {
37 /// <summary>
38 /// Record each asset request that we're notified about.
39 /// </summary>
40 private readonly Dictionary<TId, int> requestCounts = new Dictionary<TId, int>();
41
42 /// <summary>
43 /// The maximum number of requests that can be made before we drop subsequent requests.
44 /// </summary>
45 private readonly int m_maxRequests;
46 public int MaxRequests
47 {
48 get { return m_maxRequests; }
49 }
50
51 /// <summary></summary>
52 /// <param name="maxRequests">The maximum number of requests that may be served before all further
53 /// requests are dropped.</param>
54 public RepeatLimitStrategy(int maxRequests)
55 {
56 m_maxRequests = maxRequests;
57 }
58
59 /// <summary>
60 /// <see cref="IRequestLimitStrategy"/>
61 /// </summary>
62 public bool AllowRequest(TId id)
63 {
64 if (requestCounts.ContainsKey(id))
65 {
66 requestCounts[id] += 1;
67
68 if (requestCounts[id] > m_maxRequests)
69 {
70 return false;
71 }
72 }
73
74 return true;
75 }
76
77 /// <summary>
78 /// <see cref="IRequestLimitStrategy"/>
79 /// </summary>
80 public bool IsFirstRefusal(TId id)
81 {
82 if (requestCounts.ContainsKey(id) && m_maxRequests + 1 == requestCounts[id])
83 {
84 return true;
85 }
86
87 return false;
88 }
89
90 /// <summary>
91 /// <see cref="IRequestLimitStrategy"/>
92 /// </summary>
93 public void MonitorRequests(TId id)
94 {
95 if (!IsMonitoringRequests(id))
96 {
97 requestCounts.Add(id, 1);
98 }
99 }
100
101 /// <summary>
102 /// <see cref="IRequestLimitStrategy"/>
103 /// </summary>
104 public bool IsMonitoringRequests(TId id)
105 {
106 return requestCounts.ContainsKey(id);
107 }
108 }
109}
diff --git a/OpenSim/Framework/Communications/Limit/TimeLimitStrategy.cs b/OpenSim/Framework/Communications/Limit/TimeLimitStrategy.cs
deleted file mode 100644
index 7ac8293..0000000
--- a/OpenSim/Framework/Communications/Limit/TimeLimitStrategy.cs
+++ /dev/null
@@ -1,140 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30
31namespace OpenSim.Framework.Communications.Limit
32{
33 /// <summary>
34 /// Limit requests by discarding repeat attempts that occur within a given time period
35 ///
36 /// XXX Don't use this for limiting texture downloading, at least not until we better handle multiple requests
37 /// for the same texture at different resolutions.
38 /// </summary>
39 public class TimeLimitStrategy<TId> : IRequestLimitStrategy<TId>
40 {
41 /// <summary>
42 /// Record the time at which an asset request occurs.
43 /// </summary>
44 private readonly Dictionary<TId, Request> requests = new Dictionary<TId, Request>();
45
46 /// <summary>
47 /// The minimum time period between which requests for the same data will be serviced.
48 /// </summary>
49 private readonly TimeSpan m_repeatPeriod;
50 public TimeSpan RepeatPeriod
51 {
52 get { return m_repeatPeriod; }
53 }
54
55 /// <summary></summary>
56 /// <param name="repeatPeriod"></param>
57 public TimeLimitStrategy(TimeSpan repeatPeriod)
58 {
59 m_repeatPeriod = repeatPeriod;
60 }
61
62 /// <summary>
63 /// <see cref="IRequestLimitStrategy"/>
64 /// </summary>
65 public bool AllowRequest(TId id)
66 {
67 if (IsMonitoringRequests(id))
68 {
69 DateTime now = DateTime.Now;
70 TimeSpan elapsed = now - requests[id].Time;
71
72 if (elapsed < RepeatPeriod)
73 {
74 requests[id].Refusals += 1;
75 return false;
76 }
77
78 requests[id].Time = now;
79 }
80
81 return true;
82 }
83
84 /// <summary>
85 /// <see cref="IRequestLimitStrategy"/>
86 /// </summary>
87 public bool IsFirstRefusal(TId id)
88 {
89 if (IsMonitoringRequests(id))
90 {
91 if (1 == requests[id].Refusals)
92 {
93 return true;
94 }
95 }
96
97 return false;
98 }
99
100 /// <summary>
101 /// <see cref="IRequestLimitStrategy"/>
102 /// </summary>
103 public void MonitorRequests(TId id)
104 {
105 if (!IsMonitoringRequests(id))
106 {
107 requests.Add(id, new Request(DateTime.Now));
108 }
109 }
110
111 /// <summary>
112 /// <see cref="IRequestLimitStrategy"/>
113 /// </summary>
114 public bool IsMonitoringRequests(TId id)
115 {
116 return requests.ContainsKey(id);
117 }
118 }
119
120 /// <summary>
121 /// Private request details.
122 /// </summary>
123 class Request
124 {
125 /// <summary>
126 /// Time of last request
127 /// </summary>
128 public DateTime Time;
129
130 /// <summary>
131 /// Number of refusals associated with this request
132 /// </summary>
133 public int Refusals;
134
135 public Request(DateTime time)
136 {
137 Time = time;
138 }
139 }
140}
diff --git a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
deleted file mode 100644
index b398167..0000000
--- a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,65 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Reflection;
29using System.Runtime.InteropServices;
30
31// General information about an assembly is controlled through the following
32// set of attributes. Change these attribute values to modify the information
33// associated with an assembly.
34
35[assembly : AssemblyTitle("OpenSim.Framework.Communications")]
36[assembly : AssemblyDescription("")]
37[assembly : AssemblyConfiguration("")]
38[assembly : AssemblyCompany("http://opensimulator.org")]
39[assembly : AssemblyProduct("OpenSim")]
40[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers")]
41[assembly : AssemblyTrademark("")]
42[assembly : AssemblyCulture("")]
43
44// Setting ComVisible to false makes the types in this assembly not visible
45// to COM components. If you need to access a type in this assembly from
46// COM, set the ComVisible attribute to true on that type.
47
48[assembly : ComVisible(false)]
49
50// The following GUID is for the ID of the typelib if this project is exposed to COM
51
52[assembly : Guid("13e7c396-78a9-4a5c-baf2-6f980ea75d95")]
53
54// Version information for an assembly consists of the following four values:
55//
56// Major Version
57// Minor Version
58// Build Number
59// Revision
60//
61// You can specify all the values or you can default the Revision and Build Numbers
62// by using the '*' as shown below:
63
64[assembly : AssemblyVersion("0.8.2.*")]
65
diff --git a/OpenSim/Framework/Communications/XMPP/XmppError.cs b/OpenSim/Framework/Communications/XMPP/XmppError.cs
deleted file mode 100644
index 3d36e9c..0000000
--- a/OpenSim/Framework/Communications/XMPP/XmppError.cs
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Xml.Serialization;
29
30namespace OpenSim.Framework.Communications.XMPP
31{
32 [XmlRoot("error")]
33 public class XmppErrorStanza
34 {
35 public XmppErrorStanza()
36 {
37 }
38 }
39}
diff --git a/OpenSim/Framework/Communications/XMPP/XmppIqStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppIqStanza.cs
deleted file mode 100644
index 12263f4..0000000
--- a/OpenSim/Framework/Communications/XMPP/XmppIqStanza.cs
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Xml.Serialization;
29
30namespace OpenSim.Framework.Communications.XMPP
31{
32 /// <summary>
33 /// An IQ needs to have one of the follow types set.
34 /// </summary>
35 public enum XmppIqType
36 {
37 [XmlEnum("set")] set,
38 [XmlEnum("get")] get,
39 [XmlEnum("result")] result,
40 [XmlEnum("error")] error,
41 }
42
43 /// <summary>
44 /// XmppIqStanza needs to be subclassed as the query content is
45 /// specific to the query type.
46 /// </summary>
47 [XmlRoot("iq")]
48 public abstract class XmppIqStanza: XmppStanza
49 {
50 /// <summary>
51 /// IQ type: one of set, get, result, error
52 /// </summary>
53 [XmlAttribute("type")]
54 public XmppIqType Type;
55
56 public XmppIqStanza(): base()
57 {
58 }
59 }
60}
diff --git a/OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs
deleted file mode 100644
index 1e8c33e..0000000
--- a/OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Xml.Serialization;
29
30namespace OpenSim.Framework.Communications.XMPP
31{
32 /// <summary>
33 /// Message types.
34 /// </summary>
35 public enum XmppMessageType
36 {
37 [XmlEnum("chat")] chat,
38 [XmlEnum("error")] error,
39 [XmlEnum("groupchat")] groupchat,
40 [XmlEnum("headline")] headline,
41 [XmlEnum("normal")] normal,
42 }
43
44 /// <summary>
45 /// Message body.
46 /// </summary>
47 public class XmppMessageBody
48 {
49 [XmlText]
50 public string Text;
51
52 public XmppMessageBody()
53 {
54 }
55
56 public XmppMessageBody(string message)
57 {
58 Text = message;
59 }
60
61 new public string ToString()
62 {
63 return Text;
64 }
65 }
66
67 [XmlRoot("message")]
68 public class XmppMessageStanza: XmppStanza
69 {
70 /// <summary>
71 /// IQ type: one of set, get, result, error
72 /// </summary>
73 [XmlAttribute("type")]
74 public XmppMessageType MessageType;
75
76 // [XmlAttribute("error")]
77 // public XmppError Error;
78
79 [XmlElement("body")]
80 public XmppMessageBody Body;
81
82 public XmppMessageStanza() : base()
83 {
84 }
85
86 public XmppMessageStanza(string fromJid, string toJid, XmppMessageType mType, string message) :
87 base(fromJid, toJid)
88 {
89 MessageType = mType;
90 Body = new XmppMessageBody(message);
91 }
92 }
93}
diff --git a/OpenSim/Framework/Communications/XMPP/XmppPresenceStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppPresenceStanza.cs
deleted file mode 100644
index 4d45ac0..0000000
--- a/OpenSim/Framework/Communications/XMPP/XmppPresenceStanza.cs
+++ /dev/null
@@ -1,69 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Xml.Serialization;
29
30namespace OpenSim.Framework.Communications.XMPP
31{
32 /// <summary>
33 /// Message types.
34 /// </summary>
35 public enum XmppPresenceType
36 {
37 [XmlEnum("unavailable")] unavailable,
38 [XmlEnum("subscribe")] subscribe,
39 [XmlEnum("subscribed")] subscribed,
40 [XmlEnum("unsubscribe")] unsubscribe,
41 [XmlEnum("unsubscribed")] unsubscribed,
42 [XmlEnum("probe")] probe,
43 [XmlEnum("error")] error,
44 }
45
46
47 [XmlRoot("message")]
48 public class XmppPresenceStanza: XmppStanza
49 {
50 /// <summary>
51 /// IQ type: one of set, get, result, error
52 /// </summary>
53 [XmlAttribute("type")]
54 public XmppPresenceType PresenceType;
55
56 // [XmlAttribute("error")]
57 // public XmppError Error;
58
59 public XmppPresenceStanza() : base()
60 {
61 }
62
63 public XmppPresenceStanza(string fromJid, string toJid, XmppPresenceType pType) :
64 base(fromJid, toJid)
65 {
66 PresenceType = pType;
67 }
68 }
69}
diff --git a/OpenSim/Framework/Communications/XMPP/XmppSerializer.cs b/OpenSim/Framework/Communications/XMPP/XmppSerializer.cs
deleted file mode 100644
index e37ef28..0000000
--- a/OpenSim/Framework/Communications/XMPP/XmppSerializer.cs
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Xml;
31using System.Xml.Serialization;
32
33namespace OpenSim.Framework.Communications.XMPP
34{
35 public class XmppSerializer
36 {
37 // private static readonly ILog _log =
38 // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
39
40 // need to do it this way, as XmlSerializer(type, extratypes)
41 // does not work on mono (at least).
42 private Dictionary<Type, XmlSerializer> _serializerForType = new Dictionary<Type, XmlSerializer>();
43 private Dictionary<string, XmlSerializer> _serializerForName = new Dictionary<string, XmlSerializer>();
44 private XmlSerializerNamespaces _xmlNs;
45 private string _defaultNS;
46
47 public XmppSerializer(bool server)
48 {
49 _xmlNs = new XmlSerializerNamespaces();
50 _xmlNs.Add(String.Empty, String.Empty);
51 if (server)
52 _defaultNS = "jabber:server";
53 else
54 _defaultNS = "jabber:client";
55
56 // TODO: do this via reflection
57 _serializerForType[typeof(XmppMessageStanza)] = _serializerForName["message"] =
58 new XmlSerializer(typeof(XmppMessageStanza), _defaultNS);
59 }
60
61 public void Serialize(XmlWriter xw, object o)
62 {
63 if (!_serializerForType.ContainsKey(o.GetType()))
64 throw new ArgumentException(String.Format("no serializer available for type {0}", o.GetType()));
65
66 _serializerForType[o.GetType()].Serialize(xw, o, _xmlNs);
67 }
68
69 public object Deserialize(XmlReader xr)
70 {
71 // position on next element
72 xr.Read();
73 if (!_serializerForName.ContainsKey(xr.LocalName))
74 throw new ArgumentException(String.Format("no serializer available for name {0}", xr.LocalName));
75
76 return _serializerForName[xr.LocalName].Deserialize(xr);
77 }
78 }
79}
diff --git a/OpenSim/Framework/Communications/XMPP/XmppStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppStanza.cs
deleted file mode 100644
index 5312a31..0000000
--- a/OpenSim/Framework/Communications/XMPP/XmppStanza.cs
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Xml.Serialization;
30
31namespace OpenSim.Framework.Communications.XMPP
32{
33 public abstract class XmppStanza
34 {
35 /// <summary>
36 /// counter used for generating ID
37 /// </summary>
38 [XmlIgnore]
39 private static ulong _ctr = 0;
40
41 /// <summary>
42 /// recipient JID
43 /// </summary>
44 [XmlAttribute("to")]
45 public string ToJid;
46
47 /// <summary>
48 /// sender JID
49 /// </summary>
50 [XmlAttribute("from")]
51 public string FromJid;
52
53 /// <summary>
54 /// unique ID.
55 /// </summary>
56 [XmlAttribute("id")]
57 public string MessageId;
58
59 public XmppStanza()
60 {
61 }
62
63 public XmppStanza(string fromJid, string toJid)
64 {
65 ToJid = toJid;
66 FromJid = fromJid;
67 MessageId = String.Format("OpenSim_{0}{1}", DateTime.UtcNow.Ticks, _ctr++);
68 }
69 }
70}
diff --git a/OpenSim/Framework/Communications/XMPP/XmppWriter.cs b/OpenSim/Framework/Communications/XMPP/XmppWriter.cs
deleted file mode 100644
index 415d808..0000000
--- a/OpenSim/Framework/Communications/XMPP/XmppWriter.cs
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.IO;
29using System.Text;
30using System.Xml;
31using IOStream = System.IO.Stream;
32
33namespace OpenSim.Framework.Communications.XMPP
34{
35 public class XMPPWriter: XmlTextWriter
36 {
37 public XMPPWriter(TextWriter textWriter) : base(textWriter)
38 {
39 }
40
41 public XMPPWriter(IOStream stream) : this(stream, Util.UTF8)
42 {
43 }
44
45 public XMPPWriter(IOStream stream, Encoding enc) : base(stream, enc)
46 {
47 }
48
49 public override void WriteStartDocument()
50 {
51 }
52
53 public override void WriteStartDocument(bool standalone)
54 {
55 }
56 }
57}
diff --git a/OpenSim/Framework/ForeignUserProfileData.cs b/OpenSim/Framework/ForeignUserProfileData.cs
deleted file mode 100644
index 2beaf80..0000000
--- a/OpenSim/Framework/ForeignUserProfileData.cs
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29
30namespace OpenSim.Framework
31{
32 public class ForeignUserProfileData : UserProfileData
33 {
34 /// <summary>
35 /// The address of the users home sim, used for foreigners.
36 /// </summary>
37 private string _userUserServerURI = String.Empty;
38
39 /// <summary>
40 /// The address of the users home sim, used for foreigners.
41 /// </summary>
42 private string _userHomeAddress = String.Empty;
43
44 /// <summary>
45 /// The port of the users home sim, used for foreigners.
46 /// </summary>
47 private string _userHomePort = String.Empty;
48 /// <summary>
49 /// The remoting port of the users home sim, used for foreigners.
50 /// </summary>
51 private string _userHomeRemotingPort = String.Empty;
52
53 public string UserServerURI
54 {
55 get { return _userUserServerURI; }
56 set { _userUserServerURI = value; }
57 }
58
59 public string UserHomeAddress
60 {
61 get { return _userHomeAddress; }
62 set { _userHomeAddress = value; }
63 }
64
65 public string UserHomePort
66 {
67 get { return _userHomePort; }
68 set { _userHomePort = value; }
69 }
70
71 public string UserHomeRemotingPort
72 {
73 get { return _userHomeRemotingPort; }
74 set { _userHomeRemotingPort = value; }
75 }
76 }
77}
diff --git a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs b/OpenSim/Framework/LogWriter.cs
index a176958..2e0bf4a 100755
--- a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs
+++ b/OpenSim/Framework/LogWriter.cs
@@ -30,7 +30,7 @@ using System.IO;
30using System.Text; 30using System.Text;
31using log4net; 31using log4net;
32 32
33namespace OpenSim.Region.CoreModules.Framework.Statistics.Logging 33namespace OpenSim.Framework
34{ 34{
35 /// <summary> 35 /// <summary>
36 /// Class for writing a high performance, high volume log file. 36 /// Class for writing a high performance, high volume log file.
diff --git a/OpenSim/Framework/Communications/OutboundUrlFilter.cs b/OpenSim/Framework/OutboundUrlFilter.cs
index 8b572d1..baa3647 100644
--- a/OpenSim/Framework/Communications/OutboundUrlFilter.cs
+++ b/OpenSim/Framework/OutboundUrlFilter.cs
@@ -34,7 +34,7 @@ using log4net;
34using LukeSkywalker.IPNetwork; 34using LukeSkywalker.IPNetwork;
35using Nini.Config; 35using Nini.Config;
36 36
37namespace OpenSim.Framework.Communications 37namespace OpenSim.Framework
38{ 38{
39 public class OutboundUrlFilter 39 public class OutboundUrlFilter
40 { 40 {
@@ -62,7 +62,7 @@ namespace OpenSim.Framework.Communications
62 } 62 }
63 63
64 /// <summary> 64 /// <summary>
65 /// Initializes a new instance of the <see cref="OpenSim.Framework.Communications.OutboundUrlFilter"/> class. 65 /// Initializes a new instance of the <see cref="OpenSim.Framework.OutboundUrlFilter"/> class.
66 /// </summary> 66 /// </summary>
67 /// <param name="name">Name of the filter for logging purposes.</param> 67 /// <param name="name">Name of the filter for logging purposes.</param>
68 /// <param name="config">Filter configuration</param> 68 /// <param name="config">Filter configuration</param>
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs b/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs
deleted file mode 100644
index 3bcbe2f..0000000
--- a/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Framework.RegionLoader.Filesystem")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("4ab5c74b-e886-40a1-b67d-a04df285e706")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.8.2.*")]
33
diff --git a/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs b/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs
deleted file mode 100644
index 1b2519c..0000000
--- a/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Framework.RegionLoader.Web")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("985afff8-e7ed-4056-acce-39abf7a43d33")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.8.2.*")]
33
diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/RestClient.cs
index 807222b..ca19392 100644
--- a/OpenSim/Framework/Communications/RestClient.cs
+++ b/OpenSim/Framework/RestClient.cs
@@ -37,7 +37,7 @@ using log4net;
37 37
38using OpenSim.Framework.ServiceAuth; 38using OpenSim.Framework.ServiceAuth;
39 39
40namespace OpenSim.Framework.Communications 40namespace OpenSim.Framework
41{ 41{
42 /// <summary> 42 /// <summary>
43 /// Implementation of a generic REST client 43 /// Implementation of a generic REST client
@@ -524,4 +524,158 @@ namespace OpenSim.Framework.Communications
524 524
525 #endregion Async Invocation 525 #endregion Async Invocation
526 } 526 }
527
528 internal class SimpleAsyncResult : IAsyncResult
529 {
530 private readonly AsyncCallback m_callback;
531
532 /// <summary>
533 /// Is process completed?
534 /// </summary>
535 /// <remarks>Should really be boolean, but VolatileRead has no boolean method</remarks>
536 private byte m_completed;
537
538 /// <summary>
539 /// Did process complete synchronously?
540 /// </summary>
541 /// <remarks>I have a hard time imagining a scenario where this is the case, again, same issue about
542 /// booleans and VolatileRead as m_completed
543 /// </remarks>
544 private byte m_completedSynchronously;
545
546 private readonly object m_asyncState;
547 private ManualResetEvent m_waitHandle;
548 private Exception m_exception;
549
550 internal SimpleAsyncResult(AsyncCallback cb, object state)
551 {
552 m_callback = cb;
553 m_asyncState = state;
554 m_completed = 0;
555 m_completedSynchronously = 1;
556 }
557
558 #region IAsyncResult Members
559
560 public object AsyncState
561 {
562 get { return m_asyncState; }
563 }
564
565 public WaitHandle AsyncWaitHandle
566 {
567 get
568 {
569 if (m_waitHandle == null)
570 {
571 bool done = IsCompleted;
572 ManualResetEvent mre = new ManualResetEvent(done);
573 if (Interlocked.CompareExchange(ref m_waitHandle, mre, null) != null)
574 {
575 mre.Close();
576 }
577 else
578 {
579 if (!done && IsCompleted)
580 {
581 m_waitHandle.Set();
582 }
583 }
584 }
585
586 return m_waitHandle;
587 }
588 }
589
590
591 public bool CompletedSynchronously
592 {
593 get { return Thread.VolatileRead(ref m_completedSynchronously) == 1; }
594 }
595
596
597 public bool IsCompleted
598 {
599 get { return Thread.VolatileRead(ref m_completed) == 1; }
600 }
601
602 #endregion
603
604 #region class Methods
605
606 internal void SetAsCompleted(bool completedSynchronously)
607 {
608 m_completed = 1;
609 if (completedSynchronously)
610 m_completedSynchronously = 1;
611 else
612 m_completedSynchronously = 0;
613
614 SignalCompletion();
615 }
616
617 internal void HandleException(Exception e, bool completedSynchronously)
618 {
619 m_completed = 1;
620 if (completedSynchronously)
621 m_completedSynchronously = 1;
622 else
623 m_completedSynchronously = 0;
624 m_exception = e;
625
626 SignalCompletion();
627 }
628
629 private void SignalCompletion()
630 {
631 if (m_waitHandle != null) m_waitHandle.Set();
632
633 if (m_callback != null) m_callback(this);
634 }
635
636 public void EndInvoke()
637 {
638 // This method assumes that only 1 thread calls EndInvoke
639 if (!IsCompleted)
640 {
641 // If the operation isn't done, wait for it
642 AsyncWaitHandle.WaitOne();
643 AsyncWaitHandle.Close();
644 m_waitHandle.Close();
645 m_waitHandle = null; // Allow early GC
646 }
647
648 // Operation is done: if an exception occured, throw it
649 if (m_exception != null) throw m_exception;
650 }
651
652 #endregion
653 }
654
655 internal class AsyncResult<T> : SimpleAsyncResult
656 {
657 private T m_result = default(T);
658
659 public AsyncResult(AsyncCallback asyncCallback, Object state) :
660 base(asyncCallback, state)
661 {
662 }
663
664 public void SetAsCompleted(T result, bool completedSynchronously)
665 {
666 // Save the asynchronous operation's result
667 m_result = result;
668
669 // Tell the base class that the operation completed
670 // sucessfully (no exception)
671 base.SetAsCompleted(completedSynchronously);
672 }
673
674 public new T EndInvoke()
675 {
676 base.EndInvoke();
677 return m_result;
678 }
679 }
680
527} 681}
diff --git a/OpenSim/Region/Application/OpenSimBackground.cs b/OpenSim/Region/Application/OpenSimBackground.cs
index 008c6b0..15d9065 100644
--- a/OpenSim/Region/Application/OpenSimBackground.cs
+++ b/OpenSim/Region/Application/OpenSimBackground.cs
@@ -55,7 +55,7 @@ namespace OpenSim
55 base.Startup(); 55 base.Startup();
56 56
57 m_log.InfoFormat("[OPENSIM MAIN]: Startup complete, serving {0} region{1}", 57 m_log.InfoFormat("[OPENSIM MAIN]: Startup complete, serving {0} region{1}",
58 m_clientServers.Count.ToString(), m_clientServers.Count > 1 ? "s" : ""); 58 SceneManager.Scenes.Count, SceneManager.Scenes.Count > 1 ? "s" : "");
59 59
60 WorldHasComeToAnEnd.WaitOne(); 60 WorldHasComeToAnEnd.WaitOne();
61 WorldHasComeToAnEnd.Close(); 61 WorldHasComeToAnEnd.Close();
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 9108e5d..a7ebff3 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -36,17 +36,15 @@ using log4net;
36using Nini.Config; 36using Nini.Config;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Communications;
40using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
41using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
42using OpenSim.Framework.Servers.HttpServer; 41using OpenSim.Framework.Servers.HttpServer;
43using OpenSim.Framework.Monitoring; 42using OpenSim.Framework.Monitoring;
44using OpenSim.Region.ClientStack;
45using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; 43using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
46using OpenSim.Region.Framework; 44using OpenSim.Region.Framework;
47using OpenSim.Region.Framework.Interfaces; 45using OpenSim.Region.Framework.Interfaces;
48using OpenSim.Region.Framework.Scenes; 46using OpenSim.Region.Framework.Scenes;
49using OpenSim.Region.Physics.Manager; 47using OpenSim.Region.PhysicsModules.SharedBase;
50using OpenSim.Server.Base; 48using OpenSim.Server.Base;
51using OpenSim.Services.Base; 49using OpenSim.Services.Base;
52using OpenSim.Services.Interfaces; 50using OpenSim.Services.Interfaces;
@@ -121,19 +119,12 @@ namespace OpenSim
121 /// </value> 119 /// </value>
122 public OpenSimConfigSource ConfigSource { get; private set; } 120 public OpenSimConfigSource ConfigSource { get; private set; }
123 121
124 public List<IClientNetworkServer> ClientServers
125 {
126 get { return m_clientServers; }
127 }
128
129 protected EnvConfigSource m_EnvConfigSource = new EnvConfigSource(); 122 protected EnvConfigSource m_EnvConfigSource = new EnvConfigSource();
130 123
131 public EnvConfigSource envConfigSource 124 public EnvConfigSource envConfigSource
132 { 125 {
133 get { return m_EnvConfigSource; } 126 get { return m_EnvConfigSource; }
134 } 127 }
135
136 protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>();
137 128
138 public uint HttpServerPort 129 public uint HttpServerPort
139 { 130 {
@@ -371,9 +362,9 @@ namespace OpenSim
371 /// <param name="regionInfo"></param> 362 /// <param name="regionInfo"></param>
372 /// <param name="portadd_flag"></param> 363 /// <param name="portadd_flag"></param>
373 /// <returns></returns> 364 /// <returns></returns>
374 public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) 365 public void CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene)
375 { 366 {
376 return CreateRegion(regionInfo, portadd_flag, false, out scene); 367 CreateRegion(regionInfo, portadd_flag, false, out scene);
377 } 368 }
378 369
379 /// <summary> 370 /// <summary>
@@ -381,9 +372,9 @@ namespace OpenSim
381 /// </summary> 372 /// </summary>
382 /// <param name="regionInfo"></param> 373 /// <param name="regionInfo"></param>
383 /// <returns></returns> 374 /// <returns></returns>
384 public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, out IScene scene) 375 public void CreateRegion(RegionInfo regionInfo, out IScene scene)
385 { 376 {
386 return CreateRegion(regionInfo, false, true, out scene); 377 CreateRegion(regionInfo, false, true, out scene);
387 } 378 }
388 379
389 /// <summary> 380 /// <summary>
@@ -393,7 +384,7 @@ namespace OpenSim
393 /// <param name="portadd_flag"></param> 384 /// <param name="portadd_flag"></param>
394 /// <param name="do_post_init"></param> 385 /// <param name="do_post_init"></param>
395 /// <returns></returns> 386 /// <returns></returns>
396 public List<IClientNetworkServer> CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) 387 public void CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene)
397 { 388 {
398 int port = regionInfo.InternalEndPoint.Port; 389 int port = regionInfo.InternalEndPoint.Port;
399 390
@@ -418,8 +409,7 @@ namespace OpenSim
418 Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); 409 Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName);
419 } 410 }
420 411
421 List<IClientNetworkServer> clientServers; 412 Scene scene = SetupScene(regionInfo, proxyOffset, Config);
422 Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServers);
423 413
424 m_log.Info("[MODULES]: Loading Region's modules (old style)"); 414 m_log.Info("[MODULES]: Loading Region's modules (old style)");
425 415
@@ -511,14 +501,14 @@ namespace OpenSim
511 501
512 SceneManager.Add(scene); 502 SceneManager.Add(scene);
513 503
514 if (m_autoCreateClientStack) 504 //if (m_autoCreateClientStack)
515 { 505 //{
516 foreach (IClientNetworkServer clientserver in clientServers) 506 // foreach (IClientNetworkServer clientserver in clientServers)
517 { 507 // {
518 m_clientServers.Add(clientserver); 508 // m_clientServers.Add(clientserver);
519 clientserver.Start(); 509 // clientserver.Start();
520 } 510 // }
521 } 511 //}
522 512
523 if (scene.SnmpService != null) 513 if (scene.SnmpService != null)
524 { 514 {
@@ -534,7 +524,7 @@ namespace OpenSim
534 scene.SnmpService.LinkUp(scene); 524 scene.SnmpService.LinkUp(scene);
535 } 525 }
536 526
537 return clientServers; 527 //return clientServers;
538 } 528 }
539 529
540 /// <summary> 530 /// <summary>
@@ -673,7 +663,7 @@ namespace OpenSim
673 663
674 scene.DeleteAllSceneObjects(); 664 scene.DeleteAllSceneObjects();
675 SceneManager.CloseScene(scene); 665 SceneManager.CloseScene(scene);
676 ShutdownClientServer(scene.RegionInfo); 666 //ShutdownClientServer(scene.RegionInfo);
677 667
678 if (!cleanup) 668 if (!cleanup)
679 return; 669 return;
@@ -734,7 +724,7 @@ namespace OpenSim
734 } 724 }
735 725
736 SceneManager.CloseScene(scene); 726 SceneManager.CloseScene(scene);
737 ShutdownClientServer(scene.RegionInfo); 727 //ShutdownClientServer(scene.RegionInfo);
738 } 728 }
739 729
740 /// <summary> 730 /// <summary>
@@ -755,9 +745,9 @@ namespace OpenSim
755 /// <param name="regionInfo"></param> 745 /// <param name="regionInfo"></param>
756 /// <param name="clientServer"> </param> 746 /// <param name="clientServer"> </param>
757 /// <returns></returns> 747 /// <returns></returns>
758 protected Scene SetupScene(RegionInfo regionInfo, out List<IClientNetworkServer> clientServer) 748 protected Scene SetupScene(RegionInfo regionInfo)
759 { 749 {
760 return SetupScene(regionInfo, 0, null, out clientServer); 750 return SetupScene(regionInfo, 0, null);
761 } 751 }
762 752
763 /// <summary> 753 /// <summary>
@@ -768,55 +758,18 @@ namespace OpenSim
768 /// <param name="configSource"></param> 758 /// <param name="configSource"></param>
769 /// <param name="clientServer"> </param> 759 /// <param name="clientServer"> </param>
770 /// <returns></returns> 760 /// <returns></returns>
771 protected Scene SetupScene( 761 protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, IConfigSource configSource)
772 RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out List<IClientNetworkServer> clientServer)
773 { 762 {
774 List<IClientNetworkServer> clientNetworkServers = null; 763 //List<IClientNetworkServer> clientNetworkServers = null;
775 764
776 AgentCircuitManager circuitManager = new AgentCircuitManager(); 765 AgentCircuitManager circuitManager = new AgentCircuitManager();
777 IPAddress listenIP = regionInfo.InternalEndPoint.Address;
778 //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP))
779 // listenIP = IPAddress.Parse("0.0.0.0");
780
781 uint port = (uint) regionInfo.InternalEndPoint.Port;
782
783 if (m_autoCreateClientStack)
784 {
785 clientNetworkServers = m_clientStackManager.CreateServers(
786 listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource,
787 circuitManager);
788 }
789 else
790 {
791 clientServer = null;
792 }
793
794 regionInfo.InternalEndPoint.Port = (int) port;
795
796 Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager); 766 Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager);
797 767
798 if (m_autoCreateClientStack)
799 {
800 foreach (IClientNetworkServer clientnetserver in clientNetworkServers)
801 {
802 clientnetserver.AddScene(scene);
803 }
804 }
805 clientServer = clientNetworkServers;
806 scene.LoadWorldMap(); 768 scene.LoadWorldMap();
807 769
808 scene.PhysicsScene.RequestAssetMethod = scene.PhysicsRequestAsset;
809 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
810 scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight);
811
812 return scene; 770 return scene;
813 } 771 }
814 772
815 protected override ClientStackManager CreateClientStackManager()
816 {
817 return new ClientStackManager(m_configSettings.ClientstackDll);
818 }
819
820 protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, 773 protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService,
821 IEstateDataService estateDataService, AgentCircuitManager circuitManager) 774 IEstateDataService estateDataService, AgentCircuitManager circuitManager)
822 { 775 {
@@ -825,42 +778,18 @@ namespace OpenSim
825 SceneCommunicationService sceneGridService = new SceneCommunicationService(); 778 SceneCommunicationService sceneGridService = new SceneCommunicationService();
826 779
827 return new Scene( 780 return new Scene(
828 regionInfo, circuitManager, physicsScene, sceneGridService, 781 regionInfo, circuitManager,
829 simDataService, estateDataService, 782 simDataService, estateDataService,
830 Config, m_version); 783 Config, m_version);
831 } 784 }
832 785
833 protected void ShutdownClientServer(RegionInfo whichRegion)
834 {
835 // Close and remove the clientserver for a region
836 bool foundClientServer = false;
837 int clientServerElement = 0;
838 Location location = new Location(whichRegion.RegionHandle);
839
840 for (int i = 0; i < m_clientServers.Count; i++)
841 {
842 if (m_clientServers[i].HandlesRegion(location))
843 {
844 clientServerElement = i;
845 foundClientServer = true;
846 break;
847 }
848 }
849
850 if (foundClientServer)
851 {
852 m_clientServers[clientServerElement].Stop();
853 m_clientServers.RemoveAt(clientServerElement);
854 }
855 }
856
857 protected virtual void HandleRestartRegion(RegionInfo whichRegion) 786 protected virtual void HandleRestartRegion(RegionInfo whichRegion)
858 { 787 {
859 m_log.InfoFormat( 788 m_log.InfoFormat(
860 "[OPENSIM]: Got restart signal from SceneManager for region {0} ({1},{2})", 789 "[OPENSIM]: Got restart signal from SceneManager for region {0} ({1},{2})",
861 whichRegion.RegionName, whichRegion.RegionLocX, whichRegion.RegionLocY); 790 whichRegion.RegionName, whichRegion.RegionLocX, whichRegion.RegionLocY);
862 791
863 ShutdownClientServer(whichRegion); 792 //ShutdownClientServer(whichRegion);
864 IScene scene; 793 IScene scene;
865 CreateRegion(whichRegion, true, out scene); 794 CreateRegion(whichRegion, true, out scene);
866 scene.Start(); 795 scene.Start();
@@ -868,12 +797,6 @@ namespace OpenSim
868 797
869 # region Setup methods 798 # region Setup methods
870 799
871 protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier, Vector3 regionExtent)
872 {
873 return GetPhysicsScene(
874 m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, Config, osSceneIdentifier, regionExtent);
875 }
876
877 /// <summary> 800 /// <summary>
878 /// Handler to supply the current status of this sim 801 /// Handler to supply the current status of this sim
879 /// </summary> 802 /// </summary>
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/Application/RegionApplicationBase.cs
index 332bff9..ba92fd6 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/Application/RegionApplicationBase.cs
@@ -32,16 +32,15 @@ using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
37using OpenSim.Framework.Servers.HttpServer; 36using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Region.Framework; 37using OpenSim.Region.Framework;
39using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Physics.Manager; 40using OpenSim.Region.PhysicsModules.SharedBase;
42using OpenSim.Services.Interfaces; 41using OpenSim.Services.Interfaces;
43 42
44namespace OpenSim.Region.ClientStack 43namespace OpenSim
45{ 44{
46 public abstract class RegionApplicationBase : BaseOpenSimServer 45 public abstract class RegionApplicationBase : BaseOpenSimServer
47 { 46 {
@@ -53,7 +52,6 @@ namespace OpenSim.Region.ClientStack
53 protected uint m_httpServerPort; 52 protected uint m_httpServerPort;
54 protected ISimulationDataService m_simulationDataService; 53 protected ISimulationDataService m_simulationDataService;
55 protected IEstateDataService m_estateDataService; 54 protected IEstateDataService m_estateDataService;
56 protected ClientStackManager m_clientStackManager;
57 55
58 public SceneManager SceneManager { get; protected set; } 56 public SceneManager SceneManager { get; protected set; }
59 public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } } 57 public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } }
@@ -62,23 +60,11 @@ namespace OpenSim.Region.ClientStack
62 60
63 protected abstract void Initialize(); 61 protected abstract void Initialize();
64 62
65 /// <summary>
66 /// Get a new physics scene.
67 /// </summary>
68 ///
69 /// <param name="osSceneIdentifier">
70 /// The name of the OpenSim scene this physics scene is serving. This will be used in log messages.
71 /// </param>
72 /// <returns></returns>
73 protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier, Vector3 regionExtent);
74
75 protected abstract ClientStackManager CreateClientStackManager();
76 protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager); 63 protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager);
77 64
78 protected override void StartupSpecific() 65 protected override void StartupSpecific()
79 { 66 {
80 SceneManager = SceneManager.Instance; 67 SceneManager = SceneManager.Instance;
81 m_clientStackManager = CreateClientStackManager();
82 68
83 Initialize(); 69 Initialize();
84 70
@@ -125,23 +111,5 @@ namespace OpenSim.Region.ClientStack
125 base.StartupSpecific(); 111 base.StartupSpecific();
126 } 112 }
127 113
128 /// <summary>
129 /// Get a new physics scene.
130 /// </summary>
131 /// <param name="engine">The name of the physics engine to use</param>
132 /// <param name="meshEngine">The name of the mesh engine to use</param>
133 /// <param name="config">The configuration data to pass to the physics and mesh engines</param>
134 /// <param name="osSceneIdentifier">
135 /// The name of the OpenSim scene this physics scene is serving. This will be used in log messages.
136 /// </param>
137 /// <returns></returns>
138 protected PhysicsScene GetPhysicsScene(
139 string engine, string meshEngine, IConfigSource config, string osSceneIdentifier, Vector3 regionExtent)
140 {
141 PhysicsPluginManager physicsPluginManager;
142 physicsPluginManager = new PhysicsPluginManager();
143 physicsPluginManager.LoadPluginsFromAssemblies("Physics");
144 return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier, regionExtent);
145 }
146 } 114 }
147} 115}
diff --git a/OpenSim/Region/ClientStack/ClientStackManager.cs b/OpenSim/Region/ClientStack/ClientStackManager.cs
deleted file mode 100644
index 3ec968f..0000000
--- a/OpenSim/Region/ClientStack/ClientStackManager.cs
+++ /dev/null
@@ -1,147 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Net;
31using System.Reflection;
32using log4net;
33using Nini.Config;
34using OpenSim.Framework;
35
36namespace OpenSim.Region.ClientStack
37{
38 public class ClientStackManager
39 {
40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41
42 private List<Type> plugin = new List<Type>();
43 private List<Assembly> pluginAssembly = new List<Assembly>();
44
45 public ClientStackManager(string pDllName)
46 {
47 List<string> clientstacks = new List<string>();
48 if (pDllName.Contains(","))
49 {
50 clientstacks = new List<string>(pDllName.Split(','));
51 }
52 else
53 {
54 clientstacks.Add(pDllName);
55 }
56 foreach (string dllName in clientstacks)
57 {
58 m_log.Info("[CLIENTSTACK]: Attempting to load " + dllName);
59
60 try
61 {
62 //plugin = null;
63 Assembly itemAssembly = Assembly.LoadFrom(dllName);
64 pluginAssembly.Add(itemAssembly);
65
66 foreach (Type pluginType in itemAssembly.GetTypes())
67 {
68 if (pluginType.IsPublic)
69 {
70 Type typeInterface = pluginType.GetInterface("IClientNetworkServer");
71
72 if (typeInterface != null)
73 {
74 m_log.Info("[CLIENTSTACK]: Added IClientNetworkServer Interface");
75 plugin.Add(pluginType);
76 break;
77 }
78 }
79 }
80 }
81 catch (ReflectionTypeLoadException e)
82 {
83 foreach (Exception e2 in e.LoaderExceptions)
84 {
85 m_log.Error(e2.ToString());
86 }
87 throw e;
88 }
89 }
90 }
91
92 /// <summary>
93 /// Create a server that can set up sessions for virtual world client <-> server communications
94 /// </summary>
95 /// <param name="_listenIP"></param>
96 /// <param name="port"></param>
97 /// <param name="proxyPortOffset"></param>
98 /// <param name="allow_alternate_port"></param>
99 /// <param name="assetCache"></param>
100 /// <param name="authenticateClass"></param>
101 /// <returns></returns>
102 public List<IClientNetworkServer> CreateServers(
103 IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port,
104 AgentCircuitManager authenticateClass)
105 {
106 return CreateServers(
107 _listenIP, ref port, proxyPortOffset, allow_alternate_port, null, authenticateClass);
108 }
109
110 /// <summary>
111 /// Create a server that can set up sessions for virtual world client <-> server communications
112 /// </summary>
113 /// <param name="_listenIP"></param>
114 /// <param name="port"></param>
115 /// <param name="proxyPortOffset"></param>
116 /// <param name="allow_alternate_port"></param>
117 /// <param name="configSource">
118 /// Can be null, in which case default values are used
119 /// </param>
120 /// <param name="assetCache"></param>
121 /// <param name="authenticateClass"></param>
122 /// <returns></returns>
123 public List<IClientNetworkServer> CreateServers(
124 IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource,
125 AgentCircuitManager authenticateClass)
126 {
127 List<IClientNetworkServer> servers = new List<IClientNetworkServer>();
128 if (plugin != null)
129 {
130 for (int i = 0; i < plugin.Count; i++)
131 {
132 IClientNetworkServer server =
133 (IClientNetworkServer) Activator.CreateInstance(pluginAssembly[i].GetType(plugin[i].ToString()));
134
135 server.Initialise(
136 _listenIP, ref port, proxyPortOffset, allow_alternate_port,
137 configSource, authenticateClass);
138 servers.Add(server);
139 }
140 return servers;
141 }
142
143 m_log.Error("[CLIENTSTACK]: Couldn't initialize a new server");
144 return null;
145 }
146 }
147}
diff --git a/OpenSim/Region/ClientStack/IClientNetworkServer.cs b/OpenSim/Region/ClientStack/IClientNetworkServer.cs
deleted file mode 100644
index bb7e6d0..0000000
--- a/OpenSim/Region/ClientStack/IClientNetworkServer.cs
+++ /dev/null
@@ -1,59 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Net;
29using System.Net.Sockets;
30using Nini.Config;
31using OpenSim.Framework;
32
33namespace OpenSim.Region.ClientStack
34{
35 public interface IClientNetworkServer
36 {
37 void Initialise(
38 IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource,
39 AgentCircuitManager authenticateClass);
40
41 bool HandlesRegion(Location x);
42
43 /// <summary>
44 /// Add the given scene to be handled by this IClientNetworkServer.
45 /// </summary>
46 /// <param name='scene'></param>
47 void AddScene(IScene scene);
48
49 /// <summary>
50 /// Start sending and receiving data.
51 /// </summary>
52 void Start();
53
54 /// <summary>
55 /// Stop sending and receiving data.
56 /// </summary>
57 void Stop();
58 }
59}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index cb05e8f..b5bdd46 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -40,8 +40,9 @@ using OpenSim.Framework;
40using OpenSim.Framework.Console; 40using OpenSim.Framework.Console;
41using OpenSim.Framework.Monitoring; 41using OpenSim.Framework.Monitoring;
42using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Interfaces;
43using OpenMetaverse; 44using OpenMetaverse;
44 45using Mono.Addins;
45using TokenBucket = OpenSim.Region.ClientStack.LindenUDP.TokenBucket; 46using TokenBucket = OpenSim.Region.ClientStack.LindenUDP.TokenBucket;
46 47
47namespace OpenSim.Region.ClientStack.LindenUDP 48namespace OpenSim.Region.ClientStack.LindenUDP
@@ -49,14 +50,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP
49 /// <summary> 50 /// <summary>
50 /// A shim around LLUDPServer that implements the IClientNetworkServer interface 51 /// A shim around LLUDPServer that implements the IClientNetworkServer interface
51 /// </summary> 52 /// </summary>
52 public sealed class LLUDPServerShim : IClientNetworkServer 53 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LLUDPServerShim")]
54 public sealed class LLUDPServerShim : INonSharedRegionModule
53 { 55 {
56 private bool m_Enabled = true;
57 private IConfigSource m_Config;
54 LLUDPServer m_udpServer; 58 LLUDPServer m_udpServer;
55 59
56 public LLUDPServerShim() 60 #region INonSharedRegionModule
61 public string Name
62 {
63 get { return "LLUDPServerShim"; }
64 }
65
66 public Type ReplaceableInterface
67 {
68 get { return null; }
69 }
70
71 public void Initialise(IConfigSource source)
72 {
73 m_Config = source;
74 }
75
76 public void Close()
77 {
78 }
79
80 public void AddRegion(Scene scene)
57 { 81 {
82 uint port = (uint)scene.RegionInfo.InternalEndPoint.Port;
83
84 IPAddress listenIP = scene.RegionInfo.InternalEndPoint.Address;
85 Initialise(listenIP, ref port, scene.RegionInfo.ProxyOffset, scene.RegionInfo.m_allow_alternate_ports, m_Config, scene.AuthenticateHandler);
86 scene.RegionInfo.InternalEndPoint.Port = (int)port;
87
88 AddScene(scene);
58 } 89 }
59 90
91 public void RemoveRegion(Scene scene)
92 {
93 Stop();
94 }
95
96 public void RegionLoaded(Scene scene)
97 {
98 Start();
99 }
100 #endregion
101
60 public void Initialise(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) 102 public void Initialise(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager)
61 { 103 {
62 m_udpServer = new LLUDPServer(listenIP, ref port, proxyPortOffsetParm, allow_alternate_port, configSource, circuitManager); 104 m_udpServer = new LLUDPServer(listenIP, ref port, proxyPortOffsetParm, allow_alternate_port, configSource, circuitManager);
@@ -200,6 +242,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
200 { 242 {
201 m_udpServer.Stop(); 243 m_udpServer.Stop();
202 } 244 }
245
203 } 246 }
204 247
205 /// <summary> 248 /// <summary>
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs b/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs
index 8795c0c..a1ff69e 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs
@@ -1,6 +1,7 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4using Mono.Addins;
4 5
5// General Information about an assembly is controlled through the following 6// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 7// set of attributes. Change these attribute values to modify the information
@@ -31,3 +32,5 @@ using System.Runtime.InteropServices;
31// 32//
32[assembly: AssemblyVersion("0.8.2.*")] 33[assembly: AssemblyVersion("0.8.2.*")]
33 34
35[assembly: Addin("LindenUDP", OpenSim.VersionInfo.VersionNumber)]
36[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index b632774..7d9609f 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;
37using NUnit.Framework; 37using NUnit.Framework;
38using OpenMetaverse; 38using OpenMetaverse;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Framework.Communications;
41using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
42using OpenSim.Framework.Servers.HttpServer; 41using OpenSim.Framework.Servers.HttpServer;
43using OpenSim.Region.CoreModules.Avatar.Attachments; 42using OpenSim.Region.CoreModules.Avatar.Attachments;
diff --git a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
index b8a1dba..7bec18f 100644
--- a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
@@ -38,7 +38,6 @@ using System.Reflection;
38using log4net; 38using log4net;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Framework.ServiceAuth; 40using OpenSim.Framework.ServiceAuth;
41using OpenSim.Framework.Communications;
42using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
44using OpenSim.Services.Interfaces; 43using OpenSim.Services.Interfaces;
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 7ab568e..08e7dd2 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -38,7 +38,6 @@ using OpenMetaverse;
38using Mono.Addins; 38using Mono.Addins;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Framework.Servers.HttpServer; 40using OpenSim.Framework.Servers.HttpServer;
41using OpenSim.Framework.Communications;
42using OpenSim.Framework.Servers; 41using OpenSim.Framework.Servers;
43using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
44using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs
index 7ce2813..315d372 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs
@@ -32,7 +32,6 @@ using Nini.Config;
32using Mono.Addins; 32using Mono.Addins;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
37using OpenSim.Framework.Client; 36using OpenSim.Framework.Client;
38using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index 1650097..ac89f52 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -32,7 +32,6 @@ using Mono.Addins;
32using Nini.Config; 32using Nini.Config;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
37using OpenSim.Framework.Client; 36using OpenSim.Framework.Client;
38using OpenSim.Region.Framework.Interfaces; 37using 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 5295ba3..8d11d20 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;
34using Nini.Config; 34using Nini.Config;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Communications;
38using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
39using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 39using 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 84f9f3f..c2e645f 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;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Serialization; 37using OpenSim.Framework.Serialization;
38using OpenSim.Framework.Serialization.External; 38using OpenSim.Framework.Serialization.External;
39using OpenSim.Framework.Communications;
40using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; 39using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
41using OpenSim.Region.CoreModules.World.Serialiser; 40using OpenSim.Region.CoreModules.World.Serialiser;
42using OpenSim.Region.Framework.Scenes; 41using 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 d5f3a22..57b4f80 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;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Serialization; 37using OpenSim.Framework.Serialization;
38using OpenSim.Framework.Serialization.External; 38using OpenSim.Framework.Serialization.External;
39using OpenSim.Framework.Communications;
40using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; 39using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
41using OpenSim.Region.CoreModules.World.Serialiser; 40using OpenSim.Region.CoreModules.World.Serialiser;
42using OpenSim.Region.Framework.Scenes; 41using 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 b614c18..7265405 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;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Serialization; 37using OpenSim.Framework.Serialization;
38using OpenSim.Framework.Serialization.External; 38using OpenSim.Framework.Serialization.External;
39using OpenSim.Framework.Communications;
40using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; 39using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
41using OpenSim.Region.CoreModules.World.Serialiser; 40using OpenSim.Region.CoreModules.World.Serialiser;
42using OpenSim.Region.Framework.Scenes; 41using 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 4b015d7..519c697 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;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Serialization; 37using OpenSim.Framework.Serialization;
38using OpenSim.Framework.Serialization.External; 38using OpenSim.Framework.Serialization.External;
39using OpenSim.Framework.Communications;
40using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; 39using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
41using OpenSim.Region.CoreModules.World.Serialiser; 40using OpenSim.Region.CoreModules.World.Serialiser;
42using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 9a57599..3cbde62 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;
36using OpenSim.Framework.Monitoring; 36using OpenSim.Framework.Monitoring;
37using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Region.Physics.Manager; 39using OpenSim.Region.PhysicsModules.SharedBase;
40using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
41 41
42using GridRegion = OpenSim.Services.Interfaces.GridRegion; 42using GridRegion = OpenSim.Services.Interfaces.GridRegion;
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs
index 54ec751..e3c6c0d 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;
38using OpenSim.Framework.Client; 38using OpenSim.Framework.Client;
39using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Physics.Manager; 41using OpenSim.Region.PhysicsModules.SharedBase;
42using OpenSim.Services.Interfaces; 42using OpenSim.Services.Interfaces;
43using GridRegion = OpenSim.Services.Interfaces.GridRegion; 43using GridRegion = OpenSim.Services.Interfaces.GridRegion;
44 44
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
index c64ab44..1d91165 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;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Serialization; 38using OpenSim.Framework.Serialization;
39using OpenSim.Framework.Serialization.External; 39using OpenSim.Framework.Serialization.External;
40using OpenSim.Framework.Communications;
41using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; 40using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
42using OpenSim.Region.CoreModules.Framework.InventoryAccess; 41using OpenSim.Region.CoreModules.Framework.InventoryAccess;
43using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
diff --git a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
index d10c9b4..862f0b7 100644
--- a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
@@ -30,7 +30,6 @@ using System.IO;
30using System.Reflection; 30using System.Reflection;
31 31
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Communications;
34 33
35using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; 34using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
36using OpenSim.Region.Framework; 35using OpenSim.Region.Framework;
@@ -159,7 +158,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library
159 } 158 }
160 159
161 RegionInfo regInfo = new RegionInfo(); 160 RegionInfo regInfo = new RegionInfo();
162 Scene m_MockScene = new Scene(regInfo, null); 161 Scene m_MockScene = new Scene(regInfo);
163 LocalInventoryService invService = new LocalInventoryService(lib); 162 LocalInventoryService invService = new LocalInventoryService(lib);
164 m_MockScene.RegisterModuleInterface<IInventoryService>(invService); 163 m_MockScene.RegisterModuleInterface<IInventoryService>(invService);
165 m_MockScene.RegisterModuleInterface<IAssetService>(m_Scene.AssetService); 164 m_MockScene.RegisterModuleInterface<IAssetService>(m_Scene.AssetService);
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index c0faad8..87f4798 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -37,7 +37,6 @@ using System.Security.Cryptography.X509Certificates;
37using Nini.Config; 37using Nini.Config;
38using OpenMetaverse; 38using OpenMetaverse;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Framework.Communications;
41using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
42using OpenSim.Framework.Servers.HttpServer; 41using OpenSim.Framework.Servers.HttpServer;
43using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
index 7462ebd..d45962f 100644
--- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
@@ -32,7 +32,7 @@ using System.Net;
32using Nini.Config; 32using Nini.Config;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenMetaverse.Imaging; 34using OpenMetaverse.Imaging;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework;
36using OpenSim.Region.CoreModules.Scripting.DynamicTexture; 36using OpenSim.Region.CoreModules.Scripting.DynamicTexture;
37using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
index 8df30d4..c33f7f5 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
85 r1.ExternalHostName = "127.0.0.1"; 85 r1.ExternalHostName = "127.0.0.1";
86 r1.HttpPort = 9001; 86 r1.HttpPort = 9001;
87 r1.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); 87 r1.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
88 Scene s = new Scene(new RegionInfo(), null); 88 Scene s = new Scene(new RegionInfo());
89 s.RegionInfo.RegionID = r1.RegionID; 89 s.RegionInfo.RegionID = r1.RegionID;
90 m_LocalConnector.AddRegion(s); 90 m_LocalConnector.AddRegion(s);
91 91
@@ -97,7 +97,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
97 r2.ExternalHostName = "127.0.0.1"; 97 r2.ExternalHostName = "127.0.0.1";
98 r2.HttpPort = 9002; 98 r2.HttpPort = 9002;
99 r2.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); 99 r2.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
100 s = new Scene(new RegionInfo(), null); 100 s = new Scene(new RegionInfo());
101 s.RegionInfo.RegionID = r2.RegionID; 101 s.RegionInfo.RegionID = r2.RegionID;
102 m_LocalConnector.AddRegion(s); 102 m_LocalConnector.AddRegion(s);
103 103
@@ -109,7 +109,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
109 r3.ExternalHostName = "127.0.0.1"; 109 r3.ExternalHostName = "127.0.0.1";
110 r3.HttpPort = 9003; 110 r3.HttpPort = 9003;
111 r3.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); 111 r3.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
112 s = new Scene(new RegionInfo(), null); 112 s = new Scene(new RegionInfo());
113 s.RegionInfo.RegionID = r3.RegionID; 113 s.RegionInfo.RegionID = r3.RegionID;
114 m_LocalConnector.AddRegion(s); 114 m_LocalConnector.AddRegion(s);
115 115
@@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
121 r4.ExternalHostName = "127.0.0.1"; 121 r4.ExternalHostName = "127.0.0.1";
122 r4.HttpPort = 9004; 122 r4.HttpPort = 9004;
123 r4.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); 123 r4.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
124 s = new Scene(new RegionInfo(), null); 124 s = new Scene(new RegionInfo());
125 s.RegionInfo.RegionID = r4.RegionID; 125 s.RegionInfo.RegionID = r4.RegionID;
126 m_LocalConnector.AddRegion(s); 126 m_LocalConnector.AddRegion(s);
127 127
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index 12ffc01..c1daae9 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -38,7 +38,6 @@ using Nini.Config;
38using OpenMetaverse; 38using OpenMetaverse;
39using OpenMetaverse.StructuredData; 39using OpenMetaverse.StructuredData;
40using OpenSim.Framework; 40using OpenSim.Framework;
41using OpenSim.Framework.Communications;
42using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
44using OpenSim.Region.Framework.Scenes.Serialization; 43using OpenSim.Region.Framework.Scenes.Serialization;
diff --git a/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs b/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs
index f54ab2c..4bb3799 100644
--- a/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs
@@ -34,7 +34,6 @@ using Nini.Config;
34using Nwc.XmlRpc; 34using Nwc.XmlRpc;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Communications;
38using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 39using OpenSim.Services.Interfaces;
diff --git a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs
index d17c517..70c6028 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;
45using OpenSim.Region.CoreModules.Framework.InterfaceCommander; 45using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
46using OpenSim.Region.Framework.Interfaces; 46using OpenSim.Region.Framework.Interfaces;
47using OpenSim.Region.Framework.Scenes; 47using OpenSim.Region.Framework.Scenes;
48using OpenSim.Region.Physics.Manager; 48using OpenSim.Region.PhysicsModules.SharedBase;
49using OpenSim.Services.Interfaces; 49using OpenSim.Services.Interfaces;
50using Caps = OpenSim.Framework.Capabilities.Caps; 50using Caps = OpenSim.Framework.Capabilities.Caps;
51using GridRegion = OpenSim.Services.Interfaces.GridRegion; 51using GridRegion = OpenSim.Services.Interfaces.GridRegion;
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 749c2cc..ad6793f 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;
44using OpenSim.Framework.Servers.HttpServer; 44using OpenSim.Framework.Servers.HttpServer;
45using OpenSim.Region.Framework.Interfaces; 45using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Region.Framework.Scenes; 46using OpenSim.Region.Framework.Scenes;
47using OpenSim.Region.Physics.Manager; 47using OpenSim.Region.PhysicsModules.SharedBase;
48using OpenSim.Services.Interfaces; 48using OpenSim.Services.Interfaces;
49using Caps = OpenSim.Framework.Capabilities.Caps; 49using Caps = OpenSim.Framework.Capabilities.Caps;
50using GridRegion = OpenSim.Services.Interfaces.GridRegion; 50using GridRegion = OpenSim.Services.Interfaces.GridRegion;
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
index 8e843ee..443eee1 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
@@ -41,7 +41,7 @@ using Mono.Addins;
41using OpenSim.Framework; 41using OpenSim.Framework;
42using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
44using OpenSim.Region.Physics.Manager; 44using OpenSim.Region.PhysicsModules.SharedBase;
45using OpenSim.Services.Interfaces; 45using OpenSim.Services.Interfaces;
46 46
47using OpenMetaverse; 47using OpenMetaverse;
diff --git a/OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs b/OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs
deleted file mode 100644
index e60d3ae..0000000
--- a/OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Region.DataSnapshot")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("06c36944-a28d-470e-912c-654c3edaba6b")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.8.2.*")]
33
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index ade908d..e80a33b 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -35,7 +35,7 @@ using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Region.Physics.Manager; 38using OpenSim.Region.PhysicsModules.SharedBase;
39 39
40namespace OpenSim.Region.Framework.Scenes.Animation 40namespace OpenSim.Region.Framework.Scenes.Animation
41{ 41{
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 22b8e4d..0a6bca4 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -635,8 +635,8 @@ namespace OpenSim.Region.Framework.Scenes
635 /// Triggered by <see cref="TriggerScriptCollidingStart"/> 635 /// Triggered by <see cref="TriggerScriptCollidingStart"/>
636 /// in <see cref="SceneObjectPart.SendCollisionEvent"/> 636 /// in <see cref="SceneObjectPart.SendCollisionEvent"/>
637 /// via <see cref="SceneObjectPart.PhysicsCollision"/> 637 /// via <see cref="SceneObjectPart.PhysicsCollision"/>
638 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/> 638 /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.OnCollisionUpdate"/>
639 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/> 639 /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.SendCollisionUpdate"/>
640 /// </remarks> 640 /// </remarks>
641 public event ScriptColliding OnScriptColliderStart; 641 public event ScriptColliding OnScriptColliderStart;
642 642
@@ -649,8 +649,8 @@ namespace OpenSim.Region.Framework.Scenes
649 /// Triggered by <see cref="TriggerScriptColliding"/> 649 /// Triggered by <see cref="TriggerScriptColliding"/>
650 /// in <see cref="SceneObjectPart.SendCollisionEvent"/> 650 /// in <see cref="SceneObjectPart.SendCollisionEvent"/>
651 /// via <see cref="SceneObjectPart.PhysicsCollision"/> 651 /// via <see cref="SceneObjectPart.PhysicsCollision"/>
652 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/> 652 /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.OnCollisionUpdate"/>
653 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/> 653 /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.SendCollisionUpdate"/>
654 /// </remarks> 654 /// </remarks>
655 public event ScriptColliding OnScriptColliding; 655 public event ScriptColliding OnScriptColliding;
656 656
@@ -662,8 +662,8 @@ namespace OpenSim.Region.Framework.Scenes
662 /// Triggered by <see cref="TriggerScriptCollidingEnd"/> 662 /// Triggered by <see cref="TriggerScriptCollidingEnd"/>
663 /// in <see cref="SceneObjectPart.SendCollisionEvent"/> 663 /// in <see cref="SceneObjectPart.SendCollisionEvent"/>
664 /// via <see cref="SceneObjectPart.PhysicsCollision"/> 664 /// via <see cref="SceneObjectPart.PhysicsCollision"/>
665 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/> 665 /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.OnCollisionUpdate"/>
666 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/> 666 /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.SendCollisionUpdate"/>
667 /// </remarks> 667 /// </remarks>
668 public event ScriptColliding OnScriptCollidingEnd; 668 public event ScriptColliding OnScriptCollidingEnd;
669 669
@@ -675,8 +675,8 @@ namespace OpenSim.Region.Framework.Scenes
675 /// Triggered by <see cref="TriggerScriptLandCollidingStart"/> 675 /// Triggered by <see cref="TriggerScriptLandCollidingStart"/>
676 /// in <see cref="SceneObjectPart.SendLandCollisionEvent"/> 676 /// in <see cref="SceneObjectPart.SendLandCollisionEvent"/>
677 /// via <see cref="SceneObjectPart.PhysicsCollision"/> 677 /// via <see cref="SceneObjectPart.PhysicsCollision"/>
678 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/> 678 /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.OnCollisionUpdate"/>
679 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/> 679 /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.SendCollisionUpdate"/>
680 /// </remarks> 680 /// </remarks>
681 public event ScriptColliding OnScriptLandColliderStart; 681 public event ScriptColliding OnScriptLandColliderStart;
682 682
@@ -688,8 +688,8 @@ namespace OpenSim.Region.Framework.Scenes
688 /// Triggered by <see cref="TriggerScriptLandColliding"/> 688 /// Triggered by <see cref="TriggerScriptLandColliding"/>
689 /// in <see cref="SceneObjectPart.SendLandCollisionEvent"/> 689 /// in <see cref="SceneObjectPart.SendLandCollisionEvent"/>
690 /// via <see cref="SceneObjectPart.PhysicsCollision"/> 690 /// via <see cref="SceneObjectPart.PhysicsCollision"/>
691 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/> 691 /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.OnCollisionUpdate"/>
692 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/> 692 /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.SendCollisionUpdate"/>
693 /// </remarks> 693 /// </remarks>
694 public event ScriptColliding OnScriptLandColliding; 694 public event ScriptColliding OnScriptLandColliding;
695 695
@@ -701,8 +701,8 @@ namespace OpenSim.Region.Framework.Scenes
701 /// Triggered by <see cref="TriggerScriptLandCollidingEnd"/> 701 /// Triggered by <see cref="TriggerScriptLandCollidingEnd"/>
702 /// in <see cref="SceneObjectPart.SendLandCollisionEvent"/> 702 /// in <see cref="SceneObjectPart.SendLandCollisionEvent"/>
703 /// via <see cref="SceneObjectPart.PhysicsCollision"/> 703 /// via <see cref="SceneObjectPart.PhysicsCollision"/>
704 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.OnCollisionUpdate"/> 704 /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.OnCollisionUpdate"/>
705 /// via <see cref="OpenSim.Region.Physics.Manager.PhysicsActor.SendCollisionUpdate"/> 705 /// via <see cref="OpenSim.Region.PhysicsModule.SharedBase.PhysicsActor.SendCollisionUpdate"/>
706 /// </remarks> 706 /// </remarks>
707 public event ScriptColliding OnScriptLandColliderEnd; 707 public event ScriptColliding OnScriptLandColliderEnd;
708 708
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
index c00190a..cdd8d2d 100644
--- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
+++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
@@ -36,7 +36,7 @@ using System.Threading;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Physics.Manager; 39using OpenSim.Region.PhysicsModules.SharedBase;
40using OpenSim.Region.Framework.Scenes.Serialization; 40using OpenSim.Region.Framework.Scenes.Serialization;
41using System.Runtime.Serialization.Formatters.Binary; 41using System.Runtime.Serialization.Formatters.Binary;
42using System.Runtime.Serialization; 42using System.Runtime.Serialization;
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index c0405ad..bd9d580 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -31,7 +31,7 @@ using log4net;
31using Nini.Config; 31using Nini.Config;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.PhysicsModules.SharedBase;
35 35
36/* 36/*
37 * Steps to add a new prioritization policy: 37 * Steps to add a new prioritization policy:
diff --git a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
index f208afb..3b31281 100644
--- a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
+++ b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
@@ -35,7 +35,6 @@ using Nini.Config;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenMetaverse.StructuredData; 36using OpenMetaverse.StructuredData;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Console; 38using OpenSim.Framework.Console;
40using OpenSim.Framework.Servers; 39using OpenSim.Framework.Servers;
41using OpenSim.Framework.Servers.HttpServer; 40using OpenSim.Framework.Servers.HttpServer;
diff --git a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs
index b617f52..58f4641 100644
--- a/OpenSim/Region/Framework/Scenes/SOPVehicle.cs
+++ b/OpenSim/Region/Framework/Scenes/SOPVehicle.cs
@@ -29,7 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager; 32using OpenSim.Region.PhysicsModules.SharedBase;
33using System.Text; 33using System.Text;
34using System.IO; 34using System.IO;
35using System.Xml; 35using System.Xml;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 20767e5..0b0e458 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -31,7 +31,6 @@ using System.Threading;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenMetaverse.Packets; 32using OpenMetaverse.Packets;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications;
35using OpenSim.Services.Interfaces; 34using OpenSim.Services.Interfaces;
36 35
37namespace OpenSim.Region.Framework.Scenes 36namespace OpenSim.Region.Framework.Scenes
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 1b26cc3..1b90af4 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -42,12 +42,11 @@ using OpenMetaverse.Imaging;
42using OpenSim.Framework; 42using OpenSim.Framework;
43using OpenSim.Framework.Monitoring; 43using OpenSim.Framework.Monitoring;
44using OpenSim.Services.Interfaces; 44using OpenSim.Services.Interfaces;
45using OpenSim.Framework.Communications;
46using OpenSim.Framework.Console; 45using OpenSim.Framework.Console;
47using OpenSim.Region.Framework.Interfaces; 46using OpenSim.Region.Framework.Interfaces;
48using OpenSim.Region.Framework.Scenes.Scripting; 47using OpenSim.Region.Framework.Scenes.Scripting;
49using OpenSim.Region.Framework.Scenes.Serialization; 48using OpenSim.Region.Framework.Scenes.Serialization;
50using OpenSim.Region.Physics.Manager; 49using OpenSim.Region.PhysicsModules.SharedBase;
51using Timer = System.Timers.Timer; 50using Timer = System.Timers.Timer;
52using TPFlags = OpenSim.Framework.Constants.TeleportFlags; 51using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
53using GridRegion = OpenSim.Services.Interfaces.GridRegion; 52using GridRegion = OpenSim.Services.Interfaces.GridRegion;
@@ -855,11 +854,10 @@ namespace OpenSim.Region.Framework.Scenes
855 854
856 #region Constructors 855 #region Constructors
857 856
858 public Scene(RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene, 857 public Scene(RegionInfo regInfo, AgentCircuitManager authen,
859 SceneCommunicationService sceneGridService,
860 ISimulationDataService simDataService, IEstateDataService estateDataService, 858 ISimulationDataService simDataService, IEstateDataService estateDataService,
861 IConfigSource config, string simulatorVersion) 859 IConfigSource config, string simulatorVersion)
862 : this(regInfo, physicsScene) 860 : this(regInfo)
863 { 861 {
864 m_config = config; 862 m_config = config;
865 MinFrameTime = 0.089f; 863 MinFrameTime = 0.089f;
@@ -870,7 +868,7 @@ namespace OpenSim.Region.Framework.Scenes
870 868
871 m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4); 869 m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4);
872 m_authenticateHandler = authen; 870 m_authenticateHandler = authen;
873 m_sceneGridService = sceneGridService; 871 m_sceneGridService = new SceneCommunicationService();
874 m_SimulationDataService = simDataService; 872 m_SimulationDataService = simDataService;
875 m_EstateDataService = estateDataService; 873 m_EstateDataService = estateDataService;
876 874
@@ -1088,11 +1086,11 @@ namespace OpenSim.Region.Framework.Scenes
1088 } 1086 }
1089 } 1087 }
1090 1088
1091 string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "Startup" }; 1089 string[] possibleAccessControlConfigSections = new string[] { "Startup", "AccessControl"};
1092 1090
1093 string grant 1091 string grant
1094 = Util.GetConfigVarFromSections<string>( 1092 = Util.GetConfigVarFromSections<string>(
1095 config, "AllowedClients", possibleAccessControlConfigSections, ""); 1093 config, "AllowedClients", possibleAccessControlConfigSections, string.Empty);
1096 1094
1097 if (grant.Length > 0) 1095 if (grant.Length > 0)
1098 { 1096 {
@@ -1104,7 +1102,11 @@ namespace OpenSim.Region.Framework.Scenes
1104 1102
1105 grant 1103 grant
1106 = Util.GetConfigVarFromSections<string>( 1104 = Util.GetConfigVarFromSections<string>(
1107 config, "BannedClients", possibleAccessControlConfigSections, ""); 1105 config, "DeniedClients", possibleAccessControlConfigSections, String.Empty);
1106 // Deal with the mess of someone having used a different word at some point
1107 if (grant == String.Empty)
1108 grant = Util.GetConfigVarFromSections<string>(
1109 config, "BannedClients", possibleAccessControlConfigSections, String.Empty);
1108 1110
1109 if (grant.Length > 0) 1111 if (grant.Length > 0)
1110 { 1112 {
@@ -1201,11 +1203,10 @@ namespace OpenSim.Region.Framework.Scenes
1201 MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); 1203 MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect);
1202 } 1204 }
1203 1205
1204 public Scene(RegionInfo regInfo, PhysicsScene physicsScene) 1206 public Scene(RegionInfo regInfo)
1205 : base(regInfo) 1207 : base(regInfo)
1206 { 1208 {
1207 m_sceneGraph = new SceneGraph(this); 1209 m_sceneGraph = new SceneGraph(this);
1208 m_sceneGraph.PhysicsScene = physicsScene;
1209 1210
1210 // If the scene graph has an Unrecoverable error, restart this sim. 1211 // If the scene graph has an Unrecoverable error, restart this sim.
1211 // Currently the only thing that causes it to happen is two kinds of specific 1212 // Currently the only thing that causes it to happen is two kinds of specific
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index df7a72a..28df1c1 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -35,7 +35,6 @@ using OpenMetaverse.StructuredData;
35using log4net; 35using log4net;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Client; 37using OpenSim.Framework.Client;
38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Capabilities; 38using OpenSim.Framework.Capabilities;
40using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index c9c88d3..0a22bb3 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -34,7 +34,7 @@ using OpenMetaverse.Packets;
34using log4net; 34using log4net;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Region.Framework.Scenes.Types; 36using OpenSim.Region.Framework.Scenes.Types;
37using OpenSim.Region.Physics.Manager; 37using OpenSim.Region.PhysicsModules.SharedBase;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
39 39
40namespace OpenSim.Region.Framework.Scenes 40namespace OpenSim.Region.Framework.Scenes
@@ -121,7 +121,12 @@ namespace OpenSim.Region.Framework.Scenes
121 121
122 public PhysicsScene PhysicsScene 122 public PhysicsScene PhysicsScene
123 { 123 {
124 get { return _PhyScene; } 124 get
125 {
126 if (_PhyScene == null)
127 _PhyScene = m_parentScene.RequestModuleInterface<PhysicsScene>();
128 return _PhyScene;
129 }
125 set 130 set
126 { 131 {
127 // If we're not doing the initial set 132 // If we're not doing the initial set
@@ -172,9 +177,9 @@ namespace OpenSim.Region.Framework.Scenes
172 177
173 // PhysX does this (runs in the background). 178 // PhysX does this (runs in the background).
174 179
175 if (_PhyScene.IsThreaded) 180 if (PhysicsScene.IsThreaded)
176 { 181 {
177 _PhyScene.GetResults(); 182 PhysicsScene.GetResults();
178 } 183 }
179 } 184 }
180 185
@@ -214,7 +219,7 @@ namespace OpenSim.Region.Framework.Scenes
214 // position). 219 // position).
215 // 220 //
216 // Therefore, JointMoved and JointDeactivated events will be fired as a result of the following Simulate(). 221 // Therefore, JointMoved and JointDeactivated events will be fired as a result of the following Simulate().
217 return _PhyScene.Simulate((float)elapsed); 222 return PhysicsScene.Simulate((float)elapsed);
218 } 223 }
219 224
220 protected internal void UpdateScenePresenceMovement() 225 protected internal void UpdateScenePresenceMovement()
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 5e1801a..b3bd7e0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -39,7 +39,7 @@ using OpenMetaverse;
39using OpenMetaverse.Packets; 39using OpenMetaverse.Packets;
40using OpenSim.Framework; 40using OpenSim.Framework;
41using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Physics.Manager; 42using OpenSim.Region.PhysicsModules.SharedBase;
43using OpenSim.Region.Framework.Scenes.Serialization; 43using OpenSim.Region.Framework.Scenes.Serialization;
44using PermissionMask = OpenSim.Framework.PermissionMask; 44using PermissionMask = OpenSim.Framework.PermissionMask;
45 45
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index c300b96..ea96d9e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -42,7 +42,7 @@ using OpenSim.Framework;
42using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes.Scripting; 43using OpenSim.Region.Framework.Scenes.Scripting;
44using OpenSim.Region.Framework.Scenes.Serialization; 44using OpenSim.Region.Framework.Scenes.Serialization;
45using OpenSim.Region.Physics.Manager; 45using OpenSim.Region.PhysicsModules.SharedBase;
46using PermissionMask = OpenSim.Framework.PermissionMask; 46using PermissionMask = OpenSim.Framework.PermissionMask;
47 47
48namespace OpenSim.Region.Framework.Scenes 48namespace OpenSim.Region.Framework.Scenes
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4c346b7..29362d7 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -41,7 +41,7 @@ using OpenSim.Framework.Monitoring;
41using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes.Animation; 42using OpenSim.Region.Framework.Scenes.Animation;
43using OpenSim.Region.Framework.Scenes.Types; 43using OpenSim.Region.Framework.Scenes.Types;
44using OpenSim.Region.Physics.Manager; 44using OpenSim.Region.PhysicsModules.SharedBase;
45using GridRegion = OpenSim.Services.Interfaces.GridRegion; 45using GridRegion = OpenSim.Services.Interfaces.GridRegion;
46using OpenSim.Services.Interfaces; 46using OpenSim.Services.Interfaces;
47using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags; 47using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags;
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
index a3485d2..3c03130 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
@@ -34,7 +34,7 @@ using OpenMetaverse;
34using log4net; 34using log4net;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Region.Physics.Manager; 37using OpenSim.Region.PhysicsModules.SharedBase;
38 38
39namespace OpenSim.Region.Framework.Scenes.Serialization 39namespace OpenSim.Region.Framework.Scenes.Serialization
40{ 40{
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
index 766ce83..da18941 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
@@ -34,7 +34,6 @@ using Nini.Config;
34using NUnit.Framework; 34using NUnit.Framework;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Communications;
38using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
39using OpenSim.Tests.Common; 38using OpenSim.Tests.Common;
40 39
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
index b6b3344..ee7c8a9 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
@@ -32,7 +32,6 @@ using System.Text;
32using NUnit.Framework; 32using NUnit.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
37using OpenSim.Tests.Common; 36using OpenSim.Tests.Common;
38 37
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs
index 6118004..3172227 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs
@@ -32,7 +32,6 @@ using System.Threading;
32using NUnit.Framework; 32using NUnit.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
37using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
38using OpenSim.Tests.Common; 37using OpenSim.Tests.Common;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index bdf0700..098f1b4 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -33,7 +33,6 @@ using Nini.Config;
33using NUnit.Framework; 33using NUnit.Framework;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Communications;
37using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
39using OpenSim.Tests.Common; 38using OpenSim.Tests.Common;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs
index 93ac34f..dc3b717 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs
@@ -32,7 +32,6 @@ using Nini.Config;
32using NUnit.Framework; 32using NUnit.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Region.CoreModules.Framework.EntityTransfer; 35using OpenSim.Region.CoreModules.Framework.EntityTransfer;
37using OpenSim.Region.CoreModules.Framework.InventoryAccess; 36using OpenSim.Region.CoreModules.Framework.InventoryAccess;
38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 37using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
index b7e9499..f980209 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
@@ -32,7 +32,6 @@ using Nini.Config;
32using NUnit.Framework; 32using NUnit.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Region.CoreModules.Framework.EntityTransfer; 35using OpenSim.Region.CoreModules.Framework.EntityTransfer;
37using OpenSim.Region.CoreModules.Framework.InventoryAccess; 36using OpenSim.Region.CoreModules.Framework.InventoryAccess;
38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 37using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index c2e0ae3..e6d5a2f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -31,7 +31,6 @@ using System.Reflection;
31using NUnit.Framework; 31using NUnit.Framework;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Tests.Common; 35using OpenSim.Tests.Common;
37using log4net; 36using log4net;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
index ce7fc0e..9a665f6 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
@@ -30,7 +30,6 @@ using System.Reflection;
30using NUnit.Framework; 30using NUnit.Framework;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Communications;
34using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
35using OpenSim.Tests.Common; 34using OpenSim.Tests.Common;
36 35
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs
index fdbe7ae..8a2d2af 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs
@@ -31,7 +31,6 @@ using System.Reflection;
31using NUnit.Framework; 31using NUnit.Framework;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications;
35using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
37using OpenSim.Tests.Common; 36using OpenSim.Tests.Common;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs
index 927d8e8..e3ceb04 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs
@@ -36,7 +36,6 @@ using NUnit.Framework;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Serialization.External; 38using OpenSim.Framework.Serialization.External;
39using OpenSim.Framework.Communications;
40using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Framework.Scenes.Serialization; 40using OpenSim.Region.Framework.Scenes.Serialization;
42using OpenSim.Services.Interfaces; 41using OpenSim.Services.Interfaces;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs
index 974529a..e00defd 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs
@@ -31,7 +31,6 @@ using System.Threading;
31using NUnit.Framework; 31using NUnit.Framework;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Tests.Common; 35using OpenSim.Tests.Common;
37 36
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
index 5ba754c..1737e3c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -31,7 +31,6 @@ using System.Reflection;
31using NUnit.Framework; 31using NUnit.Framework;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Tests.Common; 35using OpenSim.Tests.Common;
37 36
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs
index cdebe25..af3ce8e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs
@@ -30,7 +30,6 @@ using System.Reflection;
30using NUnit.Framework; 30using NUnit.Framework;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Communications;
34using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
35using OpenSim.Tests.Common; 34using OpenSim.Tests.Common;
36 35
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
index 32d6649..a92e364 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
@@ -32,7 +32,6 @@ using Nini.Config;
32using NUnit.Framework; 32using NUnit.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Region.CoreModules.Avatar.InstantMessage; 35using OpenSim.Region.CoreModules.Avatar.InstantMessage;
37using OpenSim.Region.CoreModules.World.Permissions; 36using OpenSim.Region.CoreModules.World.Permissions;
38using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 06e6423..96d112d 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -36,7 +36,6 @@ using Nini.Config;
36using NUnit.Framework; 36using NUnit.Framework;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Communications;
40using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.ClientStack.Linden; 41using OpenSim.Region.ClientStack.Linden;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
index 42cfa1b..42d91b9 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
@@ -35,13 +35,12 @@ using Nini.Config;
35using NUnit.Framework; 35using NUnit.Framework;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Communications;
39using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.CoreModules.Framework.EntityTransfer; 40using OpenSim.Region.CoreModules.Framework.EntityTransfer;
42using OpenSim.Region.CoreModules.World.Serialiser; 41using OpenSim.Region.CoreModules.World.Serialiser;
43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 42using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
44using OpenSim.Region.Physics.Manager; 43using OpenSim.Region.PhysicsModules.SharedBase;
45using OpenSim.Tests.Common; 44using OpenSim.Tests.Common;
46 45
47namespace OpenSim.Region.Framework.Scenes.Tests 46namespace OpenSim.Region.Framework.Scenes.Tests
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs
index c6e3b8b..e5c847e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs
@@ -33,7 +33,6 @@ using Nini.Config;
33using NUnit.Framework; 33using NUnit.Framework;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Communications;
37using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
39using OpenSim.Tests.Common; 38using OpenSim.Tests.Common;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs
index 45bfbff..aa26767 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs
@@ -36,7 +36,6 @@ using Nini.Config;
36using NUnit.Framework; 36using NUnit.Framework;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Communications;
40using OpenSim.Framework.Servers; 39using OpenSim.Framework.Servers;
41using OpenSim.Framework.Servers.HttpServer; 40using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Region.ClientStack.Linden; 41using OpenSim.Region.ClientStack.Linden;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
index c193a97..37eec52 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
@@ -32,7 +32,6 @@ using Nini.Config;
32using NUnit.Framework; 32using NUnit.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
37using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.CoreModules.Framework; 37using OpenSim.Region.CoreModules.Framework;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
index 0025e9b..64f11cd 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
@@ -32,7 +32,6 @@ using Nini.Config;
32using NUnit.Framework; 32using NUnit.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
37using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 37using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index 42276dd..226ed6e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -35,7 +35,6 @@ using Nini.Config;
35using NUnit.Framework; 35using NUnit.Framework;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Servers; 38using OpenSim.Framework.Servers;
40using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.CoreModules.Framework; 40using OpenSim.Region.CoreModules.Framework;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs
index 2d36214..045fd3c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs
@@ -31,7 +31,6 @@ using System.Reflection;
31using NUnit.Framework; 31using NUnit.Framework;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Tests.Common; 35using OpenSim.Tests.Common;
37 36
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
index 33ef83b..517faf1 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
@@ -36,7 +36,6 @@ using Nini.Config;
36using NUnit.Framework; 36using NUnit.Framework;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Communications;
40using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.CoreModules.World.Serialiser; 41using OpenSim.Region.CoreModules.World.Serialiser;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index 3caea8b..33a630c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -37,7 +37,6 @@ using NUnit.Framework;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenMetaverse.Assets; 38using OpenMetaverse.Assets;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Framework.Communications;
41using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; 42using 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 edc0a52..8250e6c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
@@ -37,7 +37,6 @@ using NUnit.Framework;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenMetaverse.Assets; 38using OpenMetaverse.Assets;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Framework.Communications;
41using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; 42using 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 ed1bab4..eef3c92 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -35,7 +35,6 @@ using Nini.Config;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenMetaverse.StructuredData; 36using OpenMetaverse.StructuredData;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Communications;
39using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
41using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
index 8095b28..1cb4747 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
@@ -42,7 +42,6 @@ using OpenMetaverse;
42using OpenMetaverse.StructuredData; 42using OpenMetaverse.StructuredData;
43 43
44using OpenSim.Framework; 44using OpenSim.Framework;
45using OpenSim.Framework.Communications;
46using OpenSim.Region.Framework.Interfaces; 45using OpenSim.Region.Framework.Interfaces;
47using OpenSim.Services.Interfaces; 46using OpenSim.Services.Interfaces;
48 47
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
index e03e71d..9a42bac 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;
37using OpenMetaverse.Packets; 37using OpenMetaverse.Packets;
38using OpenMetaverse.StructuredData; 38using OpenMetaverse.StructuredData;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Framework.Communications;
41using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
42using OpenSim.Framework.Servers.HttpServer; 41using OpenSim.Framework.Servers.HttpServer;
43using OpenSim.Region.ClientStack.Linden; 42using OpenSim.Region.ClientStack.Linden;
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index a040f43..20555e4 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -41,7 +41,6 @@ using OpenMetaverse;
41using OpenMetaverse.StructuredData; 41using OpenMetaverse.StructuredData;
42 42
43using OpenSim.Framework; 43using OpenSim.Framework;
44using OpenSim.Framework.Communications;
45using OpenSim.Region.Framework.Interfaces; 44using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Services.Interfaces; 45using OpenSim.Services.Interfaces;
47 46
diff --git a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs b/OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs
index 50276ae..50276ae 100644
--- a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs
+++ b/OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs
diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs
index 0f39273..4e766eb 100644
--- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
+++ b/OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs
@@ -39,14 +39,10 @@ using Nini.Config;
39using OpenMetaverse; 39using OpenMetaverse;
40using Mono.Addins; 40using Mono.Addins;
41using OpenSim.Framework; 41using OpenSim.Framework;
42using OpenSim.Framework.Communications;
43using OpenSim.Region.DataSnapshot.Interfaces; 42using OpenSim.Region.DataSnapshot.Interfaces;
44using OpenSim.Region.Framework.Interfaces; 43using OpenSim.Region.Framework.Interfaces;
45using OpenSim.Region.Framework.Scenes; 44using OpenSim.Region.Framework.Scenes;
46 45
47[assembly: Addin("DataSnapshot", OpenSim.VersionInfo.VersionNumber)]
48[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
49
50namespace OpenSim.Region.DataSnapshot 46namespace OpenSim.Region.DataSnapshot
51{ 47{
52 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DataSnapshotManager")] 48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DataSnapshotManager")]
diff --git a/OpenSim/Region/DataSnapshot/EstateSnapshot.cs b/OpenSim/Region/OptionalModules/DataSnapshot/EstateSnapshot.cs
index 8da9e8c..8da9e8c 100644
--- a/OpenSim/Region/DataSnapshot/EstateSnapshot.cs
+++ b/OpenSim/Region/OptionalModules/DataSnapshot/EstateSnapshot.cs
diff --git a/OpenSim/Region/DataSnapshot/Interfaces/IDataSnapshot.cs b/OpenSim/Region/OptionalModules/DataSnapshot/Interfaces/IDataSnapshot.cs
index 3b3db65..3b3db65 100644
--- a/OpenSim/Region/DataSnapshot/Interfaces/IDataSnapshot.cs
+++ b/OpenSim/Region/OptionalModules/DataSnapshot/Interfaces/IDataSnapshot.cs
diff --git a/OpenSim/Region/DataSnapshot/Interfaces/IDataSnapshotProvider.cs b/OpenSim/Region/OptionalModules/DataSnapshot/Interfaces/IDataSnapshotProvider.cs
index daea373..daea373 100644
--- a/OpenSim/Region/DataSnapshot/Interfaces/IDataSnapshotProvider.cs
+++ b/OpenSim/Region/OptionalModules/DataSnapshot/Interfaces/IDataSnapshotProvider.cs
diff --git a/OpenSim/Region/DataSnapshot/LLSDDiscovery.cs b/OpenSim/Region/OptionalModules/DataSnapshot/LLSDDiscovery.cs
index 54a87f9..54a87f9 100644
--- a/OpenSim/Region/DataSnapshot/LLSDDiscovery.cs
+++ b/OpenSim/Region/OptionalModules/DataSnapshot/LLSDDiscovery.cs
diff --git a/OpenSim/Region/DataSnapshot/LandSnapshot.cs b/OpenSim/Region/OptionalModules/DataSnapshot/LandSnapshot.cs
index b8c90cd..b8c90cd 100644
--- a/OpenSim/Region/DataSnapshot/LandSnapshot.cs
+++ b/OpenSim/Region/OptionalModules/DataSnapshot/LandSnapshot.cs
diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs
index 0bb4044..0bb4044 100644
--- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
+++ b/OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs
diff --git a/OpenSim/Region/DataSnapshot/SnapshotStore.cs b/OpenSim/Region/OptionalModules/DataSnapshot/SnapshotStore.cs
index 480aaaf..480aaaf 100644
--- a/OpenSim/Region/DataSnapshot/SnapshotStore.cs
+++ b/OpenSim/Region/OptionalModules/DataSnapshot/SnapshotStore.cs
diff --git a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs
index 3083a33..1d9179c 100755
--- a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs
+++ b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs
@@ -36,7 +36,7 @@ using OpenSim.Framework.Console;
36using OpenSim.Region.CoreModules.Framework.InterfaceCommander; 36using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
37using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Region.Physics.Manager; 39using OpenSim.Region.PhysicsModules.SharedBase;
40 40
41namespace OpenSim.Region.OptionalModules.PhysicsParameters 41namespace OpenSim.Region.OptionalModules.PhysicsParameters
42{ 42{
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerClientEventForwarder.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerClientEventForwarder.cs
index 721d396..721d396 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerClientEventForwarder.cs
+++ b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerClientEventForwarder.cs
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
index 83732e2..83732e2 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
+++ b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
index e5e76e9..e5e76e9 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
+++ b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs
index 0fe3ab0..98b0ae1 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
+++ b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs
@@ -36,7 +36,7 @@ using OpenSim.Framework.Client;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Framework.Console; 38using OpenSim.Framework.Console;
39using OpenSim.Region.Physics.Manager; 39using OpenSim.Region.PhysicsModules.SharedBase;
40using Mono.Addins; 40using Mono.Addins;
41 41
42namespace OpenSim.Region.RegionCombinerModule 42namespace OpenSim.Region.RegionCombinerModule
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerPermissionModule.cs
index ddfe3e0..ddfe3e0 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
+++ b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerPermissionModule.cs
diff --git a/OpenSim/Region/RegionCombinerModule/RegionConnections.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionConnections.cs
index 6bf1c4a..6bf1c4a 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionConnections.cs
+++ b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionConnections.cs
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCourseLocation.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCourseLocation.cs
index 224ac99..224ac99 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCourseLocation.cs
+++ b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCourseLocation.cs
diff --git a/OpenSim/Region/RegionCombinerModule/RegionData.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionData.cs
index 42fca9f..42fca9f 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionData.cs
+++ b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionData.cs
diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
deleted file mode 100755
index ff4afbf..0000000
--- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
+++ /dev/null
@@ -1,623 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyrightD
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using System.Collections.Generic;
29using System.Linq;
30using System.Reflection;
31using System.Text;
32using System.Threading;
33
34using OpenSim.Framework;
35using OpenSim.Region.CoreModules;
36using OpenSim.Region.Framework;
37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Region.Physics.Manager;
40
41using Mono.Addins;
42using Nini.Config;
43using log4net;
44using OpenMetaverse;
45
46namespace OpenSim.Region.OptionalModules.Scripting
47{
48[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
49public class ExtendedPhysics : INonSharedRegionModule
50{
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 private static string LogHeader = "[EXTENDED PHYSICS]";
53
54 // =============================================================
55 // Since BulletSim is a plugin, this these values aren't defined easily in one place.
56 // This table must correspond to an identical table in BSScene.
57
58 // Per scene functions. See BSScene.
59
60 // Per avatar functions. See BSCharacter.
61
62 // Per prim functions. See BSPrim.
63 public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType";
64 public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType";
65 public const string PhysFunctChangeLinkFixed = "BulletSim.ChangeLinkFixed";
66 public const string PhysFunctChangeLinkType = "BulletSim.ChangeLinkType";
67 public const string PhysFunctGetLinkType = "BulletSim.GetLinkType";
68 public const string PhysFunctChangeLinkParams = "BulletSim.ChangeLinkParams";
69 public const string PhysFunctAxisLockLimits = "BulletSim.AxisLockLimits";
70
71 // =============================================================
72
73 private IConfig Configuration { get; set; }
74 private bool Enabled { get; set; }
75 private Scene BaseScene { get; set; }
76 private IScriptModuleComms Comms { get; set; }
77
78 #region INonSharedRegionModule
79
80 public string Name { get { return this.GetType().Name; } }
81
82 public void Initialise(IConfigSource config)
83 {
84 BaseScene = null;
85 Enabled = false;
86 Configuration = null;
87 Comms = null;
88
89 try
90 {
91 if ((Configuration = config.Configs["ExtendedPhysics"]) != null)
92 {
93 Enabled = Configuration.GetBoolean("Enabled", Enabled);
94 }
95 }
96 catch (Exception e)
97 {
98 m_log.ErrorFormat("{0} Initialization error: {0}", LogHeader, e);
99 }
100
101 m_log.InfoFormat("{0} module {1} enabled", LogHeader, (Enabled ? "is" : "is not"));
102 }
103
104 public void Close()
105 {
106 if (BaseScene != null)
107 {
108 BaseScene.EventManager.OnObjectAddedToScene -= EventManager_OnObjectAddedToScene;
109 BaseScene.EventManager.OnSceneObjectPartUpdated -= EventManager_OnSceneObjectPartUpdated;
110 BaseScene = null;
111 }
112 }
113
114 public void AddRegion(Scene scene)
115 {
116 }
117
118 public void RemoveRegion(Scene scene)
119 {
120 if (BaseScene != null && BaseScene == scene)
121 {
122 Close();
123 }
124 }
125
126 public void RegionLoaded(Scene scene)
127 {
128 if (!Enabled) return;
129
130 BaseScene = scene;
131
132 Comms = BaseScene.RequestModuleInterface<IScriptModuleComms>();
133 if (Comms == null)
134 {
135 m_log.WarnFormat("{0} ScriptModuleComms interface not defined", LogHeader);
136 Enabled = false;
137
138 return;
139 }
140
141 // Register as LSL functions all the [ScriptInvocation] marked methods.
142 Comms.RegisterScriptInvocations(this);
143 Comms.RegisterConstants(this);
144
145 // When an object is modified, we might need to update its extended physics parameters
146 BaseScene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene;
147 BaseScene.EventManager.OnSceneObjectPartUpdated += EventManager_OnSceneObjectPartUpdated;
148
149 }
150
151 public Type ReplaceableInterface { get { return null; } }
152
153 #endregion // INonSharedRegionModule
154
155 private void EventManager_OnObjectAddedToScene(SceneObjectGroup obj)
156 {
157 }
158
159 // Event generated when some property of a prim changes.
160 private void EventManager_OnSceneObjectPartUpdated(SceneObjectPart sop, bool isFullUpdate)
161 {
162 }
163
164 [ScriptConstant]
165 public const int PHYS_CENTER_OF_MASS = 1 << 0;
166
167 [ScriptInvocation]
168 public string physGetEngineType(UUID hostID, UUID scriptID)
169 {
170 string ret = string.Empty;
171
172 if (BaseScene.PhysicsScene != null)
173 {
174 ret = BaseScene.PhysicsScene.EngineType;
175 }
176
177 return ret;
178 }
179
180 // Code for specifying params.
181 // The choice if 14700 is arbitrary and only serves to catch parameter code misuse.
182 [ScriptConstant]
183 public const int PHYS_AXIS_LOCK_LINEAR = 14700;
184 [ScriptConstant]
185 public const int PHYS_AXIS_LOCK_LINEAR_X = 14701;
186 [ScriptConstant]
187 public const int PHYS_AXIS_LIMIT_LINEAR_X = 14702;
188 [ScriptConstant]
189 public const int PHYS_AXIS_LOCK_LINEAR_Y = 14703;
190 [ScriptConstant]
191 public const int PHYS_AXIS_LIMIT_LINEAR_Y = 14704;
192 [ScriptConstant]
193 public const int PHYS_AXIS_LOCK_LINEAR_Z = 14705;
194 [ScriptConstant]
195 public const int PHYS_AXIS_LIMIT_LINEAR_Z = 14706;
196 [ScriptConstant]
197 public const int PHYS_AXIS_LOCK_ANGULAR = 14707;
198 [ScriptConstant]
199 public const int PHYS_AXIS_LOCK_ANGULAR_X = 14708;
200 [ScriptConstant]
201 public const int PHYS_AXIS_LIMIT_ANGULAR_X = 14709;
202 [ScriptConstant]
203 public const int PHYS_AXIS_LOCK_ANGULAR_Y = 14710;
204 [ScriptConstant]
205 public const int PHYS_AXIS_LIMIT_ANGULAR_Y = 14711;
206 [ScriptConstant]
207 public const int PHYS_AXIS_LOCK_ANGULAR_Z = 14712;
208 [ScriptConstant]
209 public const int PHYS_AXIS_LIMIT_ANGULAR_Z = 14713;
210 [ScriptConstant]
211 public const int PHYS_AXIS_UNLOCK_LINEAR = 14714;
212 [ScriptConstant]
213 public const int PHYS_AXIS_UNLOCK_LINEAR_X = 14715;
214 [ScriptConstant]
215 public const int PHYS_AXIS_UNLOCK_LINEAR_Y = 14716;
216 [ScriptConstant]
217 public const int PHYS_AXIS_UNLOCK_LINEAR_Z = 14717;
218 [ScriptConstant]
219 public const int PHYS_AXIS_UNLOCK_ANGULAR = 14718;
220 [ScriptConstant]
221 public const int PHYS_AXIS_UNLOCK_ANGULAR_X = 14719;
222 [ScriptConstant]
223 public const int PHYS_AXIS_UNLOCK_ANGULAR_Y = 14720;
224 [ScriptConstant]
225 public const int PHYS_AXIS_UNLOCK_ANGULAR_Z = 14721;
226 [ScriptConstant]
227 public const int PHYS_AXIS_UNLOCK = 14722;
228 // physAxisLockLimits()
229 [ScriptInvocation]
230 public int physAxisLock(UUID hostID, UUID scriptID, object[] parms)
231 {
232 int ret = -1;
233 if (!Enabled) return ret;
234
235 PhysicsActor rootPhysActor;
236 if (GetRootPhysActor(hostID, out rootPhysActor))
237 {
238 object[] parms2 = AddToBeginningOfArray(rootPhysActor, null, parms);
239 ret = MakeIntError(rootPhysActor.Extension(PhysFunctAxisLockLimits, parms2));
240 }
241
242 return ret;
243 }
244
245 [ScriptConstant]
246 public const int PHYS_LINKSET_TYPE_CONSTRAINT = 0;
247 [ScriptConstant]
248 public const int PHYS_LINKSET_TYPE_COMPOUND = 1;
249 [ScriptConstant]
250 public const int PHYS_LINKSET_TYPE_MANUAL = 2;
251
252 [ScriptInvocation]
253 public int physSetLinksetType(UUID hostID, UUID scriptID, int linksetType)
254 {
255 int ret = -1;
256 if (!Enabled) return ret;
257
258 // The part that is requesting the change.
259 SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID);
260
261 if (requestingPart != null)
262 {
263 // The change is always made to the root of a linkset.
264 SceneObjectGroup containingGroup = requestingPart.ParentGroup;
265 SceneObjectPart rootPart = containingGroup.RootPart;
266
267 if (rootPart != null)
268 {
269 PhysicsActor rootPhysActor = rootPart.PhysActor;
270 if (rootPhysActor != null)
271 {
272 if (rootPhysActor.IsPhysical)
273 {
274 // Change a physical linkset by making non-physical, waiting for one heartbeat so all
275 // the prim and linkset state is updated, changing the type and making the
276 // linkset physical again.
277 containingGroup.ScriptSetPhysicsStatus(false);
278 Thread.Sleep(150); // longer than one heartbeat tick
279
280 // A kludge for the moment.
281 // Since compound linksets move the children but don't generate position updates to the
282 // simulator, it is possible for compound linkset children to have out-of-sync simulator
283 // and physical positions. The following causes the simulator to push the real child positions
284 // down into the physics engine to get everything synced.
285 containingGroup.UpdateGroupPosition(containingGroup.AbsolutePosition);
286 containingGroup.UpdateGroupRotationR(containingGroup.GroupRotation);
287
288 object[] parms2 = { rootPhysActor, null, linksetType };
289 ret = MakeIntError(rootPhysActor.Extension(PhysFunctSetLinksetType, parms2));
290 Thread.Sleep(150); // longer than one heartbeat tick
291
292 containingGroup.ScriptSetPhysicsStatus(true);
293 }
294 else
295 {
296 // Non-physical linksets don't have a physical instantiation so there is no state to
297 // worry about being updated.
298 object[] parms2 = { rootPhysActor, null, linksetType };
299 ret = MakeIntError(rootPhysActor.Extension(PhysFunctSetLinksetType, parms2));
300 }
301 }
302 else
303 {
304 m_log.WarnFormat("{0} physSetLinksetType: root part does not have a physics actor. rootName={1}, hostID={2}",
305 LogHeader, rootPart.Name, hostID);
306 }
307 }
308 else
309 {
310 m_log.WarnFormat("{0} physSetLinksetType: root part does not exist. RequestingPartName={1}, hostID={2}",
311 LogHeader, requestingPart.Name, hostID);
312 }
313 }
314 else
315 {
316 m_log.WarnFormat("{0} physSetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID);
317 }
318 return ret;
319 }
320
321 [ScriptInvocation]
322 public int physGetLinksetType(UUID hostID, UUID scriptID)
323 {
324 int ret = -1;
325 if (!Enabled) return ret;
326
327 PhysicsActor rootPhysActor;
328 if (GetRootPhysActor(hostID, out rootPhysActor))
329 {
330 object[] parms2 = { rootPhysActor, null };
331 ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinksetType, parms2));
332 }
333 else
334 {
335 m_log.WarnFormat("{0} physGetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID);
336 }
337 return ret;
338 }
339
340 [ScriptConstant]
341 public const int PHYS_LINK_TYPE_FIXED = 1234;
342 [ScriptConstant]
343 public const int PHYS_LINK_TYPE_HINGE = 4;
344 [ScriptConstant]
345 public const int PHYS_LINK_TYPE_SPRING = 9;
346 [ScriptConstant]
347 public const int PHYS_LINK_TYPE_6DOF = 6;
348 [ScriptConstant]
349 public const int PHYS_LINK_TYPE_SLIDER = 7;
350
351 // physChangeLinkType(integer linkNum, integer typeCode)
352 [ScriptInvocation]
353 public int physChangeLinkType(UUID hostID, UUID scriptID, int linkNum, int typeCode)
354 {
355 int ret = -1;
356 if (!Enabled) return ret;
357
358 PhysicsActor rootPhysActor;
359 PhysicsActor childPhysActor;
360
361 if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor))
362 {
363 object[] parms2 = { rootPhysActor, childPhysActor, typeCode };
364 ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkType, parms2));
365 }
366
367 return ret;
368 }
369
370 // physGetLinkType(integer linkNum)
371 [ScriptInvocation]
372 public int physGetLinkType(UUID hostID, UUID scriptID, int linkNum)
373 {
374 int ret = -1;
375 if (!Enabled) return ret;
376
377 PhysicsActor rootPhysActor;
378 PhysicsActor childPhysActor;
379
380 if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor))
381 {
382 object[] parms2 = { rootPhysActor, childPhysActor };
383 ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinkType, parms2));
384 }
385
386 return ret;
387 }
388
389 // physChangeLinkFixed(integer linkNum)
390 // Change the link between the root and the linkNum into a fixed, static physical connection.
391 [ScriptInvocation]
392 public int physChangeLinkFixed(UUID hostID, UUID scriptID, int linkNum)
393 {
394 int ret = -1;
395 if (!Enabled) return ret;
396
397 PhysicsActor rootPhysActor;
398 PhysicsActor childPhysActor;
399
400 if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor))
401 {
402 object[] parms2 = { rootPhysActor, childPhysActor , PHYS_LINK_TYPE_FIXED };
403 ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkType, parms2));
404 }
405
406 return ret;
407 }
408
409 // Code for specifying params.
410 // The choice if 14400 is arbitrary and only serves to catch parameter code misuse.
411 public const int PHYS_PARAM_MIN = 14401;
412
413 [ScriptConstant]
414 public const int PHYS_PARAM_FRAMEINA_LOC = 14401;
415 [ScriptConstant]
416 public const int PHYS_PARAM_FRAMEINA_ROT = 14402;
417 [ScriptConstant]
418 public const int PHYS_PARAM_FRAMEINB_LOC = 14403;
419 [ScriptConstant]
420 public const int PHYS_PARAM_FRAMEINB_ROT = 14404;
421 [ScriptConstant]
422 public const int PHYS_PARAM_LINEAR_LIMIT_LOW = 14405;
423 [ScriptConstant]
424 public const int PHYS_PARAM_LINEAR_LIMIT_HIGH = 14406;
425 [ScriptConstant]
426 public const int PHYS_PARAM_ANGULAR_LIMIT_LOW = 14407;
427 [ScriptConstant]
428 public const int PHYS_PARAM_ANGULAR_LIMIT_HIGH = 14408;
429 [ScriptConstant]
430 public const int PHYS_PARAM_USE_FRAME_OFFSET = 14409;
431 [ScriptConstant]
432 public const int PHYS_PARAM_ENABLE_TRANSMOTOR = 14410;
433 [ScriptConstant]
434 public const int PHYS_PARAM_TRANSMOTOR_MAXVEL = 14411;
435 [ScriptConstant]
436 public const int PHYS_PARAM_TRANSMOTOR_MAXFORCE = 14412;
437 [ScriptConstant]
438 public const int PHYS_PARAM_CFM = 14413;
439 [ScriptConstant]
440 public const int PHYS_PARAM_ERP = 14414;
441 [ScriptConstant]
442 public const int PHYS_PARAM_SOLVER_ITERATIONS = 14415;
443 [ScriptConstant]
444 public const int PHYS_PARAM_SPRING_AXIS_ENABLE = 14416;
445 [ScriptConstant]
446 public const int PHYS_PARAM_SPRING_DAMPING = 14417;
447 [ScriptConstant]
448 public const int PHYS_PARAM_SPRING_STIFFNESS = 14418;
449 [ScriptConstant]
450 public const int PHYS_PARAM_LINK_TYPE = 14419;
451 [ScriptConstant]
452 public const int PHYS_PARAM_USE_LINEAR_FRAMEA = 14420;
453 [ScriptConstant]
454 public const int PHYS_PARAM_SPRING_EQUILIBRIUM_POINT = 14421;
455
456 public const int PHYS_PARAM_MAX = 14421;
457
458 // Used when specifying a parameter that has settings for the three linear and three angular axis
459 [ScriptConstant]
460 public const int PHYS_AXIS_ALL = -1;
461 [ScriptConstant]
462 public const int PHYS_AXIS_LINEAR_ALL = -2;
463 [ScriptConstant]
464 public const int PHYS_AXIS_ANGULAR_ALL = -3;
465 [ScriptConstant]
466 public const int PHYS_AXIS_LINEAR_X = 0;
467 [ScriptConstant]
468 public const int PHYS_AXIS_LINEAR_Y = 1;
469 [ScriptConstant]
470 public const int PHYS_AXIS_LINEAR_Z = 2;
471 [ScriptConstant]
472 public const int PHYS_AXIS_ANGULAR_X = 3;
473 [ScriptConstant]
474 public const int PHYS_AXIS_ANGULAR_Y = 4;
475 [ScriptConstant]
476 public const int PHYS_AXIS_ANGULAR_Z = 5;
477
478 // physChangeLinkParams(integer linkNum, [ PHYS_PARAM_*, value, PHYS_PARAM_*, value, ...])
479 [ScriptInvocation]
480 public int physChangeLinkParams(UUID hostID, UUID scriptID, int linkNum, object[] parms)
481 {
482 int ret = -1;
483 if (!Enabled) return ret;
484
485 PhysicsActor rootPhysActor;
486 PhysicsActor childPhysActor;
487
488 if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor))
489 {
490 object[] parms2 = AddToBeginningOfArray(rootPhysActor, childPhysActor, parms);
491 ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkParams, parms2));
492 }
493
494 return ret;
495 }
496
497 private bool GetRootPhysActor(UUID hostID, out PhysicsActor rootPhysActor)
498 {
499 SceneObjectGroup containingGroup;
500 SceneObjectPart rootPart;
501 return GetRootPhysActor(hostID, out containingGroup, out rootPart, out rootPhysActor);
502 }
503
504 private bool GetRootPhysActor(UUID hostID, out SceneObjectGroup containingGroup, out SceneObjectPart rootPart, out PhysicsActor rootPhysActor)
505 {
506 bool ret = false;
507 rootPhysActor = null;
508 containingGroup = null;
509 rootPart = null;
510
511 SceneObjectPart requestingPart;
512
513 requestingPart = BaseScene.GetSceneObjectPart(hostID);
514 if (requestingPart != null)
515 {
516 // The type is is always on the root of a linkset.
517 containingGroup = requestingPart.ParentGroup;
518 if (containingGroup != null && !containingGroup.IsDeleted)
519 {
520 rootPart = containingGroup.RootPart;
521 if (rootPart != null)
522 {
523 rootPhysActor = rootPart.PhysActor;
524 if (rootPhysActor != null)
525 {
526 ret = true;
527 }
528 else
529 {
530 m_log.WarnFormat("{0} GetRootAndChildPhysActors: Root part does not have a physics actor. rootName={1}, hostID={2}",
531 LogHeader, rootPart.Name, hostID);
532 }
533 }
534 else
535 {
536 m_log.WarnFormat("{0} GetRootAndChildPhysActors: Root part does not exist. RequestingPartName={1}, hostID={2}",
537 LogHeader, requestingPart.Name, hostID);
538 }
539 }
540 else
541 {
542 m_log.WarnFormat("{0} GetRootAndChildPhysActors: Containing group missing or deleted. hostID={1}", LogHeader, hostID);
543 }
544 }
545 else
546 {
547 m_log.WarnFormat("{0} GetRootAndChildPhysActors: cannot find script object in scene. hostID={1}", LogHeader, hostID);
548 }
549
550 return ret;
551 }
552
553 // Find the root and child PhysActors based on the linkNum.
554 // Return 'true' if both are found and returned.
555 private bool GetRootAndChildPhysActors(UUID hostID, int linkNum, out PhysicsActor rootPhysActor, out PhysicsActor childPhysActor)
556 {
557 bool ret = false;
558 rootPhysActor = null;
559 childPhysActor = null;
560
561 SceneObjectGroup containingGroup;
562 SceneObjectPart rootPart;
563
564 if (GetRootPhysActor(hostID, out containingGroup, out rootPart, out rootPhysActor))
565 {
566 SceneObjectPart linkPart = containingGroup.GetLinkNumPart(linkNum);
567 if (linkPart != null)
568 {
569 childPhysActor = linkPart.PhysActor;
570 if (childPhysActor != null)
571 {
572 ret = true;
573 }
574 else
575 {
576 m_log.WarnFormat("{0} GetRootAndChildPhysActors: Link part has no physical actor. rootName={1}, hostID={2}, linknum={3}",
577 LogHeader, rootPart.Name, hostID, linkNum);
578 }
579 }
580 else
581 {
582 m_log.WarnFormat("{0} GetRootAndChildPhysActors: Could not find linknum part. rootName={1}, hostID={2}, linknum={3}",
583 LogHeader, rootPart.Name, hostID, linkNum);
584 }
585 }
586 else
587 {
588 m_log.WarnFormat("{0} GetRootAndChildPhysActors: Root part does not have a physics actor. rootName={1}, hostID={2}",
589 LogHeader, rootPart.Name, hostID);
590 }
591
592 return ret;
593 }
594
595 // Return an array of objects with the passed object as the first object of a new array
596 private object[] AddToBeginningOfArray(object firstOne, object secondOne, object[] prevArray)
597 {
598 object[] newArray = new object[2 + prevArray.Length];
599 newArray[0] = firstOne;
600 newArray[1] = secondOne;
601 prevArray.CopyTo(newArray, 2);
602 return newArray;
603 }
604
605 // Extension() returns an object. Convert that object into the integer error we expect to return.
606 private int MakeIntError(object extensionRet)
607 {
608 int ret = -1;
609 if (extensionRet != null)
610 {
611 try
612 {
613 ret = (int)extensionRet;
614 }
615 catch
616 {
617 ret = -1;
618 }
619 }
620 return ret;
621 }
622}
623}
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
index 5ed1514..47b9c09 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
@@ -34,7 +34,7 @@ using OpenSim.Framework;
34using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.OptionalModules.Scripting.Minimodule.Object; 36using OpenSim.Region.OptionalModules.Scripting.Minimodule.Object;
37using OpenSim.Region.Physics.Manager; 37using OpenSim.Region.PhysicsModules.SharedBase;
38using PrimType=OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.PrimType; 38using PrimType=OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.PrimType;
39using SculptType=OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.SculptType; 39using SculptType=OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.SculptType;
40 40
diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs
index 97133c0..4b7295d 100644
--- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs
@@ -35,7 +35,6 @@ using OpenMetaverse;
35using Mono.Addins; 35using Mono.Addins;
36 36
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Servers; 38using OpenSim.Framework.Servers;
40using OpenSim.Framework.Servers.HttpServer; 39using OpenSim.Framework.Servers.HttpServer;
41using OpenSim.Framework.Client; 40using OpenSim.Framework.Client;
diff --git a/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs b/OpenSim/Region/OptionalModules/UserStatistics/ActiveConnectionsAJAX.cs
index 6a1112c..6a1112c 100644
--- a/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs
+++ b/OpenSim/Region/OptionalModules/UserStatistics/ActiveConnectionsAJAX.cs
diff --git a/OpenSim/Region/UserStatistics/Clients_report.cs b/OpenSim/Region/OptionalModules/UserStatistics/Clients_report.cs
index 4a6f7be..4a6f7be 100644
--- a/OpenSim/Region/UserStatistics/Clients_report.cs
+++ b/OpenSim/Region/OptionalModules/UserStatistics/Clients_report.cs
diff --git a/OpenSim/Region/UserStatistics/Default_Report.cs b/OpenSim/Region/OptionalModules/UserStatistics/Default_Report.cs
index fabe3d4..fabe3d4 100644
--- a/OpenSim/Region/UserStatistics/Default_Report.cs
+++ b/OpenSim/Region/OptionalModules/UserStatistics/Default_Report.cs
diff --git a/OpenSim/Region/UserStatistics/HTMLUtil.cs b/OpenSim/Region/OptionalModules/UserStatistics/HTMLUtil.cs
index c07619f..c07619f 100644
--- a/OpenSim/Region/UserStatistics/HTMLUtil.cs
+++ b/OpenSim/Region/OptionalModules/UserStatistics/HTMLUtil.cs
diff --git a/OpenSim/Region/UserStatistics/IStatsReport.cs b/OpenSim/Region/OptionalModules/UserStatistics/IStatsReport.cs
index 80c4487..80c4487 100644
--- a/OpenSim/Region/UserStatistics/IStatsReport.cs
+++ b/OpenSim/Region/OptionalModules/UserStatistics/IStatsReport.cs
diff --git a/OpenSim/Region/UserStatistics/LogLinesAJAX.cs b/OpenSim/Region/OptionalModules/UserStatistics/LogLinesAJAX.cs
index 4d45b80..4d45b80 100644
--- a/OpenSim/Region/UserStatistics/LogLinesAJAX.cs
+++ b/OpenSim/Region/OptionalModules/UserStatistics/LogLinesAJAX.cs
diff --git a/OpenSim/Region/UserStatistics/Prototype_distributor.cs b/OpenSim/Region/OptionalModules/UserStatistics/Prototype_distributor.cs
index 6f8b2aa..6f8b2aa 100644
--- a/OpenSim/Region/UserStatistics/Prototype_distributor.cs
+++ b/OpenSim/Region/OptionalModules/UserStatistics/Prototype_distributor.cs
diff --git a/OpenSim/Region/UserStatistics/Sessions_Report.cs b/OpenSim/Region/OptionalModules/UserStatistics/Sessions_Report.cs
index 0e94912..0e94912 100644
--- a/OpenSim/Region/UserStatistics/Sessions_Report.cs
+++ b/OpenSim/Region/OptionalModules/UserStatistics/Sessions_Report.cs
diff --git a/OpenSim/Region/UserStatistics/SimStatsAJAX.cs b/OpenSim/Region/OptionalModules/UserStatistics/SimStatsAJAX.cs
index 06d9e91..06d9e91 100644
--- a/OpenSim/Region/UserStatistics/SimStatsAJAX.cs
+++ b/OpenSim/Region/OptionalModules/UserStatistics/SimStatsAJAX.cs
diff --git a/OpenSim/Region/UserStatistics/Updater_distributor.cs b/OpenSim/Region/OptionalModules/UserStatistics/Updater_distributor.cs
index 601e06b..601e06b 100644
--- a/OpenSim/Region/UserStatistics/Updater_distributor.cs
+++ b/OpenSim/Region/OptionalModules/UserStatistics/Updater_distributor.cs
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs
index 8ccb751..bd5289f 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs
@@ -50,9 +50,6 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
50using OSD = OpenMetaverse.StructuredData.OSD; 50using OSD = OpenMetaverse.StructuredData.OSD;
51using OSDMap = OpenMetaverse.StructuredData.OSDMap; 51using OSDMap = OpenMetaverse.StructuredData.OSDMap;
52 52
53[assembly: Addin("WebStats", OpenSim.VersionInfo.VersionNumber)]
54[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
55
56namespace OpenSim.Region.UserStatistics 53namespace OpenSim.Region.UserStatistics
57{ 54{
58 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebStatsModule")] 55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebStatsModule")]
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index 2345e38..a892cf4 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;
33using NUnit.Framework; 33using NUnit.Framework;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Communications;
37using OpenSim.Region.CoreModules.Avatar.Attachments; 36using OpenSim.Region.CoreModules.Avatar.Attachments;
38using OpenSim.Region.CoreModules.Avatar.AvatarFactory; 37using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
39using OpenSim.Region.CoreModules.Framework.InventoryAccess; 38using OpenSim.Region.CoreModules.Framework.InventoryAccess;
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
deleted file mode 100644
index 373c7e0..0000000
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using Nini.Config;
31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager;
33
34namespace OpenSim.Region.Physics.BasicPhysicsPlugin
35{
36 /// <summary>
37 /// Effectively a physics plugin that simulates no physics at all.
38 /// </summary>
39 public class BasicPhysicsPlugin : IPhysicsPlugin
40 {
41 public BasicPhysicsPlugin()
42 {
43 }
44
45 public bool Init()
46 {
47 return true;
48 }
49
50 public PhysicsScene GetScene(string sceneIdentifier)
51 {
52 return new BasicScene(GetName(), sceneIdentifier);
53 }
54
55 public string GetName()
56 {
57 return ("basicphysics");
58 }
59
60 public void Dispose()
61 {
62 }
63 }
64}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs
deleted file mode 100644
index 9442854..0000000
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs
+++ /dev/null
@@ -1,76 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyrightD
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using System.Collections.Generic;
29using OpenSim.Framework;
30using OpenSim.Region.Physics.Manager;
31using OpenMetaverse;
32
33namespace OpenSim.Region.Physics.BulletSPlugin
34{
35 /// <summary>
36 /// Entry for a port of Bullet (http://bulletphysics.org/) to OpenSim.
37 /// This module interfaces to an unmanaged C++ library which makes the
38 /// actual calls into the Bullet physics engine.
39 /// The unmanaged library is found in opensim-libs::trunk/unmanaged/BulletSim/.
40 /// The unmanaged library is compiled and linked statically with Bullet
41 /// to create BulletSim.dll and libBulletSim.so (for both 32 and 64 bit).
42 /// </summary>
43public class BSPlugin : IPhysicsPlugin
44{
45 //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
46
47 private BSScene _mScene;
48
49 public BSPlugin()
50 {
51 }
52
53 public bool Init()
54 {
55 return true;
56 }
57
58 public PhysicsScene GetScene(String sceneIdentifier)
59 {
60 if (_mScene == null)
61 {
62 _mScene = new BSScene(GetName(), sceneIdentifier);
63 }
64 return (_mScene);
65 }
66
67 public string GetName()
68 {
69 return ("BulletSim");
70 }
71
72 public void Dispose()
73 {
74 }
75}
76}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
deleted file mode 100644
index 0bace14..0000000
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ /dev/null
@@ -1,1283 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyrightD
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using System.Collections.Generic;
29using System.Linq;
30using System.Reflection;
31using System.Runtime.InteropServices;
32using System.Text;
33using System.Threading;
34using OpenSim.Framework;
35using OpenSim.Framework.Monitoring;
36using OpenSim.Region.Framework;
37using OpenSim.Region.CoreModules;
38using Logging = OpenSim.Region.CoreModules.Framework.Statistics.Logging;
39using OpenSim.Region.Physics.Manager;
40using Nini.Config;
41using log4net;
42using OpenMetaverse;
43
44namespace OpenSim.Region.Physics.BulletSPlugin
45{
46public sealed class BSScene : PhysicsScene, IPhysicsParameters
47{
48 internal static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
49 internal static readonly string LogHeader = "[BULLETS SCENE]";
50
51 // The name of the region we're working for.
52 public string RegionName { get; private set; }
53
54 public string BulletSimVersion = "?";
55
56 // The handle to the underlying managed or unmanaged version of Bullet being used.
57 public string BulletEngineName { get; private set; }
58 public BSAPITemplate PE;
59
60 // If the physics engine is running on a separate thread
61 public Thread m_physicsThread;
62
63 public Dictionary<uint, BSPhysObject> PhysObjects;
64 public BSShapeCollection Shapes;
65
66 // Keeping track of the objects with collisions so we can report begin and end of a collision
67 public HashSet<BSPhysObject> ObjectsWithCollisions = new HashSet<BSPhysObject>();
68 public HashSet<BSPhysObject> ObjectsWithNoMoreCollisions = new HashSet<BSPhysObject>();
69
70 // All the collision processing is protected with this lock object
71 public Object CollisionLock = new Object();
72
73 // Properties are updated here
74 public Object UpdateLock = new Object();
75 public HashSet<BSPhysObject> ObjectsWithUpdates = new HashSet<BSPhysObject>();
76
77 // Keep track of all the avatars so we can send them a collision event
78 // every tick so OpenSim will update its animation.
79 private HashSet<BSPhysObject> AvatarsInScene = new HashSet<BSPhysObject>();
80 private Object AvatarsInSceneLock = new Object();
81
82 // let my minuions use my logger
83 public ILog Logger { get { return m_log; } }
84
85 public IMesher mesher;
86 public uint WorldID { get; private set; }
87 public BulletWorld World { get; private set; }
88
89 // All the constraints that have been allocated in this instance.
90 public BSConstraintCollection Constraints { get; private set; }
91
92 // Simulation parameters
93 //internal float m_physicsStepTime; // if running independently, the interval simulated by default
94
95 internal int m_maxSubSteps;
96 internal float m_fixedTimeStep;
97
98 internal float m_simulatedTime; // the time simulated previously. Used for physics framerate calc.
99
100 internal long m_simulationStep = 0; // The current simulation step.
101 public long SimulationStep { get { return m_simulationStep; } }
102 // A number to use for SimulationStep that is probably not any step value
103 // Used by the collision code (which remembers the step when a collision happens) to remember not any simulation step.
104 public static long NotASimulationStep = -1234;
105
106 internal float LastTimeStep { get; private set; } // The simulation time from the last invocation of Simulate()
107
108 internal float NominalFrameRate { get; set; } // Parameterized ideal frame rate that simulation is scaled to
109
110 // Physical objects can register for prestep or poststep events
111 public delegate void PreStepAction(float timeStep);
112 public delegate void PostStepAction(float timeStep);
113 public event PreStepAction BeforeStep;
114 public event PostStepAction AfterStep;
115
116 // A value of the time 'now' so all the collision and update routines do not have to get their own
117 // Set to 'now' just before all the prims and actors are called for collisions and updates
118 public int SimulationNowTime { get; private set; }
119
120 // True if initialized and ready to do simulation steps
121 private bool m_initialized = false;
122
123 // Flag which is true when processing taints.
124 // Not guaranteed to be correct all the time (don't depend on this) but good for debugging.
125 public bool InTaintTime { get; private set; }
126
127 // Pinned memory used to pass step information between managed and unmanaged
128 internal int m_maxCollisionsPerFrame;
129 internal CollisionDesc[] m_collisionArray;
130
131 internal int m_maxUpdatesPerFrame;
132 internal EntityProperties[] m_updateArray;
133
134 /// <summary>
135 /// Used to control physics simulation timing if Bullet is running on its own thread.
136 /// </summary>
137 private ManualResetEvent m_updateWaitEvent;
138
139 public const uint TERRAIN_ID = 0; // OpenSim senses terrain with a localID of zero
140 public const uint GROUNDPLANE_ID = 1;
141 public const uint CHILDTERRAIN_ID = 2; // Terrain allocated based on our mega-prim childre start here
142
143 public float SimpleWaterLevel { get; set; }
144 public BSTerrainManager TerrainManager { get; private set; }
145
146 public ConfigurationParameters Params
147 {
148 get { return UnmanagedParams[0]; }
149 }
150 public Vector3 DefaultGravity
151 {
152 get { return new Vector3(0f, 0f, Params.gravity); }
153 }
154 // Just the Z value of the gravity
155 public float DefaultGravityZ
156 {
157 get { return Params.gravity; }
158 }
159
160 // When functions in the unmanaged code must be called, it is only
161 // done at a known time just before the simulation step. The taint
162 // system saves all these function calls and executes them in
163 // order before the simulation.
164 public delegate void TaintCallback();
165 private struct TaintCallbackEntry
166 {
167 public String originator;
168 public String ident;
169 public TaintCallback callback;
170 public TaintCallbackEntry(string pIdent, TaintCallback pCallBack)
171 {
172 originator = BSScene.DetailLogZero;
173 ident = pIdent;
174 callback = pCallBack;
175 }
176 public TaintCallbackEntry(string pOrigin, string pIdent, TaintCallback pCallBack)
177 {
178 originator = pOrigin;
179 ident = pIdent;
180 callback = pCallBack;
181 }
182 }
183 private Object _taintLock = new Object(); // lock for using the next object
184 private List<TaintCallbackEntry> _taintOperations;
185 private Dictionary<string, TaintCallbackEntry> _postTaintOperations;
186 private List<TaintCallbackEntry> _postStepOperations;
187
188 // A pointer to an instance if this structure is passed to the C++ code
189 // Used to pass basic configuration values to the unmanaged code.
190 internal ConfigurationParameters[] UnmanagedParams;
191
192 // Sometimes you just have to log everything.
193 public Logging.LogWriter PhysicsLogging;
194 private bool m_physicsLoggingEnabled;
195 private string m_physicsLoggingDir;
196 private string m_physicsLoggingPrefix;
197 private int m_physicsLoggingFileMinutes;
198 private bool m_physicsLoggingDoFlush;
199 private bool m_physicsPhysicalDumpEnabled;
200 public int PhysicsMetricDumpFrames { get; set; }
201 // 'true' of the vehicle code is to log lots of details
202 public bool VehicleLoggingEnabled { get; private set; }
203 public bool VehiclePhysicalLoggingEnabled { get; private set; }
204
205 #region Construction and Initialization
206 public BSScene(string engineType, string identifier)
207 {
208 m_initialized = false;
209
210 // The name of the region we're working for is passed to us. Keep for identification.
211 RegionName = identifier;
212
213 // Set identifying variables in the PhysicsScene interface.
214 EngineType = engineType;
215 Name = EngineType + "/" + RegionName;
216 }
217
218 // Old version of initialization that assumes legacy sized regions (256x256)
219 public override void Initialise(IMesher meshmerizer, IConfigSource config)
220 {
221 m_log.ErrorFormat("{0} WARNING WARNING WARNING! BulletSim initialized without region extent specification. Terrain will be messed up.");
222 Vector3 regionExtent = new Vector3( Constants.RegionSize, Constants.RegionSize, Constants.RegionSize);
223 Initialise(meshmerizer, config, regionExtent);
224
225 }
226
227 public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent)
228 {
229 mesher = meshmerizer;
230 _taintOperations = new List<TaintCallbackEntry>();
231 _postTaintOperations = new Dictionary<string, TaintCallbackEntry>();
232 _postStepOperations = new List<TaintCallbackEntry>();
233 PhysObjects = new Dictionary<uint, BSPhysObject>();
234 Shapes = new BSShapeCollection(this);
235
236 m_simulatedTime = 0f;
237 LastTimeStep = 0.1f;
238
239 // Allocate pinned memory to pass parameters.
240 UnmanagedParams = new ConfigurationParameters[1];
241
242 // Set default values for physics parameters plus any overrides from the ini file
243 GetInitialParameterValues(config);
244
245 // Force some parameters to values depending on other configurations
246 // Only use heightmap terrain implementation if terrain larger than legacy size
247 if ((uint)regionExtent.X > Constants.RegionSize || (uint)regionExtent.Y > Constants.RegionSize)
248 {
249 m_log.WarnFormat("{0} Forcing terrain implementation to heightmap for large region", LogHeader);
250 BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap;
251 }
252
253 // Get the connection to the physics engine (could be native or one of many DLLs)
254 PE = SelectUnderlyingBulletEngine(BulletEngineName);
255
256 // Enable very detailed logging.
257 // By creating an empty logger when not logging, the log message invocation code
258 // can be left in and every call doesn't have to check for null.
259 if (m_physicsLoggingEnabled)
260 {
261 PhysicsLogging = new Logging.LogWriter(m_physicsLoggingDir, m_physicsLoggingPrefix, m_physicsLoggingFileMinutes, m_physicsLoggingDoFlush);
262 PhysicsLogging.ErrorLogger = m_log; // for DEBUG. Let's the logger output its own error messages.
263 }
264 else
265 {
266 PhysicsLogging = new Logging.LogWriter();
267 }
268
269 // Allocate memory for returning of the updates and collisions from the physics engine
270 m_collisionArray = new CollisionDesc[m_maxCollisionsPerFrame];
271 m_updateArray = new EntityProperties[m_maxUpdatesPerFrame];
272
273 // The bounding box for the simulated world. The origin is 0,0,0 unless we're
274 // a child in a mega-region.
275 // Bullet actually doesn't care about the extents of the simulated
276 // area. It tracks active objects no matter where they are.
277 Vector3 worldExtent = regionExtent;
278
279 World = PE.Initialize(worldExtent, Params, m_maxCollisionsPerFrame, ref m_collisionArray, m_maxUpdatesPerFrame, ref m_updateArray);
280
281 Constraints = new BSConstraintCollection(World);
282
283 TerrainManager = new BSTerrainManager(this, worldExtent);
284 TerrainManager.CreateInitialGroundPlaneAndTerrain();
285
286 // Put some informational messages into the log file.
287 m_log.InfoFormat("{0} Linksets implemented with {1}", LogHeader, (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation);
288
289 InTaintTime = false;
290 m_initialized = true;
291
292 // If the physics engine runs on its own thread, start same.
293 if (BSParam.UseSeparatePhysicsThread)
294 {
295 // The physics simulation should happen independently of the heartbeat loop
296 m_physicsThread
297 = WorkManager.StartThread(
298 BulletSPluginPhysicsThread,
299 string.Format("{0} ({1})", BulletEngineName, RegionName),
300 ThreadPriority.Normal,
301 true,
302 true);
303 }
304 }
305
306 // All default parameter values are set here. There should be no values set in the
307 // variable definitions.
308 private void GetInitialParameterValues(IConfigSource config)
309 {
310 ConfigurationParameters parms = new ConfigurationParameters();
311 UnmanagedParams[0] = parms;
312
313 BSParam.SetParameterDefaultValues(this);
314
315 if (config != null)
316 {
317 // If there are specifications in the ini file, use those values
318 IConfig pConfig = config.Configs["BulletSim"];
319 if (pConfig != null)
320 {
321 BSParam.SetParameterConfigurationValues(this, pConfig);
322
323 // There are two Bullet implementations to choose from
324 BulletEngineName = pConfig.GetString("BulletEngine", "BulletUnmanaged");
325
326 // Very detailed logging for physics debugging
327 // TODO: the boolean values can be moved to the normal parameter processing.
328 m_physicsLoggingEnabled = pConfig.GetBoolean("PhysicsLoggingEnabled", false);
329 m_physicsLoggingDir = pConfig.GetString("PhysicsLoggingDir", ".");
330 m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-%REGIONNAME%-");
331 m_physicsLoggingFileMinutes = pConfig.GetInt("PhysicsLoggingFileMinutes", 5);
332 m_physicsLoggingDoFlush = pConfig.GetBoolean("PhysicsLoggingDoFlush", false);
333 m_physicsPhysicalDumpEnabled = pConfig.GetBoolean("PhysicsPhysicalDumpEnabled", false);
334 // Very detailed logging for vehicle debugging
335 VehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false);
336 VehiclePhysicalLoggingEnabled = pConfig.GetBoolean("VehiclePhysicalLoggingEnabled", false);
337
338 // Do any replacements in the parameters
339 m_physicsLoggingPrefix = m_physicsLoggingPrefix.Replace("%REGIONNAME%", RegionName);
340 }
341 else
342 {
343 // Nothing in the configuration INI file so assume unmanaged and other defaults.
344 BulletEngineName = "BulletUnmanaged";
345 m_physicsLoggingEnabled = false;
346 VehicleLoggingEnabled = false;
347 }
348
349 // The material characteristics.
350 BSMaterials.InitializeFromDefaults(Params);
351 if (pConfig != null)
352 {
353 // Let the user add new and interesting material property values.
354 BSMaterials.InitializefromParameters(pConfig);
355 }
356 }
357 }
358
359 // A helper function that handles a true/false parameter and returns the proper float number encoding
360 float ParamBoolean(IConfig config, string parmName, float deflt)
361 {
362 float ret = deflt;
363 if (config.Contains(parmName))
364 {
365 ret = ConfigurationParameters.numericFalse;
366 if (config.GetBoolean(parmName, false))
367 {
368 ret = ConfigurationParameters.numericTrue;
369 }
370 }
371 return ret;
372 }
373
374 // Select the connection to the actual Bullet implementation.
375 // The main engine selection is the engineName up to the first hypen.
376 // So "Bullet-2.80-OpenCL-Intel" specifies the 'bullet' class here and the whole name
377 // is passed to the engine to do its special selection, etc.
378 private BSAPITemplate SelectUnderlyingBulletEngine(string engineName)
379 {
380 // For the moment, do a simple switch statement.
381 // Someday do fancyness with looking up the interfaces in the assembly.
382 BSAPITemplate ret = null;
383
384 string selectionName = engineName.ToLower();
385 int hyphenIndex = engineName.IndexOf("-");
386 if (hyphenIndex > 0)
387 selectionName = engineName.ToLower().Substring(0, hyphenIndex - 1);
388
389 switch (selectionName)
390 {
391 case "bullet":
392 case "bulletunmanaged":
393 ret = new BSAPIUnman(engineName, this);
394 break;
395 case "bulletxna":
396 ret = new BSAPIXNA(engineName, this);
397 // Disable some features that are not implemented in BulletXNA
398 m_log.InfoFormat("{0} Disabling some physics features not implemented by BulletXNA", LogHeader);
399 m_log.InfoFormat("{0} Disabling ShouldUseBulletHACD", LogHeader);
400 BSParam.ShouldUseBulletHACD = false;
401 m_log.InfoFormat("{0} Disabling ShouldUseSingleConvexHullForPrims", LogHeader);
402 BSParam.ShouldUseSingleConvexHullForPrims = false;
403 m_log.InfoFormat("{0} Disabling ShouldUseGImpactShapeForPrims", LogHeader);
404 BSParam.ShouldUseGImpactShapeForPrims = false;
405 m_log.InfoFormat("{0} Setting terrain implimentation to Heightmap", LogHeader);
406 BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap;
407 break;
408 }
409
410 if (ret == null)
411 {
412 m_log.ErrorFormat("{0} COULD NOT SELECT BULLET ENGINE: '[BulletSim]PhysicsEngine' must be either 'BulletUnmanaged-*' or 'BulletXNA-*'", LogHeader);
413 }
414 else
415 {
416 m_log.InfoFormat("{0} Selected bullet engine {1} -> {2}/{3}", LogHeader, engineName, ret.BulletEngineName, ret.BulletEngineVersion);
417 }
418
419 return ret;
420 }
421
422 public override void Dispose()
423 {
424 // m_log.DebugFormat("{0}: Dispose()", LogHeader);
425
426 // make sure no stepping happens while we're deleting stuff
427 m_initialized = false;
428
429 lock (PhysObjects)
430 {
431 foreach (KeyValuePair<uint, BSPhysObject> kvp in PhysObjects)
432 {
433 kvp.Value.Destroy();
434 }
435 PhysObjects.Clear();
436 }
437
438 // Now that the prims are all cleaned up, there should be no constraints left
439 if (Constraints != null)
440 {
441 Constraints.Dispose();
442 Constraints = null;
443 }
444
445 if (Shapes != null)
446 {
447 Shapes.Dispose();
448 Shapes = null;
449 }
450
451 if (TerrainManager != null)
452 {
453 TerrainManager.ReleaseGroundPlaneAndTerrain();
454 TerrainManager.Dispose();
455 TerrainManager = null;
456 }
457
458 // Anything left in the unmanaged code should be cleaned out
459 PE.Shutdown(World);
460
461 // Not logging any more
462 PhysicsLogging.Close();
463 }
464 #endregion // Construction and Initialization
465
466 #region Prim and Avatar addition and removal
467
468 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
469 {
470 m_log.ErrorFormat("{0}: CALL TO AddAvatar in BSScene. NOT IMPLEMENTED", LogHeader);
471 return null;
472 }
473
474 public override PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
475 {
476 // m_log.DebugFormat("{0}: AddAvatar: {1}", LogHeader, avName);
477
478 if (!m_initialized) return null;
479
480 BSCharacter actor = new BSCharacter(localID, avName, this, position, velocity, size, isFlying);
481 lock (PhysObjects)
482 PhysObjects.Add(localID, actor);
483
484 // TODO: Remove kludge someday.
485 // We must generate a collision for avatars whether they collide or not.
486 // This is required by OpenSim to update avatar animations, etc.
487 lock (AvatarsInSceneLock)
488 AvatarsInScene.Add(actor);
489
490 return actor;
491 }
492
493 public override void RemoveAvatar(PhysicsActor actor)
494 {
495 // m_log.DebugFormat("{0}: RemoveAvatar", LogHeader);
496
497 if (!m_initialized) return;
498
499 BSCharacter bsactor = actor as BSCharacter;
500 if (bsactor != null)
501 {
502 try
503 {
504 lock (PhysObjects)
505 PhysObjects.Remove(bsactor.LocalID);
506 // Remove kludge someday
507 lock (AvatarsInSceneLock)
508 AvatarsInScene.Remove(bsactor);
509 }
510 catch (Exception e)
511 {
512 m_log.WarnFormat("{0}: Attempt to remove avatar that is not in physics scene: {1}", LogHeader, e);
513 }
514 bsactor.Destroy();
515 // bsactor.dispose();
516 }
517 else
518 {
519 m_log.ErrorFormat("{0}: Requested to remove avatar that is not a BSCharacter. ID={1}, type={2}",
520 LogHeader, actor.LocalID, actor.GetType().Name);
521 }
522 }
523
524 public override void RemovePrim(PhysicsActor prim)
525 {
526 if (!m_initialized) return;
527
528 BSPhysObject bsprim = prim as BSPhysObject;
529 if (bsprim != null)
530 {
531 DetailLog("{0},RemovePrim,call", bsprim.LocalID);
532 // m_log.DebugFormat("{0}: RemovePrim. id={1}/{2}", LogHeader, bsprim.Name, bsprim.LocalID);
533 try
534 {
535 lock (PhysObjects) PhysObjects.Remove(bsprim.LocalID);
536 }
537 catch (Exception e)
538 {
539 m_log.ErrorFormat("{0}: Attempt to remove prim that is not in physics scene: {1}", LogHeader, e);
540 }
541 bsprim.Destroy();
542 // bsprim.dispose();
543 }
544 else
545 {
546 m_log.ErrorFormat("{0}: Attempt to remove prim that is not a BSPrim type.", LogHeader);
547 }
548 }
549
550 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
551 Vector3 size, Quaternion rotation, bool isPhysical, uint localID)
552 {
553 // m_log.DebugFormat("{0}: AddPrimShape2: {1}", LogHeader, primName);
554
555 if (!m_initialized) return null;
556
557 // DetailLog("{0},BSScene.AddPrimShape,call", localID);
558
559 BSPhysObject prim = new BSPrimLinkable(localID, primName, this, position, size, rotation, pbs, isPhysical);
560 lock (PhysObjects) PhysObjects.Add(localID, prim);
561 return prim;
562 }
563
564 // This is a call from the simulator saying that some physical property has been updated.
565 // The BulletSim driver senses the changing of relevant properties so this taint
566 // information call is not needed.
567 public override void AddPhysicsActorTaint(PhysicsActor prim) { }
568
569 #endregion // Prim and Avatar addition and removal
570
571 #region Simulation
572
573 // Call from the simulator to send physics information to the simulator objects.
574 // This pushes all the collision and property update events into the objects in
575 // the simulator and, since it is on the heartbeat thread, there is an implicit
576 // locking of those data structures from other heartbeat events.
577 // If the physics engine is running on a separate thread, the update information
578 // will be in the ObjectsWithCollions and ObjectsWithUpdates structures.
579 public override float Simulate(float timeStep)
580 {
581 if (!BSParam.UseSeparatePhysicsThread)
582 {
583 DoPhysicsStep(timeStep);
584 }
585 return SendUpdatesToSimulator(timeStep);
586 }
587
588 // Call the physics engine to do one 'timeStep' and collect collisions and updates
589 // into ObjectsWithCollisions and ObjectsWithUpdates data structures.
590 private void DoPhysicsStep(float timeStep)
591 {
592 // prevent simulation until we've been initialized
593 if (!m_initialized) return;
594
595 LastTimeStep = timeStep;
596
597 int updatedEntityCount = 0;
598 int collidersCount = 0;
599
600 int beforeTime = Util.EnvironmentTickCount();
601 int simTime = 0;
602
603 int numTaints = _taintOperations.Count;
604 InTaintTime = true; // Only used for debugging so locking is not necessary.
605
606 // update the prim states while we know the physics engine is not busy
607 ProcessTaints();
608
609 // Some of the physical objects requre individual, pre-step calls
610 // (vehicles and avatar movement, in particular)
611 TriggerPreStepEvent(timeStep);
612
613 // the prestep actions might have added taints
614 numTaints += _taintOperations.Count;
615 ProcessTaints();
616
617 InTaintTime = false; // Only used for debugging so locking is not necessary.
618
619 // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world.
620 // Only enable this in a limited test world with few objects.
621 if (m_physicsPhysicalDumpEnabled)
622 PE.DumpAllInfo(World);
623
624 // step the physical world one interval
625 m_simulationStep++;
626 int numSubSteps = 0;
627 try
628 {
629 numSubSteps = PE.PhysicsStep(World, timeStep, m_maxSubSteps, m_fixedTimeStep, out updatedEntityCount, out collidersCount);
630
631 }
632 catch (Exception e)
633 {
634 m_log.WarnFormat("{0},PhysicsStep Exception: nTaints={1}, substeps={2}, updates={3}, colliders={4}, e={5}",
635 LogHeader, numTaints, numSubSteps, updatedEntityCount, collidersCount, e);
636 DetailLog("{0},PhysicsStepException,call, nTaints={1}, substeps={2}, updates={3}, colliders={4}",
637 DetailLogZero, numTaints, numSubSteps, updatedEntityCount, collidersCount);
638 updatedEntityCount = 0;
639 collidersCount = 0;
640 }
641
642 // Make the physics engine dump useful statistics periodically
643 if (PhysicsMetricDumpFrames != 0 && ((m_simulationStep % PhysicsMetricDumpFrames) == 0))
644 PE.DumpPhysicsStatistics(World);
645
646 // Get a value for 'now' so all the collision and update routines don't have to get their own.
647 SimulationNowTime = Util.EnvironmentTickCount();
648
649 // Send collision information to the colliding objects. The objects decide if the collision
650 // is 'real' (like linksets don't collide with themselves) and the individual objects
651 // know if the simulator has subscribed to collisions.
652 lock (CollisionLock)
653 {
654 if (collidersCount > 0)
655 {
656 lock (PhysObjects)
657 {
658 for (int ii = 0; ii < collidersCount; ii++)
659 {
660 uint cA = m_collisionArray[ii].aID;
661 uint cB = m_collisionArray[ii].bID;
662 Vector3 point = m_collisionArray[ii].point;
663 Vector3 normal = m_collisionArray[ii].normal;
664 float penetration = m_collisionArray[ii].penetration;
665 SendCollision(cA, cB, point, normal, penetration);
666 SendCollision(cB, cA, point, -normal, penetration);
667 }
668 }
669 }
670 }
671
672 // If any of the objects had updated properties, tell the managed objects about the update
673 // and remember that there was a change so it will be passed to the simulator.
674 lock (UpdateLock)
675 {
676 if (updatedEntityCount > 0)
677 {
678 lock (PhysObjects)
679 {
680 for (int ii = 0; ii < updatedEntityCount; ii++)
681 {
682 EntityProperties entprop = m_updateArray[ii];
683 BSPhysObject pobj;
684 if (PhysObjects.TryGetValue(entprop.ID, out pobj))
685 {
686 if (pobj.IsInitialized)
687 pobj.UpdateProperties(entprop);
688 }
689 }
690 }
691 }
692 }
693
694 // Some actors want to know when the simulation step is complete.
695 TriggerPostStepEvent(timeStep);
696
697 simTime = Util.EnvironmentTickCountSubtract(beforeTime);
698 if (PhysicsLogging.Enabled)
699 {
700 DetailLog("{0},DoPhysicsStep,complete,frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}, objWColl={7}",
701 DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps,
702 updatedEntityCount, collidersCount, ObjectsWithCollisions.Count);
703 }
704
705 // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world.
706 // Only enable this in a limited test world with few objects.
707 if (m_physicsPhysicalDumpEnabled)
708 PE.DumpAllInfo(World);
709
710 // The physics engine returns the number of milliseconds it simulated this call.
711 // These are summed and normalized to one second and divided by 1000 to give the reported physics FPS.
712 // Multiply by a fixed nominal frame rate to give a rate similar to the simulator (usually 55).
713// m_simulatedTime += (float)numSubSteps * m_fixedTimeStep * 1000f * NominalFrameRate;
714 m_simulatedTime += (float)numSubSteps * m_fixedTimeStep;
715 }
716
717 // Called by a BSPhysObject to note that it has changed properties and this information
718 // should be passed up to the simulator at the proper time.
719 // Note: this is called by the BSPhysObject from invocation via DoPhysicsStep() above so
720 // this is is under UpdateLock.
721 public void PostUpdate(BSPhysObject updatee)
722 {
723 lock (UpdateLock)
724 {
725 ObjectsWithUpdates.Add(updatee);
726 }
727 }
728
729 // The simulator thinks it is physics time so return all the collisions and position
730 // updates that were collected in actual physics simulation.
731 private float SendUpdatesToSimulator(float timeStep)
732 {
733 if (!m_initialized) return 5.0f;
734
735 DetailLog("{0},SendUpdatesToSimulator,collisions={1},updates={2},simedTime={3}",
736 BSScene.DetailLogZero, ObjectsWithCollisions.Count, ObjectsWithUpdates.Count, m_simulatedTime);
737 // Push the collisions into the simulator.
738 lock (CollisionLock)
739 {
740 if (ObjectsWithCollisions.Count > 0)
741 {
742 foreach (BSPhysObject bsp in ObjectsWithCollisions)
743 if (!bsp.SendCollisions())
744 {
745 // If the object is done colliding, see that it's removed from the colliding list
746 ObjectsWithNoMoreCollisions.Add(bsp);
747 }
748 }
749
750 // This is a kludge to get avatar movement updates.
751 // The simulator expects collisions for avatars even if there are have been no collisions.
752 // The event updates avatar animations and stuff.
753 // If you fix avatar animation updates, remove this overhead and let normal collision processing happen.
754 // Note that we get a copy of the list to search because SendCollision() can take a while.
755 HashSet<BSPhysObject> tempAvatarsInScene;
756 lock (AvatarsInSceneLock)
757 {
758 tempAvatarsInScene = new HashSet<BSPhysObject>(AvatarsInScene);
759 }
760 foreach (BSPhysObject actor in tempAvatarsInScene)
761 {
762 if (!ObjectsWithCollisions.Contains(actor)) // don't call avatars twice
763 actor.SendCollisions();
764 }
765 tempAvatarsInScene = null;
766
767 // Objects that are done colliding are removed from the ObjectsWithCollisions list.
768 // Not done above because it is inside an iteration of ObjectWithCollisions.
769 // This complex collision processing is required to create an empty collision
770 // event call after all real collisions have happened on an object. This allows
771 // the simulator to generate the 'collision end' event.
772 if (ObjectsWithNoMoreCollisions.Count > 0)
773 {
774 foreach (BSPhysObject po in ObjectsWithNoMoreCollisions)
775 ObjectsWithCollisions.Remove(po);
776 ObjectsWithNoMoreCollisions.Clear();
777 }
778 }
779
780 // Call the simulator for each object that has physics property updates.
781 HashSet<BSPhysObject> updatedObjects = null;
782 lock (UpdateLock)
783 {
784 if (ObjectsWithUpdates.Count > 0)
785 {
786 updatedObjects = ObjectsWithUpdates;
787 ObjectsWithUpdates = new HashSet<BSPhysObject>();
788 }
789 }
790 if (updatedObjects != null)
791 {
792 foreach (BSPhysObject obj in updatedObjects)
793 {
794 obj.RequestPhysicsterseUpdate();
795 }
796 updatedObjects.Clear();
797 }
798
799 // Return the framerate simulated to give the above returned results.
800 // (Race condition here but this is just bookkeeping so rare mistakes do not merit a lock).
801 // undo math above
802 float simTime = m_simulatedTime / timeStep;
803 m_simulatedTime = 0f;
804 return simTime;
805 }
806
807 // Something has collided
808 private void SendCollision(uint localID, uint collidingWith, Vector3 collidePoint, Vector3 collideNormal, float penetration)
809 {
810 if (localID <= TerrainManager.HighestTerrainID)
811 {
812 return; // don't send collisions to the terrain
813 }
814
815 BSPhysObject collider;
816 // NOTE that PhysObjects was locked before the call to SendCollision().
817 if (!PhysObjects.TryGetValue(localID, out collider))
818 {
819 // If the object that is colliding cannot be found, just ignore the collision.
820 DetailLog("{0},BSScene.SendCollision,colliderNotInObjectList,id={1},with={2}", DetailLogZero, localID, collidingWith);
821 return;
822 }
823
824 // Note: the terrain is not in the physical object list so 'collidee' can be null when Collide() is called.
825 BSPhysObject collidee = null;
826 PhysObjects.TryGetValue(collidingWith, out collidee);
827
828 // DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith);
829
830 if (collider.IsInitialized)
831 {
832 if (collider.Collide(collidingWith, collidee, collidePoint, collideNormal, penetration))
833 {
834 // If a collision was 'good', remember to send it to the simulator
835 lock (CollisionLock)
836 {
837 ObjectsWithCollisions.Add(collider);
838 }
839 }
840 }
841
842 return;
843 }
844
845 public void BulletSPluginPhysicsThread()
846 {
847 Thread.CurrentThread.Priority = ThreadPriority.Highest;
848 m_updateWaitEvent = new ManualResetEvent(false);
849
850 while (m_initialized)
851 {
852 int beginSimulationRealtimeMS = Util.EnvironmentTickCount();
853
854 if (BSParam.Active)
855 DoPhysicsStep(BSParam.PhysicsTimeStep);
856
857 int simulationRealtimeMS = Util.EnvironmentTickCountSubtract(beginSimulationRealtimeMS);
858 int simulationTimeVsRealtimeDifferenceMS = ((int)(BSParam.PhysicsTimeStep*1000f)) - simulationRealtimeMS;
859
860 if (simulationTimeVsRealtimeDifferenceMS > 0)
861 {
862 // The simulation of the time interval took less than realtime.
863 // Do a wait for the rest of realtime.
864 m_updateWaitEvent.WaitOne(simulationTimeVsRealtimeDifferenceMS);
865 //Thread.Sleep(simulationTimeVsRealtimeDifferenceMS);
866 }
867 else
868 {
869 // The simulation took longer than realtime.
870 // Do some scaling of simulation time.
871 // TODO.
872 DetailLog("{0},BulletSPluginPhysicsThread,longerThanRealtime={1}", BSScene.DetailLogZero, simulationTimeVsRealtimeDifferenceMS);
873 }
874
875 Watchdog.UpdateThread();
876 }
877
878 Watchdog.RemoveThread();
879 }
880
881 #endregion // Simulation
882
883 public override void GetResults() { }
884
885 #region Terrain
886
887 public override void SetTerrain(float[] heightMap) {
888 TerrainManager.SetTerrain(heightMap);
889 }
890
891 public override void SetWaterLevel(float baseheight)
892 {
893 SimpleWaterLevel = baseheight;
894 }
895
896 public override void DeleteTerrain()
897 {
898 // m_log.DebugFormat("{0}: DeleteTerrain()", LogHeader);
899 }
900
901 // Although no one seems to check this, I do support combining.
902 public override bool SupportsCombining()
903 {
904 return TerrainManager.SupportsCombining();
905 }
906 // This call says I am a child to region zero in a mega-region. 'pScene' is that
907 // of region zero, 'offset' is my offset from regions zero's origin, and
908 // 'extents' is the largest XY that is handled in my region.
909 public override void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents)
910 {
911 TerrainManager.Combine(pScene, offset, extents);
912 }
913
914 // Unhook all the combining that I know about.
915 public override void UnCombine(PhysicsScene pScene)
916 {
917 TerrainManager.UnCombine(pScene);
918 }
919
920 #endregion // Terrain
921
922 public override Dictionary<uint, float> GetTopColliders()
923 {
924 Dictionary<uint, float> topColliders;
925
926 lock (PhysObjects)
927 {
928 foreach (KeyValuePair<uint, BSPhysObject> kvp in PhysObjects)
929 {
930 kvp.Value.ComputeCollisionScore();
931 }
932
933 List<BSPhysObject> orderedPrims = new List<BSPhysObject>(PhysObjects.Values);
934 orderedPrims.OrderByDescending(p => p.CollisionScore);
935 topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore);
936 }
937
938 return topColliders;
939 }
940
941 public override bool IsThreaded { get { return false; } }
942
943 #region Extensions
944 public override object Extension(string pFunct, params object[] pParams)
945 {
946 DetailLog("{0} BSScene.Extension,op={1}", DetailLogZero, pFunct);
947 return base.Extension(pFunct, pParams);
948 }
949 #endregion // Extensions
950
951 public static string PrimitiveBaseShapeToString(PrimitiveBaseShape pbs)
952 {
953 float pathShearX = pbs.PathShearX < 128 ? (float)pbs.PathShearX * 0.01f : (float)(pbs.PathShearX - 256) * 0.01f;
954 float pathShearY = pbs.PathShearY < 128 ? (float)pbs.PathShearY * 0.01f : (float)(pbs.PathShearY - 256) * 0.01f;
955 float pathBegin = (float)pbs.PathBegin * 2.0e-5f;
956 float pathEnd = 1.0f - (float)pbs.PathEnd * 2.0e-5f;
957 float pathScaleX = (float)(200 - pbs.PathScaleX) * 0.01f;
958 float pathScaleY = (float)(200 - pbs.PathScaleY) * 0.01f;
959 float pathTaperX = pbs.PathTaperX * 0.01f;
960 float pathTaperY = pbs.PathTaperY * 0.01f;
961
962 float profileBegin = (float)pbs.ProfileBegin * 2.0e-5f;
963 float profileEnd = 1.0f - (float)pbs.ProfileEnd * 2.0e-5f;
964 float profileHollow = (float)pbs.ProfileHollow * 2.0e-5f;
965 if (profileHollow > 0.95f)
966 profileHollow = 0.95f;
967
968 StringBuilder buff = new StringBuilder();
969 buff.Append("shape=");
970 buff.Append(((ProfileShape)pbs.ProfileShape).ToString());
971 buff.Append(",");
972 buff.Append("hollow=");
973 buff.Append(((HollowShape)pbs.HollowShape).ToString());
974 buff.Append(",");
975 buff.Append("pathCurve=");
976 buff.Append(((Extrusion)pbs.PathCurve).ToString());
977 buff.Append(",");
978 buff.Append("profCurve=");
979 buff.Append(((Extrusion)pbs.ProfileCurve).ToString());
980 buff.Append(",");
981 buff.Append("profHollow=");
982 buff.Append(profileHollow.ToString());
983 buff.Append(",");
984 buff.Append("pathBegEnd=");
985 buff.Append(pathBegin.ToString());
986 buff.Append("/");
987 buff.Append(pathEnd.ToString());
988 buff.Append(",");
989 buff.Append("profileBegEnd=");
990 buff.Append(profileBegin.ToString());
991 buff.Append("/");
992 buff.Append(profileEnd.ToString());
993 buff.Append(",");
994 buff.Append("scaleXY=");
995 buff.Append(pathScaleX.ToString());
996 buff.Append("/");
997 buff.Append(pathScaleY.ToString());
998 buff.Append(",");
999 buff.Append("shearXY=");
1000 buff.Append(pathShearX.ToString());
1001 buff.Append("/");
1002 buff.Append(pathShearY.ToString());
1003 buff.Append(",");
1004 buff.Append("taperXY=");
1005 buff.Append(pbs.PathTaperX.ToString());
1006 buff.Append("/");
1007 buff.Append(pbs.PathTaperY.ToString());
1008 buff.Append(",");
1009 buff.Append("skew=");
1010 buff.Append(pbs.PathSkew.ToString());
1011 buff.Append(",");
1012 buff.Append("twist/Beg=");
1013 buff.Append(pbs.PathTwist.ToString());
1014 buff.Append("/");
1015 buff.Append(pbs.PathTwistBegin.ToString());
1016
1017 return buff.ToString();
1018 }
1019
1020 #region Taints
1021 // The simulation execution order is:
1022 // Simulate()
1023 // DoOneTimeTaints
1024 // TriggerPreStepEvent
1025 // DoOneTimeTaints
1026 // Step()
1027 // ProcessAndSendToSimulatorCollisions
1028 // ProcessAndSendToSimulatorPropertyUpdates
1029 // TriggerPostStepEvent
1030
1031 // Calls to the PhysicsActors can't directly call into the physics engine
1032 // because it might be busy. We delay changes to a known time.
1033 // We rely on C#'s closure to save and restore the context for the delegate.
1034 public void TaintedObject(string pOriginator, string pIdent, TaintCallback pCallback)
1035 {
1036 TaintedObject(false /*inTaintTime*/, pOriginator, pIdent, pCallback);
1037 }
1038 public void TaintedObject(uint pOriginator, String pIdent, TaintCallback pCallback)
1039 {
1040 TaintedObject(false /*inTaintTime*/, m_physicsLoggingEnabled ? pOriginator.ToString() : BSScene.DetailLogZero, pIdent, pCallback);
1041 }
1042 public void TaintedObject(bool inTaintTime, String pIdent, TaintCallback pCallback)
1043 {
1044 TaintedObject(inTaintTime, BSScene.DetailLogZero, pIdent, pCallback);
1045 }
1046 public void TaintedObject(bool inTaintTime, uint pOriginator, String pIdent, TaintCallback pCallback)
1047 {
1048 TaintedObject(inTaintTime, m_physicsLoggingEnabled ? pOriginator.ToString() : BSScene.DetailLogZero, pIdent, pCallback);
1049 }
1050 // Sometimes a potentially tainted operation can be used in and out of taint time.
1051 // This routine executes the command immediately if in taint-time otherwise it is queued.
1052 public void TaintedObject(bool inTaintTime, string pOriginator, string pIdent, TaintCallback pCallback)
1053 {
1054 if (!m_initialized) return;
1055
1056 if (inTaintTime)
1057 pCallback();
1058 else
1059 {
1060 lock (_taintLock)
1061 {
1062 _taintOperations.Add(new TaintCallbackEntry(pOriginator, pIdent, pCallback));
1063 }
1064 }
1065 }
1066
1067 private void TriggerPreStepEvent(float timeStep)
1068 {
1069 PreStepAction actions = BeforeStep;
1070 if (actions != null)
1071 actions(timeStep);
1072
1073 }
1074
1075 private void TriggerPostStepEvent(float timeStep)
1076 {
1077 PostStepAction actions = AfterStep;
1078 if (actions != null)
1079 actions(timeStep);
1080
1081 }
1082
1083 // When someone tries to change a property on a BSPrim or BSCharacter, the object queues
1084 // a callback into itself to do the actual property change. That callback is called
1085 // here just before the physics engine is called to step the simulation.
1086 public void ProcessTaints()
1087 {
1088 ProcessRegularTaints();
1089 ProcessPostTaintTaints();
1090 }
1091
1092 private void ProcessRegularTaints()
1093 {
1094 if (m_initialized && _taintOperations.Count > 0) // save allocating new list if there is nothing to process
1095 {
1096 // swizzle a new list into the list location so we can process what's there
1097 List<TaintCallbackEntry> oldList;
1098 lock (_taintLock)
1099 {
1100 oldList = _taintOperations;
1101 _taintOperations = new List<TaintCallbackEntry>();
1102 }
1103
1104 foreach (TaintCallbackEntry tcbe in oldList)
1105 {
1106 try
1107 {
1108 DetailLog("{0},BSScene.ProcessTaints,doTaint,id={1}", tcbe.originator, tcbe.ident); // DEBUG DEBUG DEBUG
1109 tcbe.callback();
1110 }
1111 catch (Exception e)
1112 {
1113 m_log.ErrorFormat("{0}: ProcessTaints: {1}: Exception: {2}", LogHeader, tcbe.ident, e);
1114 }
1115 }
1116 oldList.Clear();
1117 }
1118 }
1119
1120 // Schedule an update to happen after all the regular taints are processed.
1121 // Note that new requests for the same operation ("ident") for the same object ("ID")
1122 // will replace any previous operation by the same object.
1123 public void PostTaintObject(String ident, uint ID, TaintCallback callback)
1124 {
1125 string IDAsString = ID.ToString();
1126 string uniqueIdent = ident + "-" + IDAsString;
1127 lock (_taintLock)
1128 {
1129 _postTaintOperations[uniqueIdent] = new TaintCallbackEntry(IDAsString, uniqueIdent, callback);
1130 }
1131
1132 return;
1133 }
1134
1135 // Taints that happen after the normal taint processing but before the simulation step.
1136 private void ProcessPostTaintTaints()
1137 {
1138 if (m_initialized && _postTaintOperations.Count > 0)
1139 {
1140 Dictionary<string, TaintCallbackEntry> oldList;
1141 lock (_taintLock)
1142 {
1143 oldList = _postTaintOperations;
1144 _postTaintOperations = new Dictionary<string, TaintCallbackEntry>();
1145 }
1146
1147 foreach (KeyValuePair<string,TaintCallbackEntry> kvp in oldList)
1148 {
1149 try
1150 {
1151 DetailLog("{0},BSScene.ProcessPostTaintTaints,doTaint,id={1}", DetailLogZero, kvp.Key); // DEBUG DEBUG DEBUG
1152 kvp.Value.callback();
1153 }
1154 catch (Exception e)
1155 {
1156 m_log.ErrorFormat("{0}: ProcessPostTaintTaints: {1}: Exception: {2}", LogHeader, kvp.Key, e);
1157 }
1158 }
1159 oldList.Clear();
1160 }
1161 }
1162
1163 // Only used for debugging. Does not change state of anything so locking is not necessary.
1164 public bool AssertInTaintTime(string whereFrom)
1165 {
1166 if (!InTaintTime)
1167 {
1168 DetailLog("{0},BSScene.AssertInTaintTime,NOT IN TAINT TIME,Region={1},Where={2}", DetailLogZero, RegionName, whereFrom);
1169 m_log.ErrorFormat("{0} NOT IN TAINT TIME!! Region={1}, Where={2}", LogHeader, RegionName, whereFrom);
1170 // Util.PrintCallStack(DetailLog);
1171 }
1172 return InTaintTime;
1173 }
1174
1175 #endregion // Taints
1176
1177 #region IPhysicsParameters
1178 // Get the list of parameters this physics engine supports
1179 public PhysParameterEntry[] GetParameterList()
1180 {
1181 BSParam.BuildParameterTable();
1182 return BSParam.SettableParameters;
1183 }
1184
1185 // Set parameter on a specific or all instances.
1186 // Return 'false' if not able to set the parameter.
1187 // Setting the value in the m_params block will change the value the physics engine
1188 // will use the next time since it's pinned and shared memory.
1189 // Some of the values require calling into the physics engine to get the new
1190 // value activated ('terrainFriction' for instance).
1191 public bool SetPhysicsParameter(string parm, string val, uint localID)
1192 {
1193 bool ret = false;
1194
1195 BSParam.ParameterDefnBase theParam;
1196 if (BSParam.TryGetParameter(parm, out theParam))
1197 {
1198 // Set the value in the C# code
1199 theParam.SetValue(this, val);
1200
1201 // Optionally set the parameter in the unmanaged code
1202 if (theParam.HasSetOnObject)
1203 {
1204 // update all the localIDs specified
1205 // If the local ID is APPLY_TO_NONE, just change the default value
1206 // If the localID is APPLY_TO_ALL change the default value and apply the new value to all the lIDs
1207 // If the localID is a specific object, apply the parameter change to only that object
1208 List<uint> objectIDs = new List<uint>();
1209 switch (localID)
1210 {
1211 case PhysParameterEntry.APPLY_TO_NONE:
1212 // This will cause a call into the physical world if some operation is specified (SetOnObject).
1213 objectIDs.Add(TERRAIN_ID);
1214 TaintedUpdateParameter(parm, objectIDs, val);
1215 break;
1216 case PhysParameterEntry.APPLY_TO_ALL:
1217 lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys);
1218 TaintedUpdateParameter(parm, objectIDs, val);
1219 break;
1220 default:
1221 // setting only one localID
1222 objectIDs.Add(localID);
1223 TaintedUpdateParameter(parm, objectIDs, val);
1224 break;
1225 }
1226 }
1227
1228 ret = true;
1229 }
1230 return ret;
1231 }
1232
1233 // schedule the actual updating of the paramter to when the phys engine is not busy
1234 private void TaintedUpdateParameter(string parm, List<uint> lIDs, string val)
1235 {
1236 string xval = val;
1237 List<uint> xlIDs = lIDs;
1238 string xparm = parm;
1239 TaintedObject(DetailLogZero, "BSScene.UpdateParameterSet", delegate() {
1240 BSParam.ParameterDefnBase thisParam;
1241 if (BSParam.TryGetParameter(xparm, out thisParam))
1242 {
1243 if (thisParam.HasSetOnObject)
1244 {
1245 foreach (uint lID in xlIDs)
1246 {
1247 BSPhysObject theObject = null;
1248 if (PhysObjects.TryGetValue(lID, out theObject))
1249 thisParam.SetOnObject(this, theObject);
1250 }
1251 }
1252 }
1253 });
1254 }
1255
1256 // Get parameter.
1257 // Return 'false' if not able to get the parameter.
1258 public bool GetPhysicsParameter(string parm, out string value)
1259 {
1260 string val = String.Empty;
1261 bool ret = false;
1262 BSParam.ParameterDefnBase theParam;
1263 if (BSParam.TryGetParameter(parm, out theParam))
1264 {
1265 val = theParam.GetValue(this);
1266 ret = true;
1267 }
1268 value = val;
1269 return ret;
1270 }
1271
1272 #endregion IPhysicsParameters
1273
1274 // Invoke the detailed logger and output something if it's enabled.
1275 public void DetailLog(string msg, params Object[] args)
1276 {
1277 PhysicsLogging.Write(msg, args);
1278 }
1279 // Used to fill in the LocalID when there isn't one. It's the correct number of characters.
1280 public const string DetailLogZero = "0000000000";
1281
1282}
1283}
diff --git a/OpenSim/Region/Physics/ChOdePlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/ChOdePlugin/AssemblyInfo.cs
deleted file mode 100644
index d65929a..0000000
--- a/OpenSim/Region/Physics/ChOdePlugin/AssemblyInfo.cs
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Reflection;
29using System.Runtime.InteropServices;
30
31// Information about this assembly is defined by the following
32// attributes.
33//
34// change them to the information which is associated with the assembly
35// you compile.
36
37[assembly : AssemblyTitle("OdePlugin")]
38[assembly : AssemblyDescription("")]
39[assembly : AssemblyConfiguration("")]
40[assembly : AssemblyCompany("http://opensimulator.org")]
41[assembly : AssemblyProduct("OdePlugin")]
42[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
43[assembly : AssemblyTrademark("")]
44[assembly : AssemblyCulture("")]
45
46// This sets the default COM visibility of types in the assembly to invisible.
47// If you need to expose a type to COM, use [ComVisible(true)] on that type.
48
49[assembly : ComVisible(false)]
50
51// The assembly version has following format :
52//
53// Major.Minor.Build.Revision
54//
55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default):
57
58[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 e7a39eb..0000000
--- a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs
+++ /dev/null
@@ -1,1467 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using OpenMetaverse;
32using Ode.NET;
33using OpenSim.Framework;
34using OpenSim.Region.Physics.Manager;
35using log4net;
36
37namespace OpenSim.Region.Physics.OdePlugin
38{
39 /// <summary>
40 /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves.
41 /// </summary>
42
43 public enum dParam : int
44 {
45 LowStop = 0,
46 HiStop = 1,
47 Vel = 2,
48 FMax = 3,
49 FudgeFactor = 4,
50 Bounce = 5,
51 CFM = 6,
52 StopERP = 7,
53 StopCFM = 8,
54 LoStop2 = 256,
55 HiStop2 = 257,
56 Vel2 = 258,
57 FMax2 = 259,
58 StopERP2 = 7 + 256,
59 StopCFM2 = 8 + 256,
60 LoStop3 = 512,
61 HiStop3 = 513,
62 Vel3 = 514,
63 FMax3 = 515,
64 StopERP3 = 7 + 512,
65 StopCFM3 = 8 + 512
66 }
67 public class OdeCharacter : PhysicsActor
68 {
69 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
70
71 private Vector3 _position;
72 private d.Vector3 _zeroPosition;
73 // private d.Matrix3 m_StandUpRotation;
74 private bool _zeroFlag = false;
75 private bool m_lastUpdateSent = false;
76 private Vector3 _velocity;
77 private Vector3 _target_velocity;
78 private Vector3 _acceleration;
79 private Vector3 m_rotationalVelocity;
80 private float m_mass = 80f;
81 public float m_density = 60f;
82 private bool m_pidControllerActive = true;
83 public float PID_D = 800.0f;
84 public float PID_P = 900.0f;
85 //private static float POSTURE_SERVO = 10000.0f;
86 public float CAPSULE_RADIUS = 0.37f;
87 public float CAPSULE_LENGTH = 2.140599f;
88 public float m_tensor = 3800000f;
89 public float heightFudgeFactor = 0.52f;
90 public float walkDivisor = 1.3f;
91 public float runDivisor = 0.8f;
92 private bool flying = false;
93 private bool jumping = false; // add for jumping
94 private bool m_iscolliding = false;
95 private bool m_iscollidingGround = false;
96 private bool m_wascolliding = false;
97 private bool m_wascollidingGround = false;
98 private bool m_iscollidingObj = false;
99 private bool m_alwaysRun = false;
100 private bool m_hackSentFall = false;
101 private bool m_hackSentFly = false;
102 private int m_requestedUpdateFrequency = 0;
103 private Vector3 m_taintPosition = Vector3.Zero;
104 public uint m_localID = 0;
105 public bool m_returnCollisions = false;
106 // taints and their non-tainted counterparts
107 public bool m_isPhysical = false; // the current physical status
108 public bool m_tainted_isPhysical = false; // set when the physical status is tainted (false=not existing in physics engine, true=existing)
109 public float MinimumGroundFlightOffset = 3f;
110
111 private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes.
112 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
113
114
115 private float m_buoyancy = 0f;
116
117 // private CollisionLocker ode;
118
119 private string m_name = String.Empty;
120
121 private bool[] m_colliderarr = new bool[11];
122 private bool[] m_colliderGroundarr = new bool[11];
123
124 // Default we're a Character
125 private CollisionCategories m_collisionCategories = (CollisionCategories.Character);
126
127 // Default, Collide with Other Geometries, spaces, bodies and characters.
128 private CollisionCategories m_collisionFlags = (CollisionCategories.Geom
129 | CollisionCategories.Space
130 | CollisionCategories.Body
131 | CollisionCategories.Character
132 | CollisionCategories.Land);
133 public IntPtr Body = IntPtr.Zero;
134 private OdeScene _parent_scene;
135 public IntPtr Shell = IntPtr.Zero;
136 public IntPtr Amotor = IntPtr.Zero;
137 public d.Mass ShellMass;
138 public bool collidelock = false;
139
140 public int m_eventsubscription = 0;
141 private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
142
143 private Vector3 m_taintMomentum = Vector3.Zero;
144 private bool m_haveTaintMomentum = false;
145
146
147 // unique UUID of this character object
148 public UUID m_uuid;
149 public bool bad = false;
150 private Object m_syncRoot = new Object();
151
152 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)
153 {
154 m_uuid = UUID.Random();
155
156 if (pos.IsFinite())
157 {
158 if (pos.Z > 9999999f)
159 {
160 pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
161 }
162 if (pos.Z < -90000f)
163 {
164 pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
165 }
166 _position = pos;
167 m_taintPosition.X = pos.X;
168 m_taintPosition.Y = pos.Y;
169 m_taintPosition.Z = pos.Z;
170 }
171 else
172 {
173 _position = new Vector3(((float)_parent_scene.WorldExtents.X * 0.5f), ((float)_parent_scene.WorldExtents.Y * 0.5f), parent_scene.GetTerrainHeightAtXY(128f, 128f) + 10f);
174 m_taintPosition.X = _position.X;
175 m_taintPosition.Y = _position.Y;
176 m_taintPosition.Z = _position.Z;
177 m_log.Warn("[PHYSICS]: Got NaN Position on Character Create");
178 }
179
180 _parent_scene = parent_scene;
181
182 PID_D = pid_d;
183 PID_P = pid_p;
184 CAPSULE_RADIUS = capsule_radius;
185 m_tensor = tensor;
186 m_density = density;
187 heightFudgeFactor = height_fudge_factor;
188 walkDivisor = walk_divisor;
189 runDivisor = rundivisor;
190
191 // m_StandUpRotation =
192 // new d.Matrix3(0.5f, 0.7071068f, 0.5f, -0.7071068f, 0f, 0.7071068f, 0.5f, -0.7071068f,
193 // 0.5f);
194
195 for (int i = 0; i < 11; i++)
196 {
197 m_colliderarr[i] = false;
198 }
199 CAPSULE_LENGTH = (size.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
200 //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
201 m_tainted_CAPSULE_LENGTH = CAPSULE_LENGTH;
202
203 m_isPhysical = false; // current status: no ODE information exists
204 m_tainted_isPhysical = true; // new tainted status: need to create ODE information
205
206 _parent_scene.AddPhysicsActorTaint(this);
207
208 m_name = avName;
209 }
210
211 public override int PhysicsActorType
212 {
213 get { return (int) ActorTypes.Agent; }
214 set { return; }
215 }
216
217 /// <summary>
218 /// If this is set, the avatar will move faster
219 /// </summary>
220 public override bool SetAlwaysRun
221 {
222 get { return m_alwaysRun; }
223 set { m_alwaysRun = value; }
224 }
225
226 public override uint LocalID
227 {
228 set { m_localID = value; }
229 }
230
231 public override bool Grabbed
232 {
233 set { return; }
234 }
235
236 public override bool Selected
237 {
238// set { return; }
239 set { jumping = value; } // add for jumping flag
240 }
241
242 public override float Buoyancy
243 {
244 get { return m_buoyancy; }
245 set { m_buoyancy = value; }
246 }
247
248 public override bool FloatOnWater
249 {
250 set { return; }
251 }
252
253 public override bool IsPhysical
254 {
255 get { return false; }
256 set { return; }
257 }
258
259 public override bool ThrottleUpdates
260 {
261 get { return false; }
262 set { return; }
263 }
264
265 public override bool Flying
266 {
267 get { return flying; }
268 set { flying = value; }
269 }
270
271 /// <summary>
272 /// Returns if the avatar is colliding in general.
273 /// This includes the ground and objects and avatar.
274 /// </summary>
275 public override bool IsColliding
276 {
277//#@ get { return m_iscolliding; }
278 get { //##
279//Console.WriteLine(">>>>>>>>>>>> IC get = {0}", m_iscolliding); //##
280 return m_iscolliding; } //##
281 set
282 {
283 int i;
284 int truecount = 0;
285 int falsecount = 0;
286
287 if (m_colliderarr.Length >= 10)
288 {
289 for (i = 0; i < 10; i++)
290 {
291 m_colliderarr[i] = m_colliderarr[i + 1];
292 }
293 }
294 m_colliderarr[10] = value;
295
296 for (i = 0; i < 11; i++)
297 {
298 if (m_colliderarr[i])
299 {
300 truecount++;
301 }
302 else
303 {
304 falsecount++;
305 }
306 }
307
308 // Equal truecounts and false counts means we're colliding with something.
309
310 if (falsecount > 1.2*truecount)
311 {
312 m_iscolliding = false;
313 }
314 else
315 {
316 m_iscolliding = true;
317 }
318// ## Console.WriteLine("IC SET = {0} t{1} f{2} i {3}", value, truecount, falsecount, m_iscolliding);
319 if (m_wascolliding != m_iscolliding)
320 {
321 //base.SendCollisionUpdate(new CollisionEventUpdate());
322 }
323 m_wascolliding = m_iscolliding;
324 }
325 }
326
327 /// <summary>
328 /// Returns if an avatar is colliding with the ground
329 /// </summary>
330 public override bool CollidingGround
331 {
332 get { return m_iscollidingGround; }
333 set
334 {
335 // Collisions against the ground are not really reliable
336 // So, to get a consistant value we have to average the current result over time
337 // Currently we use 1 second = 10 calls to this.
338 int i;
339 int truecount = 0;
340 int falsecount = 0;
341
342 if (m_colliderGroundarr.Length >= 10)
343 {
344 for (i = 0; i < 10; i++)
345 {
346 m_colliderGroundarr[i] = m_colliderGroundarr[i + 1];
347 }
348 }
349 m_colliderGroundarr[10] = value;
350
351 for (i = 0; i < 11; i++)
352 {
353 if (m_colliderGroundarr[i])
354 {
355 truecount++;
356 }
357 else
358 {
359 falsecount++;
360 }
361 }
362
363 // Equal truecounts and false counts means we're colliding with something.
364
365 if (falsecount > 1.2*truecount)
366 {
367 m_iscollidingGround = false;
368 }
369 else
370 {
371 m_iscollidingGround = true;
372 }
373 if (m_wascollidingGround != m_iscollidingGround)
374 {
375 //base.SendCollisionUpdate(new CollisionEventUpdate());
376 }
377 m_wascollidingGround = m_iscollidingGround;
378 }
379 }
380
381 /// <summary>
382 /// Returns if the avatar is colliding with an object
383 /// </summary>
384 public override bool CollidingObj
385 {
386 get { return m_iscollidingObj; }
387 set
388 {
389 m_iscollidingObj = value;
390 if (value)
391 m_pidControllerActive = false;
392 else
393 m_pidControllerActive = true;
394 }
395 }
396
397 /// <summary>
398 /// turn the PID controller on or off.
399 /// The PID Controller will turn on all by itself in many situations
400 /// </summary>
401 /// <param name="status"></param>
402 public void SetPidStatus(bool status)
403 {
404 m_pidControllerActive = status;
405 }
406
407 public override bool Stopped
408 {
409 get { return _zeroFlag; }
410 }
411
412 /// <summary>
413 /// This 'puts' an avatar somewhere in the physics space.
414 /// Not really a good choice unless you 'know' it's a good
415 /// spot otherwise you're likely to orbit the avatar.
416 /// </summary>
417 public override Vector3 Position
418 {
419 get { return _position; }
420 set
421 {
422 if (Body == IntPtr.Zero || Shell == IntPtr.Zero)
423 {
424 if (value.IsFinite())
425 {
426 if (value.Z > 9999999f)
427 {
428 value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
429 }
430 if (value.Z < -90000f)
431 {
432 value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5;
433 }
434
435 _position.X = value.X;
436 _position.Y = value.Y;
437 _position.Z = value.Z;
438
439 m_taintPosition.X = value.X;
440 m_taintPosition.Y = value.Y;
441 m_taintPosition.Z = value.Z;
442 _parent_scene.AddPhysicsActorTaint(this);
443 }
444 else
445 {
446 m_log.Warn("[PHYSICS]: Got a NaN Position from Scene on a Character");
447 }
448 }
449 }
450 }
451
452 public override Vector3 RotationalVelocity
453 {
454 get { return m_rotationalVelocity; }
455 set { m_rotationalVelocity = value; }
456 }
457
458 /// <summary>
459 /// This property sets the height of the avatar only. We use the height to make sure the avatar stands up straight
460 /// and use it to offset landings properly
461 /// </summary>
462 public override Vector3 Size
463 {
464 get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); }
465 set
466 {
467 if (value.IsFinite())
468 {
469 m_pidControllerActive = true;
470
471 Vector3 SetSize = value;
472 m_tainted_CAPSULE_LENGTH = (SetSize.Z*1.15f) - CAPSULE_RADIUS*2.0f;
473 //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
474
475 Velocity = Vector3.Zero;
476 m_taintPosition = _position; // update the stale taint position
477 _parent_scene.AddPhysicsActorTaint(this);
478 }
479 else
480 {
481 m_log.Warn("[PHYSICS]: Got a NaN Size from Scene on a Character");
482 }
483 }
484 }
485
486 private void AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3 movementVector)
487 {
488 movementVector.Z = 0f;
489 float magnitude = (float)Math.Sqrt((double)(movementVector.X * movementVector.X + movementVector.Y * movementVector.Y));
490 if (magnitude < 0.1f) return;
491
492 // normalize the velocity vector
493 float invMagnitude = 1.0f / magnitude;
494 movementVector.X *= invMagnitude;
495 movementVector.Y *= invMagnitude;
496
497 // if we change the capsule heading too often, the capsule can fall down
498 // therefore we snap movement vector to just 1 of 4 predefined directions (ne, nw, se, sw),
499 // meaning only 4 possible capsule tilt orientations
500 if (movementVector.X > 0)
501 {
502 // east
503 if (movementVector.Y > 0)
504 {
505 // northeast
506 movementVector.X = (float)Math.Sqrt(2.0);
507 movementVector.Y = (float)Math.Sqrt(2.0);
508 }
509 else
510 {
511 // southeast
512 movementVector.X = (float)Math.Sqrt(2.0);
513 movementVector.Y = -(float)Math.Sqrt(2.0);
514 }
515 }
516 else
517 {
518 // west
519 if (movementVector.Y > 0)
520 {
521 // northwest
522 movementVector.X = -(float)Math.Sqrt(2.0);
523 movementVector.Y = (float)Math.Sqrt(2.0);
524 }
525 else
526 {
527 // southwest
528 movementVector.X = -(float)Math.Sqrt(2.0);
529 movementVector.Y = -(float)Math.Sqrt(2.0);
530 }
531 }
532
533
534 // movementVector.Z is zero
535
536 // calculate tilt components based on desired amount of tilt and current (snapped) heading.
537 // the "-" sign is to force the tilt to be OPPOSITE the direction of movement.
538 float xTiltComponent = -movementVector.X * m_tiltMagnitudeWhenProjectedOnXYPlane;
539 float yTiltComponent = -movementVector.Y * m_tiltMagnitudeWhenProjectedOnXYPlane;
540
541 //m_log.Debug("[PHYSICS] changing avatar tilt");
542 d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, xTiltComponent);
543 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, xTiltComponent); // must be same as lowstop, else a different, spurious tilt is introduced
544 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, yTiltComponent);
545 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, yTiltComponent); // same as lowstop
546 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, 0f);
547 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop
548 }
549
550 /// <summary>
551 /// This creates the Avatar's physical Surrogate at the position supplied
552 /// </summary>
553 /// <param name="npositionX"></param>
554 /// <param name="npositionY"></param>
555 /// <param name="npositionZ"></param>
556
557 // WARNING: This MUST NOT be called outside of ProcessTaints, else we can have unsynchronized access
558 // to ODE internals. ProcessTaints is called from within thread-locked Simulate(), so it is the only
559 // place that is safe to call this routine AvatarGeomAndBodyCreation.
560 private void AvatarGeomAndBodyCreation(float npositionX, float npositionY, float npositionZ, float tensor)
561 {
562 //CAPSULE_LENGTH = -5;
563 //CAPSULE_RADIUS = -5;
564 int dAMotorEuler = 1;
565 _parent_scene.waitForSpaceUnlock(_parent_scene.space);
566 if (CAPSULE_LENGTH <= 0)
567 {
568 m_log.Warn("[PHYSICS]: The capsule size you specified in opensim.ini is invalid! Setting it to the smallest possible size!");
569 CAPSULE_LENGTH = 0.01f;
570
571 }
572
573 if (CAPSULE_RADIUS <= 0)
574 {
575 m_log.Warn("[PHYSICS]: The capsule size you specified in opensim.ini is invalid! Setting it to the smallest possible size!");
576 CAPSULE_RADIUS = 0.01f;
577
578 }
579
580 if(Shell != IntPtr.Zero)
581 {
582 try
583 {
584 d.GeomDestroy(Shell);
585 }
586 catch (System.AccessViolationException)
587 {
588 m_log.Error("[PHYSICS]: PrimGeom dead");
589 }
590 // Remove any old entries
591//string tShell;
592//_parent_scene.geom_name_map.TryGetValue(Shell, out tShell);
593//Console.WriteLine("**** Remove {0}", tShell);
594 if(_parent_scene.geom_name_map.ContainsKey(Shell)) _parent_scene.geom_name_map.Remove(Shell);
595 if(_parent_scene.actor_name_map.ContainsKey(Shell)) _parent_scene.actor_name_map.Remove(Shell);
596 }
597
598 Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
599 _parent_scene.geom_name_map[Shell] = m_name;
600 _parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
601//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);
602
603 d.GeomSetCategoryBits(Shell, (int)m_collisionCategories);
604 d.GeomSetCollideBits(Shell, (int)m_collisionFlags);
605
606 d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH);
607 Body = d.BodyCreate(_parent_scene.world);
608 d.BodySetPosition(Body, npositionX, npositionY, npositionZ);
609
610 _position.X = npositionX;
611 _position.Y = npositionY;
612 _position.Z = npositionZ;
613
614
615 m_taintPosition.X = npositionX;
616 m_taintPosition.Y = npositionY;
617 m_taintPosition.Z = npositionZ;
618
619 d.BodySetMass(Body, ref ShellMass);
620 d.Matrix3 m_caprot;
621 // 90 Stand up on the cap of the capped cyllinder
622 if (_parent_scene.IsAvCapsuleTilted)
623 {
624 d.RFromAxisAndAngle(out m_caprot, 1, 0, 1, (float)(Math.PI / 2));
625 }
626 else
627 {
628 d.RFromAxisAndAngle(out m_caprot, 0, 0, 1, (float)(Math.PI / 2));
629 }
630
631
632 d.GeomSetRotation(Shell, ref m_caprot);
633 d.BodySetRotation(Body, ref m_caprot);
634
635 d.GeomSetBody(Shell, Body);
636
637
638 // The purpose of the AMotor here is to keep the avatar's physical
639 // surrogate from rotating while moving
640 Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero);
641 d.JointAttach(Amotor, Body, IntPtr.Zero);
642 d.JointSetAMotorMode(Amotor, dAMotorEuler);
643 d.JointSetAMotorNumAxes(Amotor, 3);
644 d.JointSetAMotorAxis(Amotor, 0, 0, 1, 0, 0);
645 d.JointSetAMotorAxis(Amotor, 1, 0, 0, 1, 0);
646 d.JointSetAMotorAxis(Amotor, 2, 0, 0, 0, 1);
647 d.JointSetAMotorAngle(Amotor, 0, 0);
648 d.JointSetAMotorAngle(Amotor, 1, 0);
649 d.JointSetAMotorAngle(Amotor, 2, 0);
650
651 // These lowstops and high stops are effectively (no wiggle room)
652 if (_parent_scene.IsAvCapsuleTilted)
653 {
654 d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0.000000000001f);
655 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0.000000000001f);
656 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -0.000000000001f);
657 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.000000000001f);
658 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0.000000000001f);
659 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f);
660 }
661 else
662 {
663 #region Documentation of capsule motor LowStop and HighStop parameters
664 // Intentionally introduce some tilt into the capsule by setting
665 // the motor stops to small epsilon values. This small tilt prevents
666 // the capsule from falling into the terrain; a straight-up capsule
667 // (with -0..0 motor stops) falls into the terrain for reasons yet
668 // to be comprehended in their entirety.
669 #endregion
670 AlignAvatarTiltWithCurrentDirectionOfMovement(Vector3.Zero);
671 d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f);
672 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f);
673 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f);
674 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.08f); // must be same as lowstop, else a different, spurious tilt is introduced
675 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop
676 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.08f); // same as lowstop
677 }
678
679 // Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the
680 // capped cyllinder will fall over
681 d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f);
682 d.JointSetAMotorParam(Amotor, (int)dParam.FMax, tensor);
683
684 //d.Matrix3 bodyrotation = d.BodyGetRotation(Body);
685 //d.QfromR(
686 //d.Matrix3 checkrotation = new d.Matrix3(0.7071068,0.5, -0.7071068,
687 //
688 //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22);
689 //standupStraight();
690 }
691
692 //
693 /// <summary>
694 /// Uses the capped cyllinder volume formula to calculate the avatar's mass.
695 /// This may be used in calculations in the scene/scenepresence
696 /// </summary>
697 public override float Mass
698 {
699 get
700 {
701 float AVvolume = (float) (Math.PI*Math.Pow(CAPSULE_RADIUS, 2)*CAPSULE_LENGTH);
702 return m_density*AVvolume;
703 }
704 }
705 public override void link(PhysicsActor obj)
706 {
707
708 }
709
710 public override void delink()
711 {
712
713 }
714
715 public override void LockAngularMotion(Vector3 axis)
716 {
717
718 }
719
720// This code is very useful. Written by DanX0r. We're just not using it right now.
721// Commented out to prevent a warning.
722//
723// private void standupStraight()
724// {
725// // The purpose of this routine here is to quickly stabilize the Body while it's popped up in the air.
726// // The amotor needs a few seconds to stabilize so without it, the avatar shoots up sky high when you
727// // change appearance and when you enter the simulator
728// // After this routine is done, the amotor stabilizes much quicker
729// d.Vector3 feet;
730// d.Vector3 head;
731// d.BodyGetRelPointPos(Body, 0.0f, 0.0f, -1.0f, out feet);
732// d.BodyGetRelPointPos(Body, 0.0f, 0.0f, 1.0f, out head);
733// float posture = head.Z - feet.Z;
734
735// // restoring force proportional to lack of posture:
736// float servo = (2.5f - posture) * POSTURE_SERVO;
737// d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f);
738// d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f);
739// //d.Matrix3 bodyrotation = d.BodyGetRotation(Body);
740// //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22);
741// }
742
743 public override Vector3 Force
744 {
745 get { return _target_velocity; }
746 set { return; }
747 }
748
749 public override int VehicleType
750 {
751 get { return 0; }
752 set { return; }
753 }
754
755 public override void VehicleFloatParam(int param, float value)
756 {
757
758 }
759
760 public override void VehicleVectorParam(int param, Vector3 value)
761 {
762
763 }
764
765 public override void VehicleRotationParam(int param, Quaternion rotation)
766 {
767
768 }
769
770 public override void VehicleFlags(int flags, bool remove)
771 {
772 }
773
774 public override void SetVolumeDetect(int param)
775 {
776
777 }
778
779 public override Vector3 CenterOfMass
780 {
781 get { return Vector3.Zero; }
782 }
783
784 public override Vector3 GeometricCenter
785 {
786 get { return Vector3.Zero; }
787 }
788
789 public override PrimitiveBaseShape Shape
790 {
791 set { return; }
792 }
793
794 public override Vector3 Velocity
795 {
796 get {
797 // There's a problem with Vector3.Zero! Don't Use it Here!
798 if (_zeroFlag)
799 return Vector3.Zero;
800 m_lastUpdateSent = false;
801 return _velocity;
802 }
803 set
804 {
805 if (value.IsFinite())
806 {
807 _target_velocity = value;
808 m_pidControllerActive = true;
809 }
810 else
811 {
812 m_log.Warn("[PHYSICS]: Got a NaN velocity from Scene in a Character");
813 }
814 }
815 }
816
817 public override Vector3 Torque
818 {
819 get { return Vector3.Zero; }
820 set { return; }
821 }
822
823 public override float CollisionScore
824 {
825 get { return 0f; }
826 set { }
827 }
828
829 public override bool Kinematic
830 {
831 get { return false; }
832 set { }
833 }
834
835 public override Quaternion Orientation
836 {
837 get { return Quaternion.Identity; }
838 set {
839 //Matrix3 or = Orientation.ToRotationMatrix();
840 //d.Matrix3 ord = new d.Matrix3(or.m00, or.m10, or.m20, or.m01, or.m11, or.m21, or.m02, or.m12, or.m22);
841 //d.BodySetRotation(Body, ref ord);
842 }
843 }
844
845 public override Vector3 Acceleration
846 {
847 get { return _acceleration; }
848 set { _acceleration = value; }
849 }
850
851 public void SetAcceleration(Vector3 accel)
852 {
853 m_pidControllerActive = true;
854 _acceleration = accel;
855 }
856
857 /// <summary>
858 /// Adds the force supplied to the Target Velocity
859 /// The PID controller takes this target velocity and tries to make it a reality
860 /// </summary>
861 /// <param name="force"></param>
862 public override void AddForce(Vector3 force, bool pushforce)
863 {
864 if (force.IsFinite())
865 {
866 if (pushforce)
867 {
868 m_pidControllerActive = false;
869 force *= 100f;
870//Console.WriteLine("DF 1"); // ##
871 if (!force.ApproxEquals(Vector3.Zero, 0.01f))
872 doForce(force);
873 // If uncommented, things get pushed off world
874 //
875 // m_log.Debug("Push!");
876 // _target_velocity.X += force.X;
877 // _target_velocity.Y += force.Y;
878 // _target_velocity.Z += force.Z;
879 }
880 else
881 {
882 m_pidControllerActive = true;
883 _target_velocity.X += force.X;
884 _target_velocity.Y += force.Y;
885 _target_velocity.Z += force.Z;
886 }
887 }
888 else
889 {
890 m_log.Warn("[PHYSICS]: Got a NaN force applied to a Character");
891 }
892 //m_lastUpdateSent = false;
893 }
894
895 public override void AddAngularForce(Vector3 force, bool pushforce)
896 {
897
898 }
899
900 /// <summary>
901 /// After all of the forces add up with 'add force' we apply them with doForce
902 /// </summary>
903 /// <param name="force"></param>
904 public void doForce(Vector3 force)
905 {
906 if (!collidelock)
907 {
908 d.BodyAddForce(Body, force.X, force.Y, force.Z);
909 //d.BodySetRotation(Body, ref m_StandUpRotation);
910 //standupStraight();
911 d.Vector3 vel = d.BodyGetLinearVel(Body); //##
912//Console.WriteLine("AvVel <{0},{1},{2}>", vel.X, vel.Y, vel.Z); //##
913 }
914 }
915
916 public override void SetMomentum(Vector3 momentum)
917 {
918 if (momentum.IsFinite())
919 {
920 m_taintMomentum = momentum;
921 m_haveTaintMomentum = true;
922 _parent_scene.AddPhysicsActorTaint(this);
923 }
924 else
925 m_log.Warn("[PHYSICS] !isFinite momentum");
926 }
927
928
929 /// <summary>
930 /// Called from Simulate
931 /// This is the avatar's movement control + PID Controller
932 /// </summary>
933 /// <param name="timeStep"></param>
934 public void Move(float timeStep, List<OdeCharacter> defects)
935 {
936 // no lock; for now it's only called from within Simulate()
937
938 // If the PID Controller isn't active then we set our force
939 // calculating base velocity to the current position
940
941 if (Body == IntPtr.Zero)
942 return;
943
944 if (m_pidControllerActive == false)
945 {
946 _zeroPosition = d.BodyGetPosition(Body);
947 }
948 //PidStatus = true;
949
950 d.Vector3 localpos = d.BodyGetPosition(Body);
951 Vector3 localPos = new Vector3(localpos.X, localpos.Y, localpos.Z);
952
953 if (!localPos.IsFinite())
954 {
955
956 m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
957 defects.Add(this);
958 // _parent_scene.RemoveCharacter(this);
959
960 // destroy avatar capsule and related ODE data
961 if (Amotor != IntPtr.Zero)
962 {
963 // Kill the Amotor
964 d.JointDestroy(Amotor);
965 Amotor = IntPtr.Zero;
966 }
967
968 //kill the Geometry
969 _parent_scene.waitForSpaceUnlock(_parent_scene.space);
970
971 if (Body != IntPtr.Zero)
972 {
973 //kill the body
974 d.BodyDestroy(Body);
975
976 Body = IntPtr.Zero;
977 }
978
979 if(Shell != IntPtr.Zero)
980 {
981 try
982 {
983 d.GeomDestroy(Shell);
984 }
985 catch (System.AccessViolationException)
986 {
987 m_log.Error("[PHYSICS]: PrimGeom dead");
988 }
989 // Remove any old entries
990//string tShell;
991//_parent_scene.geom_name_map.TryGetValue(Shell, out tShell);
992//Console.WriteLine("**** Remove {0}", tShell);
993
994 if(_parent_scene.geom_name_map.ContainsKey(Shell)) _parent_scene.geom_name_map.Remove(Shell);
995 if(_parent_scene.actor_name_map.ContainsKey(Shell)) _parent_scene.actor_name_map.Remove(Shell);
996 Shell = IntPtr.Zero;
997 }
998
999 return;
1000 }
1001
1002 Vector3 vec = Vector3.Zero;
1003 d.Vector3 vel = d.BodyGetLinearVel(Body);
1004
1005 float movementdivisor = 1f;
1006
1007 if (!m_alwaysRun)
1008 {
1009 movementdivisor = walkDivisor;
1010 }
1011 else
1012 {
1013 movementdivisor = runDivisor;
1014 }
1015
1016 // if velocity is zero, use position control; otherwise, velocity control
1017 if (_target_velocity.X == 0.0f && _target_velocity.Y == 0.0f && _target_velocity.Z == 0.0f && m_iscolliding)
1018 {
1019 // keep track of where we stopped. No more slippin' & slidin'
1020 if (!_zeroFlag)
1021 {
1022 _zeroFlag = true;
1023 _zeroPosition = d.BodyGetPosition(Body);
1024 }
1025 if (m_pidControllerActive)
1026 {
1027 // We only want to deactivate the PID Controller if we think we want to have our surrogate
1028 // react to the physics scene by moving it's position.
1029 // Avatar to Avatar collisions
1030 // Prim to avatar collisions
1031
1032 d.Vector3 pos = d.BodyGetPosition(Body);
1033 float errX = _zeroPosition.X - pos.X;
1034 float errY = _zeroPosition.Y - pos.Y;
1035 if( (Math.Abs(errX) > 0.1f) || (Math.Abs(errY) > 0.1f) )
1036 {
1037 vec.X = (_target_velocity.X - vel.X) * (PID_D) + (errX) * (PID_P * 2);
1038 vec.Y = (_target_velocity.Y - vel.Y) * (PID_D) + (errY) * (PID_P * 2);
1039 }
1040 else
1041 { // close, jump to lateral destination
1042 d.BodySetPosition(Body, _zeroPosition.X, _zeroPosition.Y, pos.Z);
1043 }
1044// if (flying)
1045 if (flying || jumping) // add for jumping
1046 {
1047 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P;
1048 }
1049 }
1050 //PidStatus = true;
1051 }
1052 else
1053 {
1054 m_pidControllerActive = true;
1055 _zeroFlag = false;
1056 if (m_iscolliding && !flying)
1057 {
1058 // We're standing on something
1059 vec.X = ((_target_velocity.X / movementdivisor) - vel.X) * (PID_D);
1060 vec.Y = ((_target_velocity.Y / movementdivisor) - vel.Y) * (PID_D);
1061 }
1062 else if (m_iscolliding && flying)
1063 {
1064 // We're flying and colliding with something
1065 vec.X = ((_target_velocity.X/movementdivisor) - vel.X)*(PID_D / 16);
1066 vec.Y = ((_target_velocity.Y/movementdivisor) - vel.Y)*(PID_D / 16);
1067 }
1068 else if (!m_iscolliding && flying)
1069 {
1070 // we're in mid air suspended
1071 vec.X = ((_target_velocity.X / movementdivisor) - vel.X) * (PID_D/6);
1072 vec.Y = ((_target_velocity.Y / movementdivisor) - vel.Y) * (PID_D/6);
1073 }
1074
1075 if (m_iscolliding && !flying && _target_velocity.Z > 0.0f)
1076 {
1077 // We're colliding with something and we're not flying but we're moving
1078 // This means we're walking or running.
1079 d.Vector3 pos = d.BodyGetPosition(Body);
1080 vec.Z = (_target_velocity.Z - vel.Z)*PID_D + (_zeroPosition.Z - pos.Z)*PID_P;
1081 if (_target_velocity.X > 0)
1082 {
1083 vec.X = ((_target_velocity.X - vel.X)/1.2f)*PID_D;
1084 }
1085 if (_target_velocity.Y > 0)
1086 {
1087 vec.Y = ((_target_velocity.Y - vel.Y)/1.2f)*PID_D;
1088 }
1089 }
1090 else if (!m_iscolliding && !flying)
1091 {
1092 // we're not colliding and we're not flying so that means we're falling!
1093 // m_iscolliding includes collisions with the ground.
1094
1095 // d.Vector3 pos = d.BodyGetPosition(Body);
1096 if (Math.Abs(_target_velocity.X) > 0)
1097 {
1098 vec.X = ((_target_velocity.X - vel.X)/1.2f)*PID_D;
1099 }
1100 if (Math.Abs(_target_velocity.Y) > 0)
1101 {
1102 vec.Y = ((_target_velocity.Y - vel.Y)/1.2f)*PID_D;
1103 }
1104 }
1105
1106 if (flying)
1107 {
1108 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D);
1109 }
1110 }
1111 if (flying)
1112 {
1113 vec.Z += ((-1 * _parent_scene.gravityz)*m_mass);
1114
1115 //Added for auto fly height. Kitto Flora
1116 //d.Vector3 pos = d.BodyGetPosition(Body);
1117 float target_altitude = _parent_scene.GetTerrainHeightAtXY(_position.X, _position.Y) + MinimumGroundFlightOffset;
1118
1119 if (_position.Z < target_altitude)
1120 {
1121 vec.Z += (target_altitude - _position.Z) * PID_P * 5.0f;
1122 }
1123 // end add Kitto Flora
1124 }
1125
1126 if (vel.X * vel.X + vel.Y * vel.Y + vel.Z * vel.Z > 2500.0f) // 50ms apply breaks
1127 {
1128 float breakfactor = 0.16f * m_mass; // will give aprox 60m/s terminal velocity at free fall
1129 vec.X -= breakfactor * vel.X;
1130 vec.Y -= breakfactor * vel.Y;
1131 vec.Z -= breakfactor * vel.Z;
1132 }
1133
1134 if (vec.IsFinite())
1135 {
1136 if (vec.LengthSquared() > 0.0004f) // 0.01 allows 0.002 !!
1137 {
1138//Console.WriteLine("DF 2"); // ##
1139
1140 doForce(vec);
1141 if (!_zeroFlag)
1142 {
1143// AlignAvatarTiltWithCurrentDirectionOfMovement(vec);
1144 }
1145 }
1146 }
1147 else
1148 {
1149 m_log.Warn("[PHYSICS]: Got a NaN force vector in Move()");
1150 m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
1151 defects.Add(this);
1152 // _parent_scene.RemoveCharacter(this);
1153 // destroy avatar capsule and related ODE data
1154 if (Amotor != IntPtr.Zero)
1155 {
1156 // Kill the Amotor
1157 d.JointDestroy(Amotor);
1158 Amotor = IntPtr.Zero;
1159 }
1160 //kill the Geometry
1161 _parent_scene.waitForSpaceUnlock(_parent_scene.space);
1162
1163 if (Body != IntPtr.Zero)
1164 {
1165 //kill the body
1166 d.BodyDestroy(Body);
1167
1168 Body = IntPtr.Zero;
1169 }
1170
1171 if(Shell != IntPtr.Zero)
1172 {
1173 try
1174 {
1175 d.GeomDestroy(Shell);
1176 }
1177 catch (System.AccessViolationException)
1178 {
1179 m_log.Error("[PHYSICS]: PrimGeom dead");
1180 }
1181 // Remove any old entries
1182//string tShell;
1183//_parent_scene.geom_name_map.TryGetValue(Shell, out tShell);
1184//Console.WriteLine("**** Remove {0}", tShell);
1185
1186 if(_parent_scene.geom_name_map.ContainsKey(Shell)) _parent_scene.geom_name_map.Remove(Shell);
1187 if(_parent_scene.actor_name_map.ContainsKey(Shell)) _parent_scene.actor_name_map.Remove(Shell);
1188 Shell = IntPtr.Zero;
1189 }
1190 }
1191 }
1192
1193 /// <summary>
1194 /// Updates the reported position and velocity. This essentially sends the data up to ScenePresence.
1195 /// </summary>
1196 public void UpdatePositionAndVelocity()
1197 {
1198 // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
1199 d.Vector3 vec;
1200 try
1201 {
1202 vec = d.BodyGetPosition(Body);
1203 }
1204 catch (NullReferenceException)
1205 {
1206 bad = true;
1207 _parent_scene.BadCharacter(this);
1208 vec = new d.Vector3(_position.X, _position.Y, _position.Z);
1209 base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem!
1210 m_log.WarnFormat("[ODEPLUGIN]: Avatar Null reference for Avatar {0}, physical actor {1}", m_name, m_uuid);
1211 }
1212
1213
1214 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
1215 if (vec.X < 0.0f) vec.X = 0.0f;
1216 if (vec.Y < 0.0f) vec.Y = 0.0f;
1217 if (vec.X > (int)_parent_scene.WorldExtents.X - 0.05f) vec.X = (int)_parent_scene.WorldExtents.X - 0.05f;
1218 if (vec.Y > (int)_parent_scene.WorldExtents.Y - 0.05f) vec.Y = (int)_parent_scene.WorldExtents.Y - 0.05f;
1219
1220 _position.X = vec.X;
1221 _position.Y = vec.Y;
1222 _position.Z = vec.Z;
1223
1224 // Did we move last? = zeroflag
1225 // This helps keep us from sliding all over
1226
1227 if (_zeroFlag)
1228 {
1229 _velocity.X = 0.0f;
1230 _velocity.Y = 0.0f;
1231 _velocity.Z = 0.0f;
1232
1233 // Did we send out the 'stopped' message?
1234 if (!m_lastUpdateSent)
1235 {
1236 m_lastUpdateSent = true;
1237 //base.RequestPhysicsterseUpdate();
1238
1239 }
1240 }
1241 else
1242 {
1243 m_lastUpdateSent = false;
1244 try
1245 {
1246 vec = d.BodyGetLinearVel(Body);
1247 }
1248 catch (NullReferenceException)
1249 {
1250 vec.X = _velocity.X;
1251 vec.Y = _velocity.Y;
1252 vec.Z = _velocity.Z;
1253 }
1254 _velocity.X = (vec.X);
1255 _velocity.Y = (vec.Y);
1256
1257 _velocity.Z = (vec.Z);
1258
1259 if (_velocity.Z < -6 && !m_hackSentFall)
1260 {
1261 m_hackSentFall = true;
1262 m_pidControllerActive = false;
1263 }
1264 else if (flying && !m_hackSentFly)
1265 {
1266 //m_hackSentFly = true;
1267 //base.SendCollisionUpdate(new CollisionEventUpdate());
1268 }
1269 else
1270 {
1271 m_hackSentFly = false;
1272 m_hackSentFall = false;
1273 }
1274 }
1275 }
1276
1277 /// <summary>
1278 /// Cleanup the things we use in the scene.
1279 /// </summary>
1280 public void Destroy()
1281 {
1282 m_tainted_isPhysical = false;
1283 _parent_scene.AddPhysicsActorTaint(this);
1284 }
1285
1286 public override void CrossingFailure()
1287 {
1288 }
1289
1290 public override Vector3 PIDTarget { set { return; } }
1291 public override bool PIDActive { get { return m_pidControllerActive; } set { return; } }
1292 public override float PIDTau { set { return; } }
1293
1294 public override float PIDHoverHeight { set { return; } }
1295 public override bool PIDHoverActive { set { return; } }
1296 public override PIDHoverType PIDHoverType { set { return; } }
1297 public override float PIDHoverTau { set { return; } }
1298
1299 public override Quaternion APIDTarget{ set { return; } }
1300
1301 public override bool APIDActive{ set { return; } }
1302
1303 public override float APIDStrength{ set { return; } }
1304
1305 public override float APIDDamping{ set { return; } }
1306
1307
1308 public override void SubscribeEvents(int ms)
1309 {
1310 m_requestedUpdateFrequency = ms;
1311 m_eventsubscription = ms;
1312 _parent_scene.addCollisionEventReporting(this);
1313 }
1314 public override void UnSubscribeEvents()
1315 {
1316 _parent_scene.remCollisionEventReporting(this);
1317 m_requestedUpdateFrequency = 0;
1318 m_eventsubscription = 0;
1319 }
1320 public void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
1321 {
1322 if (m_eventsubscription > 0)
1323 {
1324 CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
1325 }
1326 }
1327
1328 public void SendCollisions()
1329 {
1330 if (m_eventsubscription > m_requestedUpdateFrequency)
1331 {
1332 if (CollisionEventsThisFrame != null)
1333 {
1334 base.SendCollisionUpdate(CollisionEventsThisFrame);
1335 }
1336 CollisionEventsThisFrame = new CollisionEventUpdate();
1337 m_eventsubscription = 0;
1338 }
1339 }
1340 public override bool SubscribedEvents()
1341 {
1342 if (m_eventsubscription > 0)
1343 return true;
1344 return false;
1345 }
1346
1347 public void ProcessTaints(float timestep)
1348 {
1349 lock (m_syncRoot)
1350 {
1351 if (m_tainted_isPhysical != m_isPhysical)
1352 {
1353 if (m_tainted_isPhysical)
1354 {
1355 // Create avatar capsule and related ODE data
1356 if (!(Shell == IntPtr.Zero && Body == IntPtr.Zero && Amotor == IntPtr.Zero))
1357 {
1358 m_log.Warn("[PHYSICS]: re-creating the following avatar ODE data, even though it already exists - "
1359 + (Shell!=IntPtr.Zero ? "Shell ":"")
1360 + (Body!=IntPtr.Zero ? "Body ":"")
1361 + (Amotor!=IntPtr.Zero ? "Amotor ":""));
1362 }
1363 AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z, m_tensor);
1364 _parent_scene.AddCharacter(this);
1365 }
1366 else
1367 {
1368 _parent_scene.RemoveCharacter(this);
1369 // destroy avatar capsule and related ODE data
1370 if (Amotor != IntPtr.Zero)
1371 {
1372 // Kill the Amotor
1373 d.JointDestroy(Amotor);
1374 Amotor = IntPtr.Zero;
1375 }
1376 //kill the Geometry
1377 _parent_scene.waitForSpaceUnlock(_parent_scene.space);
1378
1379 if (Body != IntPtr.Zero)
1380 {
1381 //kill the body
1382 d.BodyDestroy(Body);
1383 Body = IntPtr.Zero;
1384 }
1385
1386 if(Shell != IntPtr.Zero)
1387 {
1388 try
1389 {
1390 d.GeomDestroy(Shell);
1391 }
1392 catch (Exception e)
1393 {
1394 m_log.ErrorFormat("[PHYSICS]: Failed to destroy character shell {0}",e.Message);
1395 }
1396 // Remove any old entries
1397 //string tShell;
1398 //_parent_scene.geom_name_map.TryGetValue(Shell, out tShell);
1399 //Console.WriteLine("**** Remove {0}", tShell);
1400
1401 if(_parent_scene.geom_name_map.ContainsKey(Shell)) _parent_scene.geom_name_map.Remove(Shell);
1402 if(_parent_scene.actor_name_map.ContainsKey(Shell)) _parent_scene.actor_name_map.Remove(Shell);
1403 Shell = IntPtr.Zero;
1404 }
1405 }
1406
1407 m_isPhysical = m_tainted_isPhysical;
1408 }
1409
1410 if (m_tainted_CAPSULE_LENGTH != CAPSULE_LENGTH)
1411 {
1412 if (Shell != IntPtr.Zero && Body != IntPtr.Zero && Amotor != IntPtr.Zero)
1413 {
1414
1415 m_pidControllerActive = true;
1416 // no lock needed on _parent_scene.OdeLock because we are called from within the thread lock in OdePlugin's simulate()
1417 d.JointDestroy(Amotor);
1418 float prevCapsule = CAPSULE_LENGTH;
1419 CAPSULE_LENGTH = m_tainted_CAPSULE_LENGTH;
1420 //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
1421 d.BodyDestroy(Body);
1422 AvatarGeomAndBodyCreation(_position.X, _position.Y,
1423 _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor);
1424 Velocity = Vector3.Zero;
1425 }
1426 else
1427 {
1428 m_log.Warn("[PHYSICS]: trying to change capsule size, but the following ODE data is missing - "
1429 + (Shell==IntPtr.Zero ? "Shell ":"")
1430 + (Body==IntPtr.Zero ? "Body ":"")
1431 + (Amotor==IntPtr.Zero ? "Amotor ":""));
1432 }
1433 }
1434
1435 if (!m_taintPosition.ApproxEquals(_position, 0.05f))
1436 {
1437 if (Body != IntPtr.Zero)
1438 {
1439 d.BodySetPosition(Body, m_taintPosition.X, m_taintPosition.Y, m_taintPosition.Z);
1440
1441 }
1442 _position.X = m_taintPosition.X;
1443 _position.Y = m_taintPosition.Y;
1444 _position.Z = m_taintPosition.Z;
1445 }
1446
1447 if (m_haveTaintMomentum)
1448 {
1449 m_haveTaintMomentum = false;
1450 _velocity = m_taintMomentum;
1451 _target_velocity = m_taintMomentum;
1452 m_pidControllerActive = true;
1453 if (Body != IntPtr.Zero)
1454 d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z);
1455 }
1456 }
1457 }
1458
1459 internal void AddCollisionFrameTime(int p)
1460 {
1461 // protect it from overflow crashing
1462 if (m_eventsubscription + p >= int.MaxValue)
1463 m_eventsubscription = 0;
1464 m_eventsubscription += p;
1465 }
1466 }
1467}
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
deleted file mode 100644
index b283152..0000000
--- a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
+++ /dev/null
@@ -1,4124 +0,0 @@
1/* Copyright (c) Contributors, http://opensimulator.org/
2 * See CONTRIBUTORS.TXT for a full list of copyright holders.
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are met:
5 * * Redistributions of source code must retain the above copyright
6 * notice, this list of conditions and the following disclaimer.
7 * * Redistributions in binary form must reproduce the above copyright
8 * notice, this list of conditions and the following disclaimer in the
9 * documentation and/or other materials provided with the distribution.
10 * * Neither the name of the OpenSimulator Project nor the
11 * names of its contributors may be used to endorse or promote products
12 * derived from this software without specific prior written permission.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * Revised March 5th 2010 by Kitto Flora. ODEDynamics.cs
26 * Ubit 2012
27 * rolled into ODEPrim.cs
28 */
29
30using System;
31using System.IO;
32using System.Collections.Generic;
33using System.Reflection;
34using System.Runtime.InteropServices;
35using System.Threading;
36using log4net;
37using OpenMetaverse;
38using Ode.NET;
39using OpenSim.Framework;
40using OpenSim.Region.Physics.Manager;
41
42namespace OpenSim.Region.Physics.OdePlugin
43{
44 /// <summary>
45 /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves.
46 /// </summary>
47
48 public class OdePrim : PhysicsActor
49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51
52 public class SerialControl
53 {
54 public object alock = new object();
55 public byte[] data = new byte[0];
56 }
57 private Vector3 _position;
58 private Vector3 _velocity;
59 private Vector3 _torque;
60 private Vector3 m_lastVelocity;
61 private Vector3 m_lastposition;
62 private Quaternion m_lastorientation = new Quaternion();
63 private Vector3 m_rotationalVelocity;
64 private Vector3 _size;
65 private Vector3 _acceleration;
66 // private d.Vector3 _zeroPosition = new d.Vector3(0.0f, 0.0f, 0.0f);
67 private Quaternion _orientation;
68 private Vector3 m_taintposition;
69 private Vector3 m_taintsize;
70 private Vector3 m_taintVelocity;
71 private Vector3 m_taintTorque;
72 private Quaternion m_taintrot;
73 private Vector3 m_rotateEnable = Vector3.One; // Current setting
74 private Vector3 m_rotateEnableRequest = Vector3.One; // Request from LSL
75 private bool m_rotateEnableUpdate = false;
76 private Vector3 m_lockX;
77 private Vector3 m_lockY;
78 private Vector3 m_lockZ;
79 private IntPtr Amotor = IntPtr.Zero;
80 private IntPtr AmotorX = IntPtr.Zero;
81 private IntPtr AmotorY = IntPtr.Zero;
82 private IntPtr AmotorZ = IntPtr.Zero;
83
84 private Vector3 m_PIDTarget;
85 private float m_PIDTau;
86 private float PID_D = 35f;
87 private float PID_G = 25f;
88 private bool m_usePID = false;
89
90 private Quaternion m_APIDTarget = new Quaternion();
91 private float m_APIDStrength = 0.5f;
92 private float m_APIDDamping = 0.5f;
93 private bool m_useAPID = false;
94 private float m_APIDdamper = 1.0f;
95
96 // These next 7 params apply to llSetHoverHeight(float height, integer water, float tau),
97 // do not confuse with VEHICLE HOVER
98
99 private float m_PIDHoverHeight;
100 private float m_PIDHoverTau;
101 private bool m_useHoverPID;
102 private PIDHoverType m_PIDHoverType = PIDHoverType.Ground;
103 private float m_targetHoverHeight;
104 private float m_groundHeight;
105 private float m_waterHeight;
106 private float m_buoyancy; //m_buoyancy set by llSetBuoyancy()
107
108 // private float m_tensor = 5f;
109 private int body_autodisable_frames = 20;
110
111
112 private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom
113 | CollisionCategories.Space
114 | CollisionCategories.Body
115 | CollisionCategories.Character
116 );
117 private bool m_taintshape;
118 private bool m_taintPhysics;
119 private bool m_collidesLand = true;
120 private bool m_collidesWater;
121 // public bool m_returnCollisions;
122
123 // Default we're a Geometry
124 private CollisionCategories m_collisionCategories = (CollisionCategories.Geom);
125
126 // Default, Collide with Other Geometries, spaces and Bodies
127 private CollisionCategories m_collisionFlags = m_default_collisionFlags;
128
129 public bool m_taintremove;
130 public bool m_taintdisable;
131 public bool m_disabled;
132 public bool m_taintadd;
133 public bool m_taintselected;
134 public bool m_taintphantom;
135 public bool m_taintCollidesWater;
136
137 public uint m_localID;
138
139 //public GCHandle gc;
140 private CollisionLocker ode;
141
142 private bool m_meshfailed = false;
143 private bool m_taintforce = false;
144 private bool m_taintaddangularforce = false;
145 private Vector3 m_force;
146 private List<Vector3> m_forcelist = new List<Vector3>();
147 private List<Vector3> m_angularforcelist = new List<Vector3>();
148
149 private IMesh _mesh;
150 private PrimitiveBaseShape _pbs;
151 private OdeScene _parent_scene;
152 public IntPtr m_targetSpace = IntPtr.Zero;
153 public IntPtr prim_geom;
154 // public IntPtr prev_geom;
155 public IntPtr _triMeshData;
156
157 private IntPtr _linkJointGroup = IntPtr.Zero;
158 private PhysicsActor _parent;
159 private PhysicsActor m_taintparent;
160
161 private List<OdePrim> childrenPrim = new List<OdePrim>();
162
163 private bool iscolliding;
164 private bool m_isphysical;
165 private bool m_isphantom;
166 private bool m_isSelected;
167
168 private bool m_NoColide; // for now only for internal use for bad meshs
169
170 internal bool m_isVolumeDetect; // If true, this prim only detects collisions but doesn't collide actively
171
172 private bool m_throttleUpdates;
173 private int throttleCounter;
174 public int m_interpenetrationcount;
175 public float m_collisionscore;
176 // public int m_roundsUnderMotionThreshold;
177 // private int m_crossingfailures;
178
179 public bool m_outofBounds;
180 private float m_density = 10.000006836f; // Aluminum g/cm3;
181
182 private float m_primMass = 10.000006836f; // Aluminum g/cm3;
183
184 private byte m_shapetype;
185 private byte m_taintshapetype;
186
187 public bool _zeroFlag; // if body has been stopped
188 private bool m_lastUpdateSent;
189
190 public IntPtr Body = IntPtr.Zero;
191 public String m_primName;
192 private Vector3 _target_velocity;
193 public d.Mass pMass;
194
195 public int m_eventsubscription;
196 private CollisionEventUpdate CollisionEventsThisFrame;
197
198 private IntPtr m_linkJoint = IntPtr.Zero;
199
200 public volatile bool childPrim;
201
202 internal int m_material = (int)Material.Wood;
203
204 private IntPtr m_body = IntPtr.Zero;
205
206 // Vehicle properties ============================================================================================
207 private Vehicle m_type = Vehicle.TYPE_NONE; // If a 'VEHICLE', and what kind
208 // private Quaternion m_referenceFrame = Quaternion.Identity; // Axis modifier
209 private VehicleFlag m_flags = (VehicleFlag)0; // Bit settings:
210 // HOVER_TERRAIN_ONLY
211 // HOVER_GLOBAL_HEIGHT
212 // NO_DEFLECTION_UP
213 // HOVER_WATER_ONLY
214 // HOVER_UP_ONLY
215 // LIMIT_MOTOR_UP
216 // LIMIT_ROLL_ONLY
217
218 // Linear properties
219 private Vector3 m_linearMotorDirection = Vector3.Zero; // (was m_linearMotorDirectionLASTSET) the (local) Velocity
220 //requested by LSL
221 private float m_linearMotorTimescale = 0; // Motor Attack rate set by LSL
222 private float m_linearMotorDecayTimescale = 0; // Motor Decay rate set by LSL
223 private Vector3 m_linearFrictionTimescale = Vector3.Zero; // General Friction set by LSL
224
225 private Vector3 m_lLinMotorDVel = Vector3.Zero; // decayed motor
226 private Vector3 m_lLinObjectVel = Vector3.Zero; // local frame object velocity
227 private Vector3 m_wLinObjectVel = Vector3.Zero; // world frame object velocity
228
229 //Angular properties
230 private Vector3 m_angularMotorDirection = Vector3.Zero; // angular velocity requested by LSL motor
231
232 private float m_angularMotorTimescale = 0; // motor angular Attack rate set by LSL
233 private float m_angularMotorDecayTimescale = 0; // motor angular Decay rate set by LSL
234 private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular Friction set by LSL
235
236 private Vector3 m_angularMotorDVel = Vector3.Zero; // decayed angular motor
237 // private Vector3 m_angObjectVel = Vector3.Zero; // current body angular velocity
238 private Vector3 m_lastAngularVelocity = Vector3.Zero; // what was last applied to body
239
240 //Deflection properties
241 // private float m_angularDeflectionEfficiency = 0;
242 // private float m_angularDeflectionTimescale = 0;
243 // private float m_linearDeflectionEfficiency = 0;
244 // private float m_linearDeflectionTimescale = 0;
245
246 //Banking properties
247 // private float m_bankingEfficiency = 0;
248 // private float m_bankingMix = 0;
249 // private float m_bankingTimescale = 0;
250
251 //Hover and Buoyancy properties
252 private float m_VhoverHeight = 0f;
253 // private float m_VhoverEfficiency = 0f;
254 private float m_VhoverTimescale = 0f;
255 private float m_VhoverTargetHeight = -1.0f; // if <0 then no hover, else its the current target height
256 private float m_VehicleBuoyancy = 0f; // Set by VEHICLE_BUOYANCY, for a vehicle.
257 // Modifies gravity. Slider between -1 (double-gravity) and 1 (full anti-gravity)
258 // KF: So far I have found no good method to combine a script-requested .Z velocity and gravity.
259 // Therefore only m_VehicleBuoyancy=1 (0g) will use the script-requested .Z velocity.
260
261 //Attractor properties
262 private float m_verticalAttractionEfficiency = 1.0f; // damped
263 private float m_verticalAttractionTimescale = 500f; // Timescale > 300 means no vert attractor.
264
265// SerialControl m_taintserial = null;
266 object m_taintvehicledata = null;
267
268 public void DoSetVehicle()
269 {
270 VehicleData vd = (VehicleData)m_taintvehicledata;
271
272 m_type = vd.m_type;
273 m_flags = vd.m_flags;
274
275 // Linear properties
276 m_linearMotorDirection = vd.m_linearMotorDirection;
277 m_linearFrictionTimescale = vd.m_linearFrictionTimescale;
278 m_linearMotorDecayTimescale = vd.m_linearMotorDecayTimescale;
279 m_linearMotorTimescale = vd.m_linearMotorTimescale;
280// m_linearMotorOffset = vd.m_linearMotorOffset;
281
282 //Angular properties
283 m_angularMotorDirection = vd.m_angularMotorDirection;
284 m_angularMotorTimescale = vd.m_angularMotorTimescale;
285 m_angularMotorDecayTimescale = vd.m_angularMotorDecayTimescale;
286 m_angularFrictionTimescale = vd.m_angularFrictionTimescale;
287
288 //Deflection properties
289// m_angularDeflectionEfficiency = vd.m_angularDeflectionEfficiency;
290// m_angularDeflectionTimescale = vd.m_angularDeflectionTimescale;
291// m_linearDeflectionEfficiency = vd.m_linearDeflectionEfficiency;
292// m_linearDeflectionTimescale = vd.m_linearDeflectionTimescale;
293
294 //Banking properties
295// m_bankingEfficiency = vd.m_bankingEfficiency;
296// m_bankingMix = vd.m_bankingMix;
297// m_bankingTimescale = vd.m_bankingTimescale;
298
299 //Hover and Buoyancy properties
300 m_VhoverHeight = vd.m_VhoverHeight;
301// m_VhoverEfficiency = vd.m_VhoverEfficiency;
302 m_VhoverTimescale = vd.m_VhoverTimescale;
303 m_VehicleBuoyancy = vd.m_VehicleBuoyancy;
304
305 //Attractor properties
306 m_verticalAttractionEfficiency = vd.m_verticalAttractionEfficiency;
307 m_verticalAttractionTimescale = vd.m_verticalAttractionTimescale;
308
309 // Axis
310// m_referenceFrame = vd.m_referenceFrame;
311
312
313 m_taintvehicledata = null;
314 }
315
316 public override void SetVehicle(object vdata)
317 {
318 m_taintvehicledata = vdata;
319 _parent_scene.AddPhysicsActorTaint(this);
320 }
321
322 public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size,
323 Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical,
324 bool pisPhantom,byte shapetype, CollisionLocker dode, uint localid)
325 {
326 m_localID = localid;
327 ode = dode;
328 if (!pos.IsFinite())
329 {
330 pos = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f),
331 parent_scene.GetTerrainHeightAtXY(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f)) + 0.5f);
332 m_log.Warn("[PHYSICS]: Got nonFinite Object create Position");
333 }
334
335 _position = pos;
336 m_taintposition = pos;
337 PID_D = parent_scene.bodyPIDD;
338 PID_G = parent_scene.bodyPIDG;
339 m_density = parent_scene.geomDefaultDensity;
340 // m_tensor = parent_scene.bodyMotorJointMaxforceTensor;
341 body_autodisable_frames = parent_scene.bodyFramesAutoDisable;
342
343 prim_geom = IntPtr.Zero;
344 // prev_geom = IntPtr.Zero;
345
346 if (!pos.IsFinite())
347 {
348 size = new Vector3(0.5f, 0.5f, 0.5f);
349 m_log.Warn("[PHYSICS]: Got nonFinite Object create Size");
350 }
351
352 if (size.X <= 0) size.X = 0.01f;
353 if (size.Y <= 0) size.Y = 0.01f;
354 if (size.Z <= 0) size.Z = 0.01f;
355
356 _size = size;
357 m_taintsize = _size;
358
359 if (!QuaternionIsFinite(rotation))
360 {
361 rotation = Quaternion.Identity;
362 m_log.Warn("[PHYSICS]: Got nonFinite Object create Rotation");
363 }
364
365 _orientation = rotation;
366 m_taintrot = _orientation;
367 _mesh = mesh;
368 _pbs = pbs;
369 m_shapetype = shapetype;
370 m_taintshapetype = shapetype;
371
372 _parent_scene = parent_scene;
373 m_targetSpace = (IntPtr)0;
374
375 // if (pos.Z < 0)
376 if (pos.Z < parent_scene.GetTerrainHeightAtXY(pos.X, pos.Y))
377 m_isphysical = false;
378 else
379 {
380 m_isphysical = pisPhysical;
381 // If we're physical, we need to be in the master space for now.
382 // linksets *should* be in a space together.. but are not currently
383 if (m_isphysical)
384 m_targetSpace = _parent_scene.space;
385 }
386
387 m_isphantom = pisPhantom;
388 m_taintphantom = pisPhantom;
389
390 _triMeshData = IntPtr.Zero;
391 m_NoColide = false;
392
393// m_taintserial = null;
394 m_primName = primName;
395 m_taintadd = true;
396 _parent_scene.AddPhysicsActorTaint(this);
397 // don't do .add() here; old geoms get recycled with the same hash
398 }
399
400 public override int PhysicsActorType
401 {
402 get { return (int)ActorTypes.Prim; }
403 set { return; }
404 }
405
406 public override bool SetAlwaysRun
407 {
408 get { return false; }
409 set { return; }
410 }
411
412 public override uint LocalID
413 {
414 set
415 {
416 //m_log.Info("[PHYSICS]: Setting TrackerID: " + value);
417 m_localID = value;
418 }
419 }
420
421 public override bool Grabbed
422 {
423 set { return; }
424 }
425
426 public override bool Selected
427 {
428 set
429 {
430 //Console.WriteLine("Sel {0} {1} {2}", m_primName, value, m_isphysical);
431 // This only makes the object not collidable if the object
432 // is physical or the object is modified somehow *IN THE FUTURE*
433 // without this, if an avatar selects prim, they can walk right
434 // through it while it's selected
435 m_collisionscore = 0;
436 if ((m_isphysical && !_zeroFlag) || !value)
437 {
438 m_taintselected = value;
439 _parent_scene.AddPhysicsActorTaint(this);
440 }
441 else
442 {
443 m_taintselected = value;
444 m_isSelected = value;
445 }
446 if (m_isSelected) disableBodySoft();
447 }
448 }
449
450 public override bool IsPhysical
451 {
452 get { return m_isphysical; }
453 set
454 {
455 m_isphysical = value;
456 if (!m_isphysical)
457 { // Zero the remembered last velocity
458 m_lastVelocity = Vector3.Zero;
459 if (m_type != Vehicle.TYPE_NONE) Halt();
460 }
461 }
462 }
463
464 public override bool IsVolumeDtc
465 {
466 set { return; }
467 get { return m_isVolumeDetect; }
468
469 }
470
471 public override bool Phantom
472 {
473 get { return m_isphantom; }
474 set
475 {
476 m_isphantom = value;
477 }
478 }
479
480 public void setPrimForRemoval()
481 {
482 m_taintremove = true;
483 }
484
485 public override bool Flying
486 {
487 // no flying prims for you
488 get { return false; }
489 set { }
490 }
491
492 public override bool IsColliding
493 {
494 get { return iscolliding; }
495 set { iscolliding = value; }
496 }
497
498 public override bool CollidingGround
499 {
500 get { return false; }
501 set { return; }
502 }
503
504 public override bool CollidingObj
505 {
506 get { return false; }
507 set { return; }
508 }
509
510 public override bool ThrottleUpdates
511 {
512 get { return m_throttleUpdates; }
513 set { m_throttleUpdates = value; }
514 }
515
516 public override bool Stopped
517 {
518 get { return _zeroFlag; }
519 }
520
521 public override Vector3 Position
522 {
523 get { return _position; }
524
525 set
526 {
527 _position = value;
528 //m_log.Info("[PHYSICS]: " + _position.ToString());
529 }
530 }
531
532 public override Vector3 Size
533 {
534 get { return _size; }
535 set
536 {
537 if (value.IsFinite())
538 {
539 _size = value;
540 }
541 else
542 {
543 m_log.Warn("[PHYSICS]: Got NaN Size on object");
544 }
545 }
546 }
547
548 public override float Mass
549 {
550 get
551 {
552 CalculateMass();
553 return m_primMass;
554 }
555 }
556
557 public override Vector3 Force
558 {
559 //get { return Vector3.Zero; }
560 get { return m_force; }
561 set
562 {
563 if (value.IsFinite())
564 {
565 m_force = value;
566 }
567 else
568 {
569 m_log.Warn("[PHYSICS]: NaN in Force Applied to an Object");
570 }
571 }
572 }
573
574 public override int VehicleType
575 {
576 get { return (int)m_type; }
577 set { ProcessTypeChange((Vehicle)value); }
578 }
579
580 public override void VehicleFloatParam(int param, float value)
581 {
582 ProcessFloatVehicleParam((Vehicle)param, value);
583 }
584
585 public override void VehicleVectorParam(int param, Vector3 value)
586 {
587 ProcessVectorVehicleParam((Vehicle)param, value);
588 }
589
590 public override void VehicleRotationParam(int param, Quaternion rotation)
591 {
592 ProcessRotationVehicleParam((Vehicle)param, rotation);
593 }
594
595 public override void VehicleFlags(int param, bool remove)
596 {
597 ProcessVehicleFlags(param, remove);
598 }
599
600 public override void SetVolumeDetect(int param)
601 {
602 lock (_parent_scene.OdeLock)
603 {
604 m_isVolumeDetect = (param != 0);
605 }
606 }
607
608
609 public override Vector3 CenterOfMass
610 {
611 get { return Vector3.Zero; }
612 }
613
614 public override Vector3 GeometricCenter
615 {
616 get { return Vector3.Zero; }
617 }
618
619 public override PrimitiveBaseShape Shape
620 {
621 set
622 {
623 _pbs = value;
624 m_taintshape = true;
625 }
626 }
627
628 public override byte PhysicsShapeType
629 {
630 get
631 {
632 return m_shapetype;
633 }
634 set
635 {
636 m_taintshapetype = value;
637 _parent_scene.AddPhysicsActorTaint(this);
638 }
639 }
640
641 public override Vector3 Velocity
642 {
643 get
644 {
645 // Averate previous velocity with the new one so
646 // client object interpolation works a 'little' better
647 if (_zeroFlag)
648 return Vector3.Zero;
649
650 Vector3 returnVelocity = Vector3.Zero;
651 returnVelocity.X = (m_lastVelocity.X + _velocity.X) / 2;
652 returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y) / 2;
653 returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z) / 2;
654 return returnVelocity;
655 }
656 set
657 {
658 if (value.IsFinite())
659 {
660 _velocity = value;
661 if (_velocity.ApproxEquals(Vector3.Zero, 0.001f))
662 _acceleration = Vector3.Zero;
663
664 m_taintVelocity = value;
665 _parent_scene.AddPhysicsActorTaint(this);
666 }
667 else
668 {
669 m_log.Warn("[PHYSICS]: Got NaN Velocity in Object");
670 }
671
672 }
673 }
674
675 public override Vector3 Torque
676 {
677 get
678 {
679 if (!m_isphysical || Body == IntPtr.Zero)
680 return Vector3.Zero;
681
682 return _torque;
683 }
684
685 set
686 {
687 if (value.IsFinite())
688 {
689 m_taintTorque = value;
690 _parent_scene.AddPhysicsActorTaint(this);
691 }
692 else
693 {
694 m_log.Warn("[PHYSICS]: Got NaN Torque in Object");
695 }
696 }
697 }
698
699 public override float CollisionScore
700 {
701 get { return m_collisionscore; }
702 set { m_collisionscore = value; }
703 }
704
705 public override bool Kinematic
706 {
707 get { return false; }
708 set { }
709 }
710
711 public override Quaternion Orientation
712 {
713 get { return _orientation; }
714 set
715 {
716 if (QuaternionIsFinite(value))
717 {
718 _orientation = value;
719 }
720 else
721 m_log.Warn("[PHYSICS]: Got NaN quaternion Orientation from Scene in Object");
722
723 }
724 }
725
726 public override bool FloatOnWater
727 {
728 set
729 {
730 m_taintCollidesWater = value;
731 _parent_scene.AddPhysicsActorTaint(this);
732 }
733 }
734
735 public override void SetMomentum(Vector3 momentum)
736 {
737 }
738
739 public override Vector3 PIDTarget
740 {
741 set
742 {
743 if (value.IsFinite())
744 {
745 m_PIDTarget = value;
746 }
747 else
748 m_log.Warn("[PHYSICS]: Got NaN PIDTarget from Scene on Object");
749 }
750 }
751 public override bool PIDActive { get { return m_usePID; } set { m_usePID = value; } }
752 public override float PIDTau { set { m_PIDTau = value; } }
753
754 // For RotLookAt
755 public override Quaternion APIDTarget { set { m_APIDTarget = value; } }
756 public override bool APIDActive { set { m_useAPID = value; } }
757 public override float APIDStrength { set { m_APIDStrength = value; } }
758 public override float APIDDamping { set { m_APIDDamping = value; } }
759
760 public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } }
761 public override bool PIDHoverActive { set { m_useHoverPID = value; } }
762 public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } }
763 public override float PIDHoverTau { set { m_PIDHoverTau = value; } }
764
765 internal static bool QuaternionIsFinite(Quaternion q)
766 {
767 if (Single.IsNaN(q.X) || Single.IsInfinity(q.X))
768 return false;
769 if (Single.IsNaN(q.Y) || Single.IsInfinity(q.Y))
770 return false;
771 if (Single.IsNaN(q.Z) || Single.IsInfinity(q.Z))
772 return false;
773 if (Single.IsNaN(q.W) || Single.IsInfinity(q.W))
774 return false;
775 return true;
776 }
777
778 public override Vector3 Acceleration // client updates read data via here
779 {
780 get
781 {
782 if (_zeroFlag)
783 {
784 return Vector3.Zero;
785 }
786 return _acceleration;
787 }
788 set { _acceleration = value; }
789 }
790
791
792 public void SetAcceleration(Vector3 accel) // No one calls this, and it would not do anything.
793 {
794 _acceleration = accel;
795 }
796
797 public override void AddForce(Vector3 force, bool pushforce)
798 {
799 if (force.IsFinite())
800 {
801 lock (m_forcelist)
802 m_forcelist.Add(force);
803
804 m_taintforce = true;
805 }
806 else
807 {
808 m_log.Warn("[PHYSICS]: Got Invalid linear force vector from Scene in Object");
809 }
810 //m_log.Info("[PHYSICS]: Added Force:" + force.ToString() + " to prim at " + Position.ToString());
811 }
812
813 public override void AddAngularForce(Vector3 force, bool pushforce)
814 {
815 if (force.IsFinite())
816 {
817 m_angularforcelist.Add(force);
818 m_taintaddangularforce = true;
819 }
820 else
821 {
822 m_log.Warn("[PHYSICS]: Got Invalid Angular force vector from Scene in Object");
823 }
824 }
825
826 public override Vector3 RotationalVelocity
827 {
828 get
829 {
830 return m_rotationalVelocity;
831 }
832 set
833 {
834 if (value.IsFinite())
835 {
836 m_rotationalVelocity = value;
837 }
838 else
839 {
840 m_log.Warn("[PHYSICS]: Got NaN RotationalVelocity in Object");
841 }
842 }
843 }
844
845 public override void CrossingFailure()
846 {
847 if (m_outofBounds)
848 {
849 _position.X = Util.Clip(_position.X, 0.5f, _parent_scene.WorldExtents.X - 0.5f);
850 _position.Y = Util.Clip(_position.Y, 0.5f, _parent_scene.WorldExtents.Y - 0.5f);
851 _position.Z = Util.Clip(_position.Z, -100f, 50000f);
852 d.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
853
854 m_lastposition = _position;
855
856 _velocity = Vector3.Zero;
857 m_lastVelocity = _velocity;
858
859
860 if (m_type != Vehicle.TYPE_NONE)
861 Halt();
862
863 d.BodySetLinearVel(Body, 0, 0, 0);
864 base.RequestPhysicsterseUpdate();
865 m_outofBounds = false;
866 }
867 /*
868 int tmp = Interlocked.Increment(ref m_crossingfailures);
869 if (tmp > _parent_scene.geomCrossingFailuresBeforeOutofbounds)
870 {
871 base.RaiseOutOfBounds(_position);
872 return;
873 }
874 else if (tmp == _parent_scene.geomCrossingFailuresBeforeOutofbounds)
875 {
876 m_log.Warn("[PHYSICS]: Too many crossing failures for: " + m_primName);
877 }
878 */
879 }
880
881 public override float Buoyancy
882 {
883 get { return m_buoyancy; }
884 set { m_buoyancy = value; }
885 }
886
887 public override void link(PhysicsActor obj)
888 {
889 m_taintparent = obj;
890 }
891
892 public override void delink()
893 {
894 m_taintparent = null;
895 }
896
897 public override void LockAngularMotion(Vector3 axis)
898 {
899 // This is actually ROTATION ENABLE, not a lock.
900 // default is <1,1,1> which is all enabled.
901 // The lock value is updated inside Move(), no point in using the taint system.
902 // OS 'm_taintAngularLock' etc change to m_rotateEnable.
903 if (axis.IsFinite())
904 {
905 axis.X = (axis.X > 0) ? 1f : 0f;
906 axis.Y = (axis.Y > 0) ? 1f : 0f;
907 axis.Z = (axis.Z > 0) ? 1f : 0f;
908 m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z);
909 m_rotateEnableRequest = axis;
910 m_rotateEnableUpdate = true;
911 }
912 else
913 {
914 m_log.Warn("[PHYSICS]: Got NaN locking axis from Scene on Object");
915 }
916 }
917
918 public void SetGeom(IntPtr geom)
919 {
920 if (prim_geom != IntPtr.Zero)
921 {
922 // Remove any old entries
923 //string tPA;
924 //_parent_scene.geom_name_map.TryGetValue(prim_geom, out tPA);
925 //Console.WriteLine("**** Remove {0}", tPA);
926 if (_parent_scene.geom_name_map.ContainsKey(prim_geom)) _parent_scene.geom_name_map.Remove(prim_geom);
927 if (_parent_scene.actor_name_map.ContainsKey(prim_geom)) _parent_scene.actor_name_map.Remove(prim_geom);
928 d.GeomDestroy(prim_geom);
929 }
930
931 prim_geom = geom;
932 //Console.WriteLine("SetGeom to " + prim_geom + " for " + m_primName);
933 if (prim_geom != IntPtr.Zero)
934 {
935 _parent_scene.geom_name_map[prim_geom] = this.m_primName;
936 _parent_scene.actor_name_map[prim_geom] = (PhysicsActor)this;
937 //Console.WriteLine("**** Create {2} Dicts: actor={0} name={1}", _parent_scene.actor_name_map.Count, _parent_scene.geom_name_map.Count, this.m_primName);
938 if (m_NoColide)
939 {
940 d.GeomSetCategoryBits(prim_geom, 0);
941 if (m_isphysical && !m_isVolumeDetect)
942 {
943 d.GeomSetCollideBits(prim_geom, (int)CollisionCategories.Land);
944 }
945 else
946 {
947 d.GeomSetCollideBits(prim_geom, 0);
948 d.GeomDisable(prim_geom);
949 }
950 }
951 else
952 {
953 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
954 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
955 }
956 }
957
958 if (childPrim)
959 {
960 if (_parent != null && _parent is OdePrim)
961 {
962 OdePrim parent = (OdePrim)_parent;
963 //Console.WriteLine("SetGeom calls ChildSetGeom");
964 parent.ChildSetGeom(this);
965 }
966 }
967 //m_log.Warn("Setting Geom to: " + prim_geom);
968 }
969
970 public void enableBodySoft()
971 {
972 if (!childPrim)
973 {
974 if (m_isphysical && Body != IntPtr.Zero)
975 {
976 d.BodyEnable(Body);
977 if (m_type != Vehicle.TYPE_NONE)
978 Enable(Body, _parent_scene);
979 }
980
981 m_disabled = false;
982 }
983 }
984
985 public void disableBodySoft()
986 {
987 m_disabled = true;
988
989 if (m_isphysical && Body != IntPtr.Zero)
990 {
991 d.BodyDisable(Body);
992 Halt();
993 }
994 }
995
996 public void enableBody()
997 {
998 // Don't enable this body if we're a child prim
999 // this should be taken care of in the parent function not here
1000 if (!childPrim)
1001 {
1002 // Sets the geom to a body
1003 Body = d.BodyCreate(_parent_scene.world);
1004
1005 setMass();
1006 d.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
1007 d.Quaternion myrot = new d.Quaternion();
1008 myrot.X = _orientation.X;
1009 myrot.Y = _orientation.Y;
1010 myrot.Z = _orientation.Z;
1011 myrot.W = _orientation.W;
1012 d.BodySetQuaternion(Body, ref myrot);
1013 d.GeomSetBody(prim_geom, Body);
1014
1015 m_collisionCategories |= CollisionCategories.Body;
1016 m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
1017
1018 if (m_NoColide)
1019 {
1020 d.GeomSetCategoryBits(prim_geom, 0);
1021 d.GeomSetCollideBits(prim_geom, (int)CollisionCategories.Land);
1022 }
1023 else
1024 {
1025 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
1026 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
1027 }
1028
1029 d.BodySetAutoDisableFlag(Body, true);
1030 d.BodySetAutoDisableSteps(Body, body_autodisable_frames);
1031
1032 // disconnect from world gravity so we can apply buoyancy
1033 d.BodySetGravityMode(Body, false);
1034
1035 m_interpenetrationcount = 0;
1036 m_collisionscore = 0;
1037 m_disabled = false;
1038
1039 if (m_type != Vehicle.TYPE_NONE)
1040 {
1041 Enable(Body, _parent_scene);
1042 }
1043
1044 _parent_scene.addActivePrim(this);
1045 }
1046 }
1047
1048 #region Mass Calculation
1049
1050 private float CalculateMass()
1051 {
1052 float volume = _size.X * _size.Y * _size.Z; // default
1053 float tmp;
1054
1055 float returnMass = 0;
1056 float hollowAmount = (float)_pbs.ProfileHollow * 2.0e-5f;
1057 float hollowVolume = hollowAmount * hollowAmount;
1058
1059 switch (_pbs.ProfileShape)
1060 {
1061 case ProfileShape.Square:
1062 // default box
1063
1064 if (_pbs.PathCurve == (byte)Extrusion.Straight)
1065 {
1066 if (hollowAmount > 0.0)
1067 {
1068 switch (_pbs.HollowShape)
1069 {
1070 case HollowShape.Square:
1071 case HollowShape.Same:
1072 break;
1073
1074 case HollowShape.Circle:
1075
1076 hollowVolume *= 0.78539816339f;
1077 break;
1078
1079 case HollowShape.Triangle:
1080
1081 hollowVolume *= (0.5f * .5f);
1082 break;
1083
1084 default:
1085 hollowVolume = 0;
1086 break;
1087 }
1088 volume *= (1.0f - hollowVolume);
1089 }
1090 }
1091
1092 else if (_pbs.PathCurve == (byte)Extrusion.Curve1)
1093 {
1094 //a tube
1095
1096 volume *= 0.78539816339e-2f * (float)(200 - _pbs.PathScaleX);
1097 tmp = 1.0f - 2.0e-2f * (float)(200 - _pbs.PathScaleY);
1098 volume -= volume * tmp * tmp;
1099
1100 if (hollowAmount > 0.0)
1101 {
1102 hollowVolume *= hollowAmount;
1103
1104 switch (_pbs.HollowShape)
1105 {
1106 case HollowShape.Square:
1107 case HollowShape.Same:
1108 break;
1109
1110 case HollowShape.Circle:
1111 hollowVolume *= 0.78539816339f; ;
1112 break;
1113
1114 case HollowShape.Triangle:
1115 hollowVolume *= 0.5f * 0.5f;
1116 break;
1117 default:
1118 hollowVolume = 0;
1119 break;
1120 }
1121 volume *= (1.0f - hollowVolume);
1122 }
1123 }
1124
1125 break;
1126
1127 case ProfileShape.Circle:
1128
1129 if (_pbs.PathCurve == (byte)Extrusion.Straight)
1130 {
1131 volume *= 0.78539816339f; // elipse base
1132
1133 if (hollowAmount > 0.0)
1134 {
1135 switch (_pbs.HollowShape)
1136 {
1137 case HollowShape.Same:
1138 case HollowShape.Circle:
1139 break;
1140
1141 case HollowShape.Square:
1142 hollowVolume *= 0.5f * 2.5984480504799f;
1143 break;
1144
1145 case HollowShape.Triangle:
1146 hollowVolume *= .5f * 1.27323954473516f;
1147 break;
1148
1149 default:
1150 hollowVolume = 0;
1151 break;
1152 }
1153 volume *= (1.0f - hollowVolume);
1154 }
1155 }
1156
1157 else if (_pbs.PathCurve == (byte)Extrusion.Curve1)
1158 {
1159 volume *= 0.61685027506808491367715568749226e-2f * (float)(200 - _pbs.PathScaleX);
1160 tmp = 1.0f - .02f * (float)(200 - _pbs.PathScaleY);
1161 volume *= (1.0f - tmp * tmp);
1162
1163 if (hollowAmount > 0.0)
1164 {
1165
1166 // calculate the hollow volume by it's shape compared to the prim shape
1167 hollowVolume *= hollowAmount;
1168
1169 switch (_pbs.HollowShape)
1170 {
1171 case HollowShape.Same:
1172 case HollowShape.Circle:
1173 break;
1174
1175 case HollowShape.Square:
1176 hollowVolume *= 0.5f * 2.5984480504799f;
1177 break;
1178
1179 case HollowShape.Triangle:
1180 hollowVolume *= .5f * 1.27323954473516f;
1181 break;
1182
1183 default:
1184 hollowVolume = 0;
1185 break;
1186 }
1187 volume *= (1.0f - hollowVolume);
1188 }
1189 }
1190 break;
1191
1192 case ProfileShape.HalfCircle:
1193 if (_pbs.PathCurve == (byte)Extrusion.Curve1)
1194 {
1195 volume *= 0.52359877559829887307710723054658f;
1196 }
1197 break;
1198
1199 case ProfileShape.EquilateralTriangle:
1200
1201 if (_pbs.PathCurve == (byte)Extrusion.Straight)
1202 {
1203 volume *= 0.32475953f;
1204
1205 if (hollowAmount > 0.0)
1206 {
1207
1208 // calculate the hollow volume by it's shape compared to the prim shape
1209 switch (_pbs.HollowShape)
1210 {
1211 case HollowShape.Same:
1212 case HollowShape.Triangle:
1213 hollowVolume *= .25f;
1214 break;
1215
1216 case HollowShape.Square:
1217 hollowVolume *= 0.499849f * 3.07920140172638f;
1218 break;
1219
1220 case HollowShape.Circle:
1221 // Hollow shape is a perfect cyllinder in respect to the cube's scale
1222 // Cyllinder hollow volume calculation
1223
1224 hollowVolume *= 0.1963495f * 3.07920140172638f;
1225 break;
1226
1227 default:
1228 hollowVolume = 0;
1229 break;
1230 }
1231 volume *= (1.0f - hollowVolume);
1232 }
1233 }
1234 else if (_pbs.PathCurve == (byte)Extrusion.Curve1)
1235 {
1236 volume *= 0.32475953f;
1237 volume *= 0.01f * (float)(200 - _pbs.PathScaleX);
1238 tmp = 1.0f - .02f * (float)(200 - _pbs.PathScaleY);
1239 volume *= (1.0f - tmp * tmp);
1240
1241 if (hollowAmount > 0.0)
1242 {
1243
1244 hollowVolume *= hollowAmount;
1245
1246 switch (_pbs.HollowShape)
1247 {
1248 case HollowShape.Same:
1249 case HollowShape.Triangle:
1250 hollowVolume *= .25f;
1251 break;
1252
1253 case HollowShape.Square:
1254 hollowVolume *= 0.499849f * 3.07920140172638f;
1255 break;
1256
1257 case HollowShape.Circle:
1258
1259 hollowVolume *= 0.1963495f * 3.07920140172638f;
1260 break;
1261
1262 default:
1263 hollowVolume = 0;
1264 break;
1265 }
1266 volume *= (1.0f - hollowVolume);
1267 }
1268 }
1269 break;
1270
1271 default:
1272 break;
1273 }
1274
1275
1276
1277 float taperX1;
1278 float taperY1;
1279 float taperX;
1280 float taperY;
1281 float pathBegin;
1282 float pathEnd;
1283 float profileBegin;
1284 float profileEnd;
1285
1286 if (_pbs.PathCurve == (byte)Extrusion.Straight || _pbs.PathCurve == (byte)Extrusion.Flexible)
1287 {
1288 taperX1 = _pbs.PathScaleX * 0.01f;
1289 if (taperX1 > 1.0f)
1290 taperX1 = 2.0f - taperX1;
1291 taperX = 1.0f - taperX1;
1292
1293 taperY1 = _pbs.PathScaleY * 0.01f;
1294 if (taperY1 > 1.0f)
1295 taperY1 = 2.0f - taperY1;
1296 taperY = 1.0f - taperY1;
1297 }
1298 else
1299 {
1300 taperX = _pbs.PathTaperX * 0.01f;
1301 if (taperX < 0.0f)
1302 taperX = -taperX;
1303 taperX1 = 1.0f - taperX;
1304
1305 taperY = _pbs.PathTaperY * 0.01f;
1306 if (taperY < 0.0f)
1307 taperY = -taperY;
1308 taperY1 = 1.0f - taperY;
1309
1310 }
1311
1312
1313 volume *= (taperX1 * taperY1 + 0.5f * (taperX1 * taperY + taperX * taperY1) + 0.3333333333f * taperX * taperY);
1314
1315 pathBegin = (float)_pbs.PathBegin * 2.0e-5f;
1316 pathEnd = 1.0f - (float)_pbs.PathEnd * 2.0e-5f;
1317 volume *= (pathEnd - pathBegin);
1318
1319 // this is crude aproximation
1320 profileBegin = (float)_pbs.ProfileBegin * 2.0e-5f;
1321 profileEnd = 1.0f - (float)_pbs.ProfileEnd * 2.0e-5f;
1322 volume *= (profileEnd - profileBegin);
1323
1324 returnMass = m_density * volume;
1325
1326 if (returnMass <= 0)
1327 returnMass = 0.0001f;//ckrinke: Mass must be greater then zero.
1328 // else if (returnMass > _parent_scene.maximumMassObject)
1329 // returnMass = _parent_scene.maximumMassObject;
1330
1331
1332
1333 m_primMass = returnMass;
1334 if (m_primMass > _parent_scene.maximumMassObject)
1335 m_primMass = _parent_scene.maximumMassObject;
1336
1337 // Recursively calculate mass
1338 bool HasChildPrim = false;
1339 lock (childrenPrim)
1340 {
1341 if (childrenPrim.Count > 0)
1342 {
1343 HasChildPrim = true;
1344 }
1345
1346 }
1347 if (HasChildPrim)
1348 {
1349 OdePrim[] childPrimArr = new OdePrim[0];
1350
1351 lock (childrenPrim)
1352 childPrimArr = childrenPrim.ToArray();
1353
1354 for (int i = 0; i < childPrimArr.Length; i++)
1355 {
1356 if (childPrimArr[i] != null && !childPrimArr[i].m_taintremove)
1357 returnMass += childPrimArr[i].CalculateMass();
1358 // failsafe, this shouldn't happen but with OpenSim, you never know :)
1359 if (i > 256)
1360 break;
1361 }
1362 }
1363 if (returnMass > _parent_scene.maximumMassObject)
1364 returnMass = _parent_scene.maximumMassObject;
1365 return returnMass;
1366 }// end CalculateMass
1367
1368 #endregion
1369
1370 public void setMass()
1371 {
1372 if (Body != (IntPtr)0)
1373 {
1374 float newmass = CalculateMass();
1375
1376 //m_log.Info("[PHYSICS]: New Mass: " + newmass.ToString());
1377
1378 d.MassSetBoxTotal(out pMass, newmass, _size.X, _size.Y, _size.Z);
1379 d.BodySetMass(Body, ref pMass);
1380 }
1381 }
1382
1383
1384 private void UpdateDataFromGeom()
1385 {
1386 if (prim_geom != IntPtr.Zero)
1387 {
1388 d.Quaternion qtmp;
1389 d.GeomCopyQuaternion(prim_geom, out qtmp);
1390 _orientation.W = qtmp.W;
1391 _orientation.X = qtmp.X;
1392 _orientation.Y = qtmp.Y;
1393 _orientation.Z = qtmp.Z;
1394
1395 d.Vector3 lpos = d.GeomGetPosition(prim_geom);
1396 _position.X = lpos.X;
1397 _position.Y = lpos.Y;
1398 _position.Z = lpos.Z;
1399 }
1400 }
1401
1402 public void disableBody()
1403 {
1404 //this kills the body so things like 'mesh' can re-create it.
1405 lock (this)
1406 {
1407 if (!childPrim)
1408 {
1409 if (Body != IntPtr.Zero)
1410 {
1411 _parent_scene.remActivePrim(this);
1412 m_collisionCategories &= ~CollisionCategories.Body;
1413 m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land);
1414
1415 if (prim_geom != IntPtr.Zero)
1416 {
1417 if (m_NoColide)
1418 {
1419 d.GeomSetCategoryBits(prim_geom, 0);
1420 d.GeomSetCollideBits(prim_geom, 0);
1421 d.GeomDisable(prim_geom);
1422 }
1423 else
1424 {
1425 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
1426 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
1427 }
1428 }
1429
1430 UpdateDataFromGeom();
1431
1432 lock (childrenPrim)
1433 {
1434 if (childrenPrim.Count > 0)
1435 {
1436 foreach (OdePrim prm in childrenPrim)
1437 {
1438 if (prm.prim_geom != IntPtr.Zero)
1439 {
1440 if (prm.m_NoColide)
1441 {
1442 d.GeomSetCategoryBits(prm.prim_geom, 0);
1443 d.GeomSetCollideBits(prm.prim_geom, 0);
1444 d.GeomDisable(prm.prim_geom);
1445
1446 }
1447 prm.UpdateDataFromGeom();
1448 }
1449 _parent_scene.remActivePrim(prm);
1450 prm.Body = IntPtr.Zero;
1451 }
1452 }
1453 }
1454 d.BodyDestroy(Body);
1455 Body = IntPtr.Zero;
1456 }
1457 }
1458 else
1459 {
1460 _parent_scene.remActivePrim(this);
1461
1462 m_collisionCategories &= ~CollisionCategories.Body;
1463 m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land);
1464
1465 if (prim_geom != IntPtr.Zero)
1466 {
1467 if (m_NoColide)
1468 {
1469 d.GeomSetCategoryBits(prim_geom, 0);
1470 d.GeomSetCollideBits(prim_geom, 0);
1471 d.GeomDisable(prim_geom);
1472 }
1473 else
1474 {
1475 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
1476 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
1477 }
1478 }
1479
1480 Body = IntPtr.Zero;
1481 }
1482 }
1483 m_disabled = true;
1484 m_collisionscore = 0;
1485 }
1486
1487// private static Dictionary<IMesh, IntPtr> m_MeshToTriMeshMap = new Dictionary<IMesh, IntPtr>();
1488
1489 public bool setMesh(OdeScene parent_scene, IMesh mesh)
1490 {
1491 //Kill Body so that mesh can re-make the geom
1492 if (IsPhysical && Body != IntPtr.Zero)
1493 {
1494 if (childPrim)
1495 {
1496 if (_parent != null)
1497 {
1498 OdePrim parent = (OdePrim)_parent;
1499 parent.ChildDelink(this);
1500 }
1501 }
1502 else
1503 {
1504 disableBody();
1505 }
1506 }
1507
1508 IntPtr vertices, indices;
1509 int vertexCount, indexCount;
1510 int vertexStride, triStride;
1511 mesh.getVertexListAsPtrToFloatArray(out vertices, out vertexStride, out vertexCount); // Note, that vertices are fixed in unmanaged heap
1512 mesh.getIndexListAsPtrToIntArray(out indices, out triStride, out indexCount); // Also fixed, needs release after usage
1513
1514 // warning this destroys the mesh for eventual future use. Only pinned float arrays stay valid
1515 mesh.releaseSourceMeshData(); // free up the original mesh data to save memory
1516
1517 if (vertexCount == 0 || indexCount == 0)
1518 {
1519 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());
1520 return false;
1521 }
1522
1523 IntPtr geo = IntPtr.Zero;
1524 try
1525 {
1526 _triMeshData = d.GeomTriMeshDataCreate();
1527 d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride);
1528 d.GeomTriMeshDataPreprocess(_triMeshData);
1529
1530 _parent_scene.waitForSpaceUnlock(m_targetSpace);
1531
1532 geo = d.CreateTriMesh(m_targetSpace, _triMeshData, null, null, null);
1533 }
1534 catch (Exception e)
1535 {
1536 m_log.ErrorFormat("[PHYSICS]: Create trimesh failed on prim {0} : {1}",Name,e.Message);
1537
1538 if (_triMeshData != IntPtr.Zero)
1539 {
1540 d.GeomTriMeshDataDestroy(_triMeshData);
1541 _triMeshData = IntPtr.Zero;
1542 }
1543 return false;
1544 }
1545
1546 SetGeom(geo);
1547
1548 return true;
1549 }
1550
1551 public void ProcessTaints(float timestep) //=============================================================================
1552 {
1553 if (m_taintadd)
1554 {
1555 changeadd(timestep);
1556 }
1557
1558 if (m_taintremove)
1559 return;
1560
1561 if (prim_geom != IntPtr.Zero)
1562 {
1563 if (!_position.ApproxEquals(m_taintposition, 0f))
1564 {
1565 changemove(timestep);
1566 }
1567 if (m_taintrot != _orientation)
1568 {
1569 if (childPrim && IsPhysical) // For physical child prim...
1570 {
1571 rotate(timestep);
1572 // KF: ODE will also rotate the parent prim!
1573 // so rotate the root back to where it was
1574 OdePrim parent = (OdePrim)_parent;
1575 parent.rotate(timestep);
1576 }
1577 else
1578 {
1579 //Just rotate the prim
1580 rotate(timestep);
1581 }
1582 }
1583 //
1584 if (m_taintphantom != m_isphantom )
1585 {
1586 changePhantomStatus();
1587 }//
1588
1589 if (m_taintPhysics != m_isphysical && !(m_taintparent != _parent))
1590 {
1591 changePhysicsStatus(timestep);
1592 }//
1593
1594
1595 if (!_size.ApproxEquals(m_taintsize, 0f))
1596 changesize(timestep);
1597 //
1598
1599 if(m_taintshapetype != m_shapetype)
1600 {
1601 m_shapetype = m_taintshapetype;
1602 changeshape(timestep);
1603 }
1604
1605 if (m_taintshape)
1606 changeshape(timestep);
1607 //
1608
1609 if (m_taintforce)
1610 changeAddForce(timestep);
1611
1612 if (m_taintaddangularforce)
1613 changeAddAngularForce(timestep);
1614
1615 if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f))
1616 changeSetTorque(timestep);
1617
1618 if (m_taintdisable)
1619 changedisable(timestep);
1620
1621 if (m_taintselected != m_isSelected)
1622 changeSelectedStatus();
1623
1624 if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f))
1625 changevelocity(timestep);
1626
1627 if (m_taintparent != _parent)
1628 changelink(timestep);
1629
1630 if (m_taintCollidesWater != m_collidesWater)
1631 changefloatonwater(timestep);
1632
1633 if (m_taintvehicledata != null)
1634 DoSetVehicle();
1635
1636 /* obsolete
1637 if (!m_angularLock.ApproxEquals(m_taintAngularLock,0f))
1638 changeAngularLock(timestep);
1639 */
1640 }
1641
1642 else
1643 {
1644 m_log.Error("[PHYSICS]: prim {0} at <{1},{2},{3}> as invalid geom");
1645
1646 // not sure this will not flame...
1647 m_taintremove = true;
1648 _parent_scene.AddPhysicsActorTaint(this);
1649 }
1650
1651 }
1652
1653 private void changelink(float timestep)
1654 {
1655 // If the newly set parent is not null
1656 // create link
1657 if (_parent == null && m_taintparent != null)
1658 {
1659 if (m_taintparent.PhysicsActorType == (int)ActorTypes.Prim)
1660 {
1661 OdePrim obj = (OdePrim)m_taintparent;
1662 obj.ParentPrim(this);
1663 }
1664 }
1665 // If the newly set parent is null
1666 // destroy link
1667 else if (_parent != null && m_taintparent == null)
1668 {
1669 if (_parent is OdePrim)
1670 {
1671 OdePrim obj = (OdePrim)_parent;
1672 obj.ChildDelink(this);
1673 childPrim = false;
1674 }
1675 }
1676
1677 _parent = m_taintparent;
1678 m_taintPhysics = m_isphysical;
1679 }
1680
1681 // I'm the parent
1682 // prim is the child
1683 public void ParentPrim(OdePrim prim)
1684 {
1685 if (this.m_localID != prim.m_localID)
1686 {
1687 if (Body == IntPtr.Zero)
1688 {
1689 Body = d.BodyCreate(_parent_scene.world);
1690 // disconnect from world gravity so we can apply buoyancy
1691 d.BodySetGravityMode(Body, false);
1692
1693 setMass();
1694 }
1695 if (Body != IntPtr.Zero)
1696 {
1697 lock (childrenPrim)
1698 {
1699 if (!childrenPrim.Contains(prim))
1700 {
1701 childrenPrim.Add(prim);
1702
1703 foreach (OdePrim prm in childrenPrim)
1704 {
1705 d.Mass m2;
1706 d.MassSetZero(out m2);
1707 d.MassSetBoxTotal(out m2, prim.CalculateMass(), prm._size.X, prm._size.Y, prm._size.Z);
1708
1709
1710 d.Quaternion quat = new d.Quaternion();
1711 quat.W = prm._orientation.W;
1712 quat.X = prm._orientation.X;
1713 quat.Y = prm._orientation.Y;
1714 quat.Z = prm._orientation.Z;
1715
1716 d.Matrix3 mat = new d.Matrix3();
1717 d.RfromQ(out mat, ref quat);
1718 d.MassRotate(ref m2, ref mat);
1719 d.MassTranslate(ref m2, Position.X - prm.Position.X, Position.Y - prm.Position.Y, Position.Z - prm.Position.Z);
1720 d.MassAdd(ref pMass, ref m2);
1721 }
1722 foreach (OdePrim prm in childrenPrim)
1723 {
1724 if (m_isphantom && !prm.m_isVolumeDetect)
1725 {
1726 prm.m_collisionCategories = 0;
1727 prm.m_collisionFlags = CollisionCategories.Land;
1728 }
1729 else
1730 {
1731 prm.m_collisionCategories |= CollisionCategories.Body;
1732 prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
1733 }
1734 if (prm.prim_geom == IntPtr.Zero)
1735 {
1736 m_log.Warn("[PHYSICS]: Unable to link one of the linkset elements. No geom yet");
1737 continue;
1738 }
1739
1740 if (prm.m_NoColide)
1741 {
1742 d.GeomSetCategoryBits(prm.prim_geom, 0);
1743 d.GeomSetCollideBits(prm.prim_geom, (int)CollisionCategories.Land);
1744 }
1745 else
1746 {
1747 d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories);
1748 d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags);
1749 }
1750
1751 d.Quaternion quat = new d.Quaternion();
1752 quat.W = prm._orientation.W;
1753 quat.X = prm._orientation.X;
1754 quat.Y = prm._orientation.Y;
1755 quat.Z = prm._orientation.Z;
1756
1757 d.Matrix3 mat = new d.Matrix3();
1758 d.RfromQ(out mat, ref quat);
1759 if (Body != IntPtr.Zero)
1760 {
1761 d.GeomSetBody(prm.prim_geom, Body);
1762 prm.childPrim = true;
1763 d.GeomSetOffsetWorldPosition(prm.prim_geom, prm.Position.X, prm.Position.Y, prm.Position.Z);
1764 //d.GeomSetOffsetPosition(prim.prim_geom,
1765 // (Position.X - prm.Position.X) - pMass.c.X,
1766 // (Position.Y - prm.Position.Y) - pMass.c.Y,
1767 // (Position.Z - prm.Position.Z) - pMass.c.Z);
1768 d.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat);
1769 //d.GeomSetOffsetRotation(prm.prim_geom, ref mat);
1770 d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z);
1771 d.BodySetMass(Body, ref pMass);
1772 }
1773 else
1774 {
1775 m_log.Debug("[PHYSICS]:I ain't got no boooooooooddy, no body");
1776 }
1777
1778 prm.m_interpenetrationcount = 0;
1779 prm.m_collisionscore = 0;
1780 prm.m_disabled = false;
1781
1782 prm.Body = Body;
1783
1784 _parent_scene.addActivePrim(prm);
1785 }
1786
1787 if (m_isphantom && !m_isVolumeDetect)
1788 {
1789 m_collisionCategories = 0;
1790 m_collisionFlags = CollisionCategories.Land;
1791 }
1792 else
1793 {
1794 m_collisionCategories |= CollisionCategories.Body;
1795 m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
1796 }
1797
1798 if (m_NoColide)
1799 {
1800 d.GeomSetCategoryBits(prim_geom, 0);
1801 d.GeomSetCollideBits(prim_geom, (int)CollisionCategories.Land);
1802 }
1803 else
1804 {
1805 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
1806 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
1807 }
1808
1809 d.Quaternion quat2 = new d.Quaternion();
1810 quat2.W = _orientation.W;
1811 quat2.X = _orientation.X;
1812 quat2.Y = _orientation.Y;
1813 quat2.Z = _orientation.Z;
1814
1815 d.Matrix3 mat2 = new d.Matrix3();
1816 d.RfromQ(out mat2, ref quat2);
1817 d.GeomSetBody(prim_geom, Body);
1818 d.GeomSetOffsetWorldPosition(prim_geom, Position.X - pMass.c.X, Position.Y - pMass.c.Y, Position.Z - pMass.c.Z);
1819 //d.GeomSetOffsetPosition(prim.prim_geom,
1820 // (Position.X - prm.Position.X) - pMass.c.X,
1821 // (Position.Y - prm.Position.Y) - pMass.c.Y,
1822 // (Position.Z - prm.Position.Z) - pMass.c.Z);
1823 //d.GeomSetOffsetRotation(prim_geom, ref mat2);
1824 d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z);
1825 d.BodySetMass(Body, ref pMass);
1826
1827 d.BodySetAutoDisableFlag(Body, true);
1828 d.BodySetAutoDisableSteps(Body, body_autodisable_frames);
1829
1830 m_interpenetrationcount = 0;
1831 m_collisionscore = 0;
1832 m_disabled = false;
1833
1834 d.BodySetPosition(Body, Position.X, Position.Y, Position.Z);
1835 if (m_type != Vehicle.TYPE_NONE) Enable(Body, _parent_scene);
1836
1837 _parent_scene.addActivePrim(this);
1838 }
1839 }
1840 }
1841 }
1842 }
1843
1844 private void ChildSetGeom(OdePrim odePrim)
1845 {
1846 lock (childrenPrim)
1847 {
1848 foreach (OdePrim prm in childrenPrim)
1849 {
1850 prm.disableBody();
1851 }
1852 }
1853 disableBody();
1854
1855 if (Body != IntPtr.Zero)
1856 {
1857 _parent_scene.remActivePrim(this);
1858 }
1859
1860 lock (childrenPrim)
1861 {
1862 foreach (OdePrim prm in childrenPrim)
1863 {
1864 ParentPrim(prm);
1865 }
1866 }
1867 }
1868
1869 private void ChildDelink(OdePrim odePrim)
1870 {
1871 // Okay, we have a delinked child.. need to rebuild the body.
1872 lock (childrenPrim)
1873 {
1874 foreach (OdePrim prm in childrenPrim)
1875 {
1876 prm.childPrim = true;
1877 prm.disableBody();
1878 }
1879 }
1880 disableBody();
1881
1882 lock (childrenPrim)
1883 {
1884 childrenPrim.Remove(odePrim);
1885 }
1886
1887 if (Body != IntPtr.Zero)
1888 {
1889 _parent_scene.remActivePrim(this);
1890 }
1891
1892 lock (childrenPrim)
1893 {
1894 foreach (OdePrim prm in childrenPrim)
1895 {
1896 ParentPrim(prm);
1897 }
1898 }
1899 }
1900
1901 private void changePhantomStatus()
1902 {
1903 m_taintphantom = m_isphantom;
1904 changeSelectedStatus();
1905 }
1906
1907/* not in use
1908 private void SetCollider()
1909 {
1910 SetCollider(m_isSelected, m_isphysical, m_isphantom, m_isSelected);
1911 }
1912
1913 private void SetCollider(bool sel, bool phys, bool phan, bool vdtc)
1914 {
1915 if (sel)
1916 {
1917 m_collisionCategories = CollisionCategories.Selected;
1918 m_collisionFlags = (CollisionCategories.Sensor | CollisionCategories.Space);
1919 }
1920 else
1921 {
1922 if (phan && !vdtc)
1923 {
1924 m_collisionCategories = 0;
1925 if (phys)
1926 m_collisionFlags = CollisionCategories.Land;
1927 else
1928 m_collisionFlags = 0; // this case should not happen non physical phantoms should not have physics
1929 }
1930 else
1931 {
1932 m_collisionCategories = CollisionCategories.Geom;
1933 if (phys)
1934 m_collisionCategories |= CollisionCategories.Body;
1935
1936 m_collisionFlags = m_default_collisionFlags;
1937
1938 if (m_collidesLand)
1939 m_collisionFlags |= CollisionCategories.Land;
1940 if (m_collidesWater)
1941 m_collisionFlags |= CollisionCategories.Water;
1942 }
1943 }
1944
1945 if (prim_geom != IntPtr.Zero)
1946 {
1947 if (m_NoColide)
1948 {
1949 d.GeomSetCategoryBits(prim_geom, 0);
1950 if (phys)
1951 d.GeomSetCollideBits(prim_geom, (int)CollisionCategories.Land);
1952 else
1953 {
1954 d.GeomSetCollideBits(prim_geom, 0);
1955 d.GeomDisable(prim_geom);
1956 }
1957 }
1958 else
1959 {
1960 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
1961 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
1962 }
1963 }
1964 }
1965*/
1966
1967 private void changeSelectedStatus()
1968 {
1969 if (m_taintselected)
1970 {
1971 m_collisionCategories = CollisionCategories.Selected;
1972 m_collisionFlags = (CollisionCategories.Sensor | CollisionCategories.Space);
1973
1974 // We do the body disable soft twice because 'in theory' a collision could have happened
1975 // in between the disabling and the collision properties setting
1976 // which would wake the physical body up from a soft disabling and potentially cause it to fall
1977 // through the ground.
1978
1979 // NOTE FOR JOINTS: this doesn't always work for jointed assemblies because if you select
1980 // just one part of the assembly, the rest of the assembly is non-selected and still simulating,
1981 // so that causes the selected part to wake up and continue moving.
1982
1983 // even if you select all parts of a jointed assembly, it is not guaranteed that the entire
1984 // assembly will stop simulating during the selection, because of the lack of atomicity
1985 // of select operations (their processing could be interrupted by a thread switch, causing
1986 // simulation to continue before all of the selected object notifications trickle down to
1987 // the physics engine).
1988
1989 // e.g. we select 100 prims that are connected by joints. non-atomically, the first 50 are
1990 // selected and disabled. then, due to a thread switch, the selection processing is
1991 // interrupted and the physics engine continues to simulate, so the last 50 items, whose
1992 // selection was not yet processed, continues to simulate. this wakes up ALL of the
1993 // first 50 again. then the last 50 are disabled. then the first 50, which were just woken
1994 // up, start simulating again, which in turn wakes up the last 50.
1995
1996 if (m_isphysical)
1997 {
1998 disableBodySoft();
1999 }
2000
2001 if (prim_geom != IntPtr.Zero)
2002 {
2003 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
2004 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
2005 if (m_NoColide)
2006 d.GeomDisable(prim_geom);
2007 }
2008
2009 if (m_isphysical)
2010 {
2011 disableBodySoft();
2012 }
2013 if (Body != IntPtr.Zero)
2014 {
2015 d.BodySetLinearVel(Body, 0f, 0f, 0f);
2016 d.BodySetForce(Body, 0f, 0f, 0f);
2017 d.BodySetAngularVel(Body, 0.0f, 0.0f, 0.0f);
2018 d.BodySetTorque(Body, 0.0f, 0.0f, 0.0f);
2019 }
2020 }
2021 else
2022 {
2023 if (m_isphantom && !m_isVolumeDetect)
2024 {
2025 m_collisionCategories = 0;
2026 if (m_isphysical)
2027 m_collisionFlags = CollisionCategories.Land;
2028 else
2029 m_collisionFlags = 0; // this case should not happen non physical phantoms should not have physics
2030 }
2031 else
2032 {
2033 m_collisionCategories = CollisionCategories.Geom;
2034 if (m_isphysical)
2035 m_collisionCategories |= CollisionCategories.Body;
2036
2037 m_collisionFlags = m_default_collisionFlags;
2038
2039 if (m_collidesLand)
2040 m_collisionFlags |= CollisionCategories.Land;
2041 if (m_collidesWater)
2042 m_collisionFlags |= CollisionCategories.Water;
2043 }
2044
2045 if (prim_geom != IntPtr.Zero)
2046 {
2047 if (m_NoColide)
2048 {
2049 d.GeomSetCategoryBits(prim_geom, 0);
2050 if (m_isphysical)
2051 d.GeomSetCollideBits(prim_geom, (int)CollisionCategories.Land);
2052 else
2053 {
2054 d.GeomSetCollideBits(prim_geom, 0);
2055 d.GeomDisable(prim_geom);
2056 }
2057 }
2058 else
2059 {
2060 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
2061 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
2062 }
2063 }
2064 if (Body != IntPtr.Zero)
2065 {
2066 d.BodySetLinearVel(Body, 0f, 0f, 0f);
2067 d.BodySetForce(Body, 0f, 0f, 0f);
2068 d.BodySetAngularVel(Body, 0.0f, 0.0f, 0.0f);
2069 d.BodySetTorque(Body, 0.0f, 0.0f, 0.0f);
2070 }
2071
2072 if (m_isphysical)
2073 {
2074 if (Body != IntPtr.Zero)
2075 {
2076 enableBodySoft();
2077 }
2078 }
2079 }
2080
2081 resetCollisionAccounting();
2082 m_isSelected = m_taintselected;
2083 }//end changeSelectedStatus
2084
2085 public void ResetTaints()
2086 {
2087 m_taintposition = _position;
2088 m_taintrot = _orientation;
2089 m_taintPhysics = m_isphysical;
2090 m_taintselected = m_isSelected;
2091 m_taintsize = _size;
2092 m_taintshape = false;
2093 m_taintforce = false;
2094 m_taintdisable = false;
2095 m_taintVelocity = Vector3.Zero;
2096 }
2097
2098 public void CreateGeom(IntPtr m_targetSpace, IMesh _mesh)
2099 {
2100 bool gottrimesh = false;
2101
2102 m_NoColide = false; // assume all will go well
2103
2104 if (_triMeshData != IntPtr.Zero)
2105 {
2106 d.GeomTriMeshDataDestroy(_triMeshData);
2107 _triMeshData = IntPtr.Zero;
2108 }
2109
2110 if (_mesh != null)
2111 {
2112 gottrimesh = setMesh(_parent_scene, _mesh);
2113 if (!gottrimesh)
2114 {
2115 // getting a mesh failed,
2116 // lets go on having a basic box or sphere, with prim size but not coliding
2117 // physical colides with land, non with nothing
2118
2119 m_NoColide = true;
2120 }
2121 }
2122
2123 if (!gottrimesh)
2124 { // we will have a basic box or sphere
2125 IntPtr geo = IntPtr.Zero;
2126
2127 if (_pbs.ProfileShape == ProfileShape.HalfCircle && _pbs.PathCurve == (byte)Extrusion.Curve1
2128 && _size.X == _size.Y && _size.X == _size.Z)
2129 {
2130 // its a sphere
2131 _parent_scene.waitForSpaceUnlock(m_targetSpace);
2132 try
2133 {
2134 geo = d.CreateSphere(m_targetSpace, _size.X * 0.5f);
2135 }
2136 catch (Exception e)
2137 {
2138 m_log.WarnFormat("[PHYSICS]: Unable to create basic sphere for object {0}", e.Message);
2139 geo = IntPtr.Zero;
2140 ode.dunlock(_parent_scene.world);
2141 }
2142 }
2143 else // make it a box
2144 {
2145 _parent_scene.waitForSpaceUnlock(m_targetSpace);
2146 try
2147 {
2148 geo = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
2149 }
2150 catch (Exception e)
2151 {
2152 m_log.WarnFormat("[PHYSICS]: Unable to create basic sphere for object {0}", e.Message);
2153 geo = IntPtr.Zero;
2154 ode.dunlock(_parent_scene.world);
2155 }
2156 }
2157
2158 if (geo == IntPtr.Zero) // if this happens it must be fixed
2159 {
2160 // if it does lets stop what we can
2161 // not sure this will not flame...
2162
2163 m_taintremove = true;
2164 _parent_scene.AddPhysicsActorTaint(this);
2165 return;
2166 }
2167
2168 SetGeom(geo); // this processes the m_NoColide
2169 }
2170 }
2171
2172 public void changeadd(float timestep)
2173 {
2174 int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
2175 IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position);
2176
2177 if (targetspace == IntPtr.Zero)
2178 targetspace = _parent_scene.createprimspace(iprimspaceArrItem[0], iprimspaceArrItem[1]);
2179
2180 m_targetSpace = targetspace;
2181
2182 if (_mesh == null) // && m_meshfailed == false)
2183 {
2184 if (_parent_scene.needsMeshing(_pbs))
2185 {
2186 bool convex;
2187 if (m_shapetype == 2)
2188 convex = true;
2189 else
2190 convex = false;
2191 try
2192 {
2193 _mesh = _parent_scene.mesher.CreateMesh(m_primName, _pbs, _size, (int)LevelOfDetail.High, true,false,convex,false);
2194 }
2195 catch
2196 {
2197 //Don't continuously try to mesh prims when meshing has failed
2198 m_meshfailed = true;
2199 _mesh = null;
2200 m_log.WarnFormat("[PHYSICS]: changeAdd CreateMesh fail on prim {0} at <{1},{2},{3}>", Name, _position.X, _position.Y, _position.Z);
2201 }
2202 }
2203 }
2204
2205 lock (_parent_scene.OdeLock)
2206 {
2207 CreateGeom(m_targetSpace, _mesh);
2208
2209 if (prim_geom != IntPtr.Zero)
2210 {
2211 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
2212 d.Quaternion myrot = new d.Quaternion();
2213 myrot.X = _orientation.X;
2214 myrot.Y = _orientation.Y;
2215 myrot.Z = _orientation.Z;
2216 myrot.W = _orientation.W;
2217 d.GeomSetQuaternion(prim_geom, ref myrot);
2218 }
2219
2220 if (m_isphysical && Body == IntPtr.Zero)
2221 {
2222 enableBody();
2223 }
2224 }
2225
2226 changeSelectedStatus();
2227
2228 m_taintadd = false;
2229 }
2230
2231 public void changemove(float timestep)
2232 {
2233 if (m_isphysical)
2234 {
2235 // if (!m_disabled && !m_taintremove && !childPrim) After one edit m_disabled is sometimes set, disabling further edits!
2236 if (!m_taintremove && !childPrim)
2237 {
2238 if (Body == IntPtr.Zero)
2239 enableBody();
2240 //Prim auto disable after 20 frames,
2241 //if you move it, re-enable the prim manually.
2242 if (_parent != null)
2243 {
2244 if (m_linkJoint != IntPtr.Zero)
2245 {
2246 d.JointDestroy(m_linkJoint);
2247 m_linkJoint = IntPtr.Zero;
2248 }
2249 }
2250 if (Body != IntPtr.Zero)
2251 {
2252 d.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
2253
2254 if (_parent != null)
2255 {
2256 OdePrim odParent = (OdePrim)_parent;
2257 if (Body != (IntPtr)0 && odParent.Body != (IntPtr)0 && Body != odParent.Body)
2258 {
2259 // KF: Fixed Joints were removed? Anyway - this Console.WriteLine does not show up, so routine is not used??
2260 Console.WriteLine("ODEPrim JointCreateFixed !!!");
2261 m_linkJoint = d.JointCreateFixed(_parent_scene.world, _linkJointGroup);
2262 d.JointAttach(m_linkJoint, Body, odParent.Body);
2263 d.JointSetFixed(m_linkJoint);
2264 }
2265 }
2266 d.BodyEnable(Body);
2267 if (m_type != Vehicle.TYPE_NONE)
2268 {
2269 Enable(Body, _parent_scene);
2270 }
2271 }
2272 else
2273 {
2274 m_log.Warn("[PHYSICS]: Body Still null after enableBody(). This is a crash scenario.");
2275 }
2276 }
2277 //else
2278 // {
2279 //m_log.Debug("[BUG]: race!");
2280 //}
2281 }
2282 else
2283 {
2284 // string primScenAvatarIn = _parent_scene.whichspaceamIin(_position);
2285 // int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
2286 _parent_scene.waitForSpaceUnlock(m_targetSpace);
2287
2288 IntPtr tempspace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace);
2289 m_targetSpace = tempspace;
2290
2291 _parent_scene.waitForSpaceUnlock(m_targetSpace);
2292 if (prim_geom != IntPtr.Zero)
2293 {
2294 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
2295
2296 _parent_scene.waitForSpaceUnlock(m_targetSpace);
2297 d.SpaceAdd(m_targetSpace, prim_geom);
2298 }
2299 }
2300
2301 changeSelectedStatus();
2302
2303 resetCollisionAccounting();
2304 m_taintposition = _position;
2305 }
2306
2307 public void rotate(float timestep)
2308 {
2309 d.Quaternion myrot = new d.Quaternion();
2310 myrot.X = _orientation.X;
2311 myrot.Y = _orientation.Y;
2312 myrot.Z = _orientation.Z;
2313 myrot.W = _orientation.W;
2314 if (Body != IntPtr.Zero)
2315 {
2316 // KF: If this is a root prim do BodySet
2317 d.BodySetQuaternion(Body, ref myrot);
2318 }
2319 else
2320 {
2321 // daughter prim, do Geom set
2322 d.GeomSetQuaternion(prim_geom, ref myrot);
2323 }
2324
2325 resetCollisionAccounting();
2326 m_taintrot = _orientation;
2327 }
2328
2329 private void resetCollisionAccounting()
2330 {
2331 m_collisionscore = 0;
2332 m_interpenetrationcount = 0;
2333 m_disabled = false;
2334 }
2335
2336 public void changedisable(float timestep)
2337 {
2338 m_disabled = true;
2339 if (Body != IntPtr.Zero)
2340 {
2341 d.BodyDisable(Body);
2342 Body = IntPtr.Zero;
2343 }
2344
2345 m_taintdisable = false;
2346 }
2347
2348 public void changePhysicsStatus(float timestep)
2349 {
2350 if (m_isphysical == true)
2351 {
2352 if (Body == IntPtr.Zero)
2353 {
2354 if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim)
2355 {
2356 changeshape(2f);
2357 }
2358 else
2359 {
2360 enableBody();
2361 }
2362 }
2363 }
2364 else
2365 {
2366 if (Body != IntPtr.Zero)
2367 {
2368 if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim)
2369 {
2370 _mesh = null;
2371 changeadd(2f);
2372 }
2373 if (childPrim)
2374 {
2375 if (_parent != null)
2376 {
2377 OdePrim parent = (OdePrim)_parent;
2378 parent.ChildDelink(this);
2379 }
2380 }
2381 else
2382 {
2383 disableBody();
2384 }
2385 }
2386 }
2387
2388 changeSelectedStatus();
2389
2390 resetCollisionAccounting();
2391 m_taintPhysics = m_isphysical;
2392 }
2393
2394 public void changesize(float timestamp)
2395 {
2396
2397 string oldname = _parent_scene.geom_name_map[prim_geom];
2398
2399 if (_size.X <= 0) _size.X = 0.01f;
2400 if (_size.Y <= 0) _size.Y = 0.01f;
2401 if (_size.Z <= 0) _size.Z = 0.01f;
2402
2403 // Cleanup of old prim geometry
2404 if (_mesh != null)
2405 {
2406 // Cleanup meshing here
2407 }
2408 //kill body to rebuild
2409 if (IsPhysical && Body != IntPtr.Zero)
2410 {
2411 if (childPrim)
2412 {
2413 if (_parent != null)
2414 {
2415 OdePrim parent = (OdePrim)_parent;
2416 parent.ChildDelink(this);
2417 }
2418 }
2419 else
2420 {
2421 disableBody();
2422 }
2423 }
2424 if (d.SpaceQuery(m_targetSpace, prim_geom))
2425 {
2426 _parent_scene.waitForSpaceUnlock(m_targetSpace);
2427 d.SpaceRemove(m_targetSpace, prim_geom);
2428 }
2429 // we don't need to do space calculation because the client sends a position update also.
2430
2431 // Construction of new prim
2432 if (_parent_scene.needsMeshing(_pbs))// && m_meshfailed == false)
2433 {
2434 float meshlod = _parent_scene.meshSculptLOD;
2435
2436 if (IsPhysical)
2437 meshlod = _parent_scene.MeshSculptphysicalLOD;
2438 // Don't need to re-enable body.. it's done in SetMesh
2439
2440 IMesh mesh = null;
2441
2442 try
2443 {
2444 if (_parent_scene.needsMeshing(_pbs))
2445 mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, (int)LevelOfDetail.High, true);
2446 }
2447 catch
2448 {
2449 m_meshfailed = true;
2450 mesh = null;
2451 m_log.WarnFormat("[PHYSICS]: changeSize CreateMesh fail on prim {0} at <{1},{2},{3}>", Name, _position.X, _position.Y, _position.Z);
2452 }
2453
2454 //IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
2455 CreateGeom(m_targetSpace, mesh);
2456 }
2457 else
2458 {
2459 _mesh = null;
2460 CreateGeom(m_targetSpace, _mesh);
2461 }
2462
2463 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
2464 d.Quaternion myrot = new d.Quaternion();
2465 myrot.X = _orientation.X;
2466 myrot.Y = _orientation.Y;
2467 myrot.Z = _orientation.Z;
2468 myrot.W = _orientation.W;
2469 d.GeomSetQuaternion(prim_geom, ref myrot);
2470
2471 //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
2472 if (IsPhysical && Body == IntPtr.Zero && !childPrim)
2473 {
2474 // Re creates body on size.
2475 // EnableBody also does setMass()
2476 enableBody();
2477 d.BodyEnable(Body);
2478 }
2479
2480 _parent_scene.geom_name_map[prim_geom] = oldname;
2481
2482 changeSelectedStatus();
2483 if (childPrim)
2484 {
2485 if (_parent is OdePrim)
2486 {
2487 OdePrim parent = (OdePrim)_parent;
2488 parent.ChildSetGeom(this);
2489 }
2490 }
2491 resetCollisionAccounting();
2492 m_taintsize = _size;
2493 }
2494
2495
2496
2497 public void changefloatonwater(float timestep)
2498 {
2499 m_collidesWater = m_taintCollidesWater;
2500
2501 if (prim_geom != IntPtr.Zero)
2502 {
2503 if (m_collidesWater)
2504 {
2505 m_collisionFlags |= CollisionCategories.Water;
2506 }
2507 else
2508 {
2509 m_collisionFlags &= ~CollisionCategories.Water;
2510 }
2511 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
2512 }
2513 }
2514
2515 public void changeshape(float timestamp)
2516 {
2517 string oldname = _parent_scene.geom_name_map[prim_geom];
2518
2519 // Cleanup of old prim geometry and Bodies
2520 if (IsPhysical && Body != IntPtr.Zero)
2521 {
2522 if (childPrim)
2523 {
2524 if (_parent != null)
2525 {
2526 OdePrim parent = (OdePrim)_parent;
2527 parent.ChildDelink(this);
2528 }
2529 }
2530 else
2531 {
2532 disableBody();
2533 }
2534 }
2535
2536
2537 // we don't need to do space calculation because the client sends a position update also.
2538 if (_size.X <= 0) _size.X = 0.01f;
2539 if (_size.Y <= 0) _size.Y = 0.01f;
2540 if (_size.Z <= 0) _size.Z = 0.01f;
2541 // Construction of new prim
2542
2543 if (_parent_scene.needsMeshing(_pbs))// && m_meshfailed == false)
2544 {
2545 // Don't need to re-enable body.. it's done in SetMesh
2546 float meshlod = _parent_scene.meshSculptLOD;
2547 IMesh mesh;
2548
2549 if (IsPhysical)
2550 meshlod = _parent_scene.MeshSculptphysicalLOD;
2551
2552 bool convex;
2553 if (m_shapetype == 2)
2554 convex = true;
2555 else
2556 convex = false;
2557
2558 try
2559 {
2560 mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, (int)LevelOfDetail.High, true, false,convex,false);
2561 }
2562 catch
2563 {
2564 mesh = null;
2565 m_meshfailed = true;
2566 m_log.WarnFormat("[PHYSICS]: changeAdd CreateMesh fail on prim {0} at <{1},{2},{3}>", Name, _position.X, _position.Y, _position.Z);
2567 }
2568
2569 CreateGeom(m_targetSpace, mesh);
2570
2571 // createmesh returns null when it doesn't mesh.
2572 }
2573 else
2574 {
2575 _mesh = null;
2576 CreateGeom(m_targetSpace, null);
2577 }
2578
2579 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
2580 d.Quaternion myrot = new d.Quaternion();
2581 //myrot.W = _orientation.w;
2582 myrot.W = _orientation.W;
2583 myrot.X = _orientation.X;
2584 myrot.Y = _orientation.Y;
2585 myrot.Z = _orientation.Z;
2586 d.GeomSetQuaternion(prim_geom, ref myrot);
2587
2588 //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
2589 if (IsPhysical && Body == IntPtr.Zero)
2590 {
2591 // Re creates body on size.
2592 // EnableBody also does setMass()
2593 enableBody();
2594 if (Body != IntPtr.Zero)
2595 {
2596 d.BodyEnable(Body);
2597 }
2598 }
2599 _parent_scene.geom_name_map[prim_geom] = oldname;
2600
2601 changeSelectedStatus();
2602 if (childPrim)
2603 {
2604 if (_parent is OdePrim)
2605 {
2606 OdePrim parent = (OdePrim)_parent;
2607 parent.ChildSetGeom(this);
2608 }
2609 }
2610 resetCollisionAccounting();
2611 m_taintshape = false;
2612 }
2613
2614 public void changeAddForce(float timestamp)
2615 {
2616 if (!m_isSelected)
2617 {
2618 lock (m_forcelist)
2619 {
2620 //m_log.Info("[PHYSICS]: dequeing forcelist");
2621 if (IsPhysical)
2622 {
2623 Vector3 iforce = Vector3.Zero;
2624 int i = 0;
2625 try
2626 {
2627 for (i = 0; i < m_forcelist.Count; i++)
2628 {
2629
2630 iforce = iforce + (m_forcelist[i] * 100);
2631 }
2632 }
2633 catch (IndexOutOfRangeException)
2634 {
2635 m_forcelist = new List<Vector3>();
2636 m_collisionscore = 0;
2637 m_interpenetrationcount = 0;
2638 m_taintforce = false;
2639 return;
2640 }
2641 catch (ArgumentOutOfRangeException)
2642 {
2643 m_forcelist = new List<Vector3>();
2644 m_collisionscore = 0;
2645 m_interpenetrationcount = 0;
2646 m_taintforce = false;
2647 return;
2648 }
2649 d.BodyEnable(Body);
2650
2651 d.BodyAddForce(Body, iforce.X, iforce.Y, iforce.Z);
2652 }
2653 m_forcelist.Clear();
2654 }
2655
2656 m_collisionscore = 0;
2657 m_interpenetrationcount = 0;
2658 }
2659
2660 m_taintforce = false;
2661
2662 }
2663
2664
2665
2666 public void changeSetTorque(float timestamp)
2667 {
2668 if (!m_isSelected)
2669 {
2670 if (IsPhysical && Body != IntPtr.Zero)
2671 {
2672 d.BodySetTorque(Body, m_taintTorque.X, m_taintTorque.Y, m_taintTorque.Z);
2673 }
2674 }
2675
2676 m_taintTorque = Vector3.Zero;
2677 }
2678
2679 public void changeAddAngularForce(float timestamp)
2680 {
2681 if (!m_isSelected)
2682 {
2683 lock (m_angularforcelist)
2684 {
2685 //m_log.Info("[PHYSICS]: dequeing forcelist");
2686 if (IsPhysical)
2687 {
2688 Vector3 iforce = Vector3.Zero;
2689 for (int i = 0; i < m_angularforcelist.Count; i++)
2690 {
2691 iforce = iforce + (m_angularforcelist[i] * 100);
2692 }
2693 d.BodyEnable(Body);
2694 d.BodyAddTorque(Body, iforce.X, iforce.Y, iforce.Z);
2695
2696 }
2697 m_angularforcelist.Clear();
2698 }
2699
2700 m_collisionscore = 0;
2701 m_interpenetrationcount = 0;
2702 }
2703
2704 m_taintaddangularforce = false;
2705 }
2706
2707 private void changevelocity(float timestep)
2708 {
2709 if (!m_isSelected)
2710 {
2711 Thread.Sleep(20);
2712 if (IsPhysical)
2713 {
2714 if (Body != IntPtr.Zero)
2715 d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z);
2716 }
2717
2718 //resetCollisionAccounting();
2719 }
2720 m_taintVelocity = Vector3.Zero;
2721 }
2722
2723 public void UpdatePositionAndVelocity()
2724 {
2725 return; // moved to the Move () method
2726 }
2727
2728 public d.Mass FromMatrix4(Matrix4 pMat, ref d.Mass obj)
2729 {
2730 obj.I.M00 = pMat[0, 0];
2731 obj.I.M01 = pMat[0, 1];
2732 obj.I.M02 = pMat[0, 2];
2733 obj.I.M10 = pMat[1, 0];
2734 obj.I.M11 = pMat[1, 1];
2735 obj.I.M12 = pMat[1, 2];
2736 obj.I.M20 = pMat[2, 0];
2737 obj.I.M21 = pMat[2, 1];
2738 obj.I.M22 = pMat[2, 2];
2739 return obj;
2740 }
2741
2742 public override void SubscribeEvents(int ms)
2743 {
2744 m_eventsubscription = ms;
2745 _parent_scene.addCollisionEventReporting(this);
2746 }
2747
2748 public override void UnSubscribeEvents()
2749 {
2750 _parent_scene.remCollisionEventReporting(this);
2751 m_eventsubscription = 0;
2752 }
2753
2754 public void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
2755 {
2756 if (CollisionEventsThisFrame == null)
2757 CollisionEventsThisFrame = new CollisionEventUpdate();
2758 CollisionEventsThisFrame.AddCollider(CollidedWith, contact);
2759 }
2760
2761 public void SendCollisions()
2762 {
2763 if (CollisionEventsThisFrame == null)
2764 return;
2765
2766 base.SendCollisionUpdate(CollisionEventsThisFrame);
2767
2768 if (CollisionEventsThisFrame.m_objCollisionList.Count == 0)
2769 CollisionEventsThisFrame = null;
2770 else
2771 CollisionEventsThisFrame = new CollisionEventUpdate();
2772 }
2773
2774 public override bool SubscribedEvents()
2775 {
2776 if (m_eventsubscription > 0)
2777 return true;
2778 return false;
2779 }
2780
2781 public static Matrix4 Inverse(Matrix4 pMat)
2782 {
2783 if (determinant3x3(pMat) == 0)
2784 {
2785 return Matrix4.Identity; // should probably throw an error. singluar matrix inverse not possible
2786 }
2787
2788
2789
2790 return (Adjoint(pMat) / determinant3x3(pMat));
2791 }
2792
2793 public static Matrix4 Adjoint(Matrix4 pMat)
2794 {
2795 Matrix4 adjointMatrix = new Matrix4();
2796 for (int i = 0; i < 4; i++)
2797 {
2798 for (int j = 0; j < 4; j++)
2799 {
2800 Matrix4SetValue(ref adjointMatrix, i, j, (float)(Math.Pow(-1, i + j) * (determinant3x3(Minor(pMat, i, j)))));
2801 }
2802 }
2803
2804 adjointMatrix = Transpose(adjointMatrix);
2805 return adjointMatrix;
2806 }
2807
2808 public static Matrix4 Minor(Matrix4 matrix, int iRow, int iCol)
2809 {
2810 Matrix4 minor = new Matrix4();
2811 int m = 0, n = 0;
2812 for (int i = 0; i < 4; i++)
2813 {
2814 if (i == iRow)
2815 continue;
2816 n = 0;
2817 for (int j = 0; j < 4; j++)
2818 {
2819 if (j == iCol)
2820 continue;
2821 Matrix4SetValue(ref minor, m, n, matrix[i, j]);
2822 n++;
2823 }
2824 m++;
2825 }
2826 return minor;
2827 }
2828
2829 public static Matrix4 Transpose(Matrix4 pMat)
2830 {
2831 Matrix4 transposeMatrix = new Matrix4();
2832 for (int i = 0; i < 4; i++)
2833 for (int j = 0; j < 4; j++)
2834 Matrix4SetValue(ref transposeMatrix, i, j, pMat[j, i]);
2835 return transposeMatrix;
2836 }
2837
2838 public static void Matrix4SetValue(ref Matrix4 pMat, int r, int c, float val)
2839 {
2840 switch (r)
2841 {
2842 case 0:
2843 switch (c)
2844 {
2845 case 0:
2846 pMat.M11 = val;
2847 break;
2848 case 1:
2849 pMat.M12 = val;
2850 break;
2851 case 2:
2852 pMat.M13 = val;
2853 break;
2854 case 3:
2855 pMat.M14 = val;
2856 break;
2857 }
2858
2859 break;
2860 case 1:
2861 switch (c)
2862 {
2863 case 0:
2864 pMat.M21 = val;
2865 break;
2866 case 1:
2867 pMat.M22 = val;
2868 break;
2869 case 2:
2870 pMat.M23 = val;
2871 break;
2872 case 3:
2873 pMat.M24 = val;
2874 break;
2875 }
2876
2877 break;
2878 case 2:
2879 switch (c)
2880 {
2881 case 0:
2882 pMat.M31 = val;
2883 break;
2884 case 1:
2885 pMat.M32 = val;
2886 break;
2887 case 2:
2888 pMat.M33 = val;
2889 break;
2890 case 3:
2891 pMat.M34 = val;
2892 break;
2893 }
2894
2895 break;
2896 case 3:
2897 switch (c)
2898 {
2899 case 0:
2900 pMat.M41 = val;
2901 break;
2902 case 1:
2903 pMat.M42 = val;
2904 break;
2905 case 2:
2906 pMat.M43 = val;
2907 break;
2908 case 3:
2909 pMat.M44 = val;
2910 break;
2911 }
2912
2913 break;
2914 }
2915 }
2916 private static float determinant3x3(Matrix4 pMat)
2917 {
2918 float det = 0;
2919 float diag1 = pMat[0, 0] * pMat[1, 1] * pMat[2, 2];
2920 float diag2 = pMat[0, 1] * pMat[2, 1] * pMat[2, 0];
2921 float diag3 = pMat[0, 2] * pMat[1, 0] * pMat[2, 1];
2922 float diag4 = pMat[2, 0] * pMat[1, 1] * pMat[0, 2];
2923 float diag5 = pMat[2, 1] * pMat[1, 2] * pMat[0, 0];
2924 float diag6 = pMat[2, 2] * pMat[1, 0] * pMat[0, 1];
2925
2926 det = diag1 + diag2 + diag3 - (diag4 + diag5 + diag6);
2927 return det;
2928
2929 }
2930
2931 private static void DMassCopy(ref d.Mass src, ref d.Mass dst)
2932 {
2933 dst.c.W = src.c.W;
2934 dst.c.X = src.c.X;
2935 dst.c.Y = src.c.Y;
2936 dst.c.Z = src.c.Z;
2937 dst.mass = src.mass;
2938 dst.I.M00 = src.I.M00;
2939 dst.I.M01 = src.I.M01;
2940 dst.I.M02 = src.I.M02;
2941 dst.I.M10 = src.I.M10;
2942 dst.I.M11 = src.I.M11;
2943 dst.I.M12 = src.I.M12;
2944 dst.I.M20 = src.I.M20;
2945 dst.I.M21 = src.I.M21;
2946 dst.I.M22 = src.I.M22;
2947 }
2948
2949 public override void SetMaterial(int pMaterial)
2950 {
2951 m_material = pMaterial;
2952 }
2953
2954 internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue)
2955 {
2956 switch (pParam)
2957 {
2958 case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY:
2959 if (pValue < 0.01f) pValue = 0.01f;
2960 // m_angularDeflectionEfficiency = pValue;
2961 break;
2962 case Vehicle.ANGULAR_DEFLECTION_TIMESCALE:
2963 if (pValue < 0.1f) pValue = 0.1f;
2964 // m_angularDeflectionTimescale = pValue;
2965 break;
2966 case Vehicle.ANGULAR_MOTOR_DECAY_TIMESCALE:
2967 if (pValue < 0.3f) pValue = 0.3f;
2968 m_angularMotorDecayTimescale = pValue;
2969 break;
2970 case Vehicle.ANGULAR_MOTOR_TIMESCALE:
2971 if (pValue < 0.3f) pValue = 0.3f;
2972 m_angularMotorTimescale = pValue;
2973 break;
2974 case Vehicle.BANKING_EFFICIENCY:
2975 if (pValue < 0.01f) pValue = 0.01f;
2976 // m_bankingEfficiency = pValue;
2977 break;
2978 case Vehicle.BANKING_MIX:
2979 if (pValue < 0.01f) pValue = 0.01f;
2980 // m_bankingMix = pValue;
2981 break;
2982 case Vehicle.BANKING_TIMESCALE:
2983 if (pValue < 0.01f) pValue = 0.01f;
2984 // m_bankingTimescale = pValue;
2985 break;
2986 case Vehicle.BUOYANCY:
2987 if (pValue < -1f) pValue = -1f;
2988 if (pValue > 1f) pValue = 1f;
2989 m_VehicleBuoyancy = pValue;
2990 break;
2991 // case Vehicle.HOVER_EFFICIENCY:
2992 // if (pValue < 0f) pValue = 0f;
2993 // if (pValue > 1f) pValue = 1f;
2994 // m_VhoverEfficiency = pValue;
2995 // break;
2996 case Vehicle.HOVER_HEIGHT:
2997 m_VhoverHeight = pValue;
2998 break;
2999 case Vehicle.HOVER_TIMESCALE:
3000 if (pValue < 0.1f) pValue = 0.1f;
3001 m_VhoverTimescale = pValue;
3002 break;
3003 case Vehicle.LINEAR_DEFLECTION_EFFICIENCY:
3004 if (pValue < 0.01f) pValue = 0.01f;
3005 // m_linearDeflectionEfficiency = pValue;
3006 break;
3007 case Vehicle.LINEAR_DEFLECTION_TIMESCALE:
3008 if (pValue < 0.01f) pValue = 0.01f;
3009 // m_linearDeflectionTimescale = pValue;
3010 break;
3011 case Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE:
3012 if (pValue < 0.3f) pValue = 0.3f;
3013 m_linearMotorDecayTimescale = pValue;
3014 break;
3015 case Vehicle.LINEAR_MOTOR_TIMESCALE:
3016 if (pValue < 0.1f) pValue = 0.1f;
3017 m_linearMotorTimescale = pValue;
3018 break;
3019 case Vehicle.VERTICAL_ATTRACTION_EFFICIENCY:
3020 if (pValue < 0.1f) pValue = 0.1f; // Less goes unstable
3021 if (pValue > 1.0f) pValue = 1.0f;
3022 m_verticalAttractionEfficiency = pValue;
3023 break;
3024 case Vehicle.VERTICAL_ATTRACTION_TIMESCALE:
3025 if (pValue < 0.1f) pValue = 0.1f;
3026 m_verticalAttractionTimescale = pValue;
3027 break;
3028
3029 // These are vector properties but the engine lets you use a single float value to
3030 // set all of the components to the same value
3031 case Vehicle.ANGULAR_FRICTION_TIMESCALE:
3032 if (pValue > 30f) pValue = 30f;
3033 if (pValue < 0.1f) pValue = 0.1f;
3034 m_angularFrictionTimescale = new Vector3(pValue, pValue, pValue);
3035 break;
3036 case Vehicle.ANGULAR_MOTOR_DIRECTION:
3037 m_angularMotorDirection = new Vector3(pValue, pValue, pValue);
3038 UpdateAngDecay();
3039 break;
3040 case Vehicle.LINEAR_FRICTION_TIMESCALE:
3041 if (pValue < 0.1f) pValue = 0.1f;
3042 m_linearFrictionTimescale = new Vector3(pValue, pValue, pValue);
3043 break;
3044 case Vehicle.LINEAR_MOTOR_DIRECTION:
3045 m_linearMotorDirection = new Vector3(pValue, pValue, pValue);
3046 UpdateLinDecay();
3047 break;
3048 case Vehicle.LINEAR_MOTOR_OFFSET:
3049 // m_linearMotorOffset = new Vector3(pValue, pValue, pValue);
3050 break;
3051
3052 }
3053
3054 }//end ProcessFloatVehicleParam
3055
3056 internal void ProcessVectorVehicleParam(Vehicle pParam, Vector3 pValue)
3057 {
3058 switch (pParam)
3059 {
3060 case Vehicle.ANGULAR_FRICTION_TIMESCALE:
3061 if (pValue.X > 30f) pValue.X = 30f;
3062 if (pValue.X < 0.1f) pValue.X = 0.1f;
3063 if (pValue.Y > 30f) pValue.Y = 30f;
3064 if (pValue.Y < 0.1f) pValue.Y = 0.1f;
3065 if (pValue.Z > 30f) pValue.Z = 30f;
3066 if (pValue.Z < 0.1f) pValue.Z = 0.1f;
3067 m_angularFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z);
3068 break;
3069 case Vehicle.ANGULAR_MOTOR_DIRECTION:
3070 m_angularMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z);
3071 // Limit requested angular speed to 2 rps= 4 pi rads/sec
3072 if (m_angularMotorDirection.X > 12.56f) m_angularMotorDirection.X = 12.56f;
3073 if (m_angularMotorDirection.X < -12.56f) m_angularMotorDirection.X = -12.56f;
3074 if (m_angularMotorDirection.Y > 12.56f) m_angularMotorDirection.Y = 12.56f;
3075 if (m_angularMotorDirection.Y < -12.56f) m_angularMotorDirection.Y = -12.56f;
3076 if (m_angularMotorDirection.Z > 12.56f) m_angularMotorDirection.Z = 12.56f;
3077 if (m_angularMotorDirection.Z < -12.56f) m_angularMotorDirection.Z = -12.56f;
3078 UpdateAngDecay();
3079 break;
3080 case Vehicle.LINEAR_FRICTION_TIMESCALE:
3081 if (pValue.X < 0.1f) pValue.X = 0.1f;
3082 if (pValue.Y < 0.1f) pValue.Y = 0.1f;
3083 if (pValue.Z < 0.1f) pValue.Z = 0.1f;
3084 m_linearFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z);
3085 break;
3086 case Vehicle.LINEAR_MOTOR_DIRECTION:
3087 m_linearMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z); // velocity requested by LSL, for max limiting
3088 UpdateLinDecay();
3089 break;
3090 case Vehicle.LINEAR_MOTOR_OFFSET:
3091 // m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z);
3092 break;
3093 }
3094
3095 }//end ProcessVectorVehicleParam
3096
3097 internal void ProcessRotationVehicleParam(Vehicle pParam, Quaternion pValue)
3098 {
3099 switch (pParam)
3100 {
3101 case Vehicle.REFERENCE_FRAME:
3102 // m_referenceFrame = pValue;
3103 break;
3104 }
3105
3106 }//end ProcessRotationVehicleParam
3107
3108 internal void ProcessVehicleFlags(int pParam, bool remove)
3109 {
3110 if (remove)
3111 {
3112 m_flags &= ~((VehicleFlag)pParam);
3113 }
3114 else
3115 {
3116 m_flags |= (VehicleFlag)pParam;
3117 }
3118 }
3119
3120 internal void ProcessTypeChange(Vehicle pType)
3121 {
3122 // Set Defaults For Type
3123 m_type = pType;
3124 switch (pType)
3125 {
3126 case Vehicle.TYPE_SLED:
3127 m_linearFrictionTimescale = new Vector3(30, 1, 1000);
3128 m_angularFrictionTimescale = new Vector3(30, 30, 30);
3129 // m_lLinMotorVel = Vector3.Zero;
3130 m_linearMotorTimescale = 1000;
3131 m_linearMotorDecayTimescale = 120;
3132 m_angularMotorDirection = Vector3.Zero;
3133 m_angularMotorDVel = Vector3.Zero;
3134 m_angularMotorTimescale = 1000;
3135 m_angularMotorDecayTimescale = 120;
3136 m_VhoverHeight = 0;
3137 // m_VhoverEfficiency = 1;
3138 m_VhoverTimescale = 10;
3139 m_VehicleBuoyancy = 0;
3140 // m_linearDeflectionEfficiency = 1;
3141 // m_linearDeflectionTimescale = 1;
3142 // m_angularDeflectionEfficiency = 1;
3143 // m_angularDeflectionTimescale = 1000;
3144 // m_bankingEfficiency = 0;
3145 // m_bankingMix = 1;
3146 // m_bankingTimescale = 10;
3147 // m_referenceFrame = Quaternion.Identity;
3148 m_flags &=
3149 ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY |
3150 VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY);
3151 m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.LIMIT_MOTOR_UP);
3152 break;
3153 case Vehicle.TYPE_CAR:
3154 m_linearFrictionTimescale = new Vector3(100, 2, 1000);
3155 m_angularFrictionTimescale = new Vector3(30, 30, 30); // was 1000, but sl max frict time is 30.
3156 // m_lLinMotorVel = Vector3.Zero;
3157 m_linearMotorTimescale = 1;
3158 m_linearMotorDecayTimescale = 60;
3159 m_angularMotorDirection = Vector3.Zero;
3160 m_angularMotorDVel = Vector3.Zero;
3161 m_angularMotorTimescale = 1;
3162 m_angularMotorDecayTimescale = 0.8f;
3163 m_VhoverHeight = 0;
3164 // m_VhoverEfficiency = 0;
3165 m_VhoverTimescale = 1000;
3166 m_VehicleBuoyancy = 0;
3167 // // m_linearDeflectionEfficiency = 1;
3168 // // m_linearDeflectionTimescale = 2;
3169 // // m_angularDeflectionEfficiency = 0;
3170 // m_angularDeflectionTimescale = 10;
3171 m_verticalAttractionEfficiency = 1f;
3172 m_verticalAttractionTimescale = 10f;
3173 // m_bankingEfficiency = -0.2f;
3174 // m_bankingMix = 1;
3175 // m_bankingTimescale = 1;
3176 // m_referenceFrame = Quaternion.Identity;
3177 m_flags &= ~(VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT);
3178 m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.HOVER_UP_ONLY |
3179 VehicleFlag.LIMIT_MOTOR_UP);
3180 break;
3181 case Vehicle.TYPE_BOAT:
3182 m_linearFrictionTimescale = new Vector3(10, 3, 2);
3183 m_angularFrictionTimescale = new Vector3(10, 10, 10);
3184 // m_lLinMotorVel = Vector3.Zero;
3185 m_linearMotorTimescale = 5;
3186 m_linearMotorDecayTimescale = 60;
3187 m_angularMotorDirection = Vector3.Zero;
3188 m_angularMotorDVel = Vector3.Zero;
3189 m_angularMotorTimescale = 4;
3190 m_angularMotorDecayTimescale = 4;
3191 m_VhoverHeight = 0;
3192 // m_VhoverEfficiency = 0.5f;
3193 m_VhoverTimescale = 2;
3194 m_VehicleBuoyancy = 1;
3195 // m_linearDeflectionEfficiency = 0.5f;
3196 // m_linearDeflectionTimescale = 3;
3197 // m_angularDeflectionEfficiency = 0.5f;
3198 // m_angularDeflectionTimescale = 5;
3199 m_verticalAttractionEfficiency = 0.5f;
3200 m_verticalAttractionTimescale = 5f;
3201 // m_bankingEfficiency = -0.3f;
3202 // m_bankingMix = 0.8f;
3203 // m_bankingTimescale = 1;
3204 // m_referenceFrame = Quaternion.Identity;
3205 m_flags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.LIMIT_ROLL_ONLY |
3206 VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY);
3207 m_flags |= (VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.HOVER_WATER_ONLY |
3208 VehicleFlag.LIMIT_MOTOR_UP);
3209 break;
3210 case Vehicle.TYPE_AIRPLANE:
3211 m_linearFrictionTimescale = new Vector3(200, 10, 5);
3212 m_angularFrictionTimescale = new Vector3(20, 20, 20);
3213 // m_lLinMotorVel = Vector3.Zero;
3214 m_linearMotorTimescale = 2;
3215 m_linearMotorDecayTimescale = 60;
3216 m_angularMotorDirection = Vector3.Zero;
3217 m_angularMotorDVel = Vector3.Zero;
3218 m_angularMotorTimescale = 4;
3219 m_angularMotorDecayTimescale = 4;
3220 m_VhoverHeight = 0;
3221 // m_VhoverEfficiency = 0.5f;
3222 m_VhoverTimescale = 1000;
3223 m_VehicleBuoyancy = 0;
3224 // m_linearDeflectionEfficiency = 0.5f;
3225 // m_linearDeflectionTimescale = 3;
3226 // m_angularDeflectionEfficiency = 1;
3227 // m_angularDeflectionTimescale = 2;
3228 m_verticalAttractionEfficiency = 0.9f;
3229 m_verticalAttractionTimescale = 2f;
3230 // m_bankingEfficiency = 1;
3231 // m_bankingMix = 0.7f;
3232 // m_bankingTimescale = 2;
3233 // m_referenceFrame = Quaternion.Identity;
3234 m_flags &= ~(VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY |
3235 VehicleFlag.HOVER_GLOBAL_HEIGHT | VehicleFlag.HOVER_UP_ONLY | VehicleFlag.LIMIT_MOTOR_UP);
3236 m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY);
3237 break;
3238 case Vehicle.TYPE_BALLOON:
3239 m_linearFrictionTimescale = new Vector3(5, 5, 5);
3240 m_angularFrictionTimescale = new Vector3(10, 10, 10);
3241 m_linearMotorTimescale = 5;
3242 m_linearMotorDecayTimescale = 60;
3243 m_angularMotorDirection = Vector3.Zero;
3244 m_angularMotorDVel = Vector3.Zero;
3245 m_angularMotorTimescale = 6;
3246 m_angularMotorDecayTimescale = 10;
3247 m_VhoverHeight = 5;
3248 // m_VhoverEfficiency = 0.8f;
3249 m_VhoverTimescale = 10;
3250 m_VehicleBuoyancy = 1;
3251 // m_linearDeflectionEfficiency = 0;
3252 // m_linearDeflectionTimescale = 5;
3253 // m_angularDeflectionEfficiency = 0;
3254 // m_angularDeflectionTimescale = 5;
3255 m_verticalAttractionEfficiency = 1f;
3256 m_verticalAttractionTimescale = 100f;
3257 // m_bankingEfficiency = 0;
3258 // m_bankingMix = 0.7f;
3259 // m_bankingTimescale = 5;
3260 // m_referenceFrame = Quaternion.Identity;
3261 m_flags &= ~(VehicleFlag.NO_DEFLECTION_UP | VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY |
3262 VehicleFlag.HOVER_UP_ONLY | VehicleFlag.LIMIT_MOTOR_UP);
3263 m_flags |= (VehicleFlag.LIMIT_ROLL_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT);
3264 break;
3265
3266 }
3267 }//end SetDefaultsForType
3268
3269 internal void Enable(IntPtr pBody, OdeScene pParentScene)
3270 {
3271 if (m_type == Vehicle.TYPE_NONE)
3272 return;
3273
3274 m_body = pBody;
3275 }
3276
3277
3278 internal void Halt()
3279 { // Kill all motions, when non-physical
3280 // m_linearMotorDirection = Vector3.Zero;
3281 m_lLinMotorDVel = Vector3.Zero;
3282 m_lLinObjectVel = Vector3.Zero;
3283 m_wLinObjectVel = Vector3.Zero;
3284 m_angularMotorDirection = Vector3.Zero;
3285 m_lastAngularVelocity = Vector3.Zero;
3286 m_angularMotorDVel = Vector3.Zero;
3287 _acceleration = Vector3.Zero;
3288 }
3289
3290 private void UpdateLinDecay()
3291 {
3292 m_lLinMotorDVel.X = m_linearMotorDirection.X;
3293 m_lLinMotorDVel.Y = m_linearMotorDirection.Y;
3294 m_lLinMotorDVel.Z = m_linearMotorDirection.Z;
3295 } // else let the motor decay on its own
3296
3297 private void UpdateAngDecay()
3298 {
3299 m_angularMotorDVel.X = m_angularMotorDirection.X;
3300 m_angularMotorDVel.Y = m_angularMotorDirection.Y;
3301 m_angularMotorDVel.Z = m_angularMotorDirection.Z;
3302 } // else let the motor decay on its own
3303
3304 public void Move(float timestep)
3305 {
3306 float fx = 0;
3307 float fy = 0;
3308 float fz = 0;
3309 Vector3 linvel; // velocity applied, including any reversal
3310
3311 // If geomCrossingFailuresBeforeOutofbounds is set to 0 in OpenSim.ini then phys objects bounce off region borders.
3312 // This is a temp patch until proper region crossing is developed.
3313
3314
3315 if (IsPhysical && (Body != IntPtr.Zero) && !m_isSelected && !childPrim && !m_outofBounds) // Only move root prims.
3316 {
3317 // Old public void UpdatePositionAndVelocity(), more accuratley calculated here
3318 bool lastZeroFlag = _zeroFlag; // was it stopped
3319
3320 d.Vector3 vec = d.BodyGetPosition(Body);
3321 Vector3 l_position = Vector3.Zero;
3322 l_position.X = vec.X;
3323 l_position.Y = vec.Y;
3324 l_position.Z = vec.Z;
3325 m_lastposition = _position;
3326 _position = l_position;
3327
3328 d.Quaternion ori = d.BodyGetQuaternion(Body);
3329 // Quaternion l_orientation = Quaternion.Identity;
3330 _orientation.X = ori.X;
3331 _orientation.Y = ori.Y;
3332 _orientation.Z = ori.Z;
3333 _orientation.W = ori.W;
3334 m_lastorientation = _orientation;
3335
3336 d.Vector3 vel = d.BodyGetLinearVel(Body);
3337 m_lastVelocity = _velocity;
3338 _velocity.X = vel.X;
3339 _velocity.Y = vel.Y;
3340 _velocity.Z = vel.Z;
3341 _acceleration = ((_velocity - m_lastVelocity) / timestep);
3342
3343 d.Vector3 torque = d.BodyGetTorque(Body);
3344 _torque = new Vector3(torque.X, torque.Y, torque.Z);
3345
3346
3347 if (_position.X < 0f || _position.X > _parent_scene.WorldExtents.X
3348 || _position.Y < 0f || _position.Y > _parent_scene.WorldExtents.Y
3349 )
3350 {
3351 // we are outside current region
3352 // clip position to a stop just outside region and stop it only internally
3353 // do it only once using m_crossingfailures as control
3354 _position.X = Util.Clip(l_position.X, -0.2f, _parent_scene.WorldExtents.X + .2f);
3355 _position.Y = Util.Clip(l_position.Y, -0.2f, _parent_scene.WorldExtents.Y + .2f);
3356 _position.Z = Util.Clip(l_position.Z, -100f, 50000f);
3357 d.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
3358 d.BodySetLinearVel(Body, 0, 0, 0);
3359 m_outofBounds = true;
3360 base.RequestPhysicsterseUpdate();
3361 return;
3362 }
3363
3364 base.RequestPhysicsterseUpdate();
3365
3366 if (l_position.Z < 0)
3367 {
3368 // This is so prim that get lost underground don't fall forever and suck up
3369 //
3370 // Sim resources and memory.
3371 // Disables the prim's movement physics....
3372 // It's a hack and will generate a console message if it fails.
3373
3374 //IsPhysical = false;
3375 if (_parent == null) base.RaiseOutOfBounds(_position);
3376
3377
3378 _acceleration.X = 0; // This stuff may stop client display but it has no
3379 _acceleration.Y = 0; // effect on the object in phys engine!
3380 _acceleration.Z = 0;
3381
3382 _velocity.X = 0;
3383 _velocity.Y = 0;
3384 _velocity.Z = 0;
3385 m_lastVelocity = Vector3.Zero;
3386 m_rotationalVelocity.X = 0;
3387 m_rotationalVelocity.Y = 0;
3388 m_rotationalVelocity.Z = 0;
3389
3390 if (_parent == null) base.RequestPhysicsterseUpdate();
3391
3392 m_throttleUpdates = false;
3393 throttleCounter = 0;
3394 _zeroFlag = true;
3395 //outofBounds = true;
3396 } // end neg Z check
3397
3398 // Is it moving?
3399 /* if ((Math.Abs(m_lastposition.X - l_position.X) < 0.02)
3400 && (Math.Abs(m_lastposition.Y - l_position.Y) < 0.02)
3401 && (Math.Abs(m_lastposition.Z - l_position.Z) < 0.02) */
3402 if ((Vector3.Mag(_velocity) < 0.01) && // moving very slowly
3403 (Vector3.Mag(_velocity) < Vector3.Mag(m_lastVelocity)) && // decelerating
3404 (1.0 - Math.Abs(Quaternion.Dot(m_lastorientation, _orientation)) < 0.0001)) // spinning very slowly
3405 {
3406 _zeroFlag = true;
3407 m_throttleUpdates = false;
3408 }
3409 else
3410 {
3411 //m_log.Debug(Math.Abs(m_lastposition.X - l_position.X).ToString());
3412 _zeroFlag = false;
3413 m_lastUpdateSent = false;
3414 //m_throttleUpdates = false;
3415 }
3416
3417 if (_zeroFlag)
3418 { // Its stopped
3419 _velocity.X = 0.0f;
3420 _velocity.Y = 0.0f;
3421 // _velocity.Z = 0.0f;
3422
3423 _acceleration.X = 0;
3424 _acceleration.Y = 0;
3425 // _acceleration.Z = 0;
3426
3427 m_rotationalVelocity.X = 0;
3428 m_rotationalVelocity.Y = 0;
3429 m_rotationalVelocity.Z = 0;
3430 // Stop it in the phys engine
3431 d.BodySetLinearVel(Body, 0.0f, 0.0f, _velocity.Z);
3432 d.BodySetAngularVel(Body, 0.0f, 0.0f, 0.0f);
3433 d.BodySetForce(Body, 0f, 0f, 0f);
3434
3435 if (!m_lastUpdateSent)
3436 {
3437 m_throttleUpdates = false;
3438 throttleCounter = 0;
3439 if (_parent == null)
3440 {
3441 base.RequestPhysicsterseUpdate();
3442 }
3443
3444 m_lastUpdateSent = true;
3445 }
3446 }
3447 else
3448 { // Its moving
3449 if (lastZeroFlag != _zeroFlag)
3450 {
3451 if (_parent == null)
3452 {
3453 base.RequestPhysicsterseUpdate();
3454 }
3455 }
3456 m_lastUpdateSent = false;
3457 if (!m_throttleUpdates || throttleCounter > _parent_scene.geomUpdatesPerThrottledUpdate)
3458 {
3459 if (_parent == null)
3460 {
3461 base.RequestPhysicsterseUpdate();
3462 }
3463 }
3464 else
3465 {
3466 throttleCounter++;
3467 }
3468 }
3469 m_lastposition = l_position;
3470
3471 /// End UpdatePositionAndVelocity insert
3472
3473
3474 // Rotation lock =====================================
3475 if (m_rotateEnableUpdate)
3476 {
3477 // Snapshot current angles, set up Amotor(s)
3478 m_rotateEnableUpdate = false;
3479 m_rotateEnable = m_rotateEnableRequest;
3480 //Console.WriteLine("RotEnable {0} = {1}",m_primName, m_rotateEnable);
3481
3482 if (Amotor != IntPtr.Zero)
3483 {
3484 d.JointDestroy(Amotor);
3485 Amotor = IntPtr.Zero;
3486 //Console.WriteLine("Old Amotor Destroyed");
3487 }
3488
3489 if (!m_rotateEnable.ApproxEquals(Vector3.One, 0.003f))
3490 { // not all are enabled
3491 d.Quaternion r = d.BodyGetQuaternion(Body);
3492 Quaternion locrot = new Quaternion(r.X, r.Y, r.Z, r.W);
3493 // extract the axes vectors
3494 Vector3 vX = new Vector3(1f, 0f, 0f);
3495 Vector3 vY = new Vector3(0f, 1f, 0f);
3496 Vector3 vZ = new Vector3(0f, 0f, 1f);
3497 vX = vX * locrot;
3498 vY = vY * locrot;
3499 vZ = vZ * locrot;
3500 // snapshot the current angle vectors
3501 m_lockX = vX;
3502 m_lockY = vY;
3503 m_lockZ = vZ;
3504 // m_lockRot = locrot;
3505 Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero);
3506 d.JointAttach(Amotor, Body, IntPtr.Zero);
3507 d.JointSetAMotorMode(Amotor, 0); // User mode??
3508 //Console.WriteLine("New Amotor Created for {0}", m_primName);
3509
3510 float axisnum = 3; // how many to lock
3511 axisnum = (axisnum - (m_rotateEnable.X + m_rotateEnable.Y + m_rotateEnable.Z));
3512 d.JointSetAMotorNumAxes(Amotor, (int)axisnum);
3513 //Console.WriteLine("AxisNum={0}",(int)axisnum);
3514
3515 int i = 0;
3516
3517 if (m_rotateEnable.X == 0)
3518 {
3519 d.JointSetAMotorAxis(Amotor, i, 0, m_lockX.X, m_lockX.Y, m_lockX.Z);
3520 //Console.WriteLine("AxisX {0} set to {1}", i, m_lockX);
3521 i++;
3522 }
3523
3524 if (m_rotateEnable.Y == 0)
3525 {
3526 d.JointSetAMotorAxis(Amotor, i, 0, m_lockY.X, m_lockY.Y, m_lockY.Z);
3527 //Console.WriteLine("AxisY {0} set to {1}", i, m_lockY);
3528 i++;
3529 }
3530
3531 if (m_rotateEnable.Z == 0)
3532 {
3533 d.JointSetAMotorAxis(Amotor, i, 0, m_lockZ.X, m_lockZ.Y, m_lockZ.Z);
3534 //Console.WriteLine("AxisZ {0} set to {1}", i, m_lockZ);
3535 i++;
3536 }
3537
3538 // These lowstops and high stops are effectively (no wiggle room)
3539 d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0f);
3540 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, 0f);
3541 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0f);
3542 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0f);
3543 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f);
3544 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0f);
3545 d.JointSetAMotorParam(Amotor, (int)dParam.Vel, 0f);
3546 d.JointSetAMotorParam(Amotor, (int)dParam.Vel3, 0f);
3547 d.JointSetAMotorParam(Amotor, (int)dParam.Vel2, 0f);
3548 d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM, 0f);
3549 d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM3, 0f);
3550 d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM2, 0f);
3551 } // else none are locked
3552 } // end Rotation Update
3553
3554
3555 // VEHICLE processing ==========================================
3556 if (m_type != Vehicle.TYPE_NONE)
3557 {
3558 // get body attitude
3559 d.Quaternion rot = d.BodyGetQuaternion(Body);
3560 Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object
3561 Quaternion irotq = Quaternion.Inverse(rotq);
3562
3563 // VEHICLE Linear Motion
3564 d.Vector3 velnow = d.BodyGetLinearVel(Body); // this is in world frame
3565 Vector3 vel_now = new Vector3(velnow.X, velnow.Y, velnow.Z);
3566 m_lLinObjectVel = vel_now * irotq;
3567 if (m_linearMotorDecayTimescale < 300.0f) //setting of 300 or more disables decay rate
3568 {
3569 if (Vector3.Mag(m_lLinMotorDVel) < 1.0f)
3570 {
3571 float decayfactor = m_linearMotorDecayTimescale / timestep;
3572 Vector3 decayAmount = (m_lLinMotorDVel / decayfactor);
3573 m_lLinMotorDVel -= decayAmount;
3574 }
3575 else
3576 {
3577 float decayfactor = 3.0f - (0.57f * (float)Math.Log((double)(m_linearMotorDecayTimescale)));
3578 Vector3 decel = Vector3.Normalize(m_lLinMotorDVel) * decayfactor * timestep;
3579 m_lLinMotorDVel -= decel;
3580 }
3581 if (m_lLinMotorDVel.ApproxEquals(Vector3.Zero, 0.01f))
3582 {
3583 m_lLinMotorDVel = Vector3.Zero;
3584 }
3585
3586 /* else
3587 {
3588 if (Math.Abs(m_lLinMotorDVel.X) < Math.Abs(m_lLinObjectVel.X)) m_lLinObjectVel.X = m_lLinMotorDVel.X;
3589 if (Math.Abs(m_lLinMotorDVel.Y) < Math.Abs(m_lLinObjectVel.Y)) m_lLinObjectVel.Y = m_lLinMotorDVel.Y;
3590 if (Math.Abs(m_lLinMotorDVel.Z) < Math.Abs(m_lLinObjectVel.Z)) m_lLinObjectVel.Z = m_lLinMotorDVel.Z;
3591 } */
3592 } // end linear motor decay
3593
3594 if ((!m_lLinMotorDVel.ApproxEquals(Vector3.Zero, 0.01f)) || (!m_lLinObjectVel.ApproxEquals(Vector3.Zero, 0.01f)))
3595 {
3596 if (!d.BodyIsEnabled(Body)) d.BodyEnable(Body);
3597 if (m_linearMotorTimescale < 300.0f)
3598 {
3599 Vector3 attack_error = m_lLinMotorDVel - m_lLinObjectVel;
3600 float linfactor = m_linearMotorTimescale / timestep;
3601 Vector3 attackAmount = (attack_error / linfactor) * 1.3f;
3602 m_lLinObjectVel += attackAmount;
3603 }
3604 if (m_linearFrictionTimescale.X < 300.0f)
3605 {
3606 float fricfactor = m_linearFrictionTimescale.X / timestep;
3607 float fricX = m_lLinObjectVel.X / fricfactor;
3608 m_lLinObjectVel.X -= fricX;
3609 }
3610 if (m_linearFrictionTimescale.Y < 300.0f)
3611 {
3612 float fricfactor = m_linearFrictionTimescale.Y / timestep;
3613 float fricY = m_lLinObjectVel.Y / fricfactor;
3614 m_lLinObjectVel.Y -= fricY;
3615 }
3616 if (m_linearFrictionTimescale.Z < 300.0f)
3617 {
3618 float fricfactor = m_linearFrictionTimescale.Z / timestep;
3619 float fricZ = m_lLinObjectVel.Z / fricfactor;
3620 m_lLinObjectVel.Z -= fricZ;
3621 }
3622 }
3623 m_wLinObjectVel = m_lLinObjectVel * rotq;
3624
3625 // Gravity and Buoyancy
3626 Vector3 grav = Vector3.Zero;
3627 if (m_VehicleBuoyancy < 1.0f)
3628 {
3629 // There is some gravity, make a gravity force vector
3630 // that is applied after object velocity.
3631 d.Mass objMass;
3632 d.BodyGetMass(Body, out objMass);
3633 // m_VehicleBuoyancy: -1=2g; 0=1g; 1=0g;
3634 grav.Z = _parent_scene.gravityz * objMass.mass * (1f - m_VehicleBuoyancy); // Applied later as a force
3635 } // else its 1.0, no gravity.
3636
3637 // Hovering
3638 if ((m_flags & (VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT)) != 0)
3639 {
3640 // We should hover, get the target height
3641 d.Vector3 pos = d.BodyGetPosition(Body);
3642 if ((m_flags & VehicleFlag.HOVER_WATER_ONLY) == VehicleFlag.HOVER_WATER_ONLY)
3643 {
3644 m_VhoverTargetHeight = _parent_scene.GetWaterLevel() + m_VhoverHeight;
3645 }
3646 else if ((m_flags & VehicleFlag.HOVER_TERRAIN_ONLY) == VehicleFlag.HOVER_TERRAIN_ONLY)
3647 {
3648 m_VhoverTargetHeight = _parent_scene.GetTerrainHeightAtXY(pos.X, pos.Y) + m_VhoverHeight;
3649 }
3650 else if ((m_flags & VehicleFlag.HOVER_GLOBAL_HEIGHT) == VehicleFlag.HOVER_GLOBAL_HEIGHT)
3651 {
3652 m_VhoverTargetHeight = m_VhoverHeight;
3653 }
3654
3655 if ((m_flags & VehicleFlag.HOVER_UP_ONLY) == VehicleFlag.HOVER_UP_ONLY)
3656 {
3657 // If body is aready heigher, use its height as target height
3658 if (pos.Z > m_VhoverTargetHeight) m_VhoverTargetHeight = pos.Z;
3659 }
3660
3661 // m_VhoverEfficiency = 0f; // 0=boucy, 1=Crit.damped
3662 // m_VhoverTimescale = 0f; // time to acheive height
3663 // timestep is time since last frame,in secs
3664 float herr0 = pos.Z - m_VhoverTargetHeight;
3665 // Replace Vertical speed with correction figure if significant
3666 if (Math.Abs(herr0) > 0.01f)
3667 {
3668 //? d.Mass objMass;
3669 //? d.BodyGetMass(Body, out objMass);
3670 m_wLinObjectVel.Z = -((herr0 * timestep * 50.0f) / m_VhoverTimescale);
3671 //KF: m_VhoverEfficiency is not yet implemented
3672 }
3673 else
3674 {
3675 m_wLinObjectVel.Z = 0f;
3676 }
3677 }
3678 else
3679 { // not hovering
3680 if (m_wLinObjectVel.Z == 0f)
3681 { // Gravity rules
3682 m_wLinObjectVel.Z = vel_now.Z;
3683 } // else the motor has it
3684 }
3685 linvel = m_wLinObjectVel;
3686
3687 // Vehicle Linear Motion done =======================================
3688 // Apply velocity
3689 d.BodySetLinearVel(Body, linvel.X, linvel.Y, linvel.Z);
3690 // apply gravity force
3691 d.BodyAddForce(Body, grav.X, grav.Y, grav.Z);
3692 //if(frcount == 0) Console.WriteLine("Vel={0} Force={1}",linvel , grav);
3693 // end MoveLinear()
3694
3695
3696 // MoveAngular
3697 /*
3698 private Vector3 m_angularMotorDirection = Vector3.Zero; // angular velocity requested by LSL motor
3699
3700 private float m_angularMotorTimescale = 0; // motor angular Attack rate set by LSL
3701 private float m_angularMotorDecayTimescale = 0; // motor angular Decay rate set by LSL
3702 private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular Friction set by LSL
3703
3704 private Vector3 m_angularMotorDVel = Vector3.Zero; // decayed angular motor
3705 private Vector3 m_angObjectVel = Vector3.Zero; // what was last applied to body
3706 */
3707 //if(frcount == 0) Console.WriteLine("MoveAngular ");
3708
3709 d.Vector3 angularObjectVel = d.BodyGetAngularVel(Body);
3710 Vector3 angObjectVel = new Vector3(angularObjectVel.X, angularObjectVel.Y, angularObjectVel.Z);
3711 angObjectVel = angObjectVel * irotq; // ============ Converts to LOCAL rotation
3712
3713 //if(frcount == 0) Console.WriteLine("V0 = {0}", angObjectVel);
3714
3715 // Decay Angular Motor 1. In SL this also depends on attack rate! decay ~= 23/Attack.
3716 float atk_decayfactor = 23.0f / (m_angularMotorTimescale * timestep);
3717 m_angularMotorDVel -= m_angularMotorDVel / atk_decayfactor;
3718 // Decay Angular Motor 2.
3719 if (m_angularMotorDecayTimescale < 300.0f)
3720 {
3721 if (Vector3.Mag(m_angularMotorDVel) < 1.0f)
3722 {
3723 float decayfactor = (m_angularMotorDecayTimescale) / timestep;
3724 Vector3 decayAmount = (m_angularMotorDVel / decayfactor);
3725 m_angularMotorDVel -= decayAmount;
3726 }
3727 else
3728 {
3729 Vector3 decel = Vector3.Normalize(m_angularMotorDVel) * timestep / m_angularMotorDecayTimescale;
3730 m_angularMotorDVel -= decel;
3731 }
3732
3733 if (m_angularMotorDVel.ApproxEquals(Vector3.Zero, 0.01f))
3734 {
3735 m_angularMotorDVel = Vector3.Zero;
3736 }
3737 else
3738 {
3739 if (Math.Abs(m_angularMotorDVel.X) < Math.Abs(angObjectVel.X)) angObjectVel.X = m_angularMotorDVel.X;
3740 if (Math.Abs(m_angularMotorDVel.Y) < Math.Abs(angObjectVel.Y)) angObjectVel.Y = m_angularMotorDVel.Y;
3741 if (Math.Abs(m_angularMotorDVel.Z) < Math.Abs(angObjectVel.Z)) angObjectVel.Z = m_angularMotorDVel.Z;
3742 }
3743 } // end decay angular motor
3744 //if(frcount == 0) Console.WriteLine("MotorDvel {0} Obj {1}", m_angularMotorDVel, angObjectVel);
3745
3746 //if(frcount == 0) Console.WriteLine("VA = {0}", angObjectVel);
3747
3748 if ((!m_angularMotorDVel.ApproxEquals(Vector3.Zero, 0.01f)) || (!angObjectVel.ApproxEquals(Vector3.Zero, 0.01f)))
3749 { // if motor or object have motion
3750 if (!d.BodyIsEnabled(Body)) d.BodyEnable(Body);
3751
3752 if (m_angularMotorTimescale < 300.0f)
3753 {
3754 Vector3 attack_error = m_angularMotorDVel - angObjectVel;
3755 float angfactor = m_angularMotorTimescale / timestep;
3756 Vector3 attackAmount = (attack_error / angfactor);
3757 angObjectVel += attackAmount;
3758 //if(frcount == 0) Console.WriteLine("Accel {0} Attk {1}",FrAaccel, attackAmount);
3759 //if(frcount == 0) Console.WriteLine("V2+= {0}", angObjectVel);
3760 }
3761
3762 angObjectVel.X -= angObjectVel.X / (m_angularFrictionTimescale.X * 0.7f / timestep);
3763 angObjectVel.Y -= angObjectVel.Y / (m_angularFrictionTimescale.Y * 0.7f / timestep);
3764 angObjectVel.Z -= angObjectVel.Z / (m_angularFrictionTimescale.Z * 0.7f / timestep);
3765 } // else no signif. motion
3766
3767 //if(frcount == 0) Console.WriteLine("Dmotor {0} Obj {1}", m_angularMotorDVel, angObjectVel);
3768 // Bank section tba
3769 // Deflection section tba
3770 //if(frcount == 0) Console.WriteLine("V3 = {0}", angObjectVel);
3771
3772
3773 /* // Rotation Axis Disables:
3774 if (!m_angularEnable.ApproxEquals(Vector3.One, 0.003f))
3775 {
3776 if (m_angularEnable.X == 0)
3777 angObjectVel.X = 0f;
3778 if (m_angularEnable.Y == 0)
3779 angObjectVel.Y = 0f;
3780 if (m_angularEnable.Z == 0)
3781 angObjectVel.Z = 0f;
3782 }
3783 */
3784 angObjectVel = angObjectVel * rotq; // ================ Converts to WORLD rotation
3785
3786 // Vertical attractor section
3787 Vector3 vertattr = Vector3.Zero;
3788
3789 if (m_verticalAttractionTimescale < 300)
3790 {
3791 float VAservo = 1.0f / (m_verticalAttractionTimescale * timestep);
3792 // make a vector pointing up
3793 Vector3 verterr = Vector3.Zero;
3794 verterr.Z = 1.0f;
3795 // rotate it to Body Angle
3796 verterr = verterr * rotq;
3797 // 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.
3798 // 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
3799 // negative. Similar for tilt and |.Y|. .X and .Y must be modulated to prevent a stable inverted body.
3800
3801 if (verterr.Z < 0.0f)
3802 { // Deflection from vertical exceeds 90-degrees. This method will ensure stable return to
3803 // vertical, BUT for some reason a z-rotation is imparted to the object. TBI.
3804 //Console.WriteLine("InvertFlip");
3805 verterr.X = 2.0f - verterr.X;
3806 verterr.Y = 2.0f - verterr.Y;
3807 }
3808 verterr *= 0.5f;
3809 // verterror is 0 (no error) to +/- 1 (max error at 180-deg tilt)
3810 Vector3 xyav = angObjectVel;
3811 xyav.Z = 0.0f;
3812 if ((!xyav.ApproxEquals(Vector3.Zero, 0.001f)) || (verterr.Z < 0.49f))
3813 {
3814 // As the body rotates around the X axis, then verterr.Y increases; Rotated around Y then .X increases, so
3815 // Change Body angular velocity X based on Y, and Y based on X. Z is not changed.
3816 vertattr.X = verterr.Y;
3817 vertattr.Y = -verterr.X;
3818 vertattr.Z = 0f;
3819 //if(frcount == 0) Console.WriteLine("VAerr=" + verterr);
3820
3821 // scaling appears better usingsquare-law
3822 float damped = m_verticalAttractionEfficiency * m_verticalAttractionEfficiency;
3823 float bounce = 1.0f - damped;
3824 // 0 = crit damp, 1 = bouncy
3825 float oavz = angObjectVel.Z; // retain z velocity
3826 // time-scaled correction, which sums, therefore is bouncy:
3827 angObjectVel = (angObjectVel + (vertattr * VAservo * 0.0333f)) * bounce;
3828 // damped, good @ < 90:
3829 angObjectVel = angObjectVel + (vertattr * VAservo * 0.0667f * damped);
3830 angObjectVel.Z = oavz;
3831 //if(frcount == 0) Console.WriteLine("VA+");
3832 //Console.WriteLine("VAttr {0} OAvel {1}", vertattr, angObjectVel);
3833 }
3834 else
3835 {
3836 // else error is very small
3837 angObjectVel.X = 0f;
3838 angObjectVel.Y = 0f;
3839 //if(frcount == 0) Console.WriteLine("VA0");
3840 }
3841 } // else vertical attractor is off
3842 //if(frcount == 0) Console.WriteLine("V1 = {0}", angObjectVel);
3843
3844
3845 m_lastAngularVelocity = angObjectVel;
3846 // apply Angular Velocity to body
3847 d.BodySetAngularVel(Body, m_lastAngularVelocity.X, m_lastAngularVelocity.Y, m_lastAngularVelocity.Z);
3848 //if(frcount == 0) Console.WriteLine("V4 = {0}", m_lastAngularVelocity);
3849
3850 } // end VEHICLES
3851 else
3852 {
3853 // Dyamics (NON-'VEHICLES') are dealt with here ================================================================
3854
3855 if (!d.BodyIsEnabled(Body)) d.BodyEnable(Body); // KF add 161009
3856
3857 /// Dynamics Buoyancy
3858 //KF: m_buoyancy is set by llSetBuoyancy() and is for non-vehicle.
3859 // m_buoyancy: (unlimited value) <0=Falls fast; 0=1g; 1=0g; >1 = floats up
3860 // NB Prims in ODE are no subject to global gravity
3861 // This should only affect gravity operations
3862
3863 float m_mass = CalculateMass();
3864 // calculate z-force due togravity on object.
3865 fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; // force = acceleration * mass
3866 if ((m_usePID) && (m_PIDTau > 0.0f)) // Dynamics llMoveToTarget.
3867 {
3868 fz = 0; // llMoveToTarget ignores gravity.
3869 // it also ignores mass of object, and any physical resting on it.
3870 // Vector3 m_PIDTarget is where we are going
3871 // float m_PIDTau is time to get there
3872 fx = 0;
3873 fy = 0;
3874 d.Vector3 pos = d.BodyGetPosition(Body);
3875 Vector3 error = new Vector3(
3876 (m_PIDTarget.X - pos.X),
3877 (m_PIDTarget.Y - pos.Y),
3878 (m_PIDTarget.Z - pos.Z));
3879 if (error.ApproxEquals(Vector3.Zero, 0.01f))
3880 { // Very close, Jump there and quit move
3881
3882 d.BodySetPosition(Body, m_PIDTarget.X, m_PIDTarget.Y, m_PIDTarget.Z);
3883 _target_velocity = Vector3.Zero;
3884 d.BodySetLinearVel(Body, _target_velocity.X, _target_velocity.Y, _target_velocity.Z);
3885 d.BodySetForce(Body, 0f, 0f, 0f);
3886 }
3887 else
3888 {
3889 float scale = 50.0f * timestep / m_PIDTau;
3890 if ((error.ApproxEquals(Vector3.Zero, 0.5f)) && (_target_velocity != Vector3.Zero))
3891 {
3892 // Nearby, quit update of velocity
3893 }
3894 else
3895 { // Far, calc damped velocity
3896 _target_velocity = error * scale;
3897 }
3898 d.BodySetLinearVel(Body, _target_velocity.X, _target_velocity.Y, _target_velocity.Z);
3899 }
3900 } // end PID MoveToTarget
3901
3902
3903 /// Dynamics Hover ===================================================================================
3904 // Hover PID Controller can only run if the PIDcontroller is not in use.
3905 if (m_useHoverPID && !m_usePID)
3906 {
3907 //Console.WriteLine("Hover " + m_primName);
3908
3909 // If we're using the PID controller, then we have no gravity
3910 fz = (-1 * _parent_scene.gravityz) * m_mass;
3911
3912 // no lock; for now it's only called from within Simulate()
3913
3914 // If the PID Controller isn't active then we set our force
3915 // calculating base velocity to the current position
3916
3917 if ((m_PIDTau < 1))
3918 {
3919 PID_G = PID_G / m_PIDTau;
3920 }
3921
3922 if ((PID_G - m_PIDTau) <= 0)
3923 {
3924 PID_G = m_PIDTau + 1;
3925 }
3926
3927
3928 // Where are we, and where are we headed?
3929 d.Vector3 pos = d.BodyGetPosition(Body);
3930 // d.Vector3 vel = d.BodyGetLinearVel(Body);
3931
3932
3933 // Non-Vehicles have a limited set of Hover options.
3934 // determine what our target height really is based on HoverType
3935 switch (m_PIDHoverType)
3936 {
3937 case PIDHoverType.Ground:
3938 m_groundHeight = _parent_scene.GetTerrainHeightAtXY(pos.X, pos.Y);
3939 m_targetHoverHeight = m_groundHeight + m_PIDHoverHeight;
3940 break;
3941 case PIDHoverType.GroundAndWater:
3942 m_groundHeight = _parent_scene.GetTerrainHeightAtXY(pos.X, pos.Y);
3943 m_waterHeight = _parent_scene.GetWaterLevel();
3944 if (m_groundHeight > m_waterHeight)
3945 {
3946 m_targetHoverHeight = m_groundHeight + m_PIDHoverHeight;
3947 }
3948 else
3949 {
3950 m_targetHoverHeight = m_waterHeight + m_PIDHoverHeight;
3951 }
3952 break;
3953
3954 } // end switch (m_PIDHoverType)
3955
3956
3957 _target_velocity =
3958 new Vector3(0.0f, 0.0f,
3959 (m_targetHoverHeight - pos.Z) * ((PID_G - m_PIDHoverTau) * timestep)
3960 );
3961
3962 // if velocity is zero, use position control; otherwise, velocity control
3963
3964 if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f))
3965 {
3966 // keep track of where we stopped. No more slippin' & slidin'
3967
3968 // We only want to deactivate the PID Controller if we think we want to have our surrogate
3969 // react to the physics scene by moving it's position.
3970 // Avatar to Avatar collisions
3971 // Prim to avatar collisions
3972 d.Vector3 dlinvel = vel;
3973 d.BodySetPosition(Body, pos.X, pos.Y, m_targetHoverHeight);
3974 d.BodySetLinearVel(Body, dlinvel.X, dlinvel.Y, dlinvel.Z);
3975 d.BodyAddForce(Body, 0, 0, fz);
3976 //KF this prevents furthur motions return;
3977 }
3978 else
3979 {
3980 _zeroFlag = false;
3981
3982 // We're flying and colliding with something
3983 fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass);
3984 }
3985 } // end m_useHoverPID && !m_usePID
3986
3987
3988 /// Dynamics Apply Forces ===================================================================================
3989 fx *= m_mass;
3990 fy *= m_mass;
3991 //fz *= m_mass;
3992 fx += m_force.X;
3993 fy += m_force.Y;
3994 fz += m_force.Z;
3995
3996 //m_log.Info("[OBJPID]: X:" + fx.ToString() + " Y:" + fy.ToString() + " Z:" + fz.ToString());
3997 if (fx != 0 || fy != 0 || fz != 0)
3998 {
3999 //m_taintdisable = true;
4000 //base.RaiseOutOfBounds(Position);
4001 //d.BodySetLinearVel(Body, fx, fy, 0f);
4002 if (!d.BodyIsEnabled(Body))
4003 {
4004 // A physical body at rest on a surface will auto-disable after a while,
4005 // this appears to re-enable it incase the surface it is upon vanishes,
4006 // and the body should fall again.
4007 d.BodySetLinearVel(Body, 0f, 0f, 0f);
4008 d.BodySetForce(Body, 0f, 0f, 0f);
4009 enableBodySoft();
4010 }
4011
4012 // 35x10 = 350n times the mass per second applied maximum.
4013 float nmax = 35f * m_mass;
4014 float nmin = -35f * m_mass;
4015
4016
4017 if (fx > nmax)
4018 fx = nmax;
4019 if (fx < nmin)
4020 fx = nmin;
4021 if (fy > nmax)
4022 fy = nmax;
4023 if (fy < nmin)
4024 fy = nmin;
4025 d.BodyAddForce(Body, fx, fy, fz);
4026 } // end apply forces
4027 } // end Vehicle/Dynamics
4028
4029 /// RotLookAt / LookAt =================================================================================
4030 if (m_useAPID)
4031 {
4032 // RotLookAt, apparently overrides all other rotation sources. Inputs:
4033 // Quaternion m_APIDTarget
4034 // float m_APIDStrength // From SL experiments, this is the time to get there
4035 // float m_APIDDamping // From SL experiments, this is damping, 1.0 = damped, 0.1 = wobbly
4036 // Also in SL the mass of the object has no effect on time to get there.
4037 // Factors:
4038 // get present body rotation
4039 float limit = 1.0f;
4040 float rscaler = 50f; // adjusts rotation damping time
4041 float lscaler = 10f; // adjusts linear damping time in llLookAt
4042 float RLAservo = 0f;
4043 Vector3 diff_axis;
4044 float diff_angle;
4045 d.Quaternion rot = d.BodyGetQuaternion(Body); // prim present rotation
4046 Quaternion rotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W);
4047 Quaternion rtarget = new Quaternion();
4048
4049 if (m_APIDTarget.W == -99.9f)
4050 {
4051 // this is really a llLookAt(), x,y,z is the target vector
4052 Vector3 target = new Vector3(m_APIDTarget.X, m_APIDTarget.Y, m_APIDTarget.Z);
4053 Vector3 ospin = new Vector3(1.0f, 0.0f, 0.0f) * rotq;
4054 Vector3 error = new Vector3(0.0f, 0.0f, 0.0f);
4055 float twopi = 2.0f * (float)Math.PI;
4056 Vector3 dir = target - _position;
4057 dir.Normalize();
4058 float tzrot = (float)Math.Atan2(dir.Y, dir.X);
4059 float txy = (float)Math.Sqrt((dir.X * dir.X) + (dir.Y * dir.Y));
4060 float terot = (float)Math.Atan2(dir.Z, txy);
4061 float ozrot = (float)Math.Atan2(ospin.Y, ospin.X);
4062 float oxy = (float)Math.Sqrt((ospin.X * ospin.X) + (ospin.Y * ospin.Y));
4063 float oerot = (float)Math.Atan2(ospin.Z, oxy);
4064 float ra = 2.0f * ((rotq.W * rotq.X) + (rotq.Y * rotq.Z));
4065 float rb = 1.0f - 2.0f * ((rotq.Y * rotq.Y) + (rotq.X * rotq.X));
4066 float roll = (float)Math.Atan2(ra, rb);
4067 float errorz = tzrot - ozrot;
4068 if (errorz > (float)Math.PI) errorz -= twopi;
4069 else if (errorz < -(float)Math.PI) errorz += twopi;
4070 float errory = oerot - terot;
4071 if (errory > (float)Math.PI) errory -= twopi;
4072 else if (errory < -(float)Math.PI) errory += twopi;
4073 diff_angle = Math.Abs(errorz) + Math.Abs(errory) + Math.Abs(roll);
4074 if (diff_angle > 0.01f * m_APIDdamper)
4075 {
4076 m_APIDdamper = 1.0f;
4077 RLAservo = timestep / m_APIDStrength * rscaler;
4078 errorz *= RLAservo;
4079 errory *= RLAservo;
4080 error.X = -roll * 8.0f;
4081 error.Y = errory;
4082 error.Z = errorz;
4083 error *= rotq;
4084 d.BodySetAngularVel(Body, error.X, error.Y, error.Z);
4085 }
4086 else
4087 {
4088 d.BodySetAngularVel(Body, 0.0f, 0.0f, 0.0f);
4089 m_APIDdamper = 2.0f;
4090 }
4091 }
4092 else
4093 {
4094 // this is a llRotLookAt()
4095 rtarget = m_APIDTarget;
4096
4097 Quaternion rot_diff = Quaternion.Inverse(rotq) * rtarget; // difference to desired rot
4098 rot_diff.GetAxisAngle(out diff_axis, out diff_angle); // convert to axis to point at & error angle
4099 //if(frcount == 0) Console.WriteLine("axis {0} angle {1}",diff_axis * 57.3f, diff_angle);
4100
4101 // diff_axis.Normalize(); it already is!
4102 if (diff_angle > 0.01f * m_APIDdamper) // diff_angle is always +ve // if there is enough error
4103 {
4104 m_APIDdamper = 1.0f;
4105 Vector3 rotforce = new Vector3(diff_axis.X, diff_axis.Y, diff_axis.Z);
4106 rotforce = rotforce * rotq;
4107 if (diff_angle > limit) diff_angle = limit; // cap the rotate rate
4108 RLAservo = timestep / m_APIDStrength * lscaler;
4109 rotforce = rotforce * RLAservo * diff_angle;
4110 d.BodySetAngularVel(Body, rotforce.X, rotforce.Y, rotforce.Z);
4111 //Console.WriteLine("axis= " + diff_axis + " angle= " + diff_angle + "servo= " + RLAservo);
4112 }
4113 else
4114 { // close enough
4115 d.BodySetAngularVel(Body, 0.0f, 0.0f, 0.0f);
4116 m_APIDdamper = 2.0f;
4117 }
4118 } // end llLookAt/llRotLookAt
4119 //if(frcount == 0) Console.WriteLine("mass= " + m_mass + " servo= " + RLAservo + " angle= " + diff_angle);
4120 } // end m_useAPID
4121 } // end root prims
4122 } // end Move()
4123 } // end class
4124}
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/Physics/ChOdePlugin/ODERayCastRequestManager.cs
deleted file mode 100644
index 712029e..0000000
--- a/OpenSim/Region/Physics/ChOdePlugin/ODERayCastRequestManager.cs
+++ /dev/null
@@ -1,384 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Runtime.InteropServices;
32using System.Text;
33using OpenMetaverse;
34using OpenSim.Region.Physics.Manager;
35using Ode.NET;
36using log4net;
37
38namespace OpenSim.Region.Physics.OdePlugin
39{
40 /// <summary>
41 /// Processes raycast requests as ODE is in a state to be able to do them.
42 /// This ensures that it's thread safe and there will be no conflicts.
43 /// Requests get returned by a different thread then they were requested by.
44 /// </summary>
45 public class ODERayCastRequestManager
46 {
47 /// <summary>
48 /// Pending Raycast Requests
49 /// </summary>
50 protected List<ODERayCastRequest> m_PendingRequests = new List<ODERayCastRequest>();
51
52 /// <summary>
53 /// Scene that created this object.
54 /// </summary>
55 private OdeScene m_scene;
56
57 /// <summary>
58 /// ODE contact array to be filled by the collision testing
59 /// </summary>
60 d.ContactGeom[] contacts = new d.ContactGeom[5];
61
62 /// <summary>
63 /// ODE near callback delegate
64 /// </summary>
65 private d.NearCallback nearCallback;
66 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
67 private List<ContactResult> m_contactResults = new List<ContactResult>();
68
69
70 public ODERayCastRequestManager(OdeScene pScene)
71 {
72 m_scene = pScene;
73 nearCallback = near;
74
75 }
76
77 /// <summary>
78 /// Queues a raycast
79 /// </summary>
80 /// <param name="position">Origin of Ray</param>
81 /// <param name="direction">Ray normal</param>
82 /// <param name="length">Ray length</param>
83 /// <param name="retMethod">Return method to send the results</param>
84 public void QueueRequest(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod)
85 {
86 lock (m_PendingRequests)
87 {
88 ODERayCastRequest req = new ODERayCastRequest();
89 req.callbackMethod = retMethod;
90 req.length = length;
91 req.Normal = direction;
92 req.Origin = position;
93
94 m_PendingRequests.Add(req);
95 }
96 }
97
98 /// <summary>
99 /// Process all queued raycast requests
100 /// </summary>
101 /// <returns>Time in MS the raycasts took to process.</returns>
102 public int ProcessQueuedRequests()
103 {
104 int time = System.Environment.TickCount;
105 lock (m_PendingRequests)
106 {
107 if (m_PendingRequests.Count > 0)
108 {
109 ODERayCastRequest[] reqs = m_PendingRequests.ToArray();
110 for (int i = 0; i < reqs.Length; i++)
111 {
112 try
113 {
114 if (reqs[i].callbackMethod != null) // quick optimization here, don't raycast
115 RayCast(reqs[i]); // if there isn't anyone to send results
116 }
117 catch
118 {
119 //Fail silently
120 //This can genuinely happen because raycast requests are queued, and the actor may have
121 //been removed from the scene since it was queued
122 }
123 }
124 /*
125 foreach (ODERayCastRequest req in m_PendingRequests)
126 {
127 if (req.callbackMethod != null) // quick optimization here, don't raycast
128 RayCast(req); // if there isn't anyone to send results to
129
130 }
131 */
132 m_PendingRequests.Clear();
133 }
134 }
135
136 lock (m_contactResults)
137 m_contactResults.Clear();
138
139 return System.Environment.TickCount - time;
140 }
141
142 /// <summary>
143 /// Method that actually initiates the raycast
144 /// </summary>
145 /// <param name="req"></param>
146 private void RayCast(ODERayCastRequest req)
147 {
148 // Create the ray
149 IntPtr ray = d.CreateRay(m_scene.space, req.length);
150 d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z);
151
152 // Collide test
153 d.SpaceCollide2(m_scene.space, ray, IntPtr.Zero, nearCallback);
154
155 // Remove Ray
156 d.GeomDestroy(ray);
157
158
159 // Define default results
160 bool hitYN = false;
161 uint hitConsumerID = 0;
162 float distance = 999999999999f;
163 Vector3 closestcontact = new Vector3(99999f, 99999f, 99999f);
164 Vector3 snormal = Vector3.Zero;
165
166 // Find closest contact and object.
167 lock (m_contactResults)
168 {
169 foreach (ContactResult cResult in m_contactResults)
170 {
171 if (Vector3.Distance(req.Origin, cResult.Pos) < Vector3.Distance(req.Origin, closestcontact))
172 {
173 closestcontact = cResult.Pos;
174 hitConsumerID = cResult.ConsumerID;
175 distance = cResult.Depth;
176 hitYN = true;
177 snormal = cResult.Normal;
178 }
179 }
180
181 m_contactResults.Clear();
182 }
183
184 // Return results
185 if (req.callbackMethod != null)
186 req.callbackMethod(hitYN, closestcontact, hitConsumerID, distance, snormal);
187 }
188
189 // This is the standard Near. Uses space AABBs to speed up detection.
190 private void near(IntPtr space, IntPtr g1, IntPtr g2)
191 {
192
193 //Don't test against heightfield Geom, or you'll be sorry!
194
195 /*
196 terminate called after throwing an instance of 'std::bad_alloc'
197 what(): std::bad_alloc
198 Stacktrace:
199
200 at (wrapper managed-to-native) Ode.NET.d.Collide (intptr,intptr,int,Ode.NET.d/ContactGeom[],int) <0x00004>
201 at (wrapper managed-to-native) Ode.NET.d.Collide (intptr,intptr,int,Ode.NET.d/ContactGeom[],int) <0xffffffff>
202 at OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.near (intptr,intptr,intptr) <0x00280>
203 at (wrapper native-to-managed) OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.near (intptr,intptr,intptr) <0xfff
204 fffff>
205 at (wrapper managed-to-native) Ode.NET.d.SpaceCollide2 (intptr,intptr,intptr,Ode.NET.d/NearCallback) <0x00004>
206 at (wrapper managed-to-native) Ode.NET.d.SpaceCollide2 (intptr,intptr,intptr,Ode.NET.d/NearCallback) <0xffffffff>
207 at OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.RayCast (OpenSim.Region.Physics.OdePlugin.ODERayCastRequest) <
208 0x00114>
209 at OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.ProcessQueuedRequests () <0x000eb>
210 at OpenSim.Region.Physics.OdePlugin.OdeScene.Simulate (single) <0x017e6>
211 at OpenSim.Region.Framework.Scenes.SceneGraph.UpdatePhysics (double) <0x00042>
212 at OpenSim.Region.Framework.Scenes.Scene.Update () <0x0039e>
213 at OpenSim.Region.Framework.Scenes.Scene.Heartbeat (object) <0x00019>
214 at (wrapper runtime-invoke) object.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0xffffffff>
215
216 Native stacktrace:
217
218 mono [0x80d2a42]
219 [0xb7f5840c]
220 /lib/i686/cmov/libc.so.6(abort+0x188) [0xb7d1a018]
221 /usr/lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x158) [0xb45fc988]
222 /usr/lib/libstdc++.so.6 [0xb45fa865]
223 /usr/lib/libstdc++.so.6 [0xb45fa8a2]
224 /usr/lib/libstdc++.so.6 [0xb45fa9da]
225 /usr/lib/libstdc++.so.6(_Znwj+0x83) [0xb45fb033]
226 /usr/lib/libstdc++.so.6(_Znaj+0x1d) [0xb45fb11d]
227 libode.so(_ZN13dxHeightfield23dCollideHeightfieldZoneEiiiiP6dxGeomiiP12dContactGeomi+0xd04) [0xb46678e4]
228 libode.so(_Z19dCollideHeightfieldP6dxGeomS0_iP12dContactGeomi+0x54b) [0xb466832b]
229 libode.so(dCollide+0x102) [0xb46571b2]
230 [0x95cfdec9]
231 [0x8ea07fe1]
232 [0xab260146]
233 libode.so [0xb465a5c4]
234 libode.so(_ZN11dxHashSpace8collide2EPvP6dxGeomPFvS0_S2_S2_E+0x75) [0xb465bcf5]
235 libode.so(dSpaceCollide2+0x177) [0xb465ac67]
236 [0x95cf978e]
237 [0x8ea07945]
238 [0x95cf2bbc]
239 [0xab2787e7]
240 [0xab419fb3]
241 [0xab416657]
242 [0xab415bda]
243 [0xb609b08e]
244 mono(mono_runtime_delegate_invoke+0x34) [0x8192534]
245 mono [0x81a2f0f]
246 mono [0x81d28b6]
247 mono [0x81ea2c6]
248 /lib/i686/cmov/libpthread.so.0 [0xb7e744c0]
249 /lib/i686/cmov/libc.so.6(clone+0x5e) [0xb7dcd6de]
250 */
251
252 // Exclude heightfield geom
253
254 if (g1 == IntPtr.Zero || g2 == IntPtr.Zero)
255 return;
256 if (d.GeomGetClass(g1) == d.GeomClassID.HeightfieldClass || d.GeomGetClass(g2) == d.GeomClassID.HeightfieldClass)
257 return;
258
259 // Raytest against AABBs of spaces first, then dig into the spaces it hits for actual geoms.
260 if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2))
261 {
262 if (g1 == IntPtr.Zero || g2 == IntPtr.Zero)
263 return;
264
265 // Separating static prim geometry spaces.
266 // We'll be calling near recursivly if one
267 // of them is a space to find all of the
268 // contact points in the space
269 try
270 {
271 d.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback);
272 }
273 catch (AccessViolationException)
274 {
275 m_log.Warn("[PHYSICS]: Unable to collide test a space");
276 return;
277 }
278 //Colliding a space or a geom with a space or a geom. so drill down
279
280 //Collide all geoms in each space..
281 //if (d.GeomIsSpace(g1)) d.SpaceCollide(g1, IntPtr.Zero, nearCallback);
282 //if (d.GeomIsSpace(g2)) d.SpaceCollide(g2, IntPtr.Zero, nearCallback);
283 return;
284 }
285
286 if (g1 == IntPtr.Zero || g2 == IntPtr.Zero)
287 return;
288
289 int count = 0;
290 try
291 {
292
293 if (g1 == g2)
294 return; // Can't collide with yourself
295
296 lock (contacts)
297 {
298 count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf);
299 }
300 }
301 catch (SEHException)
302 {
303 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.");
304 }
305 catch (Exception e)
306 {
307 m_log.WarnFormat("[PHYSICS]: Unable to collide test an object: {0}", e.Message);
308 return;
309 }
310
311 PhysicsActor p1 = null;
312 PhysicsActor p2 = null;
313
314 if (g1 != IntPtr.Zero)
315 m_scene.actor_name_map.TryGetValue(g1, out p1);
316
317 if (g2 != IntPtr.Zero)
318 m_scene.actor_name_map.TryGetValue(g1, out p2);
319
320 // Loop over contacts, build results.
321 for (int i = 0; i < count; i++)
322 {
323 if (p1 != null) {
324 if (p1 is OdePrim)
325 {
326 ContactResult collisionresult = new ContactResult();
327
328 collisionresult.ConsumerID = ((OdePrim)p1).m_localID;
329 collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z);
330 collisionresult.Depth = contacts[i].depth;
331 collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y,
332 contacts[i].normal.Z);
333 lock (m_contactResults)
334 m_contactResults.Add(collisionresult);
335 }
336 }
337
338 if (p2 != null)
339 {
340 if (p2 is OdePrim)
341 {
342 ContactResult collisionresult = new ContactResult();
343
344 collisionresult.ConsumerID = ((OdePrim)p2).m_localID;
345 collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z);
346 collisionresult.Depth = contacts[i].depth;
347 collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y,
348 contacts[i].normal.Z);
349
350 lock (m_contactResults)
351 m_contactResults.Add(collisionresult);
352 }
353 }
354
355
356 }
357
358 }
359
360 /// <summary>
361 /// Dereference the creator scene so that it can be garbage collected if needed.
362 /// </summary>
363 internal void Dispose()
364 {
365 m_scene = null;
366 }
367 }
368
369 public struct ODERayCastRequest
370 {
371 public Vector3 Origin;
372 public Vector3 Normal;
373 public float length;
374 public RaycastCallback callbackMethod;
375 }
376
377 public struct ContactResult
378 {
379 public Vector3 Pos;
380 public float Depth;
381 public uint ConsumerID;
382 public Vector3 Normal;
383 }
384}
diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdePhysicsJoint.cs b/OpenSim/Region/Physics/ChOdePlugin/OdePhysicsJoint.cs
deleted file mode 100644
index b4a3c48..0000000
--- a/OpenSim/Region/Physics/ChOdePlugin/OdePhysicsJoint.cs
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using OpenMetaverse;
30using Ode.NET;
31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager;
33using OpenSim.Region.Physics.OdePlugin;
34
35namespace OpenSim.Region.Physics.OdePlugin
36{
37 class OdePhysicsJoint : PhysicsJoint
38 {
39 public override bool IsInPhysicsEngine
40 {
41 get
42 {
43 return (jointID != IntPtr.Zero);
44 }
45 }
46 public IntPtr jointID;
47 }
48}
diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
deleted file mode 100644
index 6cad285..0000000
--- a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
+++ /dev/null
@@ -1,3887 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28//#define USE_DRAWSTUFF
29
30using System;
31using System.Collections.Generic;
32using System.Reflection;
33using System.Runtime.InteropServices;
34using System.Threading;
35using System.IO;
36using System.Diagnostics;
37using log4net;
38using Nini.Config;
39using Ode.NET;
40#if USE_DRAWSTUFF
41using Drawstuff.NET;
42#endif
43using OpenSim.Framework;
44using OpenSim.Region.Physics.Manager;
45using OpenMetaverse;
46
47//using OpenSim.Region.Physics.OdePlugin.Meshing;
48
49namespace OpenSim.Region.Physics.OdePlugin
50{
51 /// <summary>
52 /// ODE plugin
53 /// </summary>
54 public class OdePlugin : IPhysicsPlugin
55 {
56 //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
57
58 private CollisionLocker ode;
59 private OdeScene _mScene;
60
61 public OdePlugin()
62 {
63 ode = new CollisionLocker();
64 }
65
66 public bool Init()
67 {
68 return true;
69 }
70
71 public PhysicsScene GetScene(String sceneIdentifier)
72 {
73 if (_mScene == null)
74 {
75 if (Util.IsWindows())
76 Util.LoadArchSpecificWindowsDll("ode.dll");
77
78 // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to
79 // http://opensimulator.org/mantis/view.php?id=2750).
80 d.InitODE();
81
82 _mScene = new OdeScene(ode, sceneIdentifier);
83 }
84 return (_mScene);
85 }
86
87 public string GetName()
88 {
89 return ("ChODE");
90 }
91
92 public void Dispose()
93 {
94 }
95 }
96
97 public enum StatusIndicators : int
98 {
99 Generic = 0,
100 Start = 1,
101 End = 2
102 }
103
104 public struct sCollisionData
105 {
106 public uint ColliderLocalId;
107 public uint CollidedWithLocalId;
108 public int NumberOfCollisions;
109 public int CollisionType;
110 public int StatusIndicator;
111 public int lastframe;
112 }
113
114 [Flags]
115 public enum CollisionCategories : int
116 {
117 Disabled = 0,
118 Geom = 0x00000001,
119 Body = 0x00000002,
120 Space = 0x00000004,
121 Character = 0x00000008,
122 Land = 0x00000010,
123 Water = 0x00000020,
124 Wind = 0x00000040,
125 Sensor = 0x00000080,
126 Selected = 0x00000100
127 }
128
129 /// <summary>
130 /// Material type for a primitive
131 /// </summary>
132 public enum Material : int
133 {
134 /// <summary></summary>
135 Stone = 0,
136 /// <summary></summary>
137 Metal = 1,
138 /// <summary></summary>
139 Glass = 2,
140 /// <summary></summary>
141 Wood = 3,
142 /// <summary></summary>
143 Flesh = 4,
144 /// <summary></summary>
145 Plastic = 5,
146 /// <summary></summary>
147 Rubber = 6
148
149 }
150
151 public sealed class OdeScene : PhysicsScene
152 {
153 private readonly ILog m_log;
154 // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>();
155
156 CollisionLocker ode;
157
158 private Random fluidRandomizer = new Random(Environment.TickCount);
159
160 private const uint m_regionWidth = Constants.RegionSize;
161 private const uint m_regionHeight = Constants.RegionSize;
162
163 private float ODE_STEPSIZE = 0.020f;
164 private float metersInSpace = 29.9f;
165 private float m_timeDilation = 1.0f;
166
167 public float gravityx = 0f;
168 public float gravityy = 0f;
169 public float gravityz = -9.8f;
170
171 private float contactsurfacelayer = 0.001f;
172
173 private int worldHashspaceLow = -4;
174 private int worldHashspaceHigh = 128;
175
176 private int smallHashspaceLow = -4;
177 private int smallHashspaceHigh = 66;
178
179 private float waterlevel = 0f;
180 private int framecount = 0;
181 //private int m_returncollisions = 10;
182
183 private readonly IntPtr contactgroup;
184
185 internal IntPtr LandGeom;
186 internal IntPtr WaterGeom;
187
188 private float nmTerrainContactFriction = 255.0f;
189 private float nmTerrainContactBounce = 0.1f;
190 private float nmTerrainContactERP = 0.1025f;
191
192 private float mTerrainContactFriction = 75f;
193 private float mTerrainContactBounce = 0.1f;
194 private float mTerrainContactERP = 0.05025f;
195
196 private float nmAvatarObjectContactFriction = 250f;
197 private float nmAvatarObjectContactBounce = 0.1f;
198
199 private float mAvatarObjectContactFriction = 75f;
200 private float mAvatarObjectContactBounce = 0.1f;
201
202 private float avPIDD = 3200f;
203 private float avPIDP = 1400f;
204 private float avCapRadius = 0.37f;
205 private float avStandupTensor = 2000000f;
206 private bool avCapsuleTilted = true; // true = old compatibility mode with leaning capsule; false = new corrected mode
207 public bool IsAvCapsuleTilted { get { return avCapsuleTilted; } set { avCapsuleTilted = value; } }
208 private float avDensity = 80f;
209 private float avHeightFudgeFactor = 0.52f;
210 private float avMovementDivisorWalk = 1.3f;
211 private float avMovementDivisorRun = 0.8f;
212 private float minimumGroundFlightOffset = 3f;
213 public float maximumMassObject = 10000.01f;
214
215 public bool meshSculptedPrim = true;
216 public bool forceSimplePrimMeshing = false;
217
218 public float meshSculptLOD = 32;
219 public float MeshSculptphysicalLOD = 16;
220
221 public float geomDefaultDensity = 10.000006836f;
222
223 public int geomContactPointsStartthrottle = 3;
224 public int geomUpdatesPerThrottledUpdate = 15;
225
226 public float bodyPIDD = 35f;
227 public float bodyPIDG = 25;
228
229 public int geomCrossingFailuresBeforeOutofbounds = 5;
230 public float geomRegionFence = 0.0f;
231
232 public float bodyMotorJointMaxforceTensor = 2;
233
234 public int bodyFramesAutoDisable = 20;
235
236 private DateTime m_lastframe = DateTime.UtcNow;
237
238 private float[] _watermap;
239 private bool m_filterCollisions = true;
240
241 private d.NearCallback nearCallback;
242 public d.TriCallback triCallback;
243 public d.TriArrayCallback triArrayCallback;
244 private readonly HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>();
245 private readonly HashSet<OdePrim> _prims = new HashSet<OdePrim>();
246 private readonly HashSet<OdePrim> _activeprims = new HashSet<OdePrim>();
247 private readonly HashSet<OdePrim> _taintedPrimH = new HashSet<OdePrim>();
248 private readonly Object _taintedPrimLock = new Object();
249 private readonly List<OdePrim> _taintedPrimL = new List<OdePrim>();
250 private readonly HashSet<OdeCharacter> _taintedActors = new HashSet<OdeCharacter>();
251 private readonly List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>();
252 private readonly List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>();
253 private readonly HashSet<OdeCharacter> _badCharacter = new HashSet<OdeCharacter>();
254 public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();
255 public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>();
256 private bool m_NINJA_physics_joints_enabled = false;
257 //private Dictionary<String, IntPtr> jointpart_name_map = new Dictionary<String,IntPtr>();
258 private readonly Dictionary<String, List<PhysicsJoint>> joints_connecting_actor = new Dictionary<String, List<PhysicsJoint>>();
259 private d.ContactGeom[] contacts;
260 private readonly List<PhysicsJoint> requestedJointsToBeCreated = new List<PhysicsJoint>(); // lock only briefly. accessed by external code (to request new joints) and by OdeScene.Simulate() to move those joints into pending/active
261 private readonly List<PhysicsJoint> pendingJoints = new List<PhysicsJoint>(); // can lock for longer. accessed only by OdeScene.
262 private readonly List<PhysicsJoint> activeJoints = new List<PhysicsJoint>(); // can lock for longer. accessed only by OdeScene.
263 private readonly List<string> requestedJointsToBeDeleted = new List<string>(); // lock only briefly. accessed by external code (to request deletion of joints) and by OdeScene.Simulate() to move those joints out of pending/active
264 private Object externalJointRequestsLock = new Object();
265 private readonly Dictionary<String, PhysicsJoint> SOPName_to_activeJoint = new Dictionary<String, PhysicsJoint>();
266 private readonly Dictionary<String, PhysicsJoint> SOPName_to_pendingJoint = new Dictionary<String, PhysicsJoint>();
267 private readonly DoubleDictionary<Vector3, IntPtr, IntPtr> RegionTerrain = new DoubleDictionary<Vector3, IntPtr, IntPtr>();
268 private readonly Dictionary<IntPtr,float[]> TerrainHeightFieldHeights = new Dictionary<IntPtr, float[]>();
269
270 private d.Contact ContactCopy; // local copy that can be modified
271 private d.Contact TerrainContact;
272 private d.Contact AvatarStaticprimContact; // was 'contact'
273 private d.Contact AvatarMovementprimContact;
274 private d.Contact AvatarMovementTerrainContact;
275 private d.Contact WaterContact;
276 private d.Contact[,] m_materialContacts;
277
278//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it
279//Ckrinke private int m_randomizeWater = 200;
280 private int m_physicsiterations = 10;
281 private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag
282 private readonly PhysicsActor PANull = new NullPhysicsActor();
283 private float step_time = 0.0f;
284//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it
285//Ckrinke private int ms = 0;
286 public IntPtr world;
287 //private bool returncollisions = false;
288 // private uint obj1LocalID = 0;
289 private uint obj2LocalID = 0;
290 //private int ctype = 0;
291 private OdeCharacter cc1;
292 private OdePrim cp1;
293 private OdeCharacter cc2;
294 private OdePrim cp2;
295 //private int cStartStop = 0;
296 //private string cDictKey = "";
297
298 public IntPtr space;
299
300 //private IntPtr tmpSpace;
301 // split static geometry collision handling into spaces of 30 meters
302 public IntPtr[,] staticPrimspace;
303
304 public Object OdeLock;
305
306 public IMesher mesher;
307
308 private IConfigSource m_config;
309
310 public bool physics_logging = false;
311 public int physics_logging_interval = 0;
312 public bool physics_logging_append_existing_logfile = false;
313
314 public d.Vector3 xyz = new d.Vector3(128.1640f, 128.3079f, 25.7600f);
315 public d.Vector3 hpr = new d.Vector3(125.5000f, -17.0000f, 0.0000f);
316
317 // TODO: unused: private uint heightmapWidth = m_regionWidth + 1;
318 // TODO: unused: private uint heightmapHeight = m_regionHeight + 1;
319 // TODO: unused: private uint heightmapWidthSamples;
320 // TODO: unused: private uint heightmapHeightSamples;
321
322 private volatile int m_global_contactcount = 0;
323
324 private Vector3 m_worldOffset = Vector3.Zero;
325 public Vector2 WorldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize);
326 private PhysicsScene m_parentScene = null;
327
328 private ODERayCastRequestManager m_rayCastManager;
329
330 /// <summary>
331 /// Initiailizes the scene
332 /// Sets many properties that ODE requires to be stable
333 /// These settings need to be tweaked 'exactly' right or weird stuff happens.
334 /// </summary>
335 public OdeScene(CollisionLocker dode, string sceneIdentifier)
336 {
337 m_log
338 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + sceneIdentifier);
339
340 OdeLock = new Object();
341 ode = dode;
342 nearCallback = near;
343 triCallback = TriCallback;
344 triArrayCallback = TriArrayCallback;
345 m_rayCastManager = new ODERayCastRequestManager(this);
346 lock (OdeLock)
347 {
348 // Create the world and the first space
349 world = d.WorldCreate();
350 space = d.HashSpaceCreate(IntPtr.Zero);
351
352
353 contactgroup = d.JointGroupCreate(0);
354 //contactgroup
355
356 d.WorldSetAutoDisableFlag(world, false);
357 #if USE_DRAWSTUFF
358
359 Thread viewthread = new Thread(new ParameterizedThreadStart(startvisualization));
360 viewthread.Start();
361 #endif
362 }
363
364
365 _watermap = new float[258 * 258];
366
367 // Zero out the prim spaces array (we split our space into smaller spaces so
368 // we can hit test less.
369 }
370
371#if USE_DRAWSTUFF
372 public void startvisualization(object o)
373 {
374 ds.Functions fn;
375 fn.version = ds.VERSION;
376 fn.start = new ds.CallbackFunction(start);
377 fn.step = new ds.CallbackFunction(step);
378 fn.command = new ds.CallbackFunction(command);
379 fn.stop = null;
380 fn.path_to_textures = "./textures";
381 string[] args = new string[0];
382 ds.SimulationLoop(args.Length, args, 352, 288, ref fn);
383 }
384#endif
385
386 // Initialize the mesh plugin
387 public override void Initialise(IMesher meshmerizer, IConfigSource config)
388 {
389 mesher = meshmerizer;
390 m_config = config;
391 // Defaults
392
393 if (Environment.OSVersion.Platform == PlatformID.Unix)
394 {
395 avPIDD = 3200.0f;
396 avPIDP = 1400.0f;
397 avStandupTensor = 2000000f;
398 }
399 else
400 {
401 avPIDD = 2200.0f;
402 avPIDP = 900.0f;
403 avStandupTensor = 550000f;
404 }
405
406 int contactsPerCollision = 80;
407
408 if (m_config != null)
409 {
410 IConfig physicsconfig = m_config.Configs["ODEPhysicsSettings"];
411 if (physicsconfig != null)
412 {
413 gravityx = physicsconfig.GetFloat("world_gravityx", 0f);
414 gravityy = physicsconfig.GetFloat("world_gravityy", 0f);
415 gravityz = physicsconfig.GetFloat("world_gravityz", -9.8f);
416
417 worldHashspaceLow = physicsconfig.GetInt("world_hashspace_size_low", -4);
418 worldHashspaceHigh = physicsconfig.GetInt("world_hashspace_size_high", 128);
419
420 metersInSpace = physicsconfig.GetFloat("meters_in_small_space", 29.9f);
421 smallHashspaceLow = physicsconfig.GetInt("small_hashspace_size_low", -4);
422 smallHashspaceHigh = physicsconfig.GetInt("small_hashspace_size_high", 66);
423
424 contactsurfacelayer = physicsconfig.GetFloat("world_contact_surface_layer", 0.001f);
425
426 nmTerrainContactFriction = physicsconfig.GetFloat("nm_terraincontact_friction", 255.0f);
427 nmTerrainContactBounce = physicsconfig.GetFloat("nm_terraincontact_bounce", 0.1f);
428 nmTerrainContactERP = physicsconfig.GetFloat("nm_terraincontact_erp", 0.1025f);
429
430 mTerrainContactFriction = physicsconfig.GetFloat("m_terraincontact_friction", 75f);
431 mTerrainContactBounce = physicsconfig.GetFloat("m_terraincontact_bounce", 0.05f);
432 mTerrainContactERP = physicsconfig.GetFloat("m_terraincontact_erp", 0.05025f);
433
434 nmAvatarObjectContactFriction = physicsconfig.GetFloat("objectcontact_friction", 250f);
435 nmAvatarObjectContactBounce = physicsconfig.GetFloat("objectcontact_bounce", 0.2f);
436
437 mAvatarObjectContactFriction = physicsconfig.GetFloat("m_avatarobjectcontact_friction", 75f);
438 mAvatarObjectContactBounce = physicsconfig.GetFloat("m_avatarobjectcontact_bounce", 0.1f);
439
440 ODE_STEPSIZE = physicsconfig.GetFloat("world_stepsize", 0.020f);
441 m_physicsiterations = physicsconfig.GetInt("world_internal_steps_without_collisions", 10);
442
443 avDensity = physicsconfig.GetFloat("av_density", 80f);
444 avHeightFudgeFactor = physicsconfig.GetFloat("av_height_fudge_factor", 0.52f);
445 avMovementDivisorWalk = physicsconfig.GetFloat("av_movement_divisor_walk", 1.3f);
446 avMovementDivisorRun = physicsconfig.GetFloat("av_movement_divisor_run", 0.8f);
447 avCapRadius = physicsconfig.GetFloat("av_capsule_radius", 0.37f);
448 avCapsuleTilted = physicsconfig.GetBoolean("av_capsule_tilted", false);
449
450 contactsPerCollision = physicsconfig.GetInt("contacts_per_collision", 80);
451
452 geomContactPointsStartthrottle = physicsconfig.GetInt("geom_contactpoints_start_throttling", 3);
453 geomUpdatesPerThrottledUpdate = physicsconfig.GetInt("geom_updates_before_throttled_update", 15);
454 geomCrossingFailuresBeforeOutofbounds = physicsconfig.GetInt("geom_crossing_failures_before_outofbounds", 5);
455 geomRegionFence = physicsconfig.GetFloat("region_border_fence", 0.0f);
456
457 geomDefaultDensity = physicsconfig.GetFloat("geometry_default_density", 10.000006836f);
458 bodyFramesAutoDisable = physicsconfig.GetInt("body_frames_auto_disable", 20);
459
460 bodyPIDD = physicsconfig.GetFloat("body_pid_derivative", 35f);
461 bodyPIDG = physicsconfig.GetFloat("body_pid_gain", 25f);
462
463 forceSimplePrimMeshing = physicsconfig.GetBoolean("force_simple_prim_meshing", forceSimplePrimMeshing);
464 meshSculptedPrim = physicsconfig.GetBoolean("mesh_sculpted_prim", true);
465 meshSculptLOD = physicsconfig.GetFloat("mesh_lod", 32f);
466 MeshSculptphysicalLOD = physicsconfig.GetFloat("mesh_physical_lod", 16f);
467 m_filterCollisions = physicsconfig.GetBoolean("filter_collisions", false);
468
469 if (Environment.OSVersion.Platform == PlatformID.Unix)
470 {
471 avPIDD = physicsconfig.GetFloat("av_pid_derivative_linux", 2200.0f);
472 avPIDP = physicsconfig.GetFloat("av_pid_proportional_linux", 900.0f);
473 avStandupTensor = physicsconfig.GetFloat("av_capsule_standup_tensor_linux", 550000f);
474 bodyMotorJointMaxforceTensor = physicsconfig.GetFloat("body_motor_joint_maxforce_tensor_linux", 5f);
475 }
476 else
477 {
478 avPIDD = physicsconfig.GetFloat("av_pid_derivative_win", 2200.0f);
479 avPIDP = physicsconfig.GetFloat("av_pid_proportional_win", 900.0f);
480 avStandupTensor = physicsconfig.GetFloat("av_capsule_standup_tensor_win", 550000f);
481 bodyMotorJointMaxforceTensor = physicsconfig.GetFloat("body_motor_joint_maxforce_tensor_win", 5f);
482 }
483
484 physics_logging = physicsconfig.GetBoolean("physics_logging", false);
485 physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0);
486 physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false);
487
488 m_NINJA_physics_joints_enabled = physicsconfig.GetBoolean("use_NINJA_physics_joints", false);
489 minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", 3f);
490 maximumMassObject = physicsconfig.GetFloat("maximum_mass_object", 10000.01f);
491 }
492 }
493
494 contacts = new d.ContactGeom[contactsPerCollision];
495
496 staticPrimspace = new IntPtr[(int)(300 / metersInSpace), (int)(300 / metersInSpace)];
497
498 // Avatar static on a Prim parameters
499 AvatarStaticprimContact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
500 AvatarStaticprimContact.surface.mu = 255.0f;
501 AvatarStaticprimContact.surface.bounce = 0.0f;
502 AvatarStaticprimContact.surface.soft_cfm = 0.0f;
503 AvatarStaticprimContact.surface.soft_erp = 0.30f; // If this is too small static Av will fall through a sloping prim. 1.0 prevents fall-thru
504
505 // Avatar moving on a Prim parameters
506 AvatarMovementprimContact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
507 AvatarMovementprimContact.surface.mu = 255.0f;
508 AvatarMovementprimContact.surface.bounce = 0.0f;
509 AvatarMovementprimContact.surface.soft_cfm = 0.0f; // if this is 0.01 then prims become phantom to Avs!
510 AvatarMovementprimContact.surface.soft_erp = 0.3f;
511
512 // Static Avatar on Terrain parameters
513 // Keeps Avatar in place better
514 TerrainContact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
515 TerrainContact.surface.mu = 255.0f;
516 TerrainContact.surface.bounce = 0.0f;
517 TerrainContact.surface.soft_cfm = 0.0f;
518 TerrainContact.surface.soft_erp = 0.05f;
519
520 // Moving Avatar on Terrain parameters
521 AvatarMovementTerrainContact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
522 AvatarMovementTerrainContact.surface.mu = 75f;
523 AvatarMovementTerrainContact.surface.bounce = 0.0f;
524 AvatarMovementTerrainContact.surface.soft_cfm = 0.0f;
525 AvatarMovementTerrainContact.surface.soft_erp = 0.05f;
526
527 // Avatar or prim the the water, this may not be used, possibly water is same as air?
528 WaterContact.surface.mode |= (d.ContactFlags.SoftERP | d.ContactFlags.SoftCFM);
529 WaterContact.surface.mu = 0.0f; // No friction
530 WaterContact.surface.bounce = 0.0f; // No bounce
531 WaterContact.surface.soft_cfm = 0.010f;
532 WaterContact.surface.soft_erp = 0.010f;
533
534
535 // Prim static or moving on a prim, depends on material type
536 m_materialContacts = new d.Contact[7,2];
537 // V 1 = Sliding; 0 = static or fell onto
538 m_materialContacts[(int)Material.Stone, 0] = new d.Contact();
539 m_materialContacts[(int)Material.Stone, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
540 m_materialContacts[(int)Material.Stone, 0].surface.mu = 60f; // friction, 1 = slippery, 255 = no slip
541 m_materialContacts[(int)Material.Stone, 0].surface.bounce = 0.0f;
542 m_materialContacts[(int)Material.Stone, 0].surface.soft_cfm = 0.0f;
543 m_materialContacts[(int)Material.Stone, 0].surface.soft_erp = 0.50f; // erp also changes friction, more erp=less friction
544
545 m_materialContacts[(int)Material.Stone, 1] = new d.Contact();
546 m_materialContacts[(int)Material.Stone, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
547 m_materialContacts[(int)Material.Stone, 1].surface.mu = 40f;
548 m_materialContacts[(int)Material.Stone, 1].surface.bounce = 0.0f;
549 m_materialContacts[(int)Material.Stone, 1].surface.soft_cfm = 0.0f;
550 m_materialContacts[(int)Material.Stone, 1].surface.soft_erp = 0.50f;
551
552 m_materialContacts[(int)Material.Metal, 0] = new d.Contact();
553 m_materialContacts[(int)Material.Metal, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
554 m_materialContacts[(int)Material.Metal, 0].surface.mu = 15f;
555 m_materialContacts[(int)Material.Metal, 0].surface.bounce = 0.2f;
556 m_materialContacts[(int)Material.Metal, 0].surface.soft_cfm = 0.0f;
557 m_materialContacts[(int)Material.Metal, 0].surface.soft_erp = 0.50f;
558
559 m_materialContacts[(int)Material.Metal, 1] = new d.Contact();
560 m_materialContacts[(int)Material.Metal, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
561 m_materialContacts[(int)Material.Metal, 1].surface.mu = 10f;
562 m_materialContacts[(int)Material.Metal, 1].surface.bounce = 0.2f;
563 m_materialContacts[(int)Material.Metal, 1].surface.soft_cfm = 0.0f;
564 m_materialContacts[(int)Material.Metal, 1].surface.soft_erp = 0.50f;
565
566 m_materialContacts[(int)Material.Glass, 0] = new d.Contact();
567 m_materialContacts[(int)Material.Glass, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
568 m_materialContacts[(int)Material.Glass, 0].surface.mu = 7.5f;
569 m_materialContacts[(int)Material.Glass, 0].surface.bounce = 0.0f;
570 m_materialContacts[(int)Material.Glass, 0].surface.soft_cfm = 0.0f;
571 m_materialContacts[(int)Material.Glass, 0].surface.soft_erp = 0.50f;
572
573 m_materialContacts[(int)Material.Glass, 1] = new d.Contact();
574 m_materialContacts[(int)Material.Glass, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
575 m_materialContacts[(int)Material.Glass, 1].surface.mu = 5f;
576 m_materialContacts[(int)Material.Glass, 1].surface.bounce = 0.0f;
577 m_materialContacts[(int)Material.Glass, 1].surface.soft_cfm = 0.0f;
578 m_materialContacts[(int)Material.Glass, 1].surface.soft_erp = 0.50f;
579
580 m_materialContacts[(int)Material.Wood, 0] = new d.Contact();
581 m_materialContacts[(int)Material.Wood, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
582 m_materialContacts[(int)Material.Wood, 0].surface.mu = 45f;
583 m_materialContacts[(int)Material.Wood, 0].surface.bounce = 0.1f;
584 m_materialContacts[(int)Material.Wood, 0].surface.soft_cfm = 0.0f;
585 m_materialContacts[(int)Material.Wood, 0].surface.soft_erp = 0.50f;
586
587 m_materialContacts[(int)Material.Wood, 1] = new d.Contact();
588 m_materialContacts[(int)Material.Wood, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
589 m_materialContacts[(int)Material.Wood, 1].surface.mu = 30f;
590 m_materialContacts[(int)Material.Wood, 1].surface.bounce = 0.1f;
591 m_materialContacts[(int)Material.Wood, 1].surface.soft_cfm = 0.0f;
592 m_materialContacts[(int)Material.Wood, 1].surface.soft_erp = 0.50f;
593
594 m_materialContacts[(int)Material.Flesh, 0] = new d.Contact();
595 m_materialContacts[(int)Material.Flesh, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
596 m_materialContacts[(int)Material.Flesh, 0].surface.mu = 150f;
597 m_materialContacts[(int)Material.Flesh, 0].surface.bounce = 0.0f;
598 m_materialContacts[(int)Material.Flesh, 0].surface.soft_cfm = 0.0f;
599 m_materialContacts[(int)Material.Flesh, 0].surface.soft_erp = 0.50f;
600
601 m_materialContacts[(int)Material.Flesh, 1] = new d.Contact();
602 m_materialContacts[(int)Material.Flesh, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
603 m_materialContacts[(int)Material.Flesh, 1].surface.mu = 100f;
604 m_materialContacts[(int)Material.Flesh, 1].surface.bounce = 0.0f;
605 m_materialContacts[(int)Material.Flesh, 1].surface.soft_cfm = 0.0f;
606 m_materialContacts[(int)Material.Flesh, 1].surface.soft_erp = 0.50f;
607
608 m_materialContacts[(int)Material.Plastic, 0] = new d.Contact();
609 m_materialContacts[(int)Material.Plastic, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
610 m_materialContacts[(int)Material.Plastic, 0].surface.mu = 30f;
611 m_materialContacts[(int)Material.Plastic, 0].surface.bounce = 0.2f;
612 m_materialContacts[(int)Material.Plastic, 0].surface.soft_cfm = 0.0f;
613 m_materialContacts[(int)Material.Plastic, 0].surface.soft_erp = 0.50f;
614
615 m_materialContacts[(int)Material.Plastic, 1] = new d.Contact();
616 m_materialContacts[(int)Material.Plastic, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
617 m_materialContacts[(int)Material.Plastic, 1].surface.mu = 20f;
618 m_materialContacts[(int)Material.Plastic, 1].surface.bounce = 0.2f;
619 m_materialContacts[(int)Material.Plastic, 1].surface.soft_cfm = 0.0f;
620 m_materialContacts[(int)Material.Plastic, 1].surface.soft_erp = 0.50f;
621
622 m_materialContacts[(int)Material.Rubber, 0] = new d.Contact();
623 m_materialContacts[(int)Material.Rubber, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
624 m_materialContacts[(int)Material.Rubber, 0].surface.mu = 150f;
625 m_materialContacts[(int)Material.Rubber, 0].surface.bounce = 0.7f;
626 m_materialContacts[(int)Material.Rubber, 0].surface.soft_cfm = 0.0f;
627 m_materialContacts[(int)Material.Rubber, 0].surface.soft_erp = 0.50f;
628
629 m_materialContacts[(int)Material.Rubber, 1] = new d.Contact();
630 m_materialContacts[(int)Material.Rubber, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
631 m_materialContacts[(int)Material.Rubber, 1].surface.mu = 100f;
632 m_materialContacts[(int)Material.Rubber, 1].surface.bounce = 0.7f;
633 m_materialContacts[(int)Material.Rubber, 1].surface.soft_cfm = 0.0f;
634 m_materialContacts[(int)Material.Rubber, 1].surface.soft_erp = 0.50f;
635
636 d.HashSpaceSetLevels(space, worldHashspaceLow, worldHashspaceHigh);
637
638 // Set the gravity,, don't disable things automatically (we set it explicitly on some things)
639
640 d.WorldSetGravity(world, gravityx, gravityy, gravityz);
641 d.WorldSetContactSurfaceLayer(world, contactsurfacelayer);
642
643
644 d.WorldSetLinearDampingThreshold(world, 256f);
645 d.WorldSetLinearDamping(world, 256f);
646// d.WorldSetLinearDampingThreshold(world, 0.01f);
647// d.WorldSetLinearDamping(world, 0.1f);
648 d.WorldSetAngularDampingThreshold(world, 256f);
649 d.WorldSetAngularDamping(world, 256f);
650 d.WorldSetMaxAngularSpeed(world, 256f);
651
652 // Set how many steps we go without running collision testing
653 // This is in addition to the step size.
654 // Essentially Steps * m_physicsiterations
655 d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
656 //d.WorldSetContactMaxCorrectingVel(world, 1000.0f);
657
658
659
660 for (int i = 0; i < staticPrimspace.GetLength(0); i++)
661 {
662 for (int j = 0; j < staticPrimspace.GetLength(1); j++)
663 {
664 staticPrimspace[i, j] = IntPtr.Zero;
665 }
666 }
667 }
668
669 internal void waitForSpaceUnlock(IntPtr space)
670 {
671 //if (space != IntPtr.Zero)
672 //while (d.SpaceLockQuery(space)) { } // Wait and do nothing
673 }
674
675 /// <summary>
676 /// Debug space message for printing the space that a prim/avatar is in.
677 /// </summary>
678 /// <param name="pos"></param>
679 /// <returns>Returns which split up space the given position is in.</returns>
680 public string whichspaceamIin(Vector3 pos)
681 {
682 return calculateSpaceForGeom(pos).ToString();
683 }
684
685 #region Collision Detection
686
687 /// <summary>
688 /// This is our near callback. A geometry is near a body
689 /// </summary>
690 /// <param name="space">The space that contains the geoms. Remember, spaces are also geoms</param>
691 /// <param name="g1">a geometry or space</param>
692 /// <param name="g2">another geometry or space</param>
693 private void near(IntPtr space, IntPtr g1, IntPtr g2)
694 {
695 // no lock here! It's invoked from within Simulate(), which is thread-locked
696
697 // Test if we're colliding a geom with a space.
698 // If so we have to drill down into the space recursively
699//Console.WriteLine("near -----------"); //##
700 if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2))
701 {
702 if (g1 == IntPtr.Zero || g2 == IntPtr.Zero)
703 return;
704
705 // Separating static prim geometry spaces.
706 // We'll be calling near recursivly if one
707 // of them is a space to find all of the
708 // contact points in the space
709 try
710 {
711 d.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback);
712 }
713 catch (AccessViolationException)
714 {
715 m_log.Warn("[PHYSICS]: Unable to collide test a space");
716 return;
717 }
718 //Colliding a space or a geom with a space or a geom. so drill down
719
720 //Collide all geoms in each space..
721 //if (d.GeomIsSpace(g1)) d.SpaceCollide(g1, IntPtr.Zero, nearCallback);
722 //if (d.GeomIsSpace(g2)) d.SpaceCollide(g2, IntPtr.Zero, nearCallback);
723 return;
724 }
725
726 if (g1 == IntPtr.Zero || g2 == IntPtr.Zero)
727 return;
728
729 IntPtr b1 = d.GeomGetBody(g1);
730 IntPtr b2 = d.GeomGetBody(g2);
731
732 // d.GeomClassID id = d.GeomGetClass(g1);
733
734 String name1 = null;
735 String name2 = null;
736
737 if (!geom_name_map.TryGetValue(g1, out name1))
738 {
739 name1 = "null";
740 }
741 if (!geom_name_map.TryGetValue(g2, out name2))
742 {
743 name2 = "null";
744 }
745
746 //if (id == d.GeomClassId.TriMeshClass)
747 //{
748 // m_log.InfoFormat("near: A collision was detected between {1} and {2}", 0, name1, name2);
749 //m_log.Debug("near: A collision was detected between {1} and {2}", 0, name1, name2);
750 //}
751
752 // Figure out how many contact points we have
753 int count = 0;
754 try
755 {
756 // Colliding Geom To Geom
757 // This portion of the function 'was' blatantly ripped off from BoxStack.cs
758
759 if (g1 == g2)
760 return; // Can't collide with yourself
761
762 if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
763 return;
764
765 lock (contacts)
766 {
767 count = d.Collide(g1, g2, contacts.Length, contacts, d.ContactGeom.SizeOf);
768 if (count > contacts.Length)
769 m_log.Error("[PHYSICS]: Got " + count + " contacts when we asked for a maximum of " + contacts.Length);
770 }
771 }
772 catch (SEHException)
773 {
774 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.");
775 ode.drelease(world);
776 base.TriggerPhysicsBasedRestart();
777 }
778 catch (Exception e)
779 {
780 m_log.WarnFormat("[PHYSICS]: Unable to collide test an object: {0}", e.Message);
781 return;
782 }
783
784 PhysicsActor p1;
785 PhysicsActor p2;
786
787 if (!actor_name_map.TryGetValue(g1, out p1))
788 {
789 p1 = PANull;
790 }
791
792 if (!actor_name_map.TryGetValue(g2, out p2))
793 {
794 p2 = PANull;
795 }
796
797 ContactPoint maxDepthContact = new ContactPoint();
798 if (p1.CollisionScore + count >= float.MaxValue)
799 p1.CollisionScore = 0;
800 p1.CollisionScore += count;
801
802 if (p2.CollisionScore + count >= float.MaxValue)
803 p2.CollisionScore = 0;
804 p2.CollisionScore += count;
805 for (int i = 0; i < count; i++)
806 {
807 d.ContactGeom curContact = contacts[i];
808
809 if (curContact.depth > maxDepthContact.PenetrationDepth)
810 {
811 maxDepthContact = new ContactPoint(
812 new Vector3(curContact.pos.X, curContact.pos.Y, curContact.pos.Z),
813 new Vector3(curContact.normal.X, curContact.normal.Y, curContact.normal.Z),
814 curContact.depth
815 );
816 }
817
818 //m_log.Warn("[CCOUNT]: " + count);
819 IntPtr joint;
820 // If we're colliding with terrain, use 'TerrainContact' instead of AvatarStaticprimContact.
821 // allows us to have different settings
822
823 // We only need to test p2 for 'jump crouch purposes'
824 if (p2 is OdeCharacter && p1.PhysicsActorType == (int)ActorTypes.Prim)
825 {
826 // Testing if the collision is at the feet of the avatar
827
828 //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));
829//#@ if ((p2.Position.Z - curContact.pos.Z) > (p2.Size.Z * 0.6f))
830//#@ p2.IsColliding = true;
831 if ((p2.Position.Z - curContact.pos.Z) > (p2.Size.Z * 0.6f)){ //##
832 p2.IsColliding = true; //##
833 }else{
834
835 } //##
836 }
837 else
838 {
839 p2.IsColliding = true;
840 }
841
842 //if ((framecount % m_returncollisions) == 0)
843
844 switch (p1.PhysicsActorType)
845 {
846 case (int)ActorTypes.Agent:
847 p2.CollidingObj = true;
848 break;
849 case (int)ActorTypes.Prim:
850 if (p2.Velocity.LengthSquared() > 0.0f)
851 p2.CollidingObj = true;
852 break;
853 case (int)ActorTypes.Unknown:
854 p2.CollidingGround = true;
855 break;
856 default:
857 p2.CollidingGround = true;
858 break;
859 }
860
861 // we don't want prim or avatar to explode
862
863 #region InterPenetration Handling - Unintended physics explosions
864# region disabled code1
865
866 if (curContact.depth >= 0.08f)
867 {
868 //This is disabled at the moment only because it needs more tweaking
869 //It will eventually be uncommented
870 /*
871 if (AvatarStaticprimContact.depth >= 1.00f)
872 {
873 //m_log.Debug("[PHYSICS]: " + AvatarStaticprimContact.depth.ToString());
874 }
875
876 //If you interpenetrate a prim with an agent
877 if ((p2.PhysicsActorType == (int) ActorTypes.Agent &&
878 p1.PhysicsActorType == (int) ActorTypes.Prim) ||
879 (p1.PhysicsActorType == (int) ActorTypes.Agent &&
880 p2.PhysicsActorType == (int) ActorTypes.Prim))
881 {
882
883 //AvatarStaticprimContact.depth = AvatarStaticprimContact.depth * 4.15f;
884 /*
885 if (p2.PhysicsActorType == (int) ActorTypes.Agent)
886 {
887 p2.CollidingObj = true;
888 AvatarStaticprimContact.depth = 0.003f;
889 p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f);
890 OdeCharacter character = (OdeCharacter) p2;
891 character.SetPidStatus(true);
892 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));
893
894 }
895 else
896 {
897
898 //AvatarStaticprimContact.depth = 0.0000000f;
899 }
900 if (p1.PhysicsActorType == (int) ActorTypes.Agent)
901 {
902
903 p1.CollidingObj = true;
904 AvatarStaticprimContact.depth = 0.003f;
905 p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f);
906 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));
907 OdeCharacter character = (OdeCharacter)p1;
908 character.SetPidStatus(true);
909 }
910 else
911 {
912
913 //AvatarStaticprimContact.depth = 0.0000000f;
914 }
915
916
917
918 }
919*/
920 // If you interpenetrate a prim with another prim
921 /*
922 if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim)
923 {
924 #region disabledcode2
925 //OdePrim op1 = (OdePrim)p1;
926 //OdePrim op2 = (OdePrim)p2;
927 //op1.m_collisionscore++;
928 //op2.m_collisionscore++;
929
930 //if (op1.m_collisionscore > 8000 || op2.m_collisionscore > 8000)
931 //{
932 //op1.m_taintdisable = true;
933 //AddPhysicsActorTaint(p1);
934 //op2.m_taintdisable = true;
935 //AddPhysicsActorTaint(p2);
936 //}
937
938 //if (AvatarStaticprimContact.depth >= 0.25f)
939 //{
940 // Don't collide, one or both prim will expld.
941
942 //op1.m_interpenetrationcount++;
943 //op2.m_interpenetrationcount++;
944 //interpenetrations_before_disable = 200;
945 //if (op1.m_interpenetrationcount >= interpenetrations_before_disable)
946 //{
947 //op1.m_taintdisable = true;
948 //AddPhysicsActorTaint(p1);
949 //}
950 //if (op2.m_interpenetrationcount >= interpenetrations_before_disable)
951 //{
952 // op2.m_taintdisable = true;
953 //AddPhysicsActorTaint(p2);
954 //}
955
956 //AvatarStaticprimContact.depth = AvatarStaticprimContact.depth / 8f;
957 //AvatarStaticprimContact.normal = new d.Vector3(0, 0, 1);
958 //}
959 //if (op1.m_disabled || op2.m_disabled)
960 //{
961 //Manually disabled objects stay disabled
962 //AvatarStaticprimContact.depth = 0f;
963 //}
964 #endregion
965 }
966 */
967#endregion
968 if (curContact.depth >= 1.00f)
969 {
970 //m_log.Info("[P]: " + AvatarStaticprimContact.depth.ToString());
971 if ((p2.PhysicsActorType == (int) ActorTypes.Agent &&
972 p1.PhysicsActorType == (int) ActorTypes.Unknown) ||
973 (p1.PhysicsActorType == (int) ActorTypes.Agent &&
974 p2.PhysicsActorType == (int) ActorTypes.Unknown))
975 {
976 if (p2.PhysicsActorType == (int) ActorTypes.Agent)
977 {
978 if (p2 is OdeCharacter)
979 {
980 OdeCharacter character = (OdeCharacter) p2;
981
982 //p2.CollidingObj = true;
983 curContact.depth = 0.00000003f;
984 p2.Velocity = p2.Velocity + new Vector3(0f, 0f, 0.5f);
985 curContact.pos =
986 new d.Vector3(curContact.pos.X + (p1.Size.X/2),
987 curContact.pos.Y + (p1.Size.Y/2),
988 curContact.pos.Z + (p1.Size.Z/2));
989 character.SetPidStatus(true);
990 }
991 }
992
993
994 if (p1.PhysicsActorType == (int) ActorTypes.Agent)
995 {
996 if (p1 is OdeCharacter)
997 {
998 OdeCharacter character = (OdeCharacter) p1;
999
1000 //p2.CollidingObj = true;
1001 curContact.depth = 0.00000003f;
1002 p1.Velocity = p1.Velocity + new Vector3(0f, 0f, 0.5f);
1003 curContact.pos =
1004 new d.Vector3(curContact.pos.X + (p1.Size.X/2),
1005 curContact.pos.Y + (p1.Size.Y/2),
1006 curContact.pos.Z + (p1.Size.Z/2));
1007 character.SetPidStatus(true);
1008 }
1009 }
1010 }
1011 }
1012 }
1013
1014 #endregion
1015
1016 // Logic for collision handling
1017 // Note, that if *all* contacts are skipped (VolumeDetect)
1018 // The prim still detects (and forwards) collision events but
1019 // appears to be phantom for the world
1020 Boolean skipThisContact = false;
1021
1022 if ((p1 is OdePrim) && (((OdePrim)p1).m_isVolumeDetect))
1023 skipThisContact = true; // No collision on volume detect prims
1024
1025 if (!skipThisContact && (p2 is OdePrim) && (((OdePrim)p2).m_isVolumeDetect))
1026 skipThisContact = true; // No collision on volume detect prims
1027
1028 if (!skipThisContact && curContact.depth < 0f)
1029 skipThisContact = true;
1030
1031 if (!skipThisContact && checkDupe(curContact, p2.PhysicsActorType))
1032 skipThisContact = true;
1033
1034 const int maxContactsbeforedeath = 4000;
1035 joint = IntPtr.Zero;
1036
1037 if (!skipThisContact)
1038 {
1039 // Add contact joints with materials params----------------------------------
1040 // p1 is what is being hit, p2 is the physical object doing the hitting
1041 int material = (int) Material.Wood;
1042 int movintYN = 0; // 1 = Sliding; 0 = static or fell onto
1043 if (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f) movintYN = 1;
1044
1045 // If we're colliding against terrain
1046 if (name1 == "Terrain" || name2 == "Terrain")
1047 {
1048 // If we're moving
1049 if ((p2.PhysicsActorType == (int) ActorTypes.Agent) && (movintYN == 1))
1050 {
1051 //$ Av walk/run on terrain (not falling) Use the Avatar movement terrain contact
1052 AvatarMovementTerrainContact.geom = curContact;
1053 _perloopContact.Add(curContact);
1054 if (m_global_contactcount < maxContactsbeforedeath)
1055 {
1056 joint = d.JointCreateContact(world, contactgroup, ref AvatarMovementTerrainContact);
1057 m_global_contactcount++;
1058 }
1059 }
1060 else
1061 {
1062 if (p2.PhysicsActorType == (int)ActorTypes.Agent)
1063 {
1064 //$ Av standing on terrain, Use the non moving Avata terrain contact
1065 TerrainContact.geom = curContact;
1066 _perloopContact.Add(curContact);
1067 if (m_global_contactcount < maxContactsbeforedeath)
1068 {
1069 joint = d.JointCreateContact(world, contactgroup, ref TerrainContact);
1070 m_global_contactcount++;
1071 }
1072 }
1073 else
1074 {
1075 if (p2.PhysicsActorType == (int)ActorTypes.Prim && p1.PhysicsActorType == (int)ActorTypes.Prim)
1076 {
1077 //& THIS NEVER HAPPENS? prim prim contact In terrain contact?
1078 // int pj294950 = 0;
1079 // prim terrain contact
1080
1081 if (p2 is OdePrim)
1082 material = ((OdePrim)p2).m_material;
1083 //m_log.DebugFormat("Material: {0}", material);
1084 m_materialContacts[material, movintYN].geom = curContact;
1085 _perloopContact.Add(curContact);
1086
1087 if (m_global_contactcount < maxContactsbeforedeath)
1088 {
1089 joint = d.JointCreateContact(world, contactgroup, ref m_materialContacts[material, movintYN]);
1090 m_global_contactcount++;
1091
1092 }
1093
1094 }
1095 else
1096 {
1097 //$ prim on terrain contact
1098 if (p2 is OdePrim)
1099 material = ((OdePrim)p2).m_material;
1100 //m_log.DebugFormat("Material: {0}", material);
1101 m_materialContacts[material, movintYN].geom = curContact;
1102 _perloopContact.Add(curContact);
1103
1104 ContactCopy = m_materialContacts[material, movintYN];
1105 if(movintYN == 1)
1106 {
1107 // prevent excessive slide on terrain
1108 ContactCopy.surface.mu = m_materialContacts[material, movintYN].surface.mu * 30.0f;
1109 }
1110
1111 if (m_global_contactcount < maxContactsbeforedeath)
1112 {
1113 joint = d.JointCreateContact(world, contactgroup, ref ContactCopy);
1114 m_global_contactcount++;
1115 }
1116 }
1117 }
1118 }
1119 }
1120 else if (name1 == "Water" || name2 == "Water")
1121 {
1122 //$ This never happens! Perhaps water is treated like air?
1123 /*
1124 if ((p2.PhysicsActorType == (int) ActorTypes.Prim))
1125 {
1126 }
1127 else
1128 {
1129 }
1130 */
1131 //WaterContact.surface.soft_cfm = 0.0000f;
1132 //WaterContact.surface.soft_erp = 0.00000f;
1133 if (curContact.depth > 0.1f)
1134 {
1135 curContact.depth *= 52;
1136 //AvatarStaticprimContact.normal = new d.Vector3(0, 0, 1);
1137 //AvatarStaticprimContact.pos = new d.Vector3(0, 0, contact.pos.Z - 5f);
1138 }
1139 WaterContact.geom = curContact;
1140 _perloopContact.Add(curContact);
1141 if (m_global_contactcount < maxContactsbeforedeath)
1142 {
1143 joint = d.JointCreateContact(world, contactgroup, ref WaterContact);
1144 m_global_contactcount++;
1145 }
1146 //m_log.Info("[PHYSICS]: Prim Water Contact" + AvatarStaticprimContact.depth);
1147 }
1148 else
1149 {
1150
1151 // no terrain and no water, we're colliding with prim or avatar
1152 // check if we're moving
1153 if ((p2.PhysicsActorType == (int)ActorTypes.Agent))
1154 {
1155 //$ Avatar on Prim or other Avatar
1156 if (movintYN == 1)
1157 {
1158 // Use the AV Movement / prim contact
1159 AvatarMovementprimContact.geom = curContact;
1160 _perloopContact.Add(curContact);
1161 if (m_global_contactcount < maxContactsbeforedeath)
1162 {
1163 joint = d.JointCreateContact(world, contactgroup, ref AvatarMovementprimContact);
1164 m_global_contactcount++;
1165 }
1166 }
1167 else
1168 {
1169 // Use the Av non movement / prim contact
1170 AvatarStaticprimContact.geom = curContact;
1171 _perloopContact.Add(curContact);
1172 ContactCopy = AvatarStaticprimContact; // local copy so we can change locally
1173
1174 if (m_global_contactcount < maxContactsbeforedeath)
1175 {
1176 if (curContact.depth > 0.2)
1177 { // embedded, eject slowly
1178 ContactCopy.surface.soft_erp = 0.1f;
1179 ContactCopy.surface.soft_cfm = 0.1f;
1180 }
1181 else
1182 { // keep on the surface
1183 ContactCopy.surface.soft_erp = 0.3f;
1184 ContactCopy.surface.soft_cfm = 0.0f;
1185 }
1186 joint = d.JointCreateContact(world, contactgroup, ref ContactCopy);
1187 m_global_contactcount++;
1188 }
1189 }
1190 }
1191 else if (p2.PhysicsActorType == (int)ActorTypes.Prim)
1192 {
1193 //$ Prim on Prim
1194 //p1.PhysicsActorType
1195
1196 if (p2 is OdePrim) material = ((OdePrim)p2).m_material;
1197 //m_log.DebugFormat("Material: {0}", material);
1198
1199 m_materialContacts[material, movintYN].geom = curContact;
1200 _perloopContact.Add(curContact);
1201
1202 if (m_global_contactcount < maxContactsbeforedeath)
1203 {
1204 joint = d.JointCreateContact(world, contactgroup, ref m_materialContacts[material, movintYN]);
1205 m_global_contactcount++;
1206 }
1207 }
1208 }
1209
1210 if (m_global_contactcount < maxContactsbeforedeath && joint != IntPtr.Zero) // stack collide!
1211 {
1212 d.JointAttach(joint, b1, b2);
1213 m_global_contactcount++;
1214 }
1215
1216 }
1217 collision_accounting_events(p1, p2, maxDepthContact);
1218 if (count > geomContactPointsStartthrottle)
1219 {
1220 // If there are more then 3 contact points, it's likely
1221 // that we've got a pile of objects, so ...
1222 // We don't want to send out hundreds of terse updates over and over again
1223 // so lets throttle them and send them again after it's somewhat sorted out.
1224 p2.ThrottleUpdates = true;
1225 }
1226 //m_log.Debug(count.ToString());
1227 //m_log.Debug("near: A collision was detected between {1} and {2}", 0, name1, name2);
1228 } // end for i.. loop
1229 } // end near
1230
1231 private bool checkDupe(d.ContactGeom contactGeom, int atype)
1232 {
1233 bool result = false;
1234 //return result;
1235 if (!m_filterCollisions)
1236 return false;
1237
1238 ActorTypes at = (ActorTypes)atype;
1239 lock (_perloopContact)
1240 {
1241 foreach (d.ContactGeom contact in _perloopContact)
1242 {
1243 //if ((contact.g1 == contactGeom.g1 && contact.g2 == contactGeom.g2))
1244 //{
1245 // || (contact.g2 == contactGeom.g1 && contact.g1 == contactGeom.g2)
1246 if (at == ActorTypes.Agent)
1247 {
1248 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)
1249 {
1250
1251 if (Math.Abs(contact.depth - contactGeom.depth) < 0.052f)
1252 {
1253 //contactGeom.depth *= .00005f;
1254 //m_log.DebugFormat("[Collsion]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth));
1255 // 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));
1256 result = true;
1257 break;
1258 }
1259 else
1260 {
1261 //m_log.DebugFormat("[Collsion]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth));
1262 }
1263 }
1264 else
1265 {
1266 //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));
1267 //int i = 0;
1268 }
1269 }
1270 else if (at == ActorTypes.Prim)
1271 {
1272 //d.AABB aabb1 = new d.AABB();
1273 //d.AABB aabb2 = new d.AABB();
1274
1275 //d.GeomGetAABB(contactGeom.g2, out aabb2);
1276 //d.GeomGetAABB(contactGeom.g1, out aabb1);
1277 //aabb1.
1278 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)
1279 {
1280 if (contactGeom.normal.X == contact.normal.X && contactGeom.normal.Y == contact.normal.Y && contactGeom.normal.Z == contact.normal.Z)
1281 {
1282 if (Math.Abs(contact.depth - contactGeom.depth) < 0.272f)
1283 {
1284 result = true;
1285 break;
1286 }
1287 }
1288 //m_log.DebugFormat("[Collsion]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth));
1289 //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));
1290 }
1291
1292 }
1293
1294 //}
1295
1296 }
1297 }
1298 return result;
1299 }
1300
1301 private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, ContactPoint contact)
1302 {
1303 // obj1LocalID = 0;
1304 //returncollisions = false;
1305 obj2LocalID = 0;
1306 //ctype = 0;
1307 //cStartStop = 0;
1308 if (!p2.SubscribedEvents() && !p1.SubscribedEvents())
1309 return;
1310
1311 switch ((ActorTypes)p2.PhysicsActorType)
1312 {
1313 case ActorTypes.Agent:
1314 cc2 = (OdeCharacter)p2;
1315
1316 // obj1LocalID = cc2.m_localID;
1317 switch ((ActorTypes)p1.PhysicsActorType)
1318 {
1319 case ActorTypes.Agent:
1320 cc1 = (OdeCharacter)p1;
1321 obj2LocalID = cc1.m_localID;
1322 cc1.AddCollisionEvent(cc2.m_localID, contact);
1323 //ctype = (int)CollisionCategories.Character;
1324
1325 //if (cc1.CollidingObj)
1326 //cStartStop = (int)StatusIndicators.Generic;
1327 //else
1328 //cStartStop = (int)StatusIndicators.Start;
1329
1330 //returncollisions = true;
1331 break;
1332 case ActorTypes.Prim:
1333 if (p1 is OdePrim)
1334 {
1335 cp1 = (OdePrim) p1;
1336 obj2LocalID = cp1.m_localID;
1337 cp1.AddCollisionEvent(cc2.m_localID, contact);
1338 }
1339 //ctype = (int)CollisionCategories.Geom;
1340
1341 //if (cp1.CollidingObj)
1342 //cStartStop = (int)StatusIndicators.Generic;
1343 //else
1344 //cStartStop = (int)StatusIndicators.Start;
1345
1346 //returncollisions = true;
1347 break;
1348
1349 case ActorTypes.Ground:
1350 case ActorTypes.Unknown:
1351 obj2LocalID = 0;
1352 //ctype = (int)CollisionCategories.Land;
1353 //returncollisions = true;
1354 break;
1355 }
1356
1357 cc2.AddCollisionEvent(obj2LocalID, contact);
1358 break;
1359 case ActorTypes.Prim:
1360
1361 if (p2 is OdePrim)
1362 {
1363 cp2 = (OdePrim) p2;
1364
1365 // obj1LocalID = cp2.m_localID;
1366 switch ((ActorTypes) p1.PhysicsActorType)
1367 {
1368 case ActorTypes.Agent:
1369 if (p1 is OdeCharacter)
1370 {
1371 cc1 = (OdeCharacter) p1;
1372 obj2LocalID = cc1.m_localID;
1373 cc1.AddCollisionEvent(cp2.m_localID, contact);
1374 //ctype = (int)CollisionCategories.Character;
1375
1376 //if (cc1.CollidingObj)
1377 //cStartStop = (int)StatusIndicators.Generic;
1378 //else
1379 //cStartStop = (int)StatusIndicators.Start;
1380 //returncollisions = true;
1381 }
1382 break;
1383 case ActorTypes.Prim:
1384
1385 if (p1 is OdePrim)
1386 {
1387 cp1 = (OdePrim) p1;
1388 obj2LocalID = cp1.m_localID;
1389 cp1.AddCollisionEvent(cp2.m_localID, contact);
1390 //ctype = (int)CollisionCategories.Geom;
1391
1392 //if (cp1.CollidingObj)
1393 //cStartStop = (int)StatusIndicators.Generic;
1394 //else
1395 //cStartStop = (int)StatusIndicators.Start;
1396
1397 //returncollisions = true;
1398 }
1399 break;
1400
1401 case ActorTypes.Ground:
1402 case ActorTypes.Unknown:
1403 obj2LocalID = 0;
1404 //ctype = (int)CollisionCategories.Land;
1405
1406 //returncollisions = true;
1407 break;
1408 }
1409
1410 cp2.AddCollisionEvent(obj2LocalID, contact);
1411 }
1412 break;
1413 }
1414 //if (returncollisions)
1415 //{
1416
1417 //lock (m_storedCollisions)
1418 //{
1419 //cDictKey = obj1LocalID.ToString() + obj2LocalID.ToString() + cStartStop.ToString() + ctype.ToString();
1420 //if (m_storedCollisions.ContainsKey(cDictKey))
1421 //{
1422 //sCollisionData objd = m_storedCollisions[cDictKey];
1423 //objd.NumberOfCollisions += 1;
1424 //objd.lastframe = framecount;
1425 //m_storedCollisions[cDictKey] = objd;
1426 //}
1427 //else
1428 //{
1429 //sCollisionData objd = new sCollisionData();
1430 //objd.ColliderLocalId = obj1LocalID;
1431 //objd.CollidedWithLocalId = obj2LocalID;
1432 //objd.CollisionType = ctype;
1433 //objd.NumberOfCollisions = 1;
1434 //objd.lastframe = framecount;
1435 //objd.StatusIndicator = cStartStop;
1436 //m_storedCollisions.Add(cDictKey, objd);
1437 //}
1438 //}
1439 // }
1440 }
1441
1442 public int TriArrayCallback(IntPtr trimesh, IntPtr refObject, int[] triangleIndex, int triCount)
1443 {
1444 /* String name1 = null;
1445 String name2 = null;
1446
1447 if (!geom_name_map.TryGetValue(trimesh, out name1))
1448 {
1449 name1 = "null";
1450 }
1451 if (!geom_name_map.TryGetValue(refObject, out name2))
1452 {
1453 name2 = "null";
1454 }
1455
1456 m_log.InfoFormat("TriArrayCallback: A collision was detected between {1} and {2}", 0, name1, name2);
1457 */
1458 return 1;
1459 }
1460
1461 public int TriCallback(IntPtr trimesh, IntPtr refObject, int triangleIndex)
1462 {
1463 String name1 = null;
1464 String name2 = null;
1465
1466 if (!geom_name_map.TryGetValue(trimesh, out name1))
1467 {
1468 name1 = "null";
1469 }
1470
1471 if (!geom_name_map.TryGetValue(refObject, out name2))
1472 {
1473 name2 = "null";
1474 }
1475
1476 // m_log.InfoFormat("TriCallback: A collision was detected between {1} and {2}. Index was {3}", 0, name1, name2, triangleIndex);
1477
1478 d.Vector3 v0 = new d.Vector3();
1479 d.Vector3 v1 = new d.Vector3();
1480 d.Vector3 v2 = new d.Vector3();
1481
1482 d.GeomTriMeshGetTriangle(trimesh, 0, ref v0, ref v1, ref v2);
1483 // 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);
1484
1485 return 1;
1486 }
1487
1488 /// <summary>
1489 /// This is our collision testing routine in ODE
1490 /// </summary>
1491 /// <param name="timeStep"></param>
1492 private void collision_optimized(float timeStep)
1493 {
1494 _perloopContact.Clear();
1495
1496 lock (_characters)
1497 {
1498 foreach (OdeCharacter chr in _characters)
1499 {
1500 // Reset the collision values to false
1501 // since we don't know if we're colliding yet
1502
1503 // For some reason this can happen. Don't ask...
1504 //
1505 if (chr == null)
1506 continue;
1507
1508 if (chr.Shell == IntPtr.Zero || chr.Body == IntPtr.Zero)
1509 continue;
1510
1511 chr.IsColliding = false;
1512 chr.CollidingGround = false;
1513 chr.CollidingObj = false;
1514
1515 // test the avatar's geometry for collision with the space
1516 // This will return near and the space that they are the closest to
1517 // And we'll run this again against the avatar and the space segment
1518 // This will return with a bunch of possible objects in the space segment
1519 // and we'll run it again on all of them.
1520 try
1521 {
1522 d.SpaceCollide2(space, chr.Shell, IntPtr.Zero, nearCallback);
1523 }
1524 catch (AccessViolationException)
1525 {
1526 m_log.Warn("[PHYSICS]: Unable to space collide");
1527 }
1528 //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y);
1529 //if (chr.Position.Z + (chr.Velocity.Z * timeStep) < terrainheight + 10)
1530 //{
1531 //chr.Position.Z = terrainheight + 10.0f;
1532 //forcedZ = true;
1533 //}
1534 }
1535 }
1536
1537 lock (_activeprims)
1538 {
1539 List<OdePrim> removeprims = null;
1540 foreach (OdePrim chr in _activeprims)
1541 {
1542 if (chr.Body != IntPtr.Zero && d.BodyIsEnabled(chr.Body) && (!chr.m_disabled) && !chr.m_outofBounds)
1543 {
1544 try
1545 {
1546 lock (chr)
1547 {
1548 if (space != IntPtr.Zero && chr.prim_geom != IntPtr.Zero && chr.m_taintremove == false)
1549 {
1550 d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback);
1551 }
1552 else
1553 {
1554 if (removeprims == null)
1555 {
1556 removeprims = new List<OdePrim>();
1557 }
1558 removeprims.Add(chr);
1559 /// Commented this because it triggers on every bullet
1560 //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!");
1561 }
1562 }
1563 }
1564 catch (AccessViolationException)
1565 {
1566 m_log.Warn("[PHYSICS]: Unable to space collide");
1567 }
1568 }
1569 }
1570 if (removeprims != null)
1571 {
1572 foreach (OdePrim chr in removeprims)
1573 {
1574 _activeprims.Remove(chr);
1575 }
1576 }
1577 }
1578
1579 _perloopContact.Clear();
1580 }
1581
1582 #endregion
1583
1584 public override void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents)
1585 {
1586 m_worldOffset = offset;
1587 WorldExtents = new Vector2(extents.X, extents.Y);
1588 m_parentScene = pScene;
1589
1590 }
1591
1592 // Recovered for use by fly height. Kitto Flora
1593 public float GetTerrainHeightAtXY(float x, float y)
1594 {
1595
1596 int offsetX = ((int)(x / (int)Constants.RegionSize)) * (int)Constants.RegionSize;
1597 int offsetY = ((int)(y / (int)Constants.RegionSize)) * (int)Constants.RegionSize;
1598
1599 IntPtr heightFieldGeom = IntPtr.Zero;
1600
1601 if (RegionTerrain.TryGetValue(new Vector3(offsetX,offsetY,0), out heightFieldGeom))
1602 {
1603 if (heightFieldGeom != IntPtr.Zero)
1604 {
1605 if (TerrainHeightFieldHeights.ContainsKey(heightFieldGeom))
1606 {
1607
1608 int index;
1609
1610
1611 if ((int)x > WorldExtents.X || (int)y > WorldExtents.Y ||
1612 (int)x < 0.001f || (int)y < 0.001f)
1613 return 0;
1614
1615 x = x - offsetX;
1616 y = y - offsetY;
1617
1618 index = (int)((int)x * ((int)Constants.RegionSize + 2) + (int)y);
1619
1620 if (index < TerrainHeightFieldHeights[heightFieldGeom].Length)
1621 {
1622 //m_log.DebugFormat("x{0} y{1} = {2}", x, y, (float)TerrainHeightFieldHeights[heightFieldGeom][index]);
1623 return (float)TerrainHeightFieldHeights[heightFieldGeom][index];
1624 }
1625
1626 else
1627 return 0f;
1628 }
1629 else
1630 {
1631 return 0f;
1632 }
1633
1634 }
1635 else
1636 {
1637 return 0f;
1638 }
1639
1640 }
1641 else
1642 {
1643 return 0f;
1644 }
1645
1646
1647 }
1648// End recovered. Kitto Flora
1649
1650 public void addCollisionEventReporting(PhysicsActor obj)
1651 {
1652 lock (_collisionEventPrim)
1653 {
1654 if (!_collisionEventPrim.Contains(obj))
1655 _collisionEventPrim.Add(obj);
1656 }
1657 }
1658
1659 public void remCollisionEventReporting(PhysicsActor obj)
1660 {
1661 lock (_collisionEventPrim)
1662 {
1663 if (!_collisionEventPrim.Contains(obj))
1664 _collisionEventPrim.Remove(obj);
1665 }
1666 }
1667
1668 #region Add/Remove Entities
1669
1670 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
1671 {
1672 Vector3 pos;
1673 pos.X = position.X;
1674 pos.Y = position.Y;
1675 pos.Z = position.Z;
1676 OdeCharacter newAv = new OdeCharacter(avName, this, pos, ode, size, avPIDD, avPIDP, avCapRadius, avStandupTensor, avDensity, avHeightFudgeFactor, avMovementDivisorWalk, avMovementDivisorRun);
1677 newAv.Flying = isFlying;
1678 newAv.MinimumGroundFlightOffset = minimumGroundFlightOffset;
1679
1680 return newAv;
1681 }
1682
1683 public void AddCharacter(OdeCharacter chr)
1684 {
1685 lock (_characters)
1686 {
1687 if (!_characters.Contains(chr))
1688 {
1689 _characters.Add(chr);
1690 if (chr.bad)
1691 m_log.DebugFormat("[PHYSICS] Added BAD actor {0} to characters list", chr.m_uuid);
1692 }
1693 }
1694 }
1695
1696 public void RemoveCharacter(OdeCharacter chr)
1697 {
1698 lock (_characters)
1699 {
1700 if (_characters.Contains(chr))
1701 {
1702 _characters.Remove(chr);
1703 }
1704 }
1705 }
1706 public void BadCharacter(OdeCharacter chr)
1707 {
1708 lock (_badCharacter)
1709 {
1710 if (!_badCharacter.Contains(chr))
1711 _badCharacter.Add(chr);
1712 }
1713 }
1714
1715 public override void RemoveAvatar(PhysicsActor actor)
1716 {
1717 //m_log.Debug("[PHYSICS]:ODELOCK");
1718 ((OdeCharacter) actor).Destroy();
1719
1720 }
1721
1722 private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
1723 IMesh mesh, PrimitiveBaseShape pbs, bool isphysical, bool isphantom, byte shapetype, uint localid)
1724 {
1725
1726 Vector3 pos = position;
1727 Vector3 siz = size;
1728 Quaternion rot = rotation;
1729
1730 OdePrim newPrim;
1731 lock (OdeLock)
1732 {
1733 newPrim = new OdePrim(name, this, pos, siz, rot, mesh, pbs, isphysical, isphantom, shapetype, ode, localid);
1734
1735 lock (_prims)
1736 _prims.Add(newPrim);
1737 }
1738
1739 return newPrim;
1740 }
1741
1742
1743 public void addActivePrim(OdePrim activatePrim)
1744 {
1745 // adds active prim.. (ones that should be iterated over in collisions_optimized
1746 lock (_activeprims)
1747 {
1748 if (!_activeprims.Contains(activatePrim))
1749 _activeprims.Add(activatePrim);
1750 //else
1751 // m_log.Warn("[PHYSICS]: Double Entry in _activeprims detected, potential crash immenent");
1752 }
1753 }
1754
1755 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
1756 Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
1757 {
1758 PhysicsActor result;
1759 IMesh mesh = null;
1760
1761 if (needsMeshing(pbs))
1762 mesh = mesher.CreateMesh(primName, pbs, size, (int)LevelOfDetail.High, true);
1763
1764 result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical,false,0, localid);
1765
1766 return result;
1767 }
1768
1769 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
1770 Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, uint localid)
1771 {
1772 PhysicsActor result;
1773 IMesh mesh = null;
1774
1775 if (needsMeshing(pbs))
1776 mesh = mesher.CreateMesh(primName, pbs, size, (int)LevelOfDetail.High, true);
1777
1778 result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, isPhantom,0, localid);
1779
1780 return result;
1781 }
1782
1783 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
1784 Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapetype, uint localid)
1785 {
1786 PhysicsActor result;
1787 IMesh mesh = null;
1788
1789 if (needsMeshing(pbs))
1790 mesh = mesher.CreateMesh(primName, pbs, size, (int)LevelOfDetail.High, true);
1791
1792 result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, isPhantom, shapetype, localid);
1793
1794 return result;
1795 }
1796
1797 public override float TimeDilation
1798 {
1799 get { return m_timeDilation; }
1800 }
1801
1802 public override bool SupportsNINJAJoints
1803 {
1804 get { return m_NINJA_physics_joints_enabled; }
1805 }
1806
1807 // internal utility function: must be called within a lock (OdeLock)
1808 private void InternalAddActiveJoint(PhysicsJoint joint)
1809 {
1810 activeJoints.Add(joint);
1811 SOPName_to_activeJoint.Add(joint.ObjectNameInScene, joint);
1812 }
1813
1814 // internal utility function: must be called within a lock (OdeLock)
1815 private void InternalAddPendingJoint(OdePhysicsJoint joint)
1816 {
1817 pendingJoints.Add(joint);
1818 SOPName_to_pendingJoint.Add(joint.ObjectNameInScene, joint);
1819 }
1820
1821 // internal utility function: must be called within a lock (OdeLock)
1822 private void InternalRemovePendingJoint(PhysicsJoint joint)
1823 {
1824 pendingJoints.Remove(joint);
1825 SOPName_to_pendingJoint.Remove(joint.ObjectNameInScene);
1826 }
1827
1828 // internal utility function: must be called within a lock (OdeLock)
1829 private void InternalRemoveActiveJoint(PhysicsJoint joint)
1830 {
1831 activeJoints.Remove(joint);
1832 SOPName_to_activeJoint.Remove(joint.ObjectNameInScene);
1833 }
1834
1835 public override void DumpJointInfo()
1836 {
1837 string hdr = "[NINJA] JOINTINFO: ";
1838 foreach (PhysicsJoint j in pendingJoints)
1839 {
1840 m_log.Debug(hdr + " pending joint, Name: " + j.ObjectNameInScene + " raw parms:" + j.RawParams);
1841 }
1842 m_log.Debug(hdr + pendingJoints.Count + " total pending joints");
1843 foreach (string jointName in SOPName_to_pendingJoint.Keys)
1844 {
1845 m_log.Debug(hdr + " pending joints dict contains Name: " + jointName);
1846 }
1847 m_log.Debug(hdr + SOPName_to_pendingJoint.Keys.Count + " total pending joints dict entries");
1848 foreach (PhysicsJoint j in activeJoints)
1849 {
1850 m_log.Debug(hdr + " active joint, Name: " + j.ObjectNameInScene + " raw parms:" + j.RawParams);
1851 }
1852 m_log.Debug(hdr + activeJoints.Count + " total active joints");
1853 foreach (string jointName in SOPName_to_activeJoint.Keys)
1854 {
1855 m_log.Debug(hdr + " active joints dict contains Name: " + jointName);
1856 }
1857 m_log.Debug(hdr + SOPName_to_activeJoint.Keys.Count + " total active joints dict entries");
1858
1859 m_log.Debug(hdr + " Per-body joint connectivity information follows.");
1860 m_log.Debug(hdr + joints_connecting_actor.Keys.Count + " bodies are connected by joints.");
1861 foreach (string actorName in joints_connecting_actor.Keys)
1862 {
1863 m_log.Debug(hdr + " Actor " + actorName + " has the following joints connecting it");
1864 foreach (PhysicsJoint j in joints_connecting_actor[actorName])
1865 {
1866 m_log.Debug(hdr + " * joint Name: " + j.ObjectNameInScene + " raw parms:" + j.RawParams);
1867 }
1868 m_log.Debug(hdr + joints_connecting_actor[actorName].Count + " connecting joints total for this actor");
1869 }
1870 }
1871
1872 public override void RequestJointDeletion(string ObjectNameInScene)
1873 {
1874 lock (externalJointRequestsLock)
1875 {
1876 if (!requestedJointsToBeDeleted.Contains(ObjectNameInScene)) // forbid same deletion request from entering twice to prevent spurious deletions processed asynchronously
1877 {
1878 requestedJointsToBeDeleted.Add(ObjectNameInScene);
1879 }
1880 }
1881 }
1882
1883 private void DeleteRequestedJoints()
1884 {
1885 List<string> myRequestedJointsToBeDeleted;
1886 lock (externalJointRequestsLock)
1887 {
1888 // make a local copy of the shared list for processing (threading issues)
1889 myRequestedJointsToBeDeleted = new List<string>(requestedJointsToBeDeleted);
1890 }
1891
1892 foreach (string jointName in myRequestedJointsToBeDeleted)
1893 {
1894 lock (OdeLock)
1895 {
1896 //m_log.Debug("[NINJA] trying to deleting requested joint " + jointName);
1897 if (SOPName_to_activeJoint.ContainsKey(jointName) || SOPName_to_pendingJoint.ContainsKey(jointName))
1898 {
1899 OdePhysicsJoint joint = null;
1900 if (SOPName_to_activeJoint.ContainsKey(jointName))
1901 {
1902 joint = SOPName_to_activeJoint[jointName] as OdePhysicsJoint;
1903 InternalRemoveActiveJoint(joint);
1904 }
1905 else if (SOPName_to_pendingJoint.ContainsKey(jointName))
1906 {
1907 joint = SOPName_to_pendingJoint[jointName] as OdePhysicsJoint;
1908 InternalRemovePendingJoint(joint);
1909 }
1910
1911 if (joint != null)
1912 {
1913 //m_log.Debug("joint.BodyNames.Count is " + joint.BodyNames.Count + " and contents " + joint.BodyNames);
1914 for (int iBodyName = 0; iBodyName < 2; iBodyName++)
1915 {
1916 string bodyName = joint.BodyNames[iBodyName];
1917 if (bodyName != "NULL")
1918 {
1919 joints_connecting_actor[bodyName].Remove(joint);
1920 if (joints_connecting_actor[bodyName].Count == 0)
1921 {
1922 joints_connecting_actor.Remove(bodyName);
1923 }
1924 }
1925 }
1926
1927 DoJointDeactivated(joint);
1928 if (joint.jointID != IntPtr.Zero)
1929 {
1930 d.JointDestroy(joint.jointID);
1931 joint.jointID = IntPtr.Zero;
1932 //DoJointErrorMessage(joint, "successfully destroyed joint " + jointName);
1933 }
1934 else
1935 {
1936 //m_log.Warn("[NINJA] Ignoring re-request to destroy joint " + jointName);
1937 }
1938 }
1939 else
1940 {
1941 // DoJointErrorMessage(joint, "coult not find joint to destroy based on name " + jointName);
1942 }
1943 }
1944 else
1945 {
1946 // DoJointErrorMessage(joint, "WARNING - joint removal failed, joint " + jointName);
1947 }
1948 }
1949 }
1950
1951 // remove processed joints from the shared list
1952 lock (externalJointRequestsLock)
1953 {
1954 foreach (string jointName in myRequestedJointsToBeDeleted)
1955 {
1956 requestedJointsToBeDeleted.Remove(jointName);
1957 }
1958 }
1959 }
1960
1961 // for pending joints we don't know if their associated bodies exist yet or not.
1962 // the joint is actually created during processing of the taints
1963 private void CreateRequestedJoints()
1964 {
1965 List<PhysicsJoint> myRequestedJointsToBeCreated;
1966 lock (externalJointRequestsLock)
1967 {
1968 // make a local copy of the shared list for processing (threading issues)
1969 myRequestedJointsToBeCreated = new List<PhysicsJoint>(requestedJointsToBeCreated);
1970 }
1971
1972 foreach (PhysicsJoint joint in myRequestedJointsToBeCreated)
1973 {
1974 lock (OdeLock)
1975 {
1976 if (SOPName_to_pendingJoint.ContainsKey(joint.ObjectNameInScene) && SOPName_to_pendingJoint[joint.ObjectNameInScene] != null)
1977 {
1978 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);
1979 continue;
1980 }
1981 if (SOPName_to_activeJoint.ContainsKey(joint.ObjectNameInScene) && SOPName_to_activeJoint[joint.ObjectNameInScene] != null)
1982 {
1983 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);
1984 continue;
1985 }
1986
1987 InternalAddPendingJoint(joint as OdePhysicsJoint);
1988
1989 if (joint.BodyNames.Count >= 2)
1990 {
1991 for (int iBodyName = 0; iBodyName < 2; iBodyName++)
1992 {
1993 string bodyName = joint.BodyNames[iBodyName];
1994 if (bodyName != "NULL")
1995 {
1996 if (!joints_connecting_actor.ContainsKey(bodyName))
1997 {
1998 joints_connecting_actor.Add(bodyName, new List<PhysicsJoint>());
1999 }
2000 joints_connecting_actor[bodyName].Add(joint);
2001 }
2002 }
2003 }
2004 }
2005 }
2006
2007 // remove processed joints from shared list
2008 lock (externalJointRequestsLock)
2009 {
2010 foreach (PhysicsJoint joint in myRequestedJointsToBeCreated)
2011 {
2012 requestedJointsToBeCreated.Remove(joint);
2013 }
2014 }
2015
2016 }
2017
2018 // public function to add an request for joint creation
2019 // this joint will just be added to a waiting list that is NOT processed during the main
2020 // Simulate() loop (to avoid deadlocks). After Simulate() is finished, we handle unprocessed joint requests.
2021
2022 public override PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, Vector3 position,
2023 Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation)
2024
2025 {
2026
2027 OdePhysicsJoint joint = new OdePhysicsJoint();
2028 joint.ObjectNameInScene = objectNameInScene;
2029 joint.Type = jointType;
2030 joint.Position = position;
2031 joint.Rotation = rotation;
2032 joint.RawParams = parms;
2033 joint.BodyNames = new List<string>(bodyNames);
2034 joint.TrackedBodyName = trackedBodyName;
2035 joint.LocalRotation = localRotation;
2036 joint.jointID = IntPtr.Zero;
2037 joint.ErrorMessageCount = 0;
2038
2039 lock (externalJointRequestsLock)
2040 {
2041 if (!requestedJointsToBeCreated.Contains(joint)) // forbid same creation request from entering twice
2042 {
2043 requestedJointsToBeCreated.Add(joint);
2044 }
2045 }
2046 return joint;
2047 }
2048
2049 private void RemoveAllJointsConnectedToActor(PhysicsActor actor)
2050 {
2051 //m_log.Debug("RemoveAllJointsConnectedToActor: start");
2052 if (actor.SOPName != null && joints_connecting_actor.ContainsKey(actor.SOPName) && joints_connecting_actor[actor.SOPName] != null)
2053 {
2054
2055 List<PhysicsJoint> jointsToRemove = new List<PhysicsJoint>();
2056 //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)
2057 foreach (PhysicsJoint j in joints_connecting_actor[actor.SOPName])
2058 {
2059 jointsToRemove.Add(j);
2060 }
2061 foreach (PhysicsJoint j in jointsToRemove)
2062 {
2063 //m_log.Debug("RemoveAllJointsConnectedToActor: about to request deletion of " + j.ObjectNameInScene);
2064 RequestJointDeletion(j.ObjectNameInScene);
2065 //m_log.Debug("RemoveAllJointsConnectedToActor: done request deletion of " + j.ObjectNameInScene);
2066 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)
2067 }
2068 }
2069 }
2070
2071 public override void RemoveAllJointsConnectedToActorThreadLocked(PhysicsActor actor)
2072 {
2073 //m_log.Debug("RemoveAllJointsConnectedToActorThreadLocked: start");
2074 lock (OdeLock)
2075 {
2076 //m_log.Debug("RemoveAllJointsConnectedToActorThreadLocked: got lock");
2077 RemoveAllJointsConnectedToActor(actor);
2078 }
2079 }
2080
2081 // normally called from within OnJointMoved, which is called from within a lock (OdeLock)
2082 public override Vector3 GetJointAnchor(PhysicsJoint joint)
2083 {
2084 Debug.Assert(joint.IsInPhysicsEngine);
2085 d.Vector3 pos = new d.Vector3();
2086
2087 if (!(joint is OdePhysicsJoint))
2088 {
2089 DoJointErrorMessage(joint, "warning: non-ODE joint requesting anchor: " + joint.ObjectNameInScene);
2090 }
2091 else
2092 {
2093 OdePhysicsJoint odeJoint = (OdePhysicsJoint)joint;
2094 switch (odeJoint.Type)
2095 {
2096 case PhysicsJointType.Ball:
2097 d.JointGetBallAnchor(odeJoint.jointID, out pos);
2098 break;
2099 case PhysicsJointType.Hinge:
2100 d.JointGetHingeAnchor(odeJoint.jointID, out pos);
2101 break;
2102 }
2103 }
2104 return new Vector3(pos.X, pos.Y, pos.Z);
2105 }
2106
2107 // normally called from within OnJointMoved, which is called from within a lock (OdeLock)
2108 // WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function
2109 // appears to be unreliable. Fortunately we can compute the joint axis ourselves by
2110 // keeping track of the joint's original orientation relative to one of the involved bodies.
2111 public override Vector3 GetJointAxis(PhysicsJoint joint)
2112 {
2113 Debug.Assert(joint.IsInPhysicsEngine);
2114 d.Vector3 axis = new d.Vector3();
2115
2116 if (!(joint is OdePhysicsJoint))
2117 {
2118 DoJointErrorMessage(joint, "warning: non-ODE joint requesting anchor: " + joint.ObjectNameInScene);
2119 }
2120 else
2121 {
2122 OdePhysicsJoint odeJoint = (OdePhysicsJoint)joint;
2123 switch (odeJoint.Type)
2124 {
2125 case PhysicsJointType.Ball:
2126 DoJointErrorMessage(joint, "warning - axis requested for ball joint: " + joint.ObjectNameInScene);
2127 break;
2128 case PhysicsJointType.Hinge:
2129 d.JointGetHingeAxis(odeJoint.jointID, out axis);
2130 break;
2131 }
2132 }
2133 return new Vector3(axis.X, axis.Y, axis.Z);
2134 }
2135
2136
2137 public void remActivePrim(OdePrim deactivatePrim)
2138 {
2139 lock (_activeprims)
2140 {
2141 _activeprims.Remove(deactivatePrim);
2142 }
2143 }
2144
2145 public override void RemovePrim(PhysicsActor prim)
2146 {
2147 if (prim is OdePrim)
2148 {
2149 lock (OdeLock)
2150 {
2151 OdePrim p = (OdePrim) prim;
2152
2153 p.setPrimForRemoval();
2154 AddPhysicsActorTaint(prim);
2155 //RemovePrimThreadLocked(p);
2156 }
2157 }
2158 }
2159
2160 /// <summary>
2161 /// This is called from within simulate but outside the locked portion
2162 /// We need to do our own locking here
2163 /// Essentially, we need to remove the prim from our space segment, whatever segment it's in.
2164 ///
2165 /// If there are no more prim in the segment, we need to empty (spacedestroy)the segment and reclaim memory
2166 /// that the space was using.
2167 /// </summary>
2168 /// <param name="prim"></param>
2169 public void RemovePrimThreadLocked(OdePrim prim)
2170 {
2171//Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName);
2172 lock (prim)
2173 {
2174 remCollisionEventReporting(prim);
2175 lock (ode)
2176 {
2177 if (prim.prim_geom != IntPtr.Zero)
2178 {
2179 prim.ResetTaints();
2180
2181 try
2182 {
2183 if (prim._triMeshData != IntPtr.Zero)
2184 {
2185 d.GeomTriMeshDataDestroy(prim._triMeshData);
2186 prim._triMeshData = IntPtr.Zero;
2187 }
2188 }
2189 catch { };
2190
2191 if (prim.IsPhysical)
2192 {
2193 prim.disableBody();
2194 if (prim.childPrim)
2195 {
2196 prim.childPrim = false;
2197 prim.Body = IntPtr.Zero;
2198 prim.m_disabled = true;
2199 prim.IsPhysical = false;
2200 }
2201
2202 }
2203 // we don't want to remove the main space
2204
2205 // If the geometry is in the targetspace, remove it from the target space
2206 //m_log.Warn(prim.m_targetSpace);
2207
2208 //if (prim.m_targetSpace != IntPtr.Zero)
2209 //{
2210 //if (d.SpaceQuery(prim.m_targetSpace, prim.prim_geom))
2211 //{
2212
2213 //if (d.GeomIsSpace(prim.m_targetSpace))
2214 //{
2215 //waitForSpaceUnlock(prim.m_targetSpace);
2216 //d.SpaceRemove(prim.m_targetSpace, prim.prim_geom);
2217 prim.m_targetSpace = IntPtr.Zero;
2218 //}
2219 //else
2220 //{
2221 // m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" +
2222 //((OdePrim)prim).m_targetSpace.ToString());
2223 //}
2224
2225 //}
2226 //}
2227 //m_log.Warn(prim.prim_geom);
2228 try
2229 {
2230 if (prim.prim_geom != IntPtr.Zero)
2231 {
2232
2233//string tPA;
2234//geom_name_map.TryGetValue(prim.prim_geom, out tPA);
2235//Console.WriteLine("**** Remove {0}", tPA);
2236 if(geom_name_map.ContainsKey(prim.prim_geom)) geom_name_map.Remove(prim.prim_geom);
2237 if(actor_name_map.ContainsKey(prim.prim_geom)) actor_name_map.Remove(prim.prim_geom);
2238 d.GeomDestroy(prim.prim_geom);
2239 prim.prim_geom = IntPtr.Zero;
2240 }
2241 else
2242 {
2243 m_log.Warn("[PHYSICS]: Unable to remove prim from physics scene");
2244 }
2245 }
2246 catch (AccessViolationException)
2247 {
2248 m_log.Info("[PHYSICS]: Couldn't remove prim from physics scene, it was already be removed.");
2249 }
2250 lock (_prims)
2251 _prims.Remove(prim);
2252
2253 //If there are no more geometries in the sub-space, we don't need it in the main space anymore
2254 //if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0)
2255 //{
2256 //if (prim.m_targetSpace != null)
2257 //{
2258 //if (d.GeomIsSpace(prim.m_targetSpace))
2259 //{
2260 //waitForSpaceUnlock(prim.m_targetSpace);
2261 //d.SpaceRemove(space, prim.m_targetSpace);
2262 // free up memory used by the space.
2263 //d.SpaceDestroy(prim.m_targetSpace);
2264 //int[] xyspace = calculateSpaceArrayItemFromPos(prim.Position);
2265 //resetSpaceArrayItemToZero(xyspace[0], xyspace[1]);
2266 //}
2267 //else
2268 //{
2269 //m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" +
2270 //((OdePrim) prim).m_targetSpace.ToString());
2271 //}
2272 //}
2273 //}
2274
2275 if (SupportsNINJAJoints)
2276 {
2277 RemoveAllJointsConnectedToActorThreadLocked(prim);
2278 }
2279 }
2280 }
2281 }
2282 }
2283
2284 #endregion
2285
2286 #region Space Separation Calculation
2287
2288 /// <summary>
2289 /// Takes a space pointer and zeros out the array we're using to hold the spaces
2290 /// </summary>
2291 /// <param name="pSpace"></param>
2292 public void resetSpaceArrayItemToZero(IntPtr pSpace)
2293 {
2294 for (int x = 0; x < staticPrimspace.GetLength(0); x++)
2295 {
2296 for (int y = 0; y < staticPrimspace.GetLength(1); y++)
2297 {
2298 if (staticPrimspace[x, y] == pSpace)
2299 staticPrimspace[x, y] = IntPtr.Zero;
2300 }
2301 }
2302 }
2303
2304 public void resetSpaceArrayItemToZero(int arrayitemX, int arrayitemY)
2305 {
2306 staticPrimspace[arrayitemX, arrayitemY] = IntPtr.Zero;
2307 }
2308
2309 /// <summary>
2310 /// Called when a static prim moves. Allocates a space for the prim based on its position
2311 /// </summary>
2312 /// <param name="geom">the pointer to the geom that moved</param>
2313 /// <param name="pos">the position that the geom moved to</param>
2314 /// <param name="currentspace">a pointer to the space it was in before it was moved.</param>
2315 /// <returns>a pointer to the new space it's in</returns>
2316 public IntPtr recalculateSpaceForGeom(IntPtr geom, Vector3 pos, IntPtr currentspace)
2317 {
2318 // Called from setting the Position and Size of an ODEPrim so
2319 // it's already in locked space.
2320
2321 // we don't want to remove the main space
2322 // we don't need to test physical here because this function should
2323 // never be called if the prim is physical(active)
2324
2325 // All physical prim end up in the root space
2326 //Thread.Sleep(20);
2327 if (currentspace != space)
2328 {
2329 //m_log.Info("[SPACE]: C:" + currentspace.ToString() + " g:" + geom.ToString());
2330 //if (currentspace == IntPtr.Zero)
2331 //{
2332 //int adfadf = 0;
2333 //}
2334 if (d.SpaceQuery(currentspace, geom) && currentspace != IntPtr.Zero)
2335 {
2336 if (d.GeomIsSpace(currentspace))
2337 {
2338 waitForSpaceUnlock(currentspace);
2339 d.SpaceRemove(currentspace, geom);
2340 }
2341 else
2342 {
2343 m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" + currentspace +
2344 " Geom:" + geom);
2345 }
2346 }
2347 else
2348 {
2349 IntPtr sGeomIsIn = d.GeomGetSpace(geom);
2350 if (sGeomIsIn != IntPtr.Zero)
2351 {
2352 if (d.GeomIsSpace(currentspace))
2353 {
2354 waitForSpaceUnlock(sGeomIsIn);
2355 d.SpaceRemove(sGeomIsIn, geom);
2356 }
2357 else
2358 {
2359 m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" +
2360 sGeomIsIn + " Geom:" + geom);
2361 }
2362 }
2363 }
2364
2365 //If there are no more geometries in the sub-space, we don't need it in the main space anymore
2366 if (d.SpaceGetNumGeoms(currentspace) == 0)
2367 {
2368 if (currentspace != IntPtr.Zero)
2369 {
2370 if (d.GeomIsSpace(currentspace))
2371 {
2372 waitForSpaceUnlock(currentspace);
2373 waitForSpaceUnlock(space);
2374 d.SpaceRemove(space, currentspace);
2375 // free up memory used by the space.
2376
2377 //d.SpaceDestroy(currentspace);
2378 resetSpaceArrayItemToZero(currentspace);
2379 }
2380 else
2381 {
2382 m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" +
2383 currentspace + " Geom:" + geom);
2384 }
2385 }
2386 }
2387 }
2388 else
2389 {
2390 // this is a physical object that got disabled. ;.;
2391 if (currentspace != IntPtr.Zero && geom != IntPtr.Zero)
2392 {
2393 if (d.SpaceQuery(currentspace, geom))
2394 {
2395 if (d.GeomIsSpace(currentspace))
2396 {
2397 waitForSpaceUnlock(currentspace);
2398 d.SpaceRemove(currentspace, geom);
2399 }
2400 else
2401 {
2402 m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" +
2403 currentspace + " Geom:" + geom);
2404 }
2405 }
2406 else
2407 {
2408 IntPtr sGeomIsIn = d.GeomGetSpace(geom);
2409 if (sGeomIsIn != IntPtr.Zero)
2410 {
2411 if (d.GeomIsSpace(sGeomIsIn))
2412 {
2413 waitForSpaceUnlock(sGeomIsIn);
2414 d.SpaceRemove(sGeomIsIn, geom);
2415 }
2416 else
2417 {
2418 m_log.Info("[Physics]: Invalid Scene passed to 'recalculatespace':" +
2419 sGeomIsIn + " Geom:" + geom);
2420 }
2421 }
2422 }
2423 }
2424 }
2425
2426 // The routines in the Position and Size sections do the 'inserting' into the space,
2427 // so all we have to do is make sure that the space that we're putting the prim into
2428 // is in the 'main' space.
2429 int[] iprimspaceArrItem = calculateSpaceArrayItemFromPos(pos);
2430 IntPtr newspace = calculateSpaceForGeom(pos);
2431
2432 if (newspace == IntPtr.Zero)
2433 {
2434 newspace = createprimspace(iprimspaceArrItem[0], iprimspaceArrItem[1]);
2435 d.HashSpaceSetLevels(newspace, smallHashspaceLow, smallHashspaceHigh);
2436 }
2437
2438 return newspace;
2439 }
2440
2441 /// <summary>
2442 /// Creates a new space at X Y
2443 /// </summary>
2444 /// <param name="iprimspaceArrItemX"></param>
2445 /// <param name="iprimspaceArrItemY"></param>
2446 /// <returns>A pointer to the created space</returns>
2447 public IntPtr createprimspace(int iprimspaceArrItemX, int iprimspaceArrItemY)
2448 {
2449 // creating a new space for prim and inserting it into main space.
2450 staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = d.HashSpaceCreate(IntPtr.Zero);
2451 d.GeomSetCategoryBits(staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY], (int)CollisionCategories.Space);
2452 waitForSpaceUnlock(space);
2453 d.SpaceSetSublevel(space, 1);
2454 d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]);
2455 return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY];
2456 }
2457
2458 /// <summary>
2459 /// Calculates the space the prim should be in by its position
2460 /// </summary>
2461 /// <param name="pos"></param>
2462 /// <returns>a pointer to the space. This could be a new space or reused space.</returns>
2463 public IntPtr calculateSpaceForGeom(Vector3 pos)
2464 {
2465 int[] xyspace = calculateSpaceArrayItemFromPos(pos);
2466 //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString());
2467 return staticPrimspace[xyspace[0], xyspace[1]];
2468 }
2469
2470 /// <summary>
2471 /// Holds the space allocation logic
2472 /// </summary>
2473 /// <param name="pos"></param>
2474 /// <returns>an array item based on the position</returns>
2475 public int[] calculateSpaceArrayItemFromPos(Vector3 pos)
2476 {
2477 int[] returnint = new int[2];
2478
2479 returnint[0] = (int) (pos.X/metersInSpace);
2480
2481 if (returnint[0] > ((int) (259f/metersInSpace)))
2482 returnint[0] = ((int) (259f/metersInSpace));
2483 if (returnint[0] < 0)
2484 returnint[0] = 0;
2485
2486 returnint[1] = (int) (pos.Y/metersInSpace);
2487 if (returnint[1] > ((int) (259f/metersInSpace)))
2488 returnint[1] = ((int) (259f/metersInSpace));
2489 if (returnint[1] < 0)
2490 returnint[1] = 0;
2491
2492 return returnint;
2493 }
2494
2495 #endregion
2496
2497 /// <summary>
2498 /// Routine to figure out if we need to mesh this prim with our mesher
2499 /// </summary>
2500 /// <param name="pbs"></param>
2501 /// <returns></returns>
2502 public bool needsMeshing(PrimitiveBaseShape pbs)
2503 {
2504 // most of this is redundant now as the mesher will return null if it cant mesh a prim
2505 // but we still need to check for sculptie meshing being enabled so this is the most
2506 // convenient place to do it for now...
2507
2508 // //if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle && pbs.ProfileCurve == (byte)Primitive.ProfileCurve.Circle && pbs.PathScaleY <= 0.75f)
2509 // //m_log.Debug("needsMeshing: " + " pathCurve: " + pbs.PathCurve.ToString() + " profileCurve: " + pbs.ProfileCurve.ToString() + " pathScaleY: " + Primitive.UnpackPathScale(pbs.PathScaleY).ToString());
2510 int iPropertiesNotSupportedDefault = 0;
2511
2512 if (pbs.SculptEntry && !meshSculptedPrim)
2513 {
2514#if SPAM
2515 m_log.Warn("NonMesh");
2516#endif
2517 return false;
2518 }
2519
2520 // 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
2521 if (!forceSimplePrimMeshing && !pbs.SculptEntry)
2522 {
2523 if ((pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight)
2524 || (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1
2525 && pbs.Scale.X == pbs.Scale.Y && pbs.Scale.Y == pbs.Scale.Z))
2526 {
2527
2528 if (pbs.ProfileBegin == 0 && pbs.ProfileEnd == 0
2529 && pbs.ProfileHollow == 0
2530 && pbs.PathTwist == 0 && pbs.PathTwistBegin == 0
2531 && pbs.PathBegin == 0 && pbs.PathEnd == 0
2532 && pbs.PathTaperX == 0 && pbs.PathTaperY == 0
2533 && pbs.PathScaleX == 100 && pbs.PathScaleY == 100
2534 && pbs.PathShearX == 0 && pbs.PathShearY == 0)
2535 {
2536#if SPAM
2537 m_log.Warn("NonMesh");
2538#endif
2539 return false;
2540 }
2541 }
2542 }
2543
2544 if (forceSimplePrimMeshing)
2545 return true;
2546
2547 if (pbs.ProfileHollow != 0)
2548 iPropertiesNotSupportedDefault++;
2549
2550 if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0))
2551 iPropertiesNotSupportedDefault++;
2552
2553 if ((pbs.ProfileBegin != 0) || pbs.ProfileEnd != 0)
2554 iPropertiesNotSupportedDefault++;
2555
2556 if ((pbs.PathScaleX != 100) || (pbs.PathScaleY != 100))
2557 iPropertiesNotSupportedDefault++;
2558
2559 if ((pbs.PathShearX != 0) || (pbs.PathShearY != 0))
2560 iPropertiesNotSupportedDefault++;
2561
2562 if (pbs.ProfileShape == ProfileShape.Circle && pbs.PathCurve == (byte)Extrusion.Straight)
2563 iPropertiesNotSupportedDefault++;
2564
2565 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))
2566 iPropertiesNotSupportedDefault++;
2567
2568 if (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte) Extrusion.Curve1)
2569 iPropertiesNotSupportedDefault++;
2570
2571 // test for torus
2572 if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.Square)
2573 {
2574 if (pbs.PathCurve == (byte)Extrusion.Curve1)
2575 {
2576 iPropertiesNotSupportedDefault++;
2577 }
2578 }
2579 else if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.Circle)
2580 {
2581 if (pbs.PathCurve == (byte)Extrusion.Straight)
2582 {
2583 iPropertiesNotSupportedDefault++;
2584 }
2585
2586 // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits
2587 else if (pbs.PathCurve == (byte)Extrusion.Curve1)
2588 {
2589 iPropertiesNotSupportedDefault++;
2590 }
2591 }
2592 else if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle)
2593 {
2594 if (pbs.PathCurve == (byte)Extrusion.Curve1 || pbs.PathCurve == (byte)Extrusion.Curve2)
2595 {
2596 iPropertiesNotSupportedDefault++;
2597 }
2598 }
2599 else if ((pbs.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle)
2600 {
2601 if (pbs.PathCurve == (byte)Extrusion.Straight)
2602 {
2603 iPropertiesNotSupportedDefault++;
2604 }
2605 else if (pbs.PathCurve == (byte)Extrusion.Curve1)
2606 {
2607 iPropertiesNotSupportedDefault++;
2608 }
2609 }
2610
2611 if (pbs.SculptEntry && meshSculptedPrim)
2612 iPropertiesNotSupportedDefault++;
2613
2614 if (iPropertiesNotSupportedDefault == 0)
2615 {
2616#if SPAM
2617 m_log.Warn("NonMesh");
2618#endif
2619 return false;
2620 }
2621#if SPAM
2622 m_log.Debug("Mesh");
2623#endif
2624 return true;
2625 }
2626
2627 /// <summary>
2628 /// Called after our prim properties are set Scale, position etc.
2629 /// We use this event queue like method to keep changes to the physical scene occuring in the threadlocked mutex
2630 /// This assures us that we have no race conditions
2631 /// </summary>
2632 /// <param name="prim"></param>
2633 public override void AddPhysicsActorTaint(PhysicsActor prim)
2634 {
2635
2636 if (prim is OdePrim)
2637 {
2638 OdePrim taintedprim = ((OdePrim) prim);
2639 lock (_taintedPrimLock)
2640 {
2641 if (!(_taintedPrimH.Contains(taintedprim)))
2642 {
2643//Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.m_primName);
2644 _taintedPrimH.Add(taintedprim); // HashSet for searching
2645 _taintedPrimL.Add(taintedprim); // List for ordered readout
2646 }
2647 }
2648 return;
2649 }
2650 else if (prim is OdeCharacter)
2651 {
2652 OdeCharacter taintedchar = ((OdeCharacter)prim);
2653 lock (_taintedActors)
2654 {
2655 if (!(_taintedActors.Contains(taintedchar)))
2656 {
2657 _taintedActors.Add(taintedchar);
2658 if (taintedchar.bad)
2659 m_log.DebugFormat("[PHYSICS]: Added BAD actor {0} to tainted actors", taintedchar.m_uuid);
2660 }
2661 }
2662 }
2663 }
2664
2665 /// <summary>
2666 /// This is our main simulate loop
2667 /// It's thread locked by a Mutex in the scene.
2668 /// It holds Collisions, it instructs ODE to step through the physical reactions
2669 /// It moves the objects around in memory
2670 /// It calls the methods that report back to the object owners.. (scenepresence, SceneObjectGroup)
2671 /// </summary>
2672 /// <param name="timeStep"></param>
2673 /// <returns></returns>
2674 public override float Simulate(float timeStep)
2675 {
2676 if (framecount >= int.MaxValue)
2677 framecount = 0;
2678 //if (m_worldOffset != Vector3.Zero)
2679 // return 0;
2680
2681 framecount++;
2682
2683 DateTime now = DateTime.UtcNow;
2684 TimeSpan SinceLastFrame = now - m_lastframe;
2685 m_lastframe = now;
2686 float realtime = (float)SinceLastFrame.TotalSeconds;
2687// Console.WriteLine("ts={0} rt={1}", timeStep, realtime);
2688 timeStep = realtime;
2689
2690 // float fps = 1.0f / realtime;
2691 float fps = 0.0f; // number of ODE steps in this Simulate step
2692 //m_log.Info(timeStep.ToString());
2693 step_time += timeStep;
2694
2695 // If We're loaded down by something else,
2696 // or debugging with the Visual Studio project on pause
2697 // skip a few frames to catch up gracefully.
2698 // without shooting the physicsactors all over the place
2699
2700 if (step_time >= m_SkipFramesAtms)
2701 {
2702 // Instead of trying to catch up, it'll do 5 physics frames only
2703 step_time = ODE_STEPSIZE;
2704 m_physicsiterations = 5;
2705 }
2706 else
2707 {
2708 m_physicsiterations = 10;
2709 }
2710
2711 if (SupportsNINJAJoints)
2712 {
2713 DeleteRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
2714 CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
2715 }
2716
2717 lock (OdeLock)
2718 {
2719 // Process 10 frames if the sim is running normal..
2720 // process 5 frames if the sim is running slow
2721 //try
2722 //{
2723 //d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
2724 //}
2725 //catch (StackOverflowException)
2726 //{
2727 // m_log.Error("[PHYSICS]: The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim.");
2728 // ode.drelease(world);
2729 //base.TriggerPhysicsBasedRestart();
2730 //}
2731
2732 int i = 0;
2733
2734 // Figure out the Frames Per Second we're going at.
2735 //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size
2736
2737 // fps = (step_time / ODE_STEPSIZE) * 1000;
2738 // HACK: Using a time dilation of 1.0 to debug rubberbanding issues
2739 //m_timeDilation = Math.Min((step_time / ODE_STEPSIZE) / (0.09375f / ODE_STEPSIZE), 1.0f);
2740
2741 // step_time = 0.09375f;
2742
2743 while (step_time > 0.0f)
2744 {
2745 //lock (ode)
2746 //{
2747 //if (!ode.lockquery())
2748 //{
2749 // ode.dlock(world);
2750 try
2751 {
2752 // Insert, remove Characters
2753 bool processedtaints = false;
2754
2755 lock (_taintedActors)
2756 {
2757 if (_taintedActors.Count > 0)
2758 {
2759 foreach (OdeCharacter character in _taintedActors)
2760 {
2761
2762 character.ProcessTaints(ODE_STEPSIZE);
2763
2764 processedtaints = true;
2765 //character.m_collisionscore = 0;
2766 }
2767
2768 if (processedtaints)
2769 _taintedActors.Clear();
2770 }
2771 } // end lock _taintedActors
2772
2773 // Modify other objects in the scene.
2774 processedtaints = false;
2775
2776 lock (_taintedPrimLock)
2777 {
2778 foreach (OdePrim prim in _taintedPrimL)
2779 {
2780 if (prim.m_taintremove)
2781 {
2782 //Console.WriteLine("Simulate calls RemovePrimThreadLocked");
2783 RemovePrimThreadLocked(prim);
2784 }
2785 else
2786 {
2787 //Console.WriteLine("Simulate calls ProcessTaints");
2788 prim.ProcessTaints(ODE_STEPSIZE);
2789 }
2790 processedtaints = true;
2791 prim.m_collisionscore = 0;
2792
2793 // This loop can block up the Heartbeat for a very long time on large regions.
2794 // We need to let the Watchdog know that the Heartbeat is not dead
2795 // NOTE: This is currently commented out, but if things like OAR loading are
2796 // timing the heartbeat out we will need to uncomment it
2797 //Watchdog.UpdateThread();
2798 }
2799
2800 if (SupportsNINJAJoints)
2801 {
2802 // Create pending joints, if possible
2803
2804 // joints can only be processed after ALL bodies are processed (and exist in ODE), since creating
2805 // a joint requires specifying the body id of both involved bodies
2806 if (pendingJoints.Count > 0)
2807 {
2808 List<PhysicsJoint> successfullyProcessedPendingJoints = new List<PhysicsJoint>();
2809 //DoJointErrorMessage(joints_connecting_actor, "taint: " + pendingJoints.Count + " pending joints");
2810 foreach (PhysicsJoint joint in pendingJoints)
2811 {
2812 //DoJointErrorMessage(joint, "taint: time to create joint with parms: " + joint.RawParams);
2813 string[] jointParams = joint.RawParams.Split(" ".ToCharArray(),
2814 System.StringSplitOptions.RemoveEmptyEntries);
2815 List<IntPtr> jointBodies = new List<IntPtr>();
2816 bool allJointBodiesAreReady = true;
2817 foreach (string jointParam in jointParams)
2818 {
2819 if (jointParam == "NULL")
2820 {
2821 //DoJointErrorMessage(joint, "attaching NULL joint to world");
2822 jointBodies.Add(IntPtr.Zero);
2823 }
2824 else
2825 {
2826 //DoJointErrorMessage(joint, "looking for prim name: " + jointParam);
2827 bool foundPrim = false;
2828 lock (_prims)
2829 {
2830 foreach (OdePrim prim in _prims) // FIXME: inefficient
2831 {
2832 if (prim.SOPName == jointParam)
2833 {
2834 //DoJointErrorMessage(joint, "found for prim name: " + jointParam);
2835 if (prim.IsPhysical && prim.Body != IntPtr.Zero)
2836 {
2837 jointBodies.Add(prim.Body);
2838 foundPrim = true;
2839 break;
2840 }
2841 else
2842 {
2843 DoJointErrorMessage(joint, "prim name " + jointParam +
2844 " exists but is not (yet) physical; deferring joint creation. " +
2845 "IsPhysical property is " + prim.IsPhysical +
2846 " and body is " + prim.Body);
2847 foundPrim = false;
2848 break;
2849 }
2850 }
2851 }
2852 }
2853 if (foundPrim)
2854 {
2855 // all is fine
2856 }
2857 else
2858 {
2859 allJointBodiesAreReady = false;
2860 break;
2861 }
2862 }
2863 }
2864 if (allJointBodiesAreReady)
2865 {
2866 //DoJointErrorMessage(joint, "allJointBodiesAreReady for " + joint.ObjectNameInScene + " with parms " + joint.RawParams);
2867 if (jointBodies[0] == jointBodies[1])
2868 {
2869 DoJointErrorMessage(joint, "ERROR: joint cannot be created; the joint bodies are the same, body1==body2. Raw body is " + jointBodies[0] + ". raw parms: " + joint.RawParams);
2870 }
2871 else
2872 {
2873 switch (joint.Type)
2874 {
2875 case PhysicsJointType.Ball:
2876 {
2877 IntPtr odeJoint;
2878 //DoJointErrorMessage(joint, "ODE creating ball joint ");
2879 odeJoint = d.JointCreateBall(world, IntPtr.Zero);
2880 //DoJointErrorMessage(joint, "ODE attaching ball joint: " + odeJoint + " with b1:" + jointBodies[0] + " b2:" + jointBodies[1]);
2881 d.JointAttach(odeJoint, jointBodies[0], jointBodies[1]);
2882 //DoJointErrorMessage(joint, "ODE setting ball anchor: " + odeJoint + " to vec:" + joint.Position);
2883 d.JointSetBallAnchor(odeJoint,
2884 joint.Position.X,
2885 joint.Position.Y,
2886 joint.Position.Z);
2887 //DoJointErrorMessage(joint, "ODE joint setting OK");
2888 //DoJointErrorMessage(joint, "The ball joint's bodies are here: b0: ");
2889 //DoJointErrorMessage(joint, "" + (jointBodies[0] != IntPtr.Zero ? "" + d.BodyGetPosition(jointBodies[0]) : "fixed environment"));
2890 //DoJointErrorMessage(joint, "The ball joint's bodies are here: b1: ");
2891 //DoJointErrorMessage(joint, "" + (jointBodies[1] != IntPtr.Zero ? "" + d.BodyGetPosition(jointBodies[1]) : "fixed environment"));
2892
2893 if (joint is OdePhysicsJoint)
2894 {
2895 ((OdePhysicsJoint)joint).jointID = odeJoint;
2896 }
2897 else
2898 {
2899 DoJointErrorMessage(joint, "WARNING: non-ode joint in ODE!");
2900 }
2901 }
2902 break;
2903 case PhysicsJointType.Hinge:
2904 {
2905 IntPtr odeJoint;
2906 //DoJointErrorMessage(joint, "ODE creating hinge joint ");
2907 odeJoint = d.JointCreateHinge(world, IntPtr.Zero);
2908 //DoJointErrorMessage(joint, "ODE attaching hinge joint: " + odeJoint + " with b1:" + jointBodies[0] + " b2:" + jointBodies[1]);
2909 d.JointAttach(odeJoint, jointBodies[0], jointBodies[1]);
2910 //DoJointErrorMessage(joint, "ODE setting hinge anchor: " + odeJoint + " to vec:" + joint.Position);
2911 d.JointSetHingeAnchor(odeJoint,
2912 joint.Position.X,
2913 joint.Position.Y,
2914 joint.Position.Z);
2915 // We use the orientation of the x-axis of the joint's coordinate frame
2916 // as the axis for the hinge.
2917
2918 // Therefore, we must get the joint's coordinate frame based on the
2919 // joint.Rotation field, which originates from the orientation of the
2920 // joint's proxy object in the scene.
2921
2922 // The joint's coordinate frame is defined as the transformation matrix
2923 // that converts a vector from joint-local coordinates into world coordinates.
2924 // World coordinates are defined as the XYZ coordinate system of the sim,
2925 // as shown in the top status-bar of the viewer.
2926
2927 // Once we have the joint's coordinate frame, we extract its X axis (AtAxis)
2928 // and use that as the hinge axis.
2929
2930 //joint.Rotation.Normalize();
2931 Matrix4 proxyFrame = Matrix4.CreateFromQuaternion(joint.Rotation);
2932
2933 // Now extract the X axis of the joint's coordinate frame.
2934
2935 // Do not try to use proxyFrame.AtAxis or you will become mired in the
2936 // tar pit of transposed, inverted, and generally messed-up orientations.
2937 // (In other words, Matrix4.AtAxis() is borked.)
2938 // Vector3 jointAxis = proxyFrame.AtAxis; <--- this path leadeth to madness
2939
2940 // Instead, compute the X axis of the coordinate frame by transforming
2941 // the (1,0,0) vector. At least that works.
2942
2943 //m_log.Debug("PHY: making axis: complete matrix is " + proxyFrame);
2944 Vector3 jointAxis = Vector3.Transform(Vector3.UnitX, proxyFrame);
2945 //m_log.Debug("PHY: making axis: hinge joint axis is " + jointAxis);
2946 //DoJointErrorMessage(joint, "ODE setting hinge axis: " + odeJoint + " to vec:" + jointAxis);
2947 d.JointSetHingeAxis(odeJoint,
2948 jointAxis.X,
2949 jointAxis.Y,
2950 jointAxis.Z);
2951 //d.JointSetHingeParam(odeJoint, (int)dParam.CFM, 0.1f);
2952 if (joint is OdePhysicsJoint)
2953 {
2954 ((OdePhysicsJoint)joint).jointID = odeJoint;
2955 }
2956 else
2957 {
2958 DoJointErrorMessage(joint, "WARNING: non-ode joint in ODE!");
2959 }
2960 }
2961 break;
2962 }
2963 successfullyProcessedPendingJoints.Add(joint);
2964 }
2965 }
2966 else
2967 {
2968 DoJointErrorMessage(joint, "joint could not yet be created; still pending");
2969 }
2970 }
2971 foreach (PhysicsJoint successfullyProcessedJoint in successfullyProcessedPendingJoints)
2972 {
2973 //DoJointErrorMessage(successfullyProcessedJoint, "finalizing succesfully procsssed joint " + successfullyProcessedJoint.ObjectNameInScene + " parms " + successfullyProcessedJoint.RawParams);
2974 //DoJointErrorMessage(successfullyProcessedJoint, "removing from pending");
2975 InternalRemovePendingJoint(successfullyProcessedJoint);
2976 //DoJointErrorMessage(successfullyProcessedJoint, "adding to active");
2977 InternalAddActiveJoint(successfullyProcessedJoint);
2978 //DoJointErrorMessage(successfullyProcessedJoint, "done");
2979 }
2980 }
2981 } // end SupportsNINJAJoints
2982
2983 if (processedtaints)
2984//Console.WriteLine("Simulate calls Clear of _taintedPrim list");
2985 _taintedPrimH.Clear(); // ??? if this only ???
2986 _taintedPrimL.Clear();
2987 } // end lock _taintedPrimLock
2988
2989 // Move characters
2990 lock (_characters)
2991 {
2992 List<OdeCharacter> defects = new List<OdeCharacter>();
2993 foreach (OdeCharacter actor in _characters)
2994 {
2995 if (actor != null)
2996 actor.Move(ODE_STEPSIZE, defects);
2997 }
2998 if (0 != defects.Count)
2999 {
3000 foreach (OdeCharacter defect in defects)
3001 {
3002 RemoveCharacter(defect);
3003 }
3004 }
3005 } // end lock _characters
3006
3007 // Move other active objects
3008 lock (_activeprims)
3009 {
3010 foreach (OdePrim prim in _activeprims)
3011 {
3012 prim.m_collisionscore = 0;
3013 prim.Move(ODE_STEPSIZE);
3014 }
3015 } // end lock _activeprims
3016
3017 //if ((framecount % m_randomizeWater) == 0)
3018 // randomizeWater(waterlevel);
3019
3020 //int RayCastTimeMS = m_rayCastManager.ProcessQueuedRequests();
3021 m_rayCastManager.ProcessQueuedRequests();
3022
3023 collision_optimized(ODE_STEPSIZE);
3024
3025 lock (_collisionEventPrim)
3026 {
3027 foreach (PhysicsActor obj in _collisionEventPrim)
3028 {
3029 if (obj == null)
3030 continue;
3031
3032 switch ((ActorTypes)obj.PhysicsActorType)
3033 {
3034 case ActorTypes.Agent:
3035 OdeCharacter cobj = (OdeCharacter)obj;
3036 cobj.AddCollisionFrameTime(100);
3037 cobj.SendCollisions();
3038 break;
3039 case ActorTypes.Prim:
3040 OdePrim pobj = (OdePrim)obj;
3041 pobj.SendCollisions();
3042 break;
3043 }
3044 }
3045 } // end lock _collisionEventPrim
3046
3047 //if (m_global_contactcount > 5)
3048 //{
3049 // m_log.DebugFormat("[PHYSICS]: Contacts:{0}", m_global_contactcount);
3050 //}
3051
3052 m_global_contactcount = 0;
3053
3054 d.WorldQuickStep(world, ODE_STEPSIZE);
3055 d.JointGroupEmpty(contactgroup);
3056 fps++;
3057 //ode.dunlock(world);
3058 } // end try
3059 catch (Exception e)
3060 {
3061 m_log.ErrorFormat("[PHYSICS]: {0}, {1}, {2}", e.Message, e.TargetSite, e);
3062 ode.dunlock(world);
3063 }
3064
3065 step_time -= ODE_STEPSIZE;
3066 i++;
3067 //}
3068 //else
3069 //{
3070 //fps = 0;
3071 //}
3072 //}
3073 } // end while (step_time > 0.0f)
3074
3075 lock (_characters)
3076 {
3077 foreach (OdeCharacter actor in _characters)
3078 {
3079 if (actor != null)
3080 {
3081 if (actor.bad)
3082 m_log.WarnFormat("[PHYSICS]: BAD Actor {0} in _characters list was not removed?", actor.m_uuid);
3083 actor.UpdatePositionAndVelocity();
3084 }
3085 }
3086 }
3087
3088 lock (_badCharacter)
3089 {
3090 if (_badCharacter.Count > 0)
3091 {
3092 foreach (OdeCharacter chr in _badCharacter)
3093 {
3094 RemoveCharacter(chr);
3095 }
3096 _badCharacter.Clear();
3097 }
3098 }
3099
3100 lock (_activeprims)
3101 {
3102 //if (timeStep < 0.2f)
3103 {
3104 foreach (OdePrim actor in _activeprims)
3105 {
3106 if (actor.IsPhysical && (d.BodyIsEnabled(actor.Body) || !actor._zeroFlag))
3107 {
3108 actor.UpdatePositionAndVelocity();
3109
3110 if (SupportsNINJAJoints)
3111 {
3112 // If an actor moved, move its joint proxy objects as well.
3113 // There seems to be an event PhysicsActor.OnPositionUpdate that could be used
3114 // for this purpose but it is never called! So we just do the joint
3115 // movement code here.
3116
3117 if (actor.SOPName != null &&
3118 joints_connecting_actor.ContainsKey(actor.SOPName) &&
3119 joints_connecting_actor[actor.SOPName] != null &&
3120 joints_connecting_actor[actor.SOPName].Count > 0)
3121 {
3122 foreach (PhysicsJoint affectedJoint in joints_connecting_actor[actor.SOPName])
3123 {
3124 if (affectedJoint.IsInPhysicsEngine)
3125 {
3126 DoJointMoved(affectedJoint);
3127 }
3128 else
3129 {
3130 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);
3131 }
3132 }
3133 }
3134 }
3135 }
3136 }
3137 }
3138 } // end lock _activeprims
3139
3140 //DumpJointInfo();
3141
3142 // Finished with all sim stepping. If requested, dump world state to file for debugging.
3143 // TODO: This call to the export function is already inside lock (OdeLock) - but is an extra lock needed?
3144 // TODO: This overwrites all dump files in-place. Should this be a growing logfile, or separate snapshots?
3145 if (physics_logging && (physics_logging_interval>0) && (framecount % physics_logging_interval == 0))
3146 {
3147 string fname = "state-" + world.ToString() + ".DIF"; // give each physics world a separate filename
3148 string prefix = "world" + world.ToString(); // prefix for variable names in exported .DIF file
3149
3150 if (physics_logging_append_existing_logfile)
3151 {
3152 string header = "-------------- START OF PHYSICS FRAME " + framecount.ToString() + " --------------";
3153 TextWriter fwriter = File.AppendText(fname);
3154 fwriter.WriteLine(header);
3155 fwriter.Close();
3156 }
3157 d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix);
3158 }
3159 } // end lock OdeLock
3160
3161 return fps * (float)ODE_STEPSIZE / timeStep;
3162 } // end Simulate
3163
3164 public override void GetResults()
3165 {
3166 }
3167
3168 public override bool IsThreaded
3169 {
3170 // for now we won't be multithreaded
3171 get { return (false); }
3172 }
3173
3174 #region ODE Specific Terrain Fixes
3175 public float[] ResizeTerrain512NearestNeighbour(float[] heightMap)
3176 {
3177 float[] returnarr = new float[262144];
3178 float[,] resultarr = new float[(int)WorldExtents.X, (int)WorldExtents.Y];
3179
3180 // Filling out the array into its multi-dimensional components
3181 for (int y = 0; y < WorldExtents.Y; y++)
3182 {
3183 for (int x = 0; x < WorldExtents.X; x++)
3184 {
3185 resultarr[y, x] = heightMap[y * (int)WorldExtents.Y + x];
3186 }
3187 }
3188
3189 // Resize using Nearest Neighbour
3190
3191 // This particular way is quick but it only works on a multiple of the original
3192
3193 // The idea behind this method can be described with the following diagrams
3194 // second pass and third pass happen in the same loop really.. just separated
3195 // them to show what this does.
3196
3197 // First Pass
3198 // ResultArr:
3199 // 1,1,1,1,1,1
3200 // 1,1,1,1,1,1
3201 // 1,1,1,1,1,1
3202 // 1,1,1,1,1,1
3203 // 1,1,1,1,1,1
3204 // 1,1,1,1,1,1
3205
3206 // Second Pass
3207 // ResultArr2:
3208 // 1,,1,,1,,1,,1,,1,
3209 // ,,,,,,,,,,
3210 // 1,,1,,1,,1,,1,,1,
3211 // ,,,,,,,,,,
3212 // 1,,1,,1,,1,,1,,1,
3213 // ,,,,,,,,,,
3214 // 1,,1,,1,,1,,1,,1,
3215 // ,,,,,,,,,,
3216 // 1,,1,,1,,1,,1,,1,
3217 // ,,,,,,,,,,
3218 // 1,,1,,1,,1,,1,,1,
3219
3220 // Third pass fills in the blanks
3221 // ResultArr2:
3222 // 1,1,1,1,1,1,1,1,1,1,1,1
3223 // 1,1,1,1,1,1,1,1,1,1,1,1
3224 // 1,1,1,1,1,1,1,1,1,1,1,1
3225 // 1,1,1,1,1,1,1,1,1,1,1,1
3226 // 1,1,1,1,1,1,1,1,1,1,1,1
3227 // 1,1,1,1,1,1,1,1,1,1,1,1
3228 // 1,1,1,1,1,1,1,1,1,1,1,1
3229 // 1,1,1,1,1,1,1,1,1,1,1,1
3230 // 1,1,1,1,1,1,1,1,1,1,1,1
3231 // 1,1,1,1,1,1,1,1,1,1,1,1
3232 // 1,1,1,1,1,1,1,1,1,1,1,1
3233
3234 // X,Y = .
3235 // X+1,y = ^
3236 // X,Y+1 = *
3237 // X+1,Y+1 = #
3238
3239 // Filling in like this;
3240 // .*
3241 // ^#
3242 // 1st .
3243 // 2nd *
3244 // 3rd ^
3245 // 4th #
3246 // on single loop.
3247
3248 float[,] resultarr2 = new float[512, 512];
3249 for (int y = 0; y < WorldExtents.Y; y++)
3250 {
3251 for (int x = 0; x < WorldExtents.X; x++)
3252 {
3253 resultarr2[y * 2, x * 2] = resultarr[y, x];
3254
3255 if (y < WorldExtents.Y)
3256 {
3257 resultarr2[(y * 2) + 1, x * 2] = resultarr[y, x];
3258 }
3259 if (x < WorldExtents.X)
3260 {
3261 resultarr2[y * 2, (x * 2) + 1] = resultarr[y, x];
3262 }
3263 if (x < WorldExtents.X && y < WorldExtents.Y)
3264 {
3265 resultarr2[(y * 2) + 1, (x * 2) + 1] = resultarr[y, x];
3266 }
3267 }
3268 }
3269
3270 //Flatten out the array
3271 int i = 0;
3272 for (int y = 0; y < 512; y++)
3273 {
3274 for (int x = 0; x < 512; x++)
3275 {
3276 if (resultarr2[y, x] <= 0)
3277 returnarr[i] = 0.0000001f;
3278 else
3279 returnarr[i] = resultarr2[y, x];
3280
3281 i++;
3282 }
3283 }
3284
3285 return returnarr;
3286 }
3287
3288 public float[] ResizeTerrain512Interpolation(float[] heightMap)
3289 {
3290 float[] returnarr = new float[262144];
3291 float[,] resultarr = new float[512,512];
3292
3293 // Filling out the array into its multi-dimensional components
3294 for (int y = 0; y < 256; y++)
3295 {
3296 for (int x = 0; x < 256; x++)
3297 {
3298 resultarr[y, x] = heightMap[y * 256 + x];
3299 }
3300 }
3301
3302 // Resize using interpolation
3303
3304 // This particular way is quick but it only works on a multiple of the original
3305
3306 // The idea behind this method can be described with the following diagrams
3307 // second pass and third pass happen in the same loop really.. just separated
3308 // them to show what this does.
3309
3310 // First Pass
3311 // ResultArr:
3312 // 1,1,1,1,1,1
3313 // 1,1,1,1,1,1
3314 // 1,1,1,1,1,1
3315 // 1,1,1,1,1,1
3316 // 1,1,1,1,1,1
3317 // 1,1,1,1,1,1
3318
3319 // Second Pass
3320 // ResultArr2:
3321 // 1,,1,,1,,1,,1,,1,
3322 // ,,,,,,,,,,
3323 // 1,,1,,1,,1,,1,,1,
3324 // ,,,,,,,,,,
3325 // 1,,1,,1,,1,,1,,1,
3326 // ,,,,,,,,,,
3327 // 1,,1,,1,,1,,1,,1,
3328 // ,,,,,,,,,,
3329 // 1,,1,,1,,1,,1,,1,
3330 // ,,,,,,,,,,
3331 // 1,,1,,1,,1,,1,,1,
3332
3333 // Third pass fills in the blanks
3334 // ResultArr2:
3335 // 1,1,1,1,1,1,1,1,1,1,1,1
3336 // 1,1,1,1,1,1,1,1,1,1,1,1
3337 // 1,1,1,1,1,1,1,1,1,1,1,1
3338 // 1,1,1,1,1,1,1,1,1,1,1,1
3339 // 1,1,1,1,1,1,1,1,1,1,1,1
3340 // 1,1,1,1,1,1,1,1,1,1,1,1
3341 // 1,1,1,1,1,1,1,1,1,1,1,1
3342 // 1,1,1,1,1,1,1,1,1,1,1,1
3343 // 1,1,1,1,1,1,1,1,1,1,1,1
3344 // 1,1,1,1,1,1,1,1,1,1,1,1
3345 // 1,1,1,1,1,1,1,1,1,1,1,1
3346
3347 // X,Y = .
3348 // X+1,y = ^
3349 // X,Y+1 = *
3350 // X+1,Y+1 = #
3351
3352 // Filling in like this;
3353 // .*
3354 // ^#
3355 // 1st .
3356 // 2nd *
3357 // 3rd ^
3358 // 4th #
3359 // on single loop.
3360
3361 float[,] resultarr2 = new float[512,512];
3362 for (int y = 0; y < (int)Constants.RegionSize; y++)
3363 {
3364 for (int x = 0; x < (int)Constants.RegionSize; x++)
3365 {
3366 resultarr2[y*2, x*2] = resultarr[y, x];
3367
3368 if (y < (int)Constants.RegionSize)
3369 {
3370 if (y + 1 < (int)Constants.RegionSize)
3371 {
3372 if (x + 1 < (int)Constants.RegionSize)
3373 {
3374 resultarr2[(y*2) + 1, x*2] = ((resultarr[y, x] + resultarr[y + 1, x] +
3375 resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4);
3376 }
3377 else
3378 {
3379 resultarr2[(y*2) + 1, x*2] = ((resultarr[y, x] + resultarr[y + 1, x])/2);
3380 }
3381 }
3382 else
3383 {
3384 resultarr2[(y*2) + 1, x*2] = resultarr[y, x];
3385 }
3386 }
3387 if (x < (int)Constants.RegionSize)
3388 {
3389 if (x + 1 < (int)Constants.RegionSize)
3390 {
3391 if (y + 1 < (int)Constants.RegionSize)
3392 {
3393 resultarr2[y*2, (x*2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] +
3394 resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4);
3395 }
3396 else
3397 {
3398 resultarr2[y*2, (x*2) + 1] = ((resultarr[y, x] + resultarr[y, x + 1])/2);
3399 }
3400 }
3401 else
3402 {
3403 resultarr2[y*2, (x*2) + 1] = resultarr[y, x];
3404 }
3405 }
3406 if (x < (int)Constants.RegionSize && y < (int)Constants.RegionSize)
3407 {
3408 if ((x + 1 < (int)Constants.RegionSize) && (y + 1 < (int)Constants.RegionSize))
3409 {
3410 resultarr2[(y*2) + 1, (x*2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] +
3411 resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4);
3412 }
3413 else
3414 {
3415 resultarr2[(y*2) + 1, (x*2) + 1] = resultarr[y, x];
3416 }
3417 }
3418 }
3419 }
3420 //Flatten out the array
3421 int i = 0;
3422 for (int y = 0; y < 512; y++)
3423 {
3424 for (int x = 0; x < 512; x++)
3425 {
3426 if (Single.IsNaN(resultarr2[y, x]) || Single.IsInfinity(resultarr2[y, x]))
3427 {
3428 m_log.Warn("[PHYSICS]: Non finite heightfield element detected. Setting it to 0");
3429 resultarr2[y, x] = 0;
3430 }
3431 returnarr[i] = resultarr2[y, x];
3432 i++;
3433 }
3434 }
3435
3436 return returnarr;
3437 }
3438
3439 #endregion
3440
3441 public override void SetTerrain(float[] heightMap)
3442 {
3443 if (m_worldOffset != Vector3.Zero && m_parentScene != null)
3444 {
3445 if (m_parentScene is OdeScene)
3446 {
3447 ((OdeScene)m_parentScene).SetTerrain(heightMap, m_worldOffset);
3448 }
3449 }
3450 else
3451 {
3452 SetTerrain(heightMap, m_worldOffset);
3453 }
3454 }
3455
3456 public void SetTerrain(float[] heightMap, Vector3 pOffset)
3457 {
3458
3459 int regionsize = (int) Constants.RegionSize; // visible region size eg. 256(M)
3460
3461 int heightmapWidth = regionsize + 2; // ODE map size 257 x 257 (Meters) (1 extra
3462 int heightmapHeight = regionsize + 2;
3463
3464 int heightmapWidthSamples = (int)regionsize + 2; // Sample file size, 258 x 258 samples
3465 int heightmapHeightSamples = (int)regionsize + 2;
3466
3467 // Array of height samples for ODE
3468 float[] _heightmap;
3469 _heightmap = new float[(heightmapWidthSamples * heightmapHeightSamples)]; // loaded samples 258 x 258
3470
3471 // Other ODE parameters
3472 const float scale = 1.0f;
3473 const float offset = 0.0f;
3474 const float thickness = 2.0f; // Was 0.2f, Larger appears to prevent Av fall-through
3475 const int wrap = 0;
3476
3477 float hfmin = 2000f;
3478 float hfmax = -2000f;
3479 float minele = 0.0f; // Dont allow -ve heights
3480
3481 int x = 0;
3482 int y = 0;
3483 int xx = 0;
3484 int yy = 0;
3485
3486 // load the height samples array from the heightMap
3487 for ( x = 0; x < heightmapWidthSamples; x++) // 0 to 257
3488 {
3489 for ( y = 0; y < heightmapHeightSamples; y++) // 0 to 257
3490 {
3491 xx = x - 1;
3492 if (xx < 0) xx = 0;
3493 if (xx > (regionsize - 1)) xx = regionsize - 1;
3494
3495 yy = y - 1;
3496 if (yy < 0) yy = 0;
3497 if (yy > (regionsize - 1)) yy = regionsize - 1;
3498 // Input xx = 0 0 1 2 ..... 254 255 255 256 total in
3499 // Output x = 0 1 2 3 ..... 255 256 257 258 total out
3500 float val= heightMap[(yy * regionsize) + xx]; // input from heightMap, <0-255 * 256> <0-255>
3501 if (val < minele) val = minele;
3502 _heightmap[x * (regionsize + 2) + y] = val; // samples output to _heightmap, <0-257 * 258> <0-257>
3503 hfmin = (val < hfmin) ? val : hfmin;
3504 hfmax = (val > hfmax) ? val : hfmax;
3505 }
3506 }
3507
3508 lock (OdeLock)
3509 {
3510 IntPtr GroundGeom = IntPtr.Zero;
3511 if (RegionTerrain.TryGetValue(pOffset, out GroundGeom))
3512 {
3513 RegionTerrain.Remove(pOffset);
3514 if (GroundGeom != IntPtr.Zero)
3515 {
3516 if (TerrainHeightFieldHeights.ContainsKey(GroundGeom))
3517 {
3518 TerrainHeightFieldHeights.Remove(GroundGeom);
3519 }
3520 d.SpaceRemove(space, GroundGeom);
3521 d.GeomDestroy(GroundGeom);
3522 }
3523 }
3524 IntPtr HeightmapData = d.GeomHeightfieldDataCreate();
3525 d.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmap, 0,
3526 heightmapWidth, heightmapHeight, (int)heightmapWidthSamples,
3527 (int)heightmapHeightSamples, scale, offset, thickness, wrap);
3528 d.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1);
3529 GroundGeom = d.CreateHeightfield(space, HeightmapData, 1);
3530 if (GroundGeom != IntPtr.Zero)
3531 {
3532 d.GeomSetCategoryBits(GroundGeom, (int)(CollisionCategories.Land));
3533 d.GeomSetCollideBits(GroundGeom, (int)(CollisionCategories.Space));
3534 }
3535 geom_name_map[GroundGeom] = "Terrain";
3536
3537 d.Matrix3 R = new d.Matrix3();
3538
3539 Quaternion q1 = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), 1.5707f);
3540 Quaternion q2 = Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), 1.5707f);
3541 //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1));
3542
3543 q1 = q1 * q2;
3544 //q1 = q1 * q3;
3545 Vector3 v3;
3546 float angle;
3547 q1.GetAxisAngle(out v3, out angle);
3548
3549 d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle);
3550 d.GeomSetRotation(GroundGeom, ref R);
3551 d.GeomSetPosition(GroundGeom, (pOffset.X + (regionsize * 0.5f)) - 0.5f, (pOffset.Y + (regionsize * 0.5f)) - 0.5f, 0);
3552 IntPtr testGround = IntPtr.Zero;
3553 if (RegionTerrain.TryGetValue(pOffset, out testGround))
3554 {
3555 RegionTerrain.Remove(pOffset);
3556 }
3557 RegionTerrain.Add(pOffset, GroundGeom, GroundGeom);
3558 TerrainHeightFieldHeights.Add(GroundGeom,_heightmap);
3559 }
3560 }
3561
3562 public override void DeleteTerrain()
3563 {
3564 }
3565
3566 public float GetWaterLevel()
3567 {
3568 return waterlevel;
3569 }
3570
3571 public override bool SupportsCombining()
3572 {
3573 return true;
3574 }
3575
3576 public override void UnCombine(PhysicsScene pScene)
3577 {
3578 IntPtr localGround = IntPtr.Zero;
3579// float[] localHeightfield;
3580 bool proceed = false;
3581 List<IntPtr> geomDestroyList = new List<IntPtr>();
3582
3583 lock (OdeLock)
3584 {
3585 if (RegionTerrain.TryGetValue(Vector3.Zero, out localGround))
3586 {
3587 foreach (IntPtr geom in TerrainHeightFieldHeights.Keys)
3588 {
3589 if (geom == localGround)
3590 {
3591// localHeightfield = TerrainHeightFieldHeights[geom];
3592 proceed = true;
3593 }
3594 else
3595 {
3596 geomDestroyList.Add(geom);
3597 }
3598 }
3599
3600 if (proceed)
3601 {
3602 m_worldOffset = Vector3.Zero;
3603 WorldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize);
3604 m_parentScene = null;
3605
3606 foreach (IntPtr g in geomDestroyList)
3607 {
3608 // removingHeightField needs to be done or the garbage collector will
3609 // collect the terrain data before we tell ODE to destroy it causing
3610 // memory corruption
3611 if (TerrainHeightFieldHeights.ContainsKey(g))
3612 {
3613// float[] removingHeightField = TerrainHeightFieldHeights[g];
3614 TerrainHeightFieldHeights.Remove(g);
3615
3616 if (RegionTerrain.ContainsKey(g))
3617 {
3618 RegionTerrain.Remove(g);
3619 }
3620
3621 d.GeomDestroy(g);
3622 //removingHeightField = new float[0];
3623 }
3624 }
3625
3626 }
3627 else
3628 {
3629 m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data.");
3630
3631 }
3632 }
3633 }
3634 }
3635
3636 public override void SetWaterLevel(float baseheight)
3637 {
3638 waterlevel = baseheight;
3639 randomizeWater(waterlevel);
3640 }
3641
3642 public void randomizeWater(float baseheight)
3643 {
3644 const uint heightmapWidth = m_regionWidth + 2;
3645 const uint heightmapHeight = m_regionHeight + 2;
3646 const uint heightmapWidthSamples = m_regionWidth + 2;
3647 const uint heightmapHeightSamples = m_regionHeight + 2;
3648 const float scale = 1.0f;
3649 const float offset = 0.0f;
3650 const float thickness = 2.9f;
3651 const int wrap = 0;
3652
3653 for (int i = 0; i < (258 * 258); i++)
3654 {
3655 _watermap[i] = (baseheight-0.1f) + ((float)fluidRandomizer.Next(1,9) / 10f);
3656 // m_log.Info((baseheight - 0.1f) + ((float)fluidRandomizer.Next(1, 9) / 10f));
3657 }
3658
3659 lock (OdeLock)
3660 {
3661 if (WaterGeom != IntPtr.Zero)
3662 {
3663 d.SpaceRemove(space, WaterGeom);
3664 }
3665 IntPtr HeightmapData = d.GeomHeightfieldDataCreate();
3666 d.GeomHeightfieldDataBuildSingle(HeightmapData, _watermap, 0, heightmapWidth, heightmapHeight,
3667 (int)heightmapWidthSamples, (int)heightmapHeightSamples, scale,
3668 offset, thickness, wrap);
3669 d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight);
3670 WaterGeom = d.CreateHeightfield(space, HeightmapData, 1);
3671 if (WaterGeom != IntPtr.Zero)
3672 {
3673 d.GeomSetCategoryBits(WaterGeom, (int)(CollisionCategories.Water));
3674 d.GeomSetCollideBits(WaterGeom, (int)(CollisionCategories.Space));
3675
3676 }
3677 geom_name_map[WaterGeom] = "Water";
3678
3679 d.Matrix3 R = new d.Matrix3();
3680
3681 Quaternion q1 = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), 1.5707f);
3682 Quaternion q2 = Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), 1.5707f);
3683 //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1));
3684
3685 q1 = q1 * q2;
3686 //q1 = q1 * q3;
3687 Vector3 v3;
3688 float angle;
3689 q1.GetAxisAngle(out v3, out angle);
3690
3691 d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle);
3692 d.GeomSetRotation(WaterGeom, ref R);
3693 d.GeomSetPosition(WaterGeom, 128, 128, 0);
3694
3695 }
3696
3697 }
3698
3699 public override void Dispose()
3700 {
3701 m_rayCastManager.Dispose();
3702 m_rayCastManager = null;
3703
3704 lock (OdeLock)
3705 {
3706 lock (_prims)
3707 {
3708 foreach (OdePrim prm in _prims)
3709 {
3710 RemovePrim(prm);
3711 }
3712 }
3713
3714 //foreach (OdeCharacter act in _characters)
3715 //{
3716 //RemoveAvatar(act);
3717 //}
3718 d.WorldDestroy(world);
3719 //d.CloseODE();
3720 }
3721 }
3722 public override Dictionary<uint, float> GetTopColliders()
3723 {
3724 Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
3725 int cnt = 0;
3726 lock (_prims)
3727 {
3728 foreach (OdePrim prm in _prims)
3729 {
3730 if (prm.CollisionScore > 0)
3731 {
3732 returncolliders.Add(prm.m_localID, prm.CollisionScore);
3733 cnt++;
3734 prm.CollisionScore = 0f;
3735 if (cnt > 25)
3736 {
3737 break;
3738 }
3739 }
3740 }
3741 }
3742 return returncolliders;
3743 }
3744
3745 public override bool SupportsRayCast()
3746 {
3747 return true;
3748 }
3749
3750 public override void RaycastWorld(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod)
3751 {
3752 if (retMethod != null)
3753 {
3754 m_rayCastManager.QueueRequest(position, direction, length, retMethod);
3755 }
3756 }
3757
3758#if USE_DRAWSTUFF
3759 // Keyboard callback
3760 public void command(int cmd)
3761 {
3762 IntPtr geom;
3763 d.Mass mass;
3764 d.Vector3 sides = new d.Vector3(d.RandReal() * 0.5f + 0.1f, d.RandReal() * 0.5f + 0.1f, d.RandReal() * 0.5f + 0.1f);
3765
3766
3767
3768 Char ch = Char.ToLower((Char)cmd);
3769 switch ((Char)ch)
3770 {
3771 case 'w':
3772 try
3773 {
3774 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));
3775
3776 xyz.X += rotate.X; xyz.Y += rotate.Y; xyz.Z += rotate.Z;
3777 ds.SetViewpoint(ref xyz, ref hpr);
3778 }
3779 catch (ArgumentException)
3780 { hpr.X = 0; }
3781 break;
3782
3783 case 'a':
3784 hpr.X++;
3785 ds.SetViewpoint(ref xyz, ref hpr);
3786 break;
3787
3788 case 's':
3789 try
3790 {
3791 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));
3792
3793 xyz.X += rotate2.X; xyz.Y += rotate2.Y; xyz.Z += rotate2.Z;
3794 ds.SetViewpoint(ref xyz, ref hpr);
3795 }
3796 catch (ArgumentException)
3797 { hpr.X = 0; }
3798 break;
3799 case 'd':
3800 hpr.X--;
3801 ds.SetViewpoint(ref xyz, ref hpr);
3802 break;
3803 case 'r':
3804 xyz.Z++;
3805 ds.SetViewpoint(ref xyz, ref hpr);
3806 break;
3807 case 'f':
3808 xyz.Z--;
3809 ds.SetViewpoint(ref xyz, ref hpr);
3810 break;
3811 case 'e':
3812 xyz.Y++;
3813 ds.SetViewpoint(ref xyz, ref hpr);
3814 break;
3815 case 'q':
3816 xyz.Y--;
3817 ds.SetViewpoint(ref xyz, ref hpr);
3818 break;
3819 }
3820 }
3821
3822 public void step(int pause)
3823 {
3824
3825 ds.SetColor(1.0f, 1.0f, 0.0f);
3826 ds.SetTexture(ds.Texture.Wood);
3827 lock (_prims)
3828 {
3829 foreach (OdePrim prm in _prims)
3830 {
3831 //IntPtr body = d.GeomGetBody(prm.prim_geom);
3832 if (prm.prim_geom != IntPtr.Zero)
3833 {
3834 d.Vector3 pos;
3835 d.GeomCopyPosition(prm.prim_geom, out pos);
3836 //d.BodyCopyPosition(body, out pos);
3837
3838 d.Matrix3 R;
3839 d.GeomCopyRotation(prm.prim_geom, out R);
3840 //d.BodyCopyRotation(body, out R);
3841
3842
3843 d.Vector3 sides = new d.Vector3();
3844 sides.X = prm.Size.X;
3845 sides.Y = prm.Size.Y;
3846 sides.Z = prm.Size.Z;
3847
3848 ds.DrawBox(ref pos, ref R, ref sides);
3849 }
3850 }
3851 }
3852 ds.SetColor(1.0f, 0.0f, 0.0f);
3853 lock (_characters)
3854 {
3855 foreach (OdeCharacter chr in _characters)
3856 {
3857 if (chr.Shell != IntPtr.Zero)
3858 {
3859 IntPtr body = d.GeomGetBody(chr.Shell);
3860
3861 d.Vector3 pos;
3862 d.GeomCopyPosition(chr.Shell, out pos);
3863 //d.BodyCopyPosition(body, out pos);
3864
3865 d.Matrix3 R;
3866 d.GeomCopyRotation(chr.Shell, out R);
3867 //d.BodyCopyRotation(body, out R);
3868
3869 ds.DrawCapsule(ref pos, ref R, chr.Size.Z, 0.35f);
3870 d.Vector3 sides = new d.Vector3();
3871 sides.X = 0.5f;
3872 sides.Y = 0.5f;
3873 sides.Z = 0.5f;
3874
3875 ds.DrawBox(ref pos, ref R, ref sides);
3876 }
3877 }
3878 }
3879 }
3880
3881 public void start(int unused)
3882 {
3883 ds.SetViewpoint(ref xyz, ref hpr);
3884 }
3885#endif
3886 }
3887}
diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdeUtils.cs b/OpenSim/Region/Physics/ChOdePlugin/OdeUtils.cs
deleted file mode 100644
index e7e7bb3..0000000
--- a/OpenSim/Region/Physics/ChOdePlugin/OdeUtils.cs
+++ /dev/null
@@ -1,353 +0,0 @@
1/* Ubit 2012
2 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
3 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
4 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
5 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
6 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
7 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
8 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
9 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
10 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
11 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12*/
13
14// no endian conversion. So can't be use to pass information around diferent cpus with diferent endian
15
16using System;
17using System.IO;
18using OpenMetaverse;
19
20namespace OpenSim.Region.Physics.OdePlugin
21{
22
23 unsafe public class wstreamer
24 {
25 byte[] buf;
26 int index;
27 byte* src;
28
29 public wstreamer()
30 {
31 buf = new byte[1024];
32 index = 0;
33 }
34 public wstreamer(int size)
35 {
36 buf = new byte[size];
37 index = 0;
38 }
39
40 public byte[] close()
41 {
42 byte[] data = new byte[index];
43 Buffer.BlockCopy(buf, 0, data, 0, index);
44 return data;
45 }
46
47 public void Seek(int pos)
48 {
49 index = pos;
50 }
51
52 public void Seekrel(int pos)
53 {
54 index += pos;
55 }
56
57 public void Wbyte(byte value)
58 {
59 buf[index++] = value;
60 }
61 public void Wshort(short value)
62 {
63 src = (byte*)&value;
64 buf[index++] = *src++;
65 buf[index++] = *src;
66 }
67 public void Wushort(ushort value)
68 {
69 src = (byte*)&value;
70 buf[index++] = *src++;
71 buf[index++] = *src;
72 }
73 public void Wint(int value)
74 {
75 src = (byte*)&value;
76 buf[index++] = *src++;
77 buf[index++] = *src++;
78 buf[index++] = *src++;
79 buf[index++] = *src;
80 }
81 public void Wuint(uint value)
82 {
83 src = (byte*)&value;
84 buf[index++] = *src++;
85 buf[index++] = *src++;
86 buf[index++] = *src++;
87 buf[index++] = *src;
88 }
89 public void Wlong(long value)
90 {
91 src = (byte*)&value;
92 buf[index++] = *src++;
93 buf[index++] = *src++;
94 buf[index++] = *src++;
95 buf[index++] = *src++;
96 buf[index++] = *src++;
97 buf[index++] = *src++;
98 buf[index++] = *src++;
99 buf[index++] = *src;
100 }
101 public void Wulong(ulong value)
102 {
103 src = (byte*)&value;
104 buf[index++] = *src++;
105 buf[index++] = *src++;
106 buf[index++] = *src++;
107 buf[index++] = *src++;
108 buf[index++] = *src++;
109 buf[index++] = *src++;
110 buf[index++] = *src++;
111 buf[index++] = *src;
112 }
113
114 public void Wfloat(float value)
115 {
116 src = (byte*)&value;
117 buf[index++] = *src++;
118 buf[index++] = *src++;
119 buf[index++] = *src++;
120 buf[index++] = *src;
121 }
122
123 public void Wdouble(double value)
124 {
125 src = (byte*)&value;
126 buf[index++] = *src++;
127 buf[index++] = *src++;
128 buf[index++] = *src++;
129 buf[index++] = *src++;
130 buf[index++] = *src++;
131 buf[index++] = *src++;
132 buf[index++] = *src++;
133 buf[index++] = *src;
134 }
135
136 public void Wvector3(Vector3 value)
137 {
138 src = (byte*)&value.X;
139 buf[index++] = *src++;
140 buf[index++] = *src++;
141 buf[index++] = *src++;
142 buf[index++] = *src;
143 src = (byte*)&value.Y; // it may have padding ??
144 buf[index++] = *src++;
145 buf[index++] = *src++;
146 buf[index++] = *src++;
147 buf[index++] = *src;
148 src = (byte*)&value.Z;
149 buf[index++] = *src++;
150 buf[index++] = *src++;
151 buf[index++] = *src++;
152 buf[index++] = *src;
153 }
154 public void Wquat(Quaternion value)
155 {
156 src = (byte*)&value.X;
157 buf[index++] = *src++;
158 buf[index++] = *src++;
159 buf[index++] = *src++;
160 buf[index++] = *src;
161 src = (byte*)&value.Y; // it may have padding ??
162 buf[index++] = *src++;
163 buf[index++] = *src++;
164 buf[index++] = *src++;
165 buf[index++] = *src;
166 src = (byte*)&value.Z;
167 buf[index++] = *src++;
168 buf[index++] = *src++;
169 buf[index++] = *src++;
170 buf[index++] = *src;
171 src = (byte*)&value.W;
172 buf[index++] = *src++;
173 buf[index++] = *src++;
174 buf[index++] = *src++;
175 buf[index++] = *src;
176 }
177 }
178
179 unsafe public class rstreamer
180 {
181 private byte[] rbuf;
182 private int ptr;
183 private byte* dst;
184
185 public rstreamer(byte[] data)
186 {
187 rbuf = data;
188 ptr = 0;
189 }
190
191 public void close()
192 {
193 }
194
195 public void Seek(int pos)
196 {
197 ptr = pos;
198 }
199
200 public void Seekrel(int pos)
201 {
202 ptr += pos;
203 }
204
205 public byte Rbyte()
206 {
207 return (byte)rbuf[ptr++];
208 }
209
210 public short Rshort()
211 {
212 short v;
213 dst = (byte*)&v;
214 *dst++ = rbuf[ptr++];
215 *dst = rbuf[ptr++];
216 return v;
217 }
218 public ushort Rushort()
219 {
220 ushort v;
221 dst = (byte*)&v;
222 *dst++ = rbuf[ptr++];
223 *dst = rbuf[ptr++];
224 return v;
225 }
226 public int Rint()
227 {
228 int v;
229 dst = (byte*)&v;
230 *dst++ = rbuf[ptr++];
231 *dst++ = rbuf[ptr++];
232 *dst++ = rbuf[ptr++];
233 *dst = rbuf[ptr++];
234 return v;
235 }
236 public uint Ruint()
237 {
238 uint v;
239 dst = (byte*)&v;
240 *dst++ = rbuf[ptr++];
241 *dst++ = rbuf[ptr++];
242 *dst++ = rbuf[ptr++];
243 *dst = rbuf[ptr++];
244 return v;
245 }
246 public long Rlong()
247 {
248 long v;
249 dst = (byte*)&v;
250 *dst++ = rbuf[ptr++];
251 *dst++ = rbuf[ptr++];
252 *dst++ = rbuf[ptr++];
253 *dst++ = rbuf[ptr++];
254 *dst++ = rbuf[ptr++];
255 *dst++ = rbuf[ptr++];
256 *dst++ = rbuf[ptr++];
257 *dst = rbuf[ptr++];
258 return v;
259 }
260 public ulong Rulong()
261 {
262 ulong v;
263 dst = (byte*)&v;
264 *dst++ = rbuf[ptr++];
265 *dst++ = rbuf[ptr++];
266 *dst++ = rbuf[ptr++];
267 *dst++ = rbuf[ptr++];
268 *dst++ = rbuf[ptr++];
269 *dst++ = rbuf[ptr++];
270 *dst++ = rbuf[ptr++];
271 *dst = rbuf[ptr++];
272 return v;
273 }
274 public float Rfloat()
275 {
276 float v;
277 dst = (byte*)&v;
278 *dst++ = rbuf[ptr++];
279 *dst++ = rbuf[ptr++];
280 *dst++ = rbuf[ptr++];
281 *dst = rbuf[ptr++];
282 return v;
283 }
284
285 public double Rdouble()
286 {
287 double v;
288 dst = (byte*)&v;
289 *dst++ = rbuf[ptr++];
290 *dst++ = rbuf[ptr++];
291 *dst++ = rbuf[ptr++];
292 *dst++ = rbuf[ptr++];
293 *dst++ = rbuf[ptr++];
294 *dst++ = rbuf[ptr++];
295 *dst++ = rbuf[ptr++];
296 *dst = rbuf[ptr++];
297 return v;
298 }
299
300 public Vector3 Rvector3()
301 {
302 Vector3 v;
303 dst = (byte*)&v.X;
304 *dst++ = rbuf[ptr++];
305 *dst++ = rbuf[ptr++];
306 *dst++ = rbuf[ptr++];
307 *dst = rbuf[ptr++];
308
309 dst = (byte*)&v.Y;
310 *dst++ = rbuf[ptr++];
311 *dst++ = rbuf[ptr++];
312 *dst++ = rbuf[ptr++];
313 *dst = rbuf[ptr++];
314
315 dst = (byte*)&v.Z;
316 *dst++ = rbuf[ptr++];
317 *dst++ = rbuf[ptr++];
318 *dst++ = rbuf[ptr++];
319 *dst = rbuf[ptr++];
320 return v;
321 }
322
323 public Quaternion Rquat()
324 {
325 Quaternion v;
326 dst = (byte*)&v.X;
327 *dst++ = rbuf[ptr++];
328 *dst++ = rbuf[ptr++];
329 *dst++ = rbuf[ptr++];
330 *dst = rbuf[ptr++];
331
332 dst = (byte*)&v.Y;
333 *dst++ = rbuf[ptr++];
334 *dst++ = rbuf[ptr++];
335 *dst++ = rbuf[ptr++];
336 *dst = rbuf[ptr++];
337
338 dst = (byte*)&v.Z;
339 *dst++ = rbuf[ptr++];
340 *dst++ = rbuf[ptr++];
341 *dst++ = rbuf[ptr++];
342 *dst = rbuf[ptr++];
343
344 dst = (byte*)&v.W;
345 *dst++ = rbuf[ptr++];
346 *dst++ = rbuf[ptr++];
347 *dst++ = rbuf[ptr++];
348 *dst = rbuf[ptr++];
349
350 return v;
351 }
352 }
353}
diff --git a/OpenSim/Region/Physics/ChOdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/Physics/ChOdePlugin/Tests/ODETestClass.cs
deleted file mode 100644
index 69e2d03..0000000
--- a/OpenSim/Region/Physics/ChOdePlugin/Tests/ODETestClass.cs
+++ /dev/null
@@ -1,122 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using Nini.Config;
30using NUnit.Framework;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager;
34using log4net;
35using System.Reflection;
36
37namespace OpenSim.Region.Physics.OdePlugin
38{
39 [TestFixture]
40 public class ODETestClass
41 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43
44 private OdePlugin cbt;
45 private PhysicsScene ps;
46 private IMeshingPlugin imp;
47
48 [SetUp]
49 public void Initialize()
50 {
51 // Loading ODEPlugin
52 cbt = new OdePlugin();
53 // Loading Zero Mesher
54 imp = new ZeroMesherPlugin();
55 // Getting Physics Scene
56 ps = cbt.GetScene("test");
57 // Initializing Physics Scene.
58 ps.Initialise(imp.GetMesher(),null);
59 float[] _heightmap = new float[(int)Constants.RegionSize * (int)Constants.RegionSize];
60 for (int i = 0; i < ((int)Constants.RegionSize * (int)Constants.RegionSize); i++)
61 {
62 _heightmap[i] = 21f;
63 }
64 ps.SetTerrain(_heightmap);
65 }
66
67 [TearDown]
68 public void Terminate()
69 {
70 ps.DeleteTerrain();
71 ps.Dispose();
72
73 }
74
75 [Test]
76 public void CreateAndDropPhysicalCube()
77 {
78 PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox();
79 Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f);
80 Vector3 size = new Vector3(0.5f, 0.5f, 0.5f);
81 Quaternion rot = Quaternion.Identity;
82 PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true);
83 OdePrim oprim = (OdePrim)prim;
84 OdeScene pscene = (OdeScene) ps;
85
86 Assert.That(oprim.m_taintadd);
87
88 prim.LocalID = 5;
89
90 for (int i = 0; i < 58; i++)
91 {
92 ps.Simulate(0.133f);
93
94 Assert.That(oprim.prim_geom != (IntPtr)0);
95
96 Assert.That(oprim.m_targetSpace != (IntPtr)0);
97
98 //Assert.That(oprim.m_targetSpace == pscene.space);
99 m_log.Info("TargetSpace: " + oprim.m_targetSpace + " - SceneMainSpace: " + pscene.space);
100
101 Assert.That(!oprim.m_taintadd);
102 m_log.Info("Prim Position (" + oprim.m_localID + "): " + prim.Position.ToString());
103
104 // Make sure we're above the ground
105 //Assert.That(prim.Position.Z > 20f);
106 //m_log.Info("PrimCollisionScore (" + oprim.m_localID + "): " + oprim.m_collisionscore);
107
108 // Make sure we've got a Body
109 Assert.That(oprim.Body != (IntPtr)0);
110 //m_log.Info(
111 }
112
113 // Make sure we're not somewhere above the ground
114 Assert.That(prim.Position.Z < 21.5f);
115
116 ps.RemovePrim(prim);
117 Assert.That(oprim.m_taintremove);
118 ps.Simulate(0.133f);
119 Assert.That(oprim.Body == (IntPtr)0);
120 }
121 }
122}
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
deleted file mode 100644
index ddbe80b..0000000
--- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
+++ /dev/null
@@ -1,250 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using Nini.Config;
33using log4net;
34using OpenSim.Framework;
35using OpenMetaverse;
36
37namespace OpenSim.Region.Physics.Manager
38{
39 /// <summary>
40 /// Description of MyClass.
41 /// </summary>
42 public class PhysicsPluginManager
43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45
46 private Dictionary<string, IPhysicsPlugin> _PhysPlugins = new Dictionary<string, IPhysicsPlugin>();
47 private Dictionary<string, IMeshingPlugin> _MeshPlugins = new Dictionary<string, IMeshingPlugin>();
48
49 /// <summary>
50 /// Constructor.
51 /// </summary>
52 public PhysicsPluginManager()
53 {
54 // Load "plugins", that are hard coded and not existing in form of an external lib, and hence always
55 // available
56 IMeshingPlugin plugHard;
57 plugHard = new ZeroMesherPlugin();
58 _MeshPlugins.Add(plugHard.GetName(), plugHard);
59
60 m_log.Info("[PHYSICS]: Added meshing engine: " + plugHard.GetName());
61 }
62
63 // Legacy method for simulators before extent was passed
64 public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName,
65 IConfigSource config, string regionName)
66 {
67 Vector3 extent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
68 return GetPhysicsScene(physEngineName, meshEngineName, config, regionName, extent);
69 }
70
71 /// <summary>
72 /// Get a physics scene for the given physics engine and mesher.
73 /// </summary>
74 /// <param name="physEngineName"></param>
75 /// <param name="meshEngineName"></param>
76 /// <param name="config"></param>
77 /// <returns></returns>
78 public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName,
79 IConfigSource config, string regionName, Vector3 regionExtent)
80 {
81 if (String.IsNullOrEmpty(physEngineName))
82 {
83 return PhysicsScene.Null;
84 }
85
86 if (String.IsNullOrEmpty(meshEngineName))
87 {
88 return PhysicsScene.Null;
89 }
90
91 IMesher meshEngine = null;
92 if (_MeshPlugins.ContainsKey(meshEngineName))
93 {
94 m_log.Info("[PHYSICS]: creating meshing engine " + meshEngineName);
95 meshEngine = _MeshPlugins[meshEngineName].GetMesher(config);
96 }
97 else
98 {
99 m_log.WarnFormat("[PHYSICS]: couldn't find meshingEngine: {0}", meshEngineName);
100 throw new ArgumentException(String.Format("couldn't find meshingEngine: {0}", meshEngineName));
101 }
102
103 if (_PhysPlugins.ContainsKey(physEngineName))
104 {
105 m_log.Info("[PHYSICS]: creating " + physEngineName);
106 PhysicsScene result = _PhysPlugins[physEngineName].GetScene(regionName);
107 result.Initialise(meshEngine, config, regionExtent);
108 return result;
109 }
110 else
111 {
112 m_log.WarnFormat("[PHYSICS]: couldn't find physicsEngine: {0}", physEngineName);
113 throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}", physEngineName));
114 }
115 }
116
117 /// <summary>
118 /// Load all plugins in assemblies at the given path
119 /// </summary>
120 /// <param name="pluginsPath"></param>
121 public void LoadPluginsFromAssemblies(string assembliesPath)
122 {
123 // Walk all assemblies (DLLs effectively) and see if they are home
124 // of a plugin that is of interest for us
125 string[] pluginFiles = Directory.GetFiles(assembliesPath, "*.dll");
126
127 for (int i = 0; i < pluginFiles.Length; i++)
128 {
129 LoadPluginsFromAssembly(pluginFiles[i]);
130 }
131 }
132
133 /// <summary>
134 /// Load plugins from an assembly at the given path
135 /// </summary>
136 /// <param name="assemblyPath"></param>
137 public void LoadPluginsFromAssembly(string assemblyPath)
138 {
139 // TODO / NOTE
140 // The assembly named 'OpenSim.Region.Physics.BasicPhysicsPlugin' was loaded from
141 // 'file:///C:/OpenSim/trunk2/bin/Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll'
142 // using the LoadFrom context. The use of this context can result in unexpected behavior
143 // for serialization, casting and dependency resolution. In almost all cases, it is recommended
144 // that the LoadFrom context be avoided. This can be done by installing assemblies in the
145 // Global Assembly Cache or in the ApplicationBase directory and using Assembly.
146 // Load when explicitly loading assemblies.
147 Assembly pluginAssembly = null;
148 Type[] types = null;
149
150 try
151 {
152 pluginAssembly = Assembly.LoadFrom(assemblyPath);
153 }
154 catch (Exception ex)
155 {
156 m_log.Error("[PHYSICS]: Failed to load plugin from " + assemblyPath, ex);
157 }
158
159 if (pluginAssembly != null)
160 {
161 try
162 {
163 types = pluginAssembly.GetTypes();
164 }
165 catch (ReflectionTypeLoadException ex)
166 {
167 m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + assemblyPath + ": " +
168 ex.LoaderExceptions[0].Message, ex);
169 }
170 catch (Exception ex)
171 {
172 m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + assemblyPath, ex);
173 }
174
175 if (types != null)
176 {
177 foreach (Type pluginType in types)
178 {
179 if (pluginType.IsPublic)
180 {
181 if (!pluginType.IsAbstract)
182 {
183 Type physTypeInterface = pluginType.GetInterface("IPhysicsPlugin");
184
185 if (physTypeInterface != null)
186 {
187 IPhysicsPlugin plug =
188 (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
189 plug.Init();
190 if (!_PhysPlugins.ContainsKey(plug.GetName()))
191 {
192 _PhysPlugins.Add(plug.GetName(), plug);
193 m_log.Info("[PHYSICS]: Added physics engine: " + plug.GetName());
194 }
195 }
196
197 Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin");
198
199 if (meshTypeInterface != null)
200 {
201 IMeshingPlugin plug =
202 (IMeshingPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
203 if (!_MeshPlugins.ContainsKey(plug.GetName()))
204 {
205 _MeshPlugins.Add(plug.GetName(), plug);
206 m_log.Info("[PHYSICS]: Added meshing engine: " + plug.GetName());
207 }
208 }
209
210 physTypeInterface = null;
211 meshTypeInterface = null;
212 }
213 }
214 }
215 }
216 }
217
218 pluginAssembly = null;
219 }
220
221 //---
222 public static void PhysicsPluginMessage(string message, bool isWarning)
223 {
224 if (isWarning)
225 {
226 m_log.Warn("[PHYSICS]: " + message);
227 }
228 else
229 {
230 m_log.Info("[PHYSICS]: " + message);
231 }
232 }
233
234 //---
235 }
236
237 public interface IPhysicsPlugin
238 {
239 bool Init();
240 PhysicsScene GetScene(String sceneIdentifier);
241 string GetName();
242 void Dispose();
243 }
244
245 public interface IMeshingPlugin
246 {
247 string GetName();
248 IMesher GetMesher(IConfigSource config);
249 }
250}
diff --git a/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs b/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs
deleted file mode 100644
index ec968c0..0000000
--- a/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Region.Physics.Meshing")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("4b7e35c2-a9dd-4b10-b778-eb417f4f6884")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.8.2.*")]
33
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
deleted file mode 100644
index 7e652fc..0000000
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ /dev/null
@@ -1,90 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Runtime.InteropServices;
32using System.Threading;
33using System.IO;
34using System.Diagnostics;
35using log4net;
36using Nini.Config;
37using Ode.NET;
38using OpenSim.Framework;
39using OpenSim.Region.Physics.Manager;
40using OpenMetaverse;
41
42namespace OpenSim.Region.Physics.OdePlugin
43{
44 /// <summary>
45 /// ODE plugin
46 /// </summary>
47 public class OdePlugin : IPhysicsPlugin
48 {
49// private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
50
51 private OdeScene m_scene;
52
53 public bool Init()
54 {
55 return true;
56 }
57
58 public PhysicsScene GetScene(String sceneIdentifier)
59 {
60 if (m_scene == null)
61 {
62 // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether
63 // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports
64 // will find it already loaded later on.
65 //
66 // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be
67 // controlled in Ode.NET.dll.config
68 if (Util.IsWindows())
69 Util.LoadArchSpecificWindowsDll("ode.dll");
70
71 // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to
72 // http://opensimulator.org/mantis/view.php?id=2750).
73 d.InitODE();
74
75 m_scene = new OdeScene(GetName(), sceneIdentifier);
76 }
77
78 return m_scene;
79 }
80
81 public string GetName()
82 {
83 return ("OpenDynamicsEngine");
84 }
85
86 public void Dispose()
87 {
88 }
89 }
90} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/OdePlugin/drawstuff.cs b/OpenSim/Region/Physics/OdePlugin/drawstuff.cs
deleted file mode 100644
index 87ca446..0000000
--- a/OpenSim/Region/Physics/OdePlugin/drawstuff.cs
+++ /dev/null
@@ -1,98 +0,0 @@
1/*
2 * Copyright ODE
3 * Ode.NET - .NET bindings for ODE
4 * Jason Perkins (starkos@industriousone.com)
5 * Licensed under the New BSD
6 * Part of the OpenDynamicsEngine
7Open Dynamics Engine
8Copyright (c) 2001-2007, Russell L. Smith.
9All rights reserved.
10
11Redistribution and use in source and binary forms, with or without
12modification, are permitted provided that the following conditions
13are met:
14
15Redistributions of source code must retain the above copyright notice,
16this list of conditions and the following disclaimer.
17
18Redistributions in binary form must reproduce the above copyright notice,
19this list of conditions and the following disclaimer in the documentation
20and/or other materials provided with the distribution.
21
22Neither the names of ODE's copyright owner nor the names of its
23contributors may be used to endorse or promote products derived from
24this software without specific prior written permission.
25
26THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
29FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
32TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 *
38 *
39 */
40
41using System;
42using System.Runtime.InteropServices;
43using Ode.NET;
44
45namespace Drawstuff.NET
46{
47#if dDOUBLE
48 using dReal = System.Double;
49#else
50 using dReal = System.Single;
51#endif
52
53 public static class ds
54 {
55 public const int VERSION = 2;
56
57 public enum Texture
58 {
59 None,
60 Wood
61 }
62
63 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
64 public delegate void CallbackFunction(int arg);
65
66 [StructLayout(LayoutKind.Sequential)]
67 public struct Functions
68 {
69 public int version;
70 public CallbackFunction start;
71 public CallbackFunction step;
72 public CallbackFunction command;
73 public CallbackFunction stop;
74 public string path_to_textures;
75 }
76
77 [DllImport("drawstuff", EntryPoint = "dsDrawBox")]
78 public static extern void DrawBox(ref d.Vector3 pos, ref d.Matrix3 R, ref d.Vector3 sides);
79
80 [DllImport("drawstuff", EntryPoint = "dsDrawCapsule")]
81 public static extern void DrawCapsule(ref d.Vector3 pos, ref d.Matrix3 R, dReal length, dReal radius);
82
83 [DllImport("drawstuff", EntryPoint = "dsDrawConvex")]
84 public static extern void DrawConvex(ref d.Vector3 pos, ref d.Matrix3 R, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons);
85
86 [DllImport("drawstuff", EntryPoint = "dsSetColor")]
87 public static extern void SetColor(float red, float green, float blue);
88
89 [DllImport("drawstuff", EntryPoint = "dsSetTexture")]
90 public static extern void SetTexture(Texture texture);
91
92 [DllImport("drawstuff", EntryPoint = "dsSetViewpoint")]
93 public static extern void SetViewpoint(ref d.Vector3 xyz, ref d.Vector3 hpr);
94
95 [DllImport("drawstuff", EntryPoint = "dsSimulationLoop")]
96 public static extern void SimulationLoop(int argc, string[] argv, int window_width, int window_height, ref Functions fn);
97 }
98}
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
deleted file mode 100644
index ed086dd..0000000
--- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using Nini.Config;
31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager;
33
34namespace OpenSim.Region.Physics.POSPlugin
35{
36 /// <summary>
37 /// for now will be a very POS physics engine
38 /// </summary>
39 public class POSPlugin : IPhysicsPlugin
40 {
41 public POSPlugin()
42 {
43 }
44
45 public bool Init()
46 {
47 return true;
48 }
49
50 public PhysicsScene GetScene(string sceneIdentifier)
51 {
52 return new POSScene(GetName(), sceneIdentifier);
53 }
54
55 public string GetName()
56 {
57 return ("POS");
58 }
59
60 public void Dispose()
61 {
62 }
63 }
64}
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdePlugin.cs
deleted file mode 100644
index d32188e..0000000
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdePlugin.cs
+++ /dev/null
@@ -1,90 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Runtime.InteropServices;
32using System.Threading;
33using System.IO;
34using System.Diagnostics;
35using log4net;
36using Nini.Config;
37using OdeAPI;
38using OpenSim.Framework;
39using OpenSim.Region.Physics.Manager;
40using OpenMetaverse;
41
42namespace OpenSim.Region.Physics.OdePlugin
43{
44 /// <summary>
45 /// ODE plugin
46 /// </summary>
47 public class OdePlugin : IPhysicsPlugin
48 {
49 //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
50
51 private OdeScene m_scene;
52
53 public bool Init()
54 {
55 if (Util.IsWindows())
56 Util.LoadArchSpecificWindowsDll("ode.dll");
57
58 if (d.InitODE2(0) != 0)
59 {
60 if (d.AllocateODEDataForThread(~0U) == 0)
61 {
62 d.CloseODE();
63 return false;
64 }
65 return true;
66 }
67 return false;
68 }
69
70 public PhysicsScene GetScene(String sceneIdentifier)
71 {
72 if (m_scene == null)
73 {
74
75 m_scene = new OdeScene(sceneIdentifier);
76 }
77 return (m_scene);
78 }
79
80 public string GetName()
81 {
82 return ("UbitODE");
83 }
84
85 public void Dispose()
86 {
87 d.CloseODE();
88 }
89 }
90} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/AssemblyInfo.cs
index 7d054dd..1765ae0 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/PhysicsModules/BasicPhysics/AssemblyInfo.cs
@@ -27,6 +27,7 @@
27 27
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30using Mono.Addins;
30 31
31// Information about this assembly is defined by the following 32// Information about this assembly is defined by the following
32// attributes. 33// attributes.
@@ -34,11 +35,11 @@ using System.Runtime.InteropServices;
34// change them to the information which is associated with the assembly 35// change them to the information which is associated with the assembly
35// you compile. 36// you compile.
36 37
37[assembly : AssemblyTitle("BasicPhysicsPlugin")] 38[assembly : AssemblyTitle("BasicPhysicsModule")]
38[assembly : AssemblyDescription("")] 39[assembly : AssemblyDescription("")]
39[assembly : AssemblyConfiguration("")] 40[assembly : AssemblyConfiguration("")]
40[assembly : AssemblyCompany("http://opensimulator.org")] 41[assembly : AssemblyCompany("http://opensimulator.org")]
41[assembly : AssemblyProduct("BasicPhysicsPlugin")] 42[assembly : AssemblyProduct("BasicPhysicsModule")]
42[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers")] 43[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers")]
43[assembly : AssemblyTrademark("")] 44[assembly : AssemblyTrademark("")]
44[assembly : AssemblyCulture("")] 45[assembly : AssemblyCulture("")]
@@ -56,3 +57,6 @@ using System.Runtime.InteropServices;
56// numbers with the '*' character (the default): 57// numbers with the '*' character (the default):
57 58
58[assembly : AssemblyVersion("0.8.2.*")] 59[assembly : AssemblyVersion("0.8.2.*")]
60
61[assembly: Addin("OpenSim.Region.PhysicsModule.BasicPhysics", OpenSim.VersionInfo.VersionNumber)]
62[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsActor.cs
index 43fba7b..e7b30ba 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
+++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsActor.cs
@@ -30,9 +30,9 @@ using System.Collections.Generic;
30using Nini.Config; 30using Nini.Config;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.PhysicsModules.SharedBase;
34 34
35namespace OpenSim.Region.Physics.BasicPhysicsPlugin 35namespace OpenSim.Region.PhysicsModule.BasicPhysics
36{ 36{
37 public class BasicActor : PhysicsActor 37 public class BasicActor : PhysicsActor
38 { 38 {
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPrim.cs
index dfe4c19..5383f1b 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs
+++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPrim.cs
@@ -30,9 +30,9 @@ using System.Collections.Generic;
30using Nini.Config; 30using Nini.Config;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.PhysicsModules.SharedBase;
34 34
35namespace OpenSim.Region.Physics.BasicPhysicsPlugin 35namespace OpenSim.Region.PhysicsModule.BasicPhysics
36{ 36{
37 public class BasicPhysicsPrim : PhysicsActor 37 public class BasicPhysicsPrim : PhysicsActor
38 { 38 {
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs
index 0d28c8e..ac2c1f3 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
+++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs
@@ -28,11 +28,14 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using Nini.Config; 30using Nini.Config;
31using Mono.Addins;
31using OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Framework; 33using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.PhysicsModules.SharedBase;
35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces;
34 37
35namespace OpenSim.Region.Physics.BasicPhysicsPlugin 38namespace OpenSim.Region.PhysicsModule.BasicPhysics
36{ 39{
37 /// <summary> 40 /// <summary>
38 /// This is an incomplete extremely basic physics implementation 41 /// This is an incomplete extremely basic physics implementation
@@ -41,32 +44,74 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
41 /// Not useful for anything at the moment apart from some regression testing in other components where some form 44 /// Not useful for anything at the moment apart from some regression testing in other components where some form
42 /// of physics plugin is needed. 45 /// of physics plugin is needed.
43 /// </remarks> 46 /// </remarks>
44 public class BasicScene : PhysicsScene 47 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BasicPhysicsScene")]
48 public class BasicScene : PhysicsScene, INonSharedRegionModule
45 { 49 {
46 private List<BasicActor> _actors = new List<BasicActor>(); 50 private List<BasicActor> _actors = new List<BasicActor>();
47 private List<BasicPhysicsPrim> _prims = new List<BasicPhysicsPrim>(); 51 private List<BasicPhysicsPrim> _prims = new List<BasicPhysicsPrim>();
48 private float[] _heightMap; 52 private float[] _heightMap;
49 private Vector3 m_regionExtent; 53 private Vector3 m_regionExtent;
50 54
55 private bool m_Enabled = false;
56
51 //protected internal string sceneIdentifier; 57 //protected internal string sceneIdentifier;
58 #region INonSharedRegionModule
59 public string Name
60 {
61 get { return "basicphysics"; }
62 }
52 63
53 public BasicScene(string engineType, string _sceneIdentifier) 64 public Type ReplaceableInterface
54 { 65 {
55 EngineType = engineType; 66 get { return null; }
56 Name = EngineType + "/" + _sceneIdentifier;
57 //sceneIdentifier = _sceneIdentifier;
58 } 67 }
59 68
60 public override void Initialise(IMesher meshmerizer, IConfigSource config) 69 public void Initialise(IConfigSource source)
61 { 70 {
62 throw new Exception("Should not be called."); 71 // TODO: Move this out of Startup
72 IConfig config = source.Configs["Startup"];
73 if (config != null)
74 {
75 string physics = config.GetString("physics", string.Empty);
76 if (physics == Name)
77 m_Enabled = true;
78 }
79
63 } 80 }
64 81
65 public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) 82 public void Close()
66 { 83 {
67 m_regionExtent = regionExtent;
68 } 84 }
69 85
86 public void AddRegion(Scene scene)
87 {
88 if (!m_Enabled)
89 return;
90
91 EngineType = Name;
92 PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName;
93
94 scene.RegisterModuleInterface<PhysicsScene>(this);
95 m_regionExtent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ);
96 base.Initialise(scene.PhysicsRequestAsset,
97 (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[scene.RegionInfo.RegionSizeX * scene.RegionInfo.RegionSizeY]),
98 (float)scene.RegionInfo.RegionSettings.WaterHeight);
99
100 }
101
102 public void RemoveRegion(Scene scene)
103 {
104 if (!m_Enabled)
105 return;
106 }
107
108 public void RegionLoaded(Scene scene)
109 {
110 if (!m_Enabled)
111 return;
112 }
113 #endregion
114
70 public override void Dispose() {} 115 public override void Dispose() {}
71 116
72 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, 117 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
@@ -119,8 +164,8 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
119 Vector3 actorPosition = actor.Position; 164 Vector3 actorPosition = actor.Position;
120 Vector3 actorVelocity = actor.Velocity; 165 Vector3 actorVelocity = actor.Velocity;
121 166
122// Console.WriteLine( 167 //Console.WriteLine(
123// "Processing actor {0}, starting pos {1}, starting vel {2}", i, actorPosition, actorVelocity); 168 // "Processing actor {0}, starting pos {1}, starting vel {2}", i, actorPosition, actorVelocity);
124 169
125 actorPosition.X += actor.Velocity.X * timeStep; 170 actorPosition.X += actor.Velocity.X * timeStep;
126 actorPosition.Y += actor.Velocity.Y * timeStep; 171 actorPosition.Y += actor.Velocity.Y * timeStep;
@@ -206,5 +251,6 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
206 Dictionary<uint, float> returncolliders = new Dictionary<uint, float>(); 251 Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
207 return returncolliders; 252 return returncolliders;
208 } 253 }
254
209 } 255 }
210} 256}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs b/OpenSim/Region/PhysicsModules/BulletS/BSAPIUnman.cs
index 3bd81d4..c4a923c 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSAPIUnman.cs
@@ -35,7 +35,7 @@ using OpenSim.Framework;
35 35
36using OpenMetaverse; 36using OpenMetaverse;
37 37
38namespace OpenSim.Region.Physics.BulletSPlugin 38namespace OpenSim.Region.PhysicsModule.BulletS
39{ 39{
40public sealed class BSAPIUnman : BSAPITemplate 40public sealed class BSAPIUnman : BSAPITemplate
41{ 41{
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/PhysicsModules/BulletS/BSAPIXNA.cs
index 741f8db..887311d 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSAPIXNA.cs
@@ -40,7 +40,7 @@ using BulletXNA.BulletCollision;
40using BulletXNA.BulletDynamics; 40using BulletXNA.BulletDynamics;
41using BulletXNA.BulletCollision.CollisionDispatch; 41using BulletXNA.BulletCollision.CollisionDispatch;
42 42
43namespace OpenSim.Region.Physics.BulletSPlugin 43namespace OpenSim.Region.PhysicsModule.BulletS
44{ 44{
45public sealed class BSAPIXNA : BSAPITemplate 45public sealed class BSAPIXNA : BSAPITemplate
46{ 46{
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs
index bde4557..0191893 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs
@@ -31,11 +31,11 @@ using System.Linq;
31using System.Text; 31using System.Text;
32 32
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.PhysicsModules.SharedBase;
35 35
36using OMV = OpenMetaverse; 36using OMV = OpenMetaverse;
37 37
38namespace OpenSim.Region.Physics.BulletSPlugin 38namespace OpenSim.Region.PhysicsModule.BulletS
39{ 39{
40public class BSActorAvatarMove : BSActor 40public class BSActorAvatarMove : BSActor
41{ 41{
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorHover.cs
index e54c27b..7ff171e 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorHover.cs
@@ -30,11 +30,11 @@ using System.Collections.Generic;
30using System.Linq; 30using System.Linq;
31using System.Text; 31using System.Text;
32 32
33using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.PhysicsModules.SharedBase;
34 34
35using OMV = OpenMetaverse; 35using OMV = OpenMetaverse;
36 36
37namespace OpenSim.Region.Physics.BulletSPlugin 37namespace OpenSim.Region.PhysicsModule.BulletS
38{ 38{
39public class BSActorHover : BSActor 39public class BSActorHover : BSActor
40{ 40{
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorLockAxis.cs
index 3b3c161..78c1b6a 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorLockAxis.cs
@@ -32,7 +32,7 @@ using System.Text;
32 32
33using OMV = OpenMetaverse; 33using OMV = OpenMetaverse;
34 34
35namespace OpenSim.Region.Physics.BulletSPlugin 35namespace OpenSim.Region.PhysicsModule.BulletS
36{ 36{
37public class BSActorLockAxis : BSActor 37public class BSActorLockAxis : BSActor
38{ 38{
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs
index 1145006..3db8f2c 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs
@@ -30,11 +30,11 @@ using System.Collections.Generic;
30using System.Linq; 30using System.Linq;
31using System.Text; 31using System.Text;
32 32
33using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.PhysicsModules.SharedBase;
34 34
35using OMV = OpenMetaverse; 35using OMV = OpenMetaverse;
36 36
37namespace OpenSim.Region.Physics.BulletSPlugin 37namespace OpenSim.Region.PhysicsModule.BulletS
38{ 38{
39public class BSActorMoveToTarget : BSActor 39public class BSActorMoveToTarget : BSActor
40{ 40{
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorSetForce.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetForce.cs
index 4e81363..ecb4b7f 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorSetForce.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetForce.cs
@@ -30,11 +30,11 @@ using System.Collections.Generic;
30using System.Linq; 30using System.Linq;
31using System.Text; 31using System.Text;
32 32
33using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.PhysicsModules.SharedBase;
34 34
35using OMV = OpenMetaverse; 35using OMV = OpenMetaverse;
36 36
37namespace OpenSim.Region.Physics.BulletSPlugin 37namespace OpenSim.Region.PhysicsModule.BulletS
38{ 38{
39public class BSActorSetForce : BSActor 39public class BSActorSetForce : BSActor
40{ 40{
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorSetTorque.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs
index 79e1d38..a1cf4db 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorSetTorque.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs
@@ -30,11 +30,11 @@ using System.Collections.Generic;
30using System.Linq; 30using System.Linq;
31using System.Text; 31using System.Text;
32 32
33using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.PhysicsModules.SharedBase;
34 34
35using OMV = OpenMetaverse; 35using OMV = OpenMetaverse;
36 36
37namespace OpenSim.Region.Physics.BulletSPlugin 37namespace OpenSim.Region.PhysicsModule.BulletS
38{ 38{
39public class BSActorSetTorque : BSActor 39public class BSActorSetTorque : BSActor
40{ 40{
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActors.cs
index 7f45e2c..851347b 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSActors.cs
@@ -28,7 +28,7 @@ using System;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Text; 29using System.Text;
30 30
31namespace OpenSim.Region.Physics.BulletSPlugin 31namespace OpenSim.Region.PhysicsModule.BulletS
32{ 32{
33public class BSActorCollection 33public class BSActorCollection
34{ 34{
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/PhysicsModules/BulletS/BSApiTemplate.cs
index 8491c0f..7756b10 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSApiTemplate.cs
@@ -31,7 +31,7 @@ using System.Security;
31using System.Text; 31using System.Text;
32using OpenMetaverse; 32using OpenMetaverse;
33 33
34namespace OpenSim.Region.Physics.BulletSPlugin { 34namespace OpenSim.Region.PhysicsModule.BulletS {
35 35
36 // Constraint type values as defined by Bullet 36 // Constraint type values as defined by Bullet
37public enum ConstraintType : int 37public enum ConstraintType : int
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs
index 9c3f160..83fc3a6 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs
@@ -30,9 +30,9 @@ using System.Reflection;
30using log4net; 30using log4net;
31using OMV = OpenMetaverse; 31using OMV = OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.PhysicsModules.SharedBase;
34 34
35namespace OpenSim.Region.Physics.BulletSPlugin 35namespace OpenSim.Region.PhysicsModule.BulletS
36{ 36{
37public sealed class BSCharacter : BSPhysObject 37public sealed class BSCharacter : BSPhysObject
38{ 38{
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraint.cs
index b47e9a8..e42e868 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraint.cs
@@ -29,7 +29,7 @@ using System.Collections.Generic;
29using System.Text; 29using System.Text;
30using OpenMetaverse; 30using OpenMetaverse;
31 31
32namespace OpenSim.Region.Physics.BulletSPlugin 32namespace OpenSim.Region.PhysicsModule.BulletS
33{ 33{
34 34
35public abstract class BSConstraint : IDisposable 35public abstract class BSConstraint : IDisposable
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraint6Dof.cs
index 7fcb75c..4bcde2b 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraint6Dof.cs
@@ -29,7 +29,7 @@ using System.Collections.Generic;
29using System.Text; 29using System.Text;
30using OpenMetaverse; 30using OpenMetaverse;
31 31
32namespace OpenSim.Region.Physics.BulletSPlugin 32namespace OpenSim.Region.PhysicsModule.BulletS
33{ 33{
34 34
35public class BSConstraint6Dof : BSConstraint 35public class BSConstraint6Dof : BSConstraint
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintCollection.cs
index 5c8d94e..5746ac1 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintCollection.cs
@@ -30,7 +30,7 @@ using System.Text;
30using log4net; 30using log4net;
31using OpenMetaverse; 31using OpenMetaverse;
32 32
33namespace OpenSim.Region.Physics.BulletSPlugin 33namespace OpenSim.Region.PhysicsModule.BulletS
34{ 34{
35 35
36public sealed class BSConstraintCollection : IDisposable 36public sealed class BSConstraintCollection : IDisposable
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintConeTwist.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintConeTwist.cs
index 7a76a9a..e7566a8 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintConeTwist.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintConeTwist.cs
@@ -29,7 +29,7 @@ using System.Collections.Generic;
29using System.Text; 29using System.Text;
30using OpenMetaverse; 30using OpenMetaverse;
31 31
32namespace OpenSim.Region.Physics.BulletSPlugin 32namespace OpenSim.Region.PhysicsModule.BulletS
33{ 33{
34 34
35public sealed class BSConstraintConeTwist : BSConstraint 35public sealed class BSConstraintConeTwist : BSConstraint
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintHinge.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintHinge.cs
index ed89f63..d20538d 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintHinge.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintHinge.cs
@@ -29,7 +29,7 @@ using System.Collections.Generic;
29using System.Text; 29using System.Text;
30using OpenMetaverse; 30using OpenMetaverse;
31 31
32namespace OpenSim.Region.Physics.BulletSPlugin 32namespace OpenSim.Region.PhysicsModule.BulletS
33{ 33{
34 34
35public sealed class BSConstraintHinge : BSConstraint 35public sealed class BSConstraintHinge : BSConstraint
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSlider.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintSlider.cs
index 37cfa07..83d42af 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSlider.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintSlider.cs
@@ -29,7 +29,7 @@ using System.Collections.Generic;
29using System.Text; 29using System.Text;
30using OpenMetaverse; 30using OpenMetaverse;
31 31
32namespace OpenSim.Region.Physics.BulletSPlugin 32namespace OpenSim.Region.PhysicsModule.BulletS
33{ 33{
34 34
35public sealed class BSConstraintSlider : BSConstraint 35public sealed class BSConstraintSlider : BSConstraint
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSpring.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintSpring.cs
index 8e7ddff..563a1b1 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSpring.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintSpring.cs
@@ -29,7 +29,7 @@ using System.Collections.Generic;
29using System.Text; 29using System.Text;
30using OpenMetaverse; 30using OpenMetaverse;
31 31
32namespace OpenSim.Region.Physics.BulletSPlugin 32namespace OpenSim.Region.PhysicsModule.BulletS
33{ 33{
34 34
35public sealed class BSConstraintSpring : BSConstraint6Dof 35public sealed class BSConstraintSpring : BSConstraint6Dof
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs
index c6d6331..0fc5577 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs
@@ -36,9 +36,9 @@ using System.Reflection;
36using System.Runtime.InteropServices; 36using System.Runtime.InteropServices;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Region.Physics.Manager; 39using OpenSim.Region.PhysicsModules.SharedBase;
40 40
41namespace OpenSim.Region.Physics.BulletSPlugin 41namespace OpenSim.Region.PhysicsModule.BulletS
42{ 42{
43 public sealed class BSDynamics : BSActor 43 public sealed class BSDynamics : BSActor
44 { 44 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/PhysicsModules/BulletS/BSLinkset.cs
index 87eba33..8312239 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSLinkset.cs
@@ -30,7 +30,7 @@ using System.Text;
30 30
31using OMV = OpenMetaverse; 31using OMV = OpenMetaverse;
32 32
33namespace OpenSim.Region.Physics.BulletSPlugin 33namespace OpenSim.Region.PhysicsModule.BulletS
34{ 34{
35 35
36public abstract class BSLinkset 36public abstract class BSLinkset
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/PhysicsModules/BulletS/BSLinksetCompound.cs
index cae9efa..953ddee 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSLinksetCompound.cs
@@ -32,7 +32,7 @@ using OpenSim.Framework;
32 32
33using OMV = OpenMetaverse; 33using OMV = OpenMetaverse;
34 34
35namespace OpenSim.Region.Physics.BulletSPlugin 35namespace OpenSim.Region.PhysicsModule.BulletS
36{ 36{
37 37
38public sealed class BSLinksetCompound : BSLinkset 38public sealed class BSLinksetCompound : BSLinkset
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/PhysicsModules/BulletS/BSLinksetConstraints.cs
index 4384cdc..c4b4c86 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSLinksetConstraints.cs
@@ -28,11 +28,9 @@ using System;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Text; 29using System.Text;
30 30
31using OpenSim.Region.OptionalModules.Scripting;
32
33using OMV = OpenMetaverse; 31using OMV = OpenMetaverse;
34 32
35namespace OpenSim.Region.Physics.BulletSPlugin 33namespace OpenSim.Region.PhysicsModule.BulletS
36{ 34{
37public sealed class BSLinksetConstraints : BSLinkset 35public sealed class BSLinksetConstraints : BSLinkset
38{ 36{
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs b/OpenSim/Region/PhysicsModules/BulletS/BSMaterials.cs
index ee77d6e..0e44d03 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSMaterials.cs
@@ -30,7 +30,7 @@ using System.Text;
30using System.Reflection; 30using System.Reflection;
31using Nini.Config; 31using Nini.Config;
32 32
33namespace OpenSim.Region.Physics.BulletSPlugin 33namespace OpenSim.Region.PhysicsModule.BulletS
34{ 34{
35 35
36public struct MaterialAttributes 36public struct MaterialAttributes
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs b/OpenSim/Region/PhysicsModules/BulletS/BSMotors.cs
index 7693195..2faf2d4 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSMotors.cs
@@ -31,7 +31,7 @@ using System.Text;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33 33
34namespace OpenSim.Region.Physics.BulletSPlugin 34namespace OpenSim.Region.PhysicsModule.BulletS
35{ 35{
36public abstract class BSMotor 36public abstract class BSMotor
37{ 37{
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs
index 6d46fe6..c296008 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs
@@ -29,12 +29,12 @@ using System.Collections.Generic;
29using System.Reflection; 29using System.Reflection;
30using System.Text; 30using System.Text;
31 31
32using OpenSim.Region.Physics.Manager; 32using OpenSim.Region.PhysicsModules.SharedBase;
33 33
34using OpenMetaverse; 34using OpenMetaverse;
35using Nini.Config; 35using Nini.Config;
36 36
37namespace OpenSim.Region.Physics.BulletSPlugin 37namespace OpenSim.Region.PhysicsModule.BulletS
38{ 38{
39public static class BSParam 39public static class BSParam
40{ 40{
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
index 90da7a6..da3fc18 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
@@ -30,9 +30,9 @@ using System.Text;
30 30
31using OMV = OpenMetaverse; 31using OMV = OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.PhysicsModules.SharedBase;
34 34
35namespace OpenSim.Region.Physics.BulletSPlugin 35namespace OpenSim.Region.PhysicsModule.BulletS
36{ 36{
37/* 37/*
38 * Class to wrap all objects. 38 * Class to wrap all objects.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs
index a00991f..6f27ac7 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs
@@ -32,11 +32,10 @@ using System.Xml;
32using log4net; 32using log4net;
33using OMV = OpenMetaverse; 33using OMV = OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Region.Physics.Manager; 35using OpenSim.Region.PhysicsModules.SharedBase;
36using OpenSim.Region.Physics.ConvexDecompositionDotNet; 36using OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet;
37using OpenSim.Region.OptionalModules.Scripting; // for ExtendedPhysics
38 37
39namespace OpenSim.Region.Physics.BulletSPlugin 38namespace OpenSim.Region.PhysicsModule.BulletS
40{ 39{
41 40
42 [Serializable] 41 [Serializable]
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrimDisplaced.cs
index 2eb1440..d8ed56b 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSPrimDisplaced.cs
@@ -31,11 +31,11 @@ using System.Reflection;
31using System.Runtime.InteropServices; 31using System.Runtime.InteropServices;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.PhysicsModules.SharedBase;
35 35
36using OMV = OpenMetaverse; 36using OMV = OpenMetaverse;
37 37
38namespace OpenSim.Region.Physics.BulletSPlugin 38namespace OpenSim.Region.PhysicsModule.BulletS
39{ 39{
40public class BSPrimDisplaced : BSPrim 40public class BSPrimDisplaced : BSPrim
41{ 41{
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs
index 430d645..55b5da0 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs
@@ -30,11 +30,10 @@ using System.Linq;
30using System.Text; 30using System.Text;
31 31
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Region.OptionalModules.Scripting;
34 33
35using OMV = OpenMetaverse; 34using OMV = OpenMetaverse;
36 35
37namespace OpenSim.Region.Physics.BulletSPlugin 36namespace OpenSim.Region.PhysicsModule.BulletS
38{ 37{
39public class BSPrimLinkable : BSPrimDisplaced 38public class BSPrimLinkable : BSPrimDisplaced
40{ 39{
@@ -72,7 +71,7 @@ public class BSPrimLinkable : BSPrimDisplaced
72 base.Destroy(); 71 base.Destroy();
73 } 72 }
74 73
75 public override void link(Manager.PhysicsActor obj) 74 public override void link(OpenSim.Region.PhysicsModules.SharedBase.PhysicsActor obj)
76 { 75 {
77 BSPrimLinkable parent = obj as BSPrimLinkable; 76 BSPrimLinkable parent = obj as BSPrimLinkable;
78 if (parent != null) 77 if (parent != null)
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs
new file mode 100644
index 0000000..452ce55
--- /dev/null
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs
@@ -0,0 +1,1333 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyrightD
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using System.Collections.Generic;
29using System.Linq;
30using System.Reflection;
31using System.Runtime.InteropServices;
32using System.Text;
33using System.Threading;
34using OpenSim.Framework;
35using OpenSim.Framework.Monitoring;
36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.PhysicsModules.SharedBase;
39using Nini.Config;
40using log4net;
41using OpenMetaverse;
42using Mono.Addins;
43
44namespace OpenSim.Region.PhysicsModule.BulletS
45{
46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BulletSPhysicsScene")]
47 public sealed class BSScene : PhysicsScene, IPhysicsParameters, INonSharedRegionModule
48 {
49 internal static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
50 internal static readonly string LogHeader = "[BULLETS SCENE]";
51
52 private bool m_Enabled = false;
53 private IConfigSource m_Config;
54
55 // The name of the region we're working for.
56 public string RegionName { get; private set; }
57
58 public string BulletSimVersion = "?";
59
60 // The handle to the underlying managed or unmanaged version of Bullet being used.
61 public string BulletEngineName { get; private set; }
62 public BSAPITemplate PE;
63
64 // If the physics engine is running on a separate thread
65 public Thread m_physicsThread;
66
67 public Dictionary<uint, BSPhysObject> PhysObjects;
68 public BSShapeCollection Shapes;
69
70 // Keeping track of the objects with collisions so we can report begin and end of a collision
71 public HashSet<BSPhysObject> ObjectsWithCollisions = new HashSet<BSPhysObject>();
72 public HashSet<BSPhysObject> ObjectsWithNoMoreCollisions = new HashSet<BSPhysObject>();
73
74 // All the collision processing is protected with this lock object
75 public Object CollisionLock = new Object();
76
77 // Properties are updated here
78 public Object UpdateLock = new Object();
79 public HashSet<BSPhysObject> ObjectsWithUpdates = new HashSet<BSPhysObject>();
80
81 // Keep track of all the avatars so we can send them a collision event
82 // every tick so OpenSim will update its animation.
83 private HashSet<BSPhysObject> AvatarsInScene = new HashSet<BSPhysObject>();
84 private Object AvatarsInSceneLock = new Object();
85
86 // let my minuions use my logger
87 public ILog Logger { get { return m_log; } }
88
89 public IMesher mesher;
90 public uint WorldID { get; private set; }
91 public BulletWorld World { get; private set; }
92
93 // All the constraints that have been allocated in this instance.
94 public BSConstraintCollection Constraints { get; private set; }
95
96 // Simulation parameters
97 //internal float m_physicsStepTime; // if running independently, the interval simulated by default
98
99 internal int m_maxSubSteps;
100 internal float m_fixedTimeStep;
101
102 internal float m_simulatedTime; // the time simulated previously. Used for physics framerate calc.
103
104 internal long m_simulationStep = 0; // The current simulation step.
105 public long SimulationStep { get { return m_simulationStep; } }
106 // A number to use for SimulationStep that is probably not any step value
107 // Used by the collision code (which remembers the step when a collision happens) to remember not any simulation step.
108 public static long NotASimulationStep = -1234;
109
110 internal float LastTimeStep { get; private set; } // The simulation time from the last invocation of Simulate()
111
112 internal float NominalFrameRate { get; set; } // Parameterized ideal frame rate that simulation is scaled to
113
114 // Physical objects can register for prestep or poststep events
115 public delegate void PreStepAction(float timeStep);
116 public delegate void PostStepAction(float timeStep);
117 public event PreStepAction BeforeStep;
118 public event PostStepAction AfterStep;
119
120 // A value of the time 'now' so all the collision and update routines do not have to get their own
121 // Set to 'now' just before all the prims and actors are called for collisions and updates
122 public int SimulationNowTime { get; private set; }
123
124 // True if initialized and ready to do simulation steps
125 private bool m_initialized = false;
126
127 // Flag which is true when processing taints.
128 // Not guaranteed to be correct all the time (don't depend on this) but good for debugging.
129 public bool InTaintTime { get; private set; }
130
131 // Pinned memory used to pass step information between managed and unmanaged
132 internal int m_maxCollisionsPerFrame;
133 internal CollisionDesc[] m_collisionArray;
134
135 internal int m_maxUpdatesPerFrame;
136 internal EntityProperties[] m_updateArray;
137
138 /// <summary>
139 /// Used to control physics simulation timing if Bullet is running on its own thread.
140 /// </summary>
141 private ManualResetEvent m_updateWaitEvent;
142
143 public const uint TERRAIN_ID = 0; // OpenSim senses terrain with a localID of zero
144 public const uint GROUNDPLANE_ID = 1;
145 public const uint CHILDTERRAIN_ID = 2; // Terrain allocated based on our mega-prim childre start here
146
147 public float SimpleWaterLevel { get; set; }
148 public BSTerrainManager TerrainManager { get; private set; }
149
150 public ConfigurationParameters Params
151 {
152 get { return UnmanagedParams[0]; }
153 }
154 public Vector3 DefaultGravity
155 {
156 get { return new Vector3(0f, 0f, Params.gravity); }
157 }
158 // Just the Z value of the gravity
159 public float DefaultGravityZ
160 {
161 get { return Params.gravity; }
162 }
163
164 // When functions in the unmanaged code must be called, it is only
165 // done at a known time just before the simulation step. The taint
166 // system saves all these function calls and executes them in
167 // order before the simulation.
168 public delegate void TaintCallback();
169 private struct TaintCallbackEntry
170 {
171 public String originator;
172 public String ident;
173 public TaintCallback callback;
174 public TaintCallbackEntry(string pIdent, TaintCallback pCallBack)
175 {
176 originator = BSScene.DetailLogZero;
177 ident = pIdent;
178 callback = pCallBack;
179 }
180 public TaintCallbackEntry(string pOrigin, string pIdent, TaintCallback pCallBack)
181 {
182 originator = pOrigin;
183 ident = pIdent;
184 callback = pCallBack;
185 }
186 }
187 private Object _taintLock = new Object(); // lock for using the next object
188 private List<TaintCallbackEntry> _taintOperations;
189 private Dictionary<string, TaintCallbackEntry> _postTaintOperations;
190 private List<TaintCallbackEntry> _postStepOperations;
191
192 // A pointer to an instance if this structure is passed to the C++ code
193 // Used to pass basic configuration values to the unmanaged code.
194 internal ConfigurationParameters[] UnmanagedParams;
195
196 // Sometimes you just have to log everything.
197 public LogWriter PhysicsLogging;
198 private bool m_physicsLoggingEnabled;
199 private string m_physicsLoggingDir;
200 private string m_physicsLoggingPrefix;
201 private int m_physicsLoggingFileMinutes;
202 private bool m_physicsLoggingDoFlush;
203 private bool m_physicsPhysicalDumpEnabled;
204 public int PhysicsMetricDumpFrames { get; set; }
205 // 'true' of the vehicle code is to log lots of details
206 public bool VehicleLoggingEnabled { get; private set; }
207 public bool VehiclePhysicalLoggingEnabled { get; private set; }
208
209 #region INonSharedRegionModule
210 public string Name
211 {
212 get { return "BulletSim"; }
213 }
214
215 public Type ReplaceableInterface
216 {
217 get { return null; }
218 }
219
220 public void Initialise(IConfigSource source)
221 {
222 // TODO: Move this out of Startup
223 IConfig config = source.Configs["Startup"];
224 if (config != null)
225 {
226 string physics = config.GetString("physics", string.Empty);
227 if (physics == Name)
228 {
229 m_Enabled = true;
230 m_Config = source;
231 }
232 }
233
234 }
235
236 public void Close()
237 {
238 }
239
240 public void AddRegion(Scene scene)
241 {
242 if (!m_Enabled)
243 return;
244
245 EngineType = Name;
246 RegionName = scene.RegionInfo.RegionName;
247 PhysicsSceneName = EngineType + "/" + RegionName;
248
249 scene.RegisterModuleInterface<PhysicsScene>(this);
250 Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ);
251 Initialise(m_Config, extent);
252
253 base.Initialise(scene.PhysicsRequestAsset,
254 (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[scene.RegionInfo.RegionSizeX * scene.RegionInfo.RegionSizeY]),
255 (float)scene.RegionInfo.RegionSettings.WaterHeight);
256
257 }
258
259 public void RemoveRegion(Scene scene)
260 {
261 if (!m_Enabled)
262 return;
263 }
264
265 public void RegionLoaded(Scene scene)
266 {
267 if (!m_Enabled)
268 return;
269
270 mesher = scene.RequestModuleInterface<IMesher>();
271 if (mesher == null)
272 m_log.WarnFormat("{0} No mesher. Things will not work well.", LogHeader);
273
274 scene.PhysicsEnabled = true;
275 }
276 #endregion
277
278 #region Initialization
279
280 private void Initialise(IConfigSource config, Vector3 regionExtent)
281 {
282 _taintOperations = new List<TaintCallbackEntry>();
283 _postTaintOperations = new Dictionary<string, TaintCallbackEntry>();
284 _postStepOperations = new List<TaintCallbackEntry>();
285 PhysObjects = new Dictionary<uint, BSPhysObject>();
286 Shapes = new BSShapeCollection(this);
287
288 m_simulatedTime = 0f;
289 LastTimeStep = 0.1f;
290
291 // Allocate pinned memory to pass parameters.
292 UnmanagedParams = new ConfigurationParameters[1];
293
294 // Set default values for physics parameters plus any overrides from the ini file
295 GetInitialParameterValues(config);
296
297 // Force some parameters to values depending on other configurations
298 // Only use heightmap terrain implementation if terrain larger than legacy size
299 if ((uint)regionExtent.X > Constants.RegionSize || (uint)regionExtent.Y > Constants.RegionSize)
300 {
301 m_log.WarnFormat("{0} Forcing terrain implementation to heightmap for large region", LogHeader);
302 BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap;
303 }
304
305 // Get the connection to the physics engine (could be native or one of many DLLs)
306 PE = SelectUnderlyingBulletEngine(BulletEngineName);
307
308 // Enable very detailed logging.
309 // By creating an empty logger when not logging, the log message invocation code
310 // can be left in and every call doesn't have to check for null.
311 if (m_physicsLoggingEnabled)
312 {
313 PhysicsLogging = new LogWriter(m_physicsLoggingDir, m_physicsLoggingPrefix, m_physicsLoggingFileMinutes, m_physicsLoggingDoFlush);
314 PhysicsLogging.ErrorLogger = m_log; // for DEBUG. Let's the logger output its own error messages.
315 }
316 else
317 {
318 PhysicsLogging = new LogWriter();
319 }
320
321 // Allocate memory for returning of the updates and collisions from the physics engine
322 m_collisionArray = new CollisionDesc[m_maxCollisionsPerFrame];
323 m_updateArray = new EntityProperties[m_maxUpdatesPerFrame];
324
325 // The bounding box for the simulated world. The origin is 0,0,0 unless we're
326 // a child in a mega-region.
327 // Bullet actually doesn't care about the extents of the simulated
328 // area. It tracks active objects no matter where they are.
329 Vector3 worldExtent = regionExtent;
330
331 World = PE.Initialize(worldExtent, Params, m_maxCollisionsPerFrame, ref m_collisionArray, m_maxUpdatesPerFrame, ref m_updateArray);
332
333 Constraints = new BSConstraintCollection(World);
334
335 TerrainManager = new BSTerrainManager(this, worldExtent);
336 TerrainManager.CreateInitialGroundPlaneAndTerrain();
337
338 // Put some informational messages into the log file.
339 m_log.InfoFormat("{0} Linksets implemented with {1}", LogHeader, (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation);
340
341 InTaintTime = false;
342 m_initialized = true;
343
344 // If the physics engine runs on its own thread, start same.
345 if (BSParam.UseSeparatePhysicsThread)
346 {
347 // The physics simulation should happen independently of the heartbeat loop
348 m_physicsThread
349 = WorkManager.StartThread(
350 BulletSPluginPhysicsThread,
351 string.Format("{0} ({1})", BulletEngineName, RegionName),
352 ThreadPriority.Normal,
353 true,
354 true);
355 }
356 }
357
358 // All default parameter values are set here. There should be no values set in the
359 // variable definitions.
360 private void GetInitialParameterValues(IConfigSource config)
361 {
362 ConfigurationParameters parms = new ConfigurationParameters();
363 UnmanagedParams[0] = parms;
364
365 BSParam.SetParameterDefaultValues(this);
366
367 if (config != null)
368 {
369 // If there are specifications in the ini file, use those values
370 IConfig pConfig = config.Configs["BulletSim"];
371 if (pConfig != null)
372 {
373 BSParam.SetParameterConfigurationValues(this, pConfig);
374
375 // There are two Bullet implementations to choose from
376 BulletEngineName = pConfig.GetString("BulletEngine", "BulletUnmanaged");
377
378 // Very detailed logging for physics debugging
379 // TODO: the boolean values can be moved to the normal parameter processing.
380 m_physicsLoggingEnabled = pConfig.GetBoolean("PhysicsLoggingEnabled", false);
381 m_physicsLoggingDir = pConfig.GetString("PhysicsLoggingDir", ".");
382 m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-%REGIONNAME%-");
383 m_physicsLoggingFileMinutes = pConfig.GetInt("PhysicsLoggingFileMinutes", 5);
384 m_physicsLoggingDoFlush = pConfig.GetBoolean("PhysicsLoggingDoFlush", false);
385 m_physicsPhysicalDumpEnabled = pConfig.GetBoolean("PhysicsPhysicalDumpEnabled", false);
386 // Very detailed logging for vehicle debugging
387 VehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false);
388 VehiclePhysicalLoggingEnabled = pConfig.GetBoolean("VehiclePhysicalLoggingEnabled", false);
389
390 // Do any replacements in the parameters
391 m_physicsLoggingPrefix = m_physicsLoggingPrefix.Replace("%REGIONNAME%", RegionName);
392 }
393 else
394 {
395 // Nothing in the configuration INI file so assume unmanaged and other defaults.
396 BulletEngineName = "BulletUnmanaged";
397 m_physicsLoggingEnabled = false;
398 VehicleLoggingEnabled = false;
399 }
400
401 // The material characteristics.
402 BSMaterials.InitializeFromDefaults(Params);
403 if (pConfig != null)
404 {
405 // Let the user add new and interesting material property values.
406 BSMaterials.InitializefromParameters(pConfig);
407 }
408 }
409 }
410
411 // A helper function that handles a true/false parameter and returns the proper float number encoding
412 float ParamBoolean(IConfig config, string parmName, float deflt)
413 {
414 float ret = deflt;
415 if (config.Contains(parmName))
416 {
417 ret = ConfigurationParameters.numericFalse;
418 if (config.GetBoolean(parmName, false))
419 {
420 ret = ConfigurationParameters.numericTrue;
421 }
422 }
423 return ret;
424 }
425
426 // Select the connection to the actual Bullet implementation.
427 // The main engine selection is the engineName up to the first hypen.
428 // So "Bullet-2.80-OpenCL-Intel" specifies the 'bullet' class here and the whole name
429 // is passed to the engine to do its special selection, etc.
430 private BSAPITemplate SelectUnderlyingBulletEngine(string engineName)
431 {
432 // For the moment, do a simple switch statement.
433 // Someday do fancyness with looking up the interfaces in the assembly.
434 BSAPITemplate ret = null;
435
436 string selectionName = engineName.ToLower();
437 int hyphenIndex = engineName.IndexOf("-");
438 if (hyphenIndex > 0)
439 selectionName = engineName.ToLower().Substring(0, hyphenIndex - 1);
440
441 switch (selectionName)
442 {
443 case "bullet":
444 case "bulletunmanaged":
445 ret = new BSAPIUnman(engineName, this);
446 break;
447 case "bulletxna":
448 ret = new BSAPIXNA(engineName, this);
449 // Disable some features that are not implemented in BulletXNA
450 m_log.InfoFormat("{0} Disabling some physics features not implemented by BulletXNA", LogHeader);
451 m_log.InfoFormat("{0} Disabling ShouldUseBulletHACD", LogHeader);
452 BSParam.ShouldUseBulletHACD = false;
453 m_log.InfoFormat("{0} Disabling ShouldUseSingleConvexHullForPrims", LogHeader);
454 BSParam.ShouldUseSingleConvexHullForPrims = false;
455 m_log.InfoFormat("{0} Disabling ShouldUseGImpactShapeForPrims", LogHeader);
456 BSParam.ShouldUseGImpactShapeForPrims = false;
457 m_log.InfoFormat("{0} Setting terrain implimentation to Heightmap", LogHeader);
458 BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap;
459 break;
460 }
461
462 if (ret == null)
463 {
464 m_log.ErrorFormat("{0} COULD NOT SELECT BULLET ENGINE: '[BulletSim]PhysicsEngine' must be either 'BulletUnmanaged-*' or 'BulletXNA-*'", LogHeader);
465 }
466 else
467 {
468 m_log.InfoFormat("{0} Selected bullet engine {1} -> {2}/{3}", LogHeader, engineName, ret.BulletEngineName, ret.BulletEngineVersion);
469 }
470
471 return ret;
472 }
473
474 public override void Dispose()
475 {
476 // m_log.DebugFormat("{0}: Dispose()", LogHeader);
477
478 // make sure no stepping happens while we're deleting stuff
479 m_initialized = false;
480
481 lock (PhysObjects)
482 {
483 foreach (KeyValuePair<uint, BSPhysObject> kvp in PhysObjects)
484 {
485 kvp.Value.Destroy();
486 }
487 PhysObjects.Clear();
488 }
489
490 // Now that the prims are all cleaned up, there should be no constraints left
491 if (Constraints != null)
492 {
493 Constraints.Dispose();
494 Constraints = null;
495 }
496
497 if (Shapes != null)
498 {
499 Shapes.Dispose();
500 Shapes = null;
501 }
502
503 if (TerrainManager != null)
504 {
505 TerrainManager.ReleaseGroundPlaneAndTerrain();
506 TerrainManager.Dispose();
507 TerrainManager = null;
508 }
509
510 // Anything left in the unmanaged code should be cleaned out
511 PE.Shutdown(World);
512
513 // Not logging any more
514 PhysicsLogging.Close();
515 }
516 #endregion // Construction and Initialization
517
518 #region Prim and Avatar addition and removal
519
520 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
521 {
522 m_log.ErrorFormat("{0}: CALL TO AddAvatar in BSScene. NOT IMPLEMENTED", LogHeader);
523 return null;
524 }
525
526 public override PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
527 {
528 // m_log.DebugFormat("{0}: AddAvatar: {1}", LogHeader, avName);
529
530 if (!m_initialized) return null;
531
532 BSCharacter actor = new BSCharacter(localID, avName, this, position, velocity, size, isFlying);
533 lock (PhysObjects)
534 PhysObjects.Add(localID, actor);
535
536 // TODO: Remove kludge someday.
537 // We must generate a collision for avatars whether they collide or not.
538 // This is required by OpenSim to update avatar animations, etc.
539 lock (AvatarsInSceneLock)
540 AvatarsInScene.Add(actor);
541
542 return actor;
543 }
544
545 public override void RemoveAvatar(PhysicsActor actor)
546 {
547 // m_log.DebugFormat("{0}: RemoveAvatar", LogHeader);
548
549 if (!m_initialized) return;
550
551 BSCharacter bsactor = actor as BSCharacter;
552 if (bsactor != null)
553 {
554 try
555 {
556 lock (PhysObjects)
557 PhysObjects.Remove(bsactor.LocalID);
558 // Remove kludge someday
559 lock (AvatarsInSceneLock)
560 AvatarsInScene.Remove(bsactor);
561 }
562 catch (Exception e)
563 {
564 m_log.WarnFormat("{0}: Attempt to remove avatar that is not in physics scene: {1}", LogHeader, e);
565 }
566 bsactor.Destroy();
567 // bsactor.dispose();
568 }
569 else
570 {
571 m_log.ErrorFormat("{0}: Requested to remove avatar that is not a BSCharacter. ID={1}, type={2}",
572 LogHeader, actor.LocalID, actor.GetType().Name);
573 }
574 }
575
576 public override void RemovePrim(PhysicsActor prim)
577 {
578 if (!m_initialized) return;
579
580 BSPhysObject bsprim = prim as BSPhysObject;
581 if (bsprim != null)
582 {
583 DetailLog("{0},RemovePrim,call", bsprim.LocalID);
584 // m_log.DebugFormat("{0}: RemovePrim. id={1}/{2}", LogHeader, bsprim.Name, bsprim.LocalID);
585 try
586 {
587 lock (PhysObjects) PhysObjects.Remove(bsprim.LocalID);
588 }
589 catch (Exception e)
590 {
591 m_log.ErrorFormat("{0}: Attempt to remove prim that is not in physics scene: {1}", LogHeader, e);
592 }
593 bsprim.Destroy();
594 // bsprim.dispose();
595 }
596 else
597 {
598 m_log.ErrorFormat("{0}: Attempt to remove prim that is not a BSPrim type.", LogHeader);
599 }
600 }
601
602 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
603 Vector3 size, Quaternion rotation, bool isPhysical, uint localID)
604 {
605 // m_log.DebugFormat("{0}: AddPrimShape2: {1}", LogHeader, primName);
606
607 if (!m_initialized) return null;
608
609 // DetailLog("{0},BSScene.AddPrimShape,call", localID);
610
611 BSPhysObject prim = new BSPrimLinkable(localID, primName, this, position, size, rotation, pbs, isPhysical);
612 lock (PhysObjects) PhysObjects.Add(localID, prim);
613 return prim;
614 }
615
616 // This is a call from the simulator saying that some physical property has been updated.
617 // The BulletSim driver senses the changing of relevant properties so this taint
618 // information call is not needed.
619 public override void AddPhysicsActorTaint(PhysicsActor prim) { }
620
621 #endregion // Prim and Avatar addition and removal
622
623 #region Simulation
624
625 // Call from the simulator to send physics information to the simulator objects.
626 // This pushes all the collision and property update events into the objects in
627 // the simulator and, since it is on the heartbeat thread, there is an implicit
628 // locking of those data structures from other heartbeat events.
629 // If the physics engine is running on a separate thread, the update information
630 // will be in the ObjectsWithCollions and ObjectsWithUpdates structures.
631 public override float Simulate(float timeStep)
632 {
633 if (!BSParam.UseSeparatePhysicsThread)
634 {
635 DoPhysicsStep(timeStep);
636 }
637 return SendUpdatesToSimulator(timeStep);
638 }
639
640 // Call the physics engine to do one 'timeStep' and collect collisions and updates
641 // into ObjectsWithCollisions and ObjectsWithUpdates data structures.
642 private void DoPhysicsStep(float timeStep)
643 {
644 // prevent simulation until we've been initialized
645 if (!m_initialized) return;
646
647 LastTimeStep = timeStep;
648
649 int updatedEntityCount = 0;
650 int collidersCount = 0;
651
652 int beforeTime = Util.EnvironmentTickCount();
653 int simTime = 0;
654
655 int numTaints = _taintOperations.Count;
656 InTaintTime = true; // Only used for debugging so locking is not necessary.
657
658 // update the prim states while we know the physics engine is not busy
659 ProcessTaints();
660
661 // Some of the physical objects requre individual, pre-step calls
662 // (vehicles and avatar movement, in particular)
663 TriggerPreStepEvent(timeStep);
664
665 // the prestep actions might have added taints
666 numTaints += _taintOperations.Count;
667 ProcessTaints();
668
669 InTaintTime = false; // Only used for debugging so locking is not necessary.
670
671 // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world.
672 // Only enable this in a limited test world with few objects.
673 if (m_physicsPhysicalDumpEnabled)
674 PE.DumpAllInfo(World);
675
676 // step the physical world one interval
677 m_simulationStep++;
678 int numSubSteps = 0;
679 try
680 {
681 numSubSteps = PE.PhysicsStep(World, timeStep, m_maxSubSteps, m_fixedTimeStep, out updatedEntityCount, out collidersCount);
682
683 }
684 catch (Exception e)
685 {
686 m_log.WarnFormat("{0},PhysicsStep Exception: nTaints={1}, substeps={2}, updates={3}, colliders={4}, e={5}",
687 LogHeader, numTaints, numSubSteps, updatedEntityCount, collidersCount, e);
688 DetailLog("{0},PhysicsStepException,call, nTaints={1}, substeps={2}, updates={3}, colliders={4}",
689 DetailLogZero, numTaints, numSubSteps, updatedEntityCount, collidersCount);
690 updatedEntityCount = 0;
691 collidersCount = 0;
692 }
693
694 // Make the physics engine dump useful statistics periodically
695 if (PhysicsMetricDumpFrames != 0 && ((m_simulationStep % PhysicsMetricDumpFrames) == 0))
696 PE.DumpPhysicsStatistics(World);
697
698 // Get a value for 'now' so all the collision and update routines don't have to get their own.
699 SimulationNowTime = Util.EnvironmentTickCount();
700
701 // Send collision information to the colliding objects. The objects decide if the collision
702 // is 'real' (like linksets don't collide with themselves) and the individual objects
703 // know if the simulator has subscribed to collisions.
704 lock (CollisionLock)
705 {
706 if (collidersCount > 0)
707 {
708 lock (PhysObjects)
709 {
710 for (int ii = 0; ii < collidersCount; ii++)
711 {
712 uint cA = m_collisionArray[ii].aID;
713 uint cB = m_collisionArray[ii].bID;
714 Vector3 point = m_collisionArray[ii].point;
715 Vector3 normal = m_collisionArray[ii].normal;
716 float penetration = m_collisionArray[ii].penetration;
717 SendCollision(cA, cB, point, normal, penetration);
718 SendCollision(cB, cA, point, -normal, penetration);
719 }
720 }
721 }
722 }
723
724 // If any of the objects had updated properties, tell the managed objects about the update
725 // and remember that there was a change so it will be passed to the simulator.
726 lock (UpdateLock)
727 {
728 if (updatedEntityCount > 0)
729 {
730 lock (PhysObjects)
731 {
732 for (int ii = 0; ii < updatedEntityCount; ii++)
733 {
734 EntityProperties entprop = m_updateArray[ii];
735 BSPhysObject pobj;
736 if (PhysObjects.TryGetValue(entprop.ID, out pobj))
737 {
738 if (pobj.IsInitialized)
739 pobj.UpdateProperties(entprop);
740 }
741 }
742 }
743 }
744 }
745
746 // Some actors want to know when the simulation step is complete.
747 TriggerPostStepEvent(timeStep);
748
749 simTime = Util.EnvironmentTickCountSubtract(beforeTime);
750 if (PhysicsLogging.Enabled)
751 {
752 DetailLog("{0},DoPhysicsStep,complete,frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}, objWColl={7}",
753 DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps,
754 updatedEntityCount, collidersCount, ObjectsWithCollisions.Count);
755 }
756
757 // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world.
758 // Only enable this in a limited test world with few objects.
759 if (m_physicsPhysicalDumpEnabled)
760 PE.DumpAllInfo(World);
761
762 // The physics engine returns the number of milliseconds it simulated this call.
763 // These are summed and normalized to one second and divided by 1000 to give the reported physics FPS.
764 // Multiply by a fixed nominal frame rate to give a rate similar to the simulator (usually 55).
765 m_simulatedTime += (float)numSubSteps * m_fixedTimeStep * 1000f * NominalFrameRate;
766 }
767
768 // Called by a BSPhysObject to note that it has changed properties and this information
769 // should be passed up to the simulator at the proper time.
770 // Note: this is called by the BSPhysObject from invocation via DoPhysicsStep() above so
771 // this is is under UpdateLock.
772 public void PostUpdate(BSPhysObject updatee)
773 {
774 lock (UpdateLock)
775 {
776 ObjectsWithUpdates.Add(updatee);
777 }
778 }
779
780 // The simulator thinks it is physics time so return all the collisions and position
781 // updates that were collected in actual physics simulation.
782 private float SendUpdatesToSimulator(float timeStep)
783 {
784 if (!m_initialized) return 5.0f;
785
786 DetailLog("{0},SendUpdatesToSimulator,collisions={1},updates={2},simedTime={3}",
787 BSScene.DetailLogZero, ObjectsWithCollisions.Count, ObjectsWithUpdates.Count, m_simulatedTime);
788 // Push the collisions into the simulator.
789 lock (CollisionLock)
790 {
791 if (ObjectsWithCollisions.Count > 0)
792 {
793 foreach (BSPhysObject bsp in ObjectsWithCollisions)
794 if (!bsp.SendCollisions())
795 {
796 // If the object is done colliding, see that it's removed from the colliding list
797 ObjectsWithNoMoreCollisions.Add(bsp);
798 }
799 }
800
801 // This is a kludge to get avatar movement updates.
802 // The simulator expects collisions for avatars even if there are have been no collisions.
803 // The event updates avatar animations and stuff.
804 // If you fix avatar animation updates, remove this overhead and let normal collision processing happen.
805 // Note that we get a copy of the list to search because SendCollision() can take a while.
806 HashSet<BSPhysObject> tempAvatarsInScene;
807 lock (AvatarsInSceneLock)
808 {
809 tempAvatarsInScene = new HashSet<BSPhysObject>(AvatarsInScene);
810 }
811 foreach (BSPhysObject actor in tempAvatarsInScene)
812 {
813 if (!ObjectsWithCollisions.Contains(actor)) // don't call avatars twice
814 actor.SendCollisions();
815 }
816 tempAvatarsInScene = null;
817
818 // Objects that are done colliding are removed from the ObjectsWithCollisions list.
819 // Not done above because it is inside an iteration of ObjectWithCollisions.
820 // This complex collision processing is required to create an empty collision
821 // event call after all real collisions have happened on an object. This allows
822 // the simulator to generate the 'collision end' event.
823 if (ObjectsWithNoMoreCollisions.Count > 0)
824 {
825 foreach (BSPhysObject po in ObjectsWithNoMoreCollisions)
826 ObjectsWithCollisions.Remove(po);
827 ObjectsWithNoMoreCollisions.Clear();
828 }
829 }
830
831 // Call the simulator for each object that has physics property updates.
832 HashSet<BSPhysObject> updatedObjects = null;
833 lock (UpdateLock)
834 {
835 if (ObjectsWithUpdates.Count > 0)
836 {
837 updatedObjects = ObjectsWithUpdates;
838 ObjectsWithUpdates = new HashSet<BSPhysObject>();
839 }
840 }
841 if (updatedObjects != null)
842 {
843 foreach (BSPhysObject obj in updatedObjects)
844 {
845 obj.RequestPhysicsterseUpdate();
846 }
847 updatedObjects.Clear();
848 }
849
850 // Return the framerate simulated to give the above returned results.
851 // (Race condition here but this is just bookkeeping so rare mistakes do not merit a lock).
852 float simTime = m_simulatedTime;
853 m_simulatedTime = 0f;
854 return simTime;
855 }
856
857 // Something has collided
858 private void SendCollision(uint localID, uint collidingWith, Vector3 collidePoint, Vector3 collideNormal, float penetration)
859 {
860 if (localID <= TerrainManager.HighestTerrainID)
861 {
862 return; // don't send collisions to the terrain
863 }
864
865 BSPhysObject collider;
866 // NOTE that PhysObjects was locked before the call to SendCollision().
867 if (!PhysObjects.TryGetValue(localID, out collider))
868 {
869 // If the object that is colliding cannot be found, just ignore the collision.
870 DetailLog("{0},BSScene.SendCollision,colliderNotInObjectList,id={1},with={2}", DetailLogZero, localID, collidingWith);
871 return;
872 }
873
874 // Note: the terrain is not in the physical object list so 'collidee' can be null when Collide() is called.
875 BSPhysObject collidee = null;
876 PhysObjects.TryGetValue(collidingWith, out collidee);
877
878 // DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith);
879
880 if (collider.IsInitialized)
881 {
882 if (collider.Collide(collidingWith, collidee, collidePoint, collideNormal, penetration))
883 {
884 // If a collision was 'good', remember to send it to the simulator
885 lock (CollisionLock)
886 {
887 ObjectsWithCollisions.Add(collider);
888 }
889 }
890 }
891
892 return;
893 }
894
895 public void BulletSPluginPhysicsThread()
896 {
897 Thread.CurrentThread.Priority = ThreadPriority.Highest;
898 m_updateWaitEvent = new ManualResetEvent(false);
899
900 while (m_initialized)
901 {
902 int beginSimulationRealtimeMS = Util.EnvironmentTickCount();
903
904 if (BSParam.Active)
905 DoPhysicsStep(BSParam.PhysicsTimeStep);
906
907 int simulationRealtimeMS = Util.EnvironmentTickCountSubtract(beginSimulationRealtimeMS);
908 int simulationTimeVsRealtimeDifferenceMS = ((int)(BSParam.PhysicsTimeStep*1000f)) - simulationRealtimeMS;
909
910 if (simulationTimeVsRealtimeDifferenceMS > 0)
911 {
912 // The simulation of the time interval took less than realtime.
913 // Do a wait for the rest of realtime.
914 m_updateWaitEvent.WaitOne(simulationTimeVsRealtimeDifferenceMS);
915 //Thread.Sleep(simulationTimeVsRealtimeDifferenceMS);
916 }
917 else
918 {
919 // The simulation took longer than realtime.
920 // Do some scaling of simulation time.
921 // TODO.
922 DetailLog("{0},BulletSPluginPhysicsThread,longerThanRealtime={1}", BSScene.DetailLogZero, simulationTimeVsRealtimeDifferenceMS);
923 }
924
925 Watchdog.UpdateThread();
926 }
927
928 Watchdog.RemoveThread();
929 }
930
931 #endregion // Simulation
932
933 public override void GetResults() { }
934
935 #region Terrain
936
937 public override void SetTerrain(float[] heightMap) {
938 TerrainManager.SetTerrain(heightMap);
939 }
940
941 public override void SetWaterLevel(float baseheight)
942 {
943 SimpleWaterLevel = baseheight;
944 }
945
946 public override void DeleteTerrain()
947 {
948 // m_log.DebugFormat("{0}: DeleteTerrain()", LogHeader);
949 }
950
951 // Although no one seems to check this, I do support combining.
952 public override bool SupportsCombining()
953 {
954 return TerrainManager.SupportsCombining();
955 }
956 // This call says I am a child to region zero in a mega-region. 'pScene' is that
957 // of region zero, 'offset' is my offset from regions zero's origin, and
958 // 'extents' is the largest XY that is handled in my region.
959 public override void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents)
960 {
961 TerrainManager.Combine(pScene, offset, extents);
962 }
963
964 // Unhook all the combining that I know about.
965 public override void UnCombine(PhysicsScene pScene)
966 {
967 TerrainManager.UnCombine(pScene);
968 }
969
970 #endregion // Terrain
971
972 public override Dictionary<uint, float> GetTopColliders()
973 {
974 Dictionary<uint, float> topColliders;
975
976 lock (PhysObjects)
977 {
978 foreach (KeyValuePair<uint, BSPhysObject> kvp in PhysObjects)
979 {
980 kvp.Value.ComputeCollisionScore();
981 }
982
983 List<BSPhysObject> orderedPrims = new List<BSPhysObject>(PhysObjects.Values);
984 orderedPrims.OrderByDescending(p => p.CollisionScore);
985 topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore);
986 }
987
988 return topColliders;
989 }
990
991 public override bool IsThreaded { get { return false; } }
992
993 #region Extensions
994 public override object Extension(string pFunct, params object[] pParams)
995 {
996 DetailLog("{0} BSScene.Extension,op={1}", DetailLogZero, pFunct);
997 return base.Extension(pFunct, pParams);
998 }
999 #endregion // Extensions
1000
1001 public static string PrimitiveBaseShapeToString(PrimitiveBaseShape pbs)
1002 {
1003 float pathShearX = pbs.PathShearX < 128 ? (float)pbs.PathShearX * 0.01f : (float)(pbs.PathShearX - 256) * 0.01f;
1004 float pathShearY = pbs.PathShearY < 128 ? (float)pbs.PathShearY * 0.01f : (float)(pbs.PathShearY - 256) * 0.01f;
1005 float pathBegin = (float)pbs.PathBegin * 2.0e-5f;
1006 float pathEnd = 1.0f - (float)pbs.PathEnd * 2.0e-5f;
1007 float pathScaleX = (float)(200 - pbs.PathScaleX) * 0.01f;
1008 float pathScaleY = (float)(200 - pbs.PathScaleY) * 0.01f;
1009 float pathTaperX = pbs.PathTaperX * 0.01f;
1010 float pathTaperY = pbs.PathTaperY * 0.01f;
1011
1012 float profileBegin = (float)pbs.ProfileBegin * 2.0e-5f;
1013 float profileEnd = 1.0f - (float)pbs.ProfileEnd * 2.0e-5f;
1014 float profileHollow = (float)pbs.ProfileHollow * 2.0e-5f;
1015 if (profileHollow > 0.95f)
1016 profileHollow = 0.95f;
1017
1018 StringBuilder buff = new StringBuilder();
1019 buff.Append("shape=");
1020 buff.Append(((ProfileShape)pbs.ProfileShape).ToString());
1021 buff.Append(",");
1022 buff.Append("hollow=");
1023 buff.Append(((HollowShape)pbs.HollowShape).ToString());
1024 buff.Append(",");
1025 buff.Append("pathCurve=");
1026 buff.Append(((Extrusion)pbs.PathCurve).ToString());
1027 buff.Append(",");
1028 buff.Append("profCurve=");
1029 buff.Append(((Extrusion)pbs.ProfileCurve).ToString());
1030 buff.Append(",");
1031 buff.Append("profHollow=");
1032 buff.Append(profileHollow.ToString());
1033 buff.Append(",");
1034 buff.Append("pathBegEnd=");
1035 buff.Append(pathBegin.ToString());
1036 buff.Append("/");
1037 buff.Append(pathEnd.ToString());
1038 buff.Append(",");
1039 buff.Append("profileBegEnd=");
1040 buff.Append(profileBegin.ToString());
1041 buff.Append("/");
1042 buff.Append(profileEnd.ToString());
1043 buff.Append(",");
1044 buff.Append("scaleXY=");
1045 buff.Append(pathScaleX.ToString());
1046 buff.Append("/");
1047 buff.Append(pathScaleY.ToString());
1048 buff.Append(",");
1049 buff.Append("shearXY=");
1050 buff.Append(pathShearX.ToString());
1051 buff.Append("/");
1052 buff.Append(pathShearY.ToString());
1053 buff.Append(",");
1054 buff.Append("taperXY=");
1055 buff.Append(pbs.PathTaperX.ToString());
1056 buff.Append("/");
1057 buff.Append(pbs.PathTaperY.ToString());
1058 buff.Append(",");
1059 buff.Append("skew=");
1060 buff.Append(pbs.PathSkew.ToString());
1061 buff.Append(",");
1062 buff.Append("twist/Beg=");
1063 buff.Append(pbs.PathTwist.ToString());
1064 buff.Append("/");
1065 buff.Append(pbs.PathTwistBegin.ToString());
1066
1067 return buff.ToString();
1068 }
1069
1070 #region Taints
1071 // The simulation execution order is:
1072 // Simulate()
1073 // DoOneTimeTaints
1074 // TriggerPreStepEvent
1075 // DoOneTimeTaints
1076 // Step()
1077 // ProcessAndSendToSimulatorCollisions
1078 // ProcessAndSendToSimulatorPropertyUpdates
1079 // TriggerPostStepEvent
1080
1081 // Calls to the PhysicsActors can't directly call into the physics engine
1082 // because it might be busy. We delay changes to a known time.
1083 // We rely on C#'s closure to save and restore the context for the delegate.
1084 public void TaintedObject(string pOriginator, string pIdent, TaintCallback pCallback)
1085 {
1086 TaintedObject(false /*inTaintTime*/, pOriginator, pIdent, pCallback);
1087 }
1088 public void TaintedObject(uint pOriginator, String pIdent, TaintCallback pCallback)
1089 {
1090 TaintedObject(false /*inTaintTime*/, m_physicsLoggingEnabled ? pOriginator.ToString() : BSScene.DetailLogZero, pIdent, pCallback);
1091 }
1092 public void TaintedObject(bool inTaintTime, String pIdent, TaintCallback pCallback)
1093 {
1094 TaintedObject(inTaintTime, BSScene.DetailLogZero, pIdent, pCallback);
1095 }
1096 public void TaintedObject(bool inTaintTime, uint pOriginator, String pIdent, TaintCallback pCallback)
1097 {
1098 TaintedObject(inTaintTime, m_physicsLoggingEnabled ? pOriginator.ToString() : BSScene.DetailLogZero, pIdent, pCallback);
1099 }
1100 // Sometimes a potentially tainted operation can be used in and out of taint time.
1101 // This routine executes the command immediately if in taint-time otherwise it is queued.
1102 public void TaintedObject(bool inTaintTime, string pOriginator, string pIdent, TaintCallback pCallback)
1103 {
1104 if (!m_initialized) return;
1105
1106 if (inTaintTime)
1107 pCallback();
1108 else
1109 {
1110 lock (_taintLock)
1111 {
1112 _taintOperations.Add(new TaintCallbackEntry(pOriginator, pIdent, pCallback));
1113 }
1114 }
1115 }
1116
1117 private void TriggerPreStepEvent(float timeStep)
1118 {
1119 PreStepAction actions = BeforeStep;
1120 if (actions != null)
1121 actions(timeStep);
1122
1123 }
1124
1125 private void TriggerPostStepEvent(float timeStep)
1126 {
1127 PostStepAction actions = AfterStep;
1128 if (actions != null)
1129 actions(timeStep);
1130
1131 }
1132
1133 // When someone tries to change a property on a BSPrim or BSCharacter, the object queues
1134 // a callback into itself to do the actual property change. That callback is called
1135 // here just before the physics engine is called to step the simulation.
1136 public void ProcessTaints()
1137 {
1138 ProcessRegularTaints();
1139 ProcessPostTaintTaints();
1140 }
1141
1142 private void ProcessRegularTaints()
1143 {
1144 if (m_initialized && _taintOperations.Count > 0) // save allocating new list if there is nothing to process
1145 {
1146 // swizzle a new list into the list location so we can process what's there
1147 List<TaintCallbackEntry> oldList;
1148 lock (_taintLock)
1149 {
1150 oldList = _taintOperations;
1151 _taintOperations = new List<TaintCallbackEntry>();
1152 }
1153
1154 foreach (TaintCallbackEntry tcbe in oldList)
1155 {
1156 try
1157 {
1158 DetailLog("{0},BSScene.ProcessTaints,doTaint,id={1}", tcbe.originator, tcbe.ident); // DEBUG DEBUG DEBUG
1159 tcbe.callback();
1160 }
1161 catch (Exception e)
1162 {
1163 m_log.ErrorFormat("{0}: ProcessTaints: {1}: Exception: {2}", LogHeader, tcbe.ident, e);
1164 }
1165 }
1166 oldList.Clear();
1167 }
1168 }
1169
1170 // Schedule an update to happen after all the regular taints are processed.
1171 // Note that new requests for the same operation ("ident") for the same object ("ID")
1172 // will replace any previous operation by the same object.
1173 public void PostTaintObject(String ident, uint ID, TaintCallback callback)
1174 {
1175 string IDAsString = ID.ToString();
1176 string uniqueIdent = ident + "-" + IDAsString;
1177 lock (_taintLock)
1178 {
1179 _postTaintOperations[uniqueIdent] = new TaintCallbackEntry(IDAsString, uniqueIdent, callback);
1180 }
1181
1182 return;
1183 }
1184
1185 // Taints that happen after the normal taint processing but before the simulation step.
1186 private void ProcessPostTaintTaints()
1187 {
1188 if (m_initialized && _postTaintOperations.Count > 0)
1189 {
1190 Dictionary<string, TaintCallbackEntry> oldList;
1191 lock (_taintLock)
1192 {
1193 oldList = _postTaintOperations;
1194 _postTaintOperations = new Dictionary<string, TaintCallbackEntry>();
1195 }
1196
1197 foreach (KeyValuePair<string,TaintCallbackEntry> kvp in oldList)
1198 {
1199 try
1200 {
1201 DetailLog("{0},BSScene.ProcessPostTaintTaints,doTaint,id={1}", DetailLogZero, kvp.Key); // DEBUG DEBUG DEBUG
1202 kvp.Value.callback();
1203 }
1204 catch (Exception e)
1205 {
1206 m_log.ErrorFormat("{0}: ProcessPostTaintTaints: {1}: Exception: {2}", LogHeader, kvp.Key, e);
1207 }
1208 }
1209 oldList.Clear();
1210 }
1211 }
1212
1213 // Only used for debugging. Does not change state of anything so locking is not necessary.
1214 public bool AssertInTaintTime(string whereFrom)
1215 {
1216 if (!InTaintTime)
1217 {
1218 DetailLog("{0},BSScene.AssertInTaintTime,NOT IN TAINT TIME,Region={1},Where={2}", DetailLogZero, RegionName, whereFrom);
1219 m_log.ErrorFormat("{0} NOT IN TAINT TIME!! Region={1}, Where={2}", LogHeader, RegionName, whereFrom);
1220 // Util.PrintCallStack(DetailLog);
1221 }
1222 return InTaintTime;
1223 }
1224
1225 #endregion // Taints
1226
1227 #region IPhysicsParameters
1228 // Get the list of parameters this physics engine supports
1229 public PhysParameterEntry[] GetParameterList()
1230 {
1231 BSParam.BuildParameterTable();
1232 return BSParam.SettableParameters;
1233 }
1234
1235 // Set parameter on a specific or all instances.
1236 // Return 'false' if not able to set the parameter.
1237 // Setting the value in the m_params block will change the value the physics engine
1238 // will use the next time since it's pinned and shared memory.
1239 // Some of the values require calling into the physics engine to get the new
1240 // value activated ('terrainFriction' for instance).
1241 public bool SetPhysicsParameter(string parm, string val, uint localID)
1242 {
1243 bool ret = false;
1244
1245 BSParam.ParameterDefnBase theParam;
1246 if (BSParam.TryGetParameter(parm, out theParam))
1247 {
1248 // Set the value in the C# code
1249 theParam.SetValue(this, val);
1250
1251 // Optionally set the parameter in the unmanaged code
1252 if (theParam.HasSetOnObject)
1253 {
1254 // update all the localIDs specified
1255 // If the local ID is APPLY_TO_NONE, just change the default value
1256 // If the localID is APPLY_TO_ALL change the default value and apply the new value to all the lIDs
1257 // If the localID is a specific object, apply the parameter change to only that object
1258 List<uint> objectIDs = new List<uint>();
1259 switch (localID)
1260 {
1261 case PhysParameterEntry.APPLY_TO_NONE:
1262 // This will cause a call into the physical world if some operation is specified (SetOnObject).
1263 objectIDs.Add(TERRAIN_ID);
1264 TaintedUpdateParameter(parm, objectIDs, val);
1265 break;
1266 case PhysParameterEntry.APPLY_TO_ALL:
1267 lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys);
1268 TaintedUpdateParameter(parm, objectIDs, val);
1269 break;
1270 default:
1271 // setting only one localID
1272 objectIDs.Add(localID);
1273 TaintedUpdateParameter(parm, objectIDs, val);
1274 break;
1275 }
1276 }
1277
1278 ret = true;
1279 }
1280 return ret;
1281 }
1282
1283 // schedule the actual updating of the paramter to when the phys engine is not busy
1284 private void TaintedUpdateParameter(string parm, List<uint> lIDs, string val)
1285 {
1286 string xval = val;
1287 List<uint> xlIDs = lIDs;
1288 string xparm = parm;
1289 TaintedObject(DetailLogZero, "BSScene.UpdateParameterSet", delegate() {
1290 BSParam.ParameterDefnBase thisParam;
1291 if (BSParam.TryGetParameter(xparm, out thisParam))
1292 {
1293 if (thisParam.HasSetOnObject)
1294 {
1295 foreach (uint lID in xlIDs)
1296 {
1297 BSPhysObject theObject = null;
1298 if (PhysObjects.TryGetValue(lID, out theObject))
1299 thisParam.SetOnObject(this, theObject);
1300 }
1301 }
1302 }
1303 });
1304 }
1305
1306 // Get parameter.
1307 // Return 'false' if not able to get the parameter.
1308 public bool GetPhysicsParameter(string parm, out string value)
1309 {
1310 string val = String.Empty;
1311 bool ret = false;
1312 BSParam.ParameterDefnBase theParam;
1313 if (BSParam.TryGetParameter(parm, out theParam))
1314 {
1315 val = theParam.GetValue(this);
1316 ret = true;
1317 }
1318 value = val;
1319 return ret;
1320 }
1321
1322 #endregion IPhysicsParameters
1323
1324 // Invoke the detailed logger and output something if it's enabled.
1325 public void DetailLog(string msg, params Object[] args)
1326 {
1327 PhysicsLogging.Write(msg, args);
1328 }
1329 // Used to fill in the LocalID when there isn't one. It's the correct number of characters.
1330 public const string DetailLogZero = "0000000000";
1331
1332 }
1333}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/PhysicsModules/BulletS/BSShapeCollection.cs
index d1de844..b100273 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSShapeCollection.cs
@@ -29,10 +29,10 @@ using System.Collections.Generic;
29using System.Text; 29using System.Text;
30using OMV = OpenMetaverse; 30using OMV = OpenMetaverse;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager; 32using OpenSim.Region.PhysicsModules.SharedBase;
33using OpenSim.Region.Physics.ConvexDecompositionDotNet; 33using OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet;
34 34
35namespace OpenSim.Region.Physics.BulletSPlugin 35namespace OpenSim.Region.PhysicsModule.BulletS
36{ 36{
37public sealed class BSShapeCollection : IDisposable 37public sealed class BSShapeCollection : IDisposable
38{ 38{
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs
index 03a9ddc..79f1a89 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs
@@ -30,13 +30,13 @@ using System.Collections.Generic;
30using System.Text; 30using System.Text;
31 31
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.PhysicsModules.SharedBase;
34using OpenSim.Region.Physics.Meshing; 34using OpenSim.Region.PhysicsModules.Meshing;
35using OpenSim.Region.Physics.ConvexDecompositionDotNet; 35using OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet;
36 36
37using OMV = OpenMetaverse; 37using OMV = OpenMetaverse;
38 38
39namespace OpenSim.Region.Physics.BulletSPlugin 39namespace OpenSim.Region.PhysicsModule.BulletS
40{ 40{
41// Information class that holds stats for the shape. Which values mean 41// Information class that holds stats for the shape. Which values mean
42// something depends on the type of shape. 42// something depends on the type of shape.
@@ -299,7 +299,7 @@ public abstract class BSShape
299 { 299 {
300 xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch; 300 xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch;
301 physicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}", 301 physicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}",
302 LogHeader, physicsScene.Name); 302 LogHeader, physicsScene.PhysicsSceneName);
303 } 303 }
304 } 304 }
305 else 305 else
@@ -336,7 +336,7 @@ public abstract class BSShape
336 if (pScene != null) 336 if (pScene != null)
337 { 337 {
338 buff.Append("/rgn="); 338 buff.Append("/rgn=");
339 buff.Append(pScene.Name); 339 buff.Append(pScene.PhysicsSceneName);
340 } 340 }
341 return buff.ToString(); 341 return buff.ToString();
342 } 342 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs
index d70b2fb..42fc11b 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs
@@ -30,15 +30,14 @@ using System.Text;
30 30
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Framework; 32using OpenSim.Region.Framework;
33using OpenSim.Region.CoreModules; 33using OpenSim.Region.PhysicsModules.SharedBase;
34using OpenSim.Region.Physics.Manager;
35 34
36using Nini.Config; 35using Nini.Config;
37using log4net; 36using log4net;
38 37
39using OpenMetaverse; 38using OpenMetaverse;
40 39
41namespace OpenSim.Region.Physics.BulletSPlugin 40namespace OpenSim.Region.PhysicsModule.BulletS
42{ 41{
43public sealed class BSTerrainHeightmap : BSTerrainPhys 42public sealed class BSTerrainHeightmap : BSTerrainPhys
44{ 43{
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs
index 50f917a..d11baa6 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs
@@ -30,15 +30,14 @@ using System.Text;
30 30
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Framework; 32using OpenSim.Region.Framework;
33using OpenSim.Region.CoreModules; 33using OpenSim.Region.PhysicsModules.SharedBase;
34using OpenSim.Region.Physics.Manager;
35 34
36using Nini.Config; 35using Nini.Config;
37using log4net; 36using log4net;
38 37
39using OpenMetaverse; 38using OpenMetaverse;
40 39
41namespace OpenSim.Region.Physics.BulletSPlugin 40namespace OpenSim.Region.PhysicsModule.BulletS
42{ 41{
43 42
44// The physical implementation of the terrain is wrapped in this class. 43// The physical implementation of the terrain is wrapped in this class.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs
index e4ca098..cd59b65 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs
@@ -30,15 +30,14 @@ using System.Text;
30 30
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Framework; 32using OpenSim.Region.Framework;
33using OpenSim.Region.CoreModules; 33using OpenSim.Region.PhysicsModules.SharedBase;
34using OpenSim.Region.Physics.Manager;
35 34
36using Nini.Config; 35using Nini.Config;
37using log4net; 36using log4net;
38 37
39using OpenMetaverse; 38using OpenMetaverse;
40 39
41namespace OpenSim.Region.Physics.BulletSPlugin 40namespace OpenSim.Region.PhysicsModule.BulletS
42{ 41{
43public sealed class BSTerrainMesh : BSTerrainPhys 42public sealed class BSTerrainMesh : BSTerrainPhys
44{ 43{
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs b/OpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs
index 5932461..3329395 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs
@@ -29,7 +29,7 @@ using System.Collections.Generic;
29using System.Text; 29using System.Text;
30using OMV = OpenMetaverse; 30using OMV = OpenMetaverse;
31 31
32namespace OpenSim.Region.Physics.BulletSPlugin 32namespace OpenSim.Region.PhysicsModule.BulletS
33{ 33{
34// Classes to allow some type checking for the API 34// Classes to allow some type checking for the API
35// These hold pointers to allocated objects in the unmanaged space. 35// These hold pointers to allocated objects in the unmanaged space.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/PhysicsModules/BulletS/BulletSimTODO.txt
index 0453376..0453376 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
+++ b/OpenSim/Region/PhysicsModules/BulletS/BulletSimTODO.txt
diff --git a/OpenSim/Region/PhysicsModules/BulletS/ExtendedPhysics.cs b/OpenSim/Region/PhysicsModules/BulletS/ExtendedPhysics.cs
new file mode 100755
index 0000000..2ba3c5a
--- /dev/null
+++ b/OpenSim/Region/PhysicsModules/BulletS/ExtendedPhysics.cs
@@ -0,0 +1,622 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyrightD
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using System.Collections.Generic;
29using System.Linq;
30using System.Reflection;
31using System.Text;
32using System.Threading;
33
34using OpenSim.Framework;
35using OpenSim.Region.Framework;
36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Region.PhysicsModules.SharedBase;
39
40using Mono.Addins;
41using Nini.Config;
42using log4net;
43using OpenMetaverse;
44
45namespace OpenSim.Region.PhysicsModule.BulletS
46{
47 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
48 public class ExtendedPhysics : INonSharedRegionModule
49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 private static string LogHeader = "[EXTENDED PHYSICS]";
52
53 // =============================================================
54 // Since BulletSim is a plugin, this these values aren't defined easily in one place.
55 // This table must correspond to an identical table in BSScene.
56
57 // Per scene functions. See BSScene.
58
59 // Per avatar functions. See BSCharacter.
60
61 // Per prim functions. See BSPrim.
62 public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType";
63 public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType";
64 public const string PhysFunctChangeLinkFixed = "BulletSim.ChangeLinkFixed";
65 public const string PhysFunctChangeLinkType = "BulletSim.ChangeLinkType";
66 public const string PhysFunctGetLinkType = "BulletSim.GetLinkType";
67 public const string PhysFunctChangeLinkParams = "BulletSim.ChangeLinkParams";
68 public const string PhysFunctAxisLockLimits = "BulletSim.AxisLockLimits";
69
70 // =============================================================
71
72 private IConfig Configuration { get; set; }
73 private bool Enabled { get; set; }
74 private Scene BaseScene { get; set; }
75 private IScriptModuleComms Comms { get; set; }
76
77 #region INonSharedRegionModule
78
79 public string Name { get { return this.GetType().Name; } }
80
81 public void Initialise(IConfigSource config)
82 {
83 BaseScene = null;
84 Enabled = false;
85 Configuration = null;
86 Comms = null;
87
88 try
89 {
90 if ((Configuration = config.Configs["ExtendedPhysics"]) != null)
91 {
92 Enabled = Configuration.GetBoolean("Enabled", Enabled);
93 }
94 }
95 catch (Exception e)
96 {
97 m_log.ErrorFormat("{0} Initialization error: {0}", LogHeader, e);
98 }
99
100 m_log.InfoFormat("{0} module {1} enabled", LogHeader, (Enabled ? "is" : "is not"));
101 }
102
103 public void Close()
104 {
105 if (BaseScene != null)
106 {
107 BaseScene.EventManager.OnObjectAddedToScene -= EventManager_OnObjectAddedToScene;
108 BaseScene.EventManager.OnSceneObjectPartUpdated -= EventManager_OnSceneObjectPartUpdated;
109 BaseScene = null;
110 }
111 }
112
113 public void AddRegion(Scene scene)
114 {
115 }
116
117 public void RemoveRegion(Scene scene)
118 {
119 if (BaseScene != null && BaseScene == scene)
120 {
121 Close();
122 }
123 }
124
125 public void RegionLoaded(Scene scene)
126 {
127 if (!Enabled) return;
128
129 BaseScene = scene;
130
131 Comms = BaseScene.RequestModuleInterface<IScriptModuleComms>();
132 if (Comms == null)
133 {
134 m_log.WarnFormat("{0} ScriptModuleComms interface not defined", LogHeader);
135 Enabled = false;
136
137 return;
138 }
139
140 // Register as LSL functions all the [ScriptInvocation] marked methods.
141 Comms.RegisterScriptInvocations(this);
142 Comms.RegisterConstants(this);
143
144 // When an object is modified, we might need to update its extended physics parameters
145 BaseScene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene;
146 BaseScene.EventManager.OnSceneObjectPartUpdated += EventManager_OnSceneObjectPartUpdated;
147
148 }
149
150 public Type ReplaceableInterface { get { return null; } }
151
152 #endregion // INonSharedRegionModule
153
154 private void EventManager_OnObjectAddedToScene(SceneObjectGroup obj)
155 {
156 }
157
158 // Event generated when some property of a prim changes.
159 private void EventManager_OnSceneObjectPartUpdated(SceneObjectPart sop, bool isFullUpdate)
160 {
161 }
162
163 [ScriptConstant]
164 public const int PHYS_CENTER_OF_MASS = 1 << 0;
165
166 [ScriptInvocation]
167 public string physGetEngineType(UUID hostID, UUID scriptID)
168 {
169 string ret = string.Empty;
170
171 if (BaseScene.PhysicsScene != null)
172 {
173 ret = BaseScene.PhysicsScene.EngineType;
174 }
175
176 return ret;
177 }
178
179 // Code for specifying params.
180 // The choice if 14700 is arbitrary and only serves to catch parameter code misuse.
181 [ScriptConstant]
182 public const int PHYS_AXIS_LOCK_LINEAR = 14700;
183 [ScriptConstant]
184 public const int PHYS_AXIS_LOCK_LINEAR_X = 14701;
185 [ScriptConstant]
186 public const int PHYS_AXIS_LIMIT_LINEAR_X = 14702;
187 [ScriptConstant]
188 public const int PHYS_AXIS_LOCK_LINEAR_Y = 14703;
189 [ScriptConstant]
190 public const int PHYS_AXIS_LIMIT_LINEAR_Y = 14704;
191 [ScriptConstant]
192 public const int PHYS_AXIS_LOCK_LINEAR_Z = 14705;
193 [ScriptConstant]
194 public const int PHYS_AXIS_LIMIT_LINEAR_Z = 14706;
195 [ScriptConstant]
196 public const int PHYS_AXIS_LOCK_ANGULAR = 14707;
197 [ScriptConstant]
198 public const int PHYS_AXIS_LOCK_ANGULAR_X = 14708;
199 [ScriptConstant]
200 public const int PHYS_AXIS_LIMIT_ANGULAR_X = 14709;
201 [ScriptConstant]
202 public const int PHYS_AXIS_LOCK_ANGULAR_Y = 14710;
203 [ScriptConstant]
204 public const int PHYS_AXIS_LIMIT_ANGULAR_Y = 14711;
205 [ScriptConstant]
206 public const int PHYS_AXIS_LOCK_ANGULAR_Z = 14712;
207 [ScriptConstant]
208 public const int PHYS_AXIS_LIMIT_ANGULAR_Z = 14713;
209 [ScriptConstant]
210 public const int PHYS_AXIS_UNLOCK_LINEAR = 14714;
211 [ScriptConstant]
212 public const int PHYS_AXIS_UNLOCK_LINEAR_X = 14715;
213 [ScriptConstant]
214 public const int PHYS_AXIS_UNLOCK_LINEAR_Y = 14716;
215 [ScriptConstant]
216 public const int PHYS_AXIS_UNLOCK_LINEAR_Z = 14717;
217 [ScriptConstant]
218 public const int PHYS_AXIS_UNLOCK_ANGULAR = 14718;
219 [ScriptConstant]
220 public const int PHYS_AXIS_UNLOCK_ANGULAR_X = 14719;
221 [ScriptConstant]
222 public const int PHYS_AXIS_UNLOCK_ANGULAR_Y = 14720;
223 [ScriptConstant]
224 public const int PHYS_AXIS_UNLOCK_ANGULAR_Z = 14721;
225 [ScriptConstant]
226 public const int PHYS_AXIS_UNLOCK = 14722;
227 // physAxisLockLimits()
228 [ScriptInvocation]
229 public int physAxisLock(UUID hostID, UUID scriptID, object[] parms)
230 {
231 int ret = -1;
232 if (!Enabled) return ret;
233
234 PhysicsActor rootPhysActor;
235 if (GetRootPhysActor(hostID, out rootPhysActor))
236 {
237 object[] parms2 = AddToBeginningOfArray(rootPhysActor, null, parms);
238 ret = MakeIntError(rootPhysActor.Extension(PhysFunctAxisLockLimits, parms2));
239 }
240
241 return ret;
242 }
243
244 [ScriptConstant]
245 public const int PHYS_LINKSET_TYPE_CONSTRAINT = 0;
246 [ScriptConstant]
247 public const int PHYS_LINKSET_TYPE_COMPOUND = 1;
248 [ScriptConstant]
249 public const int PHYS_LINKSET_TYPE_MANUAL = 2;
250
251 [ScriptInvocation]
252 public int physSetLinksetType(UUID hostID, UUID scriptID, int linksetType)
253 {
254 int ret = -1;
255 if (!Enabled) return ret;
256
257 // The part that is requesting the change.
258 SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID);
259
260 if (requestingPart != null)
261 {
262 // The change is always made to the root of a linkset.
263 SceneObjectGroup containingGroup = requestingPart.ParentGroup;
264 SceneObjectPart rootPart = containingGroup.RootPart;
265
266 if (rootPart != null)
267 {
268 PhysicsActor rootPhysActor = rootPart.PhysActor;
269 if (rootPhysActor != null)
270 {
271 if (rootPhysActor.IsPhysical)
272 {
273 // Change a physical linkset by making non-physical, waiting for one heartbeat so all
274 // the prim and linkset state is updated, changing the type and making the
275 // linkset physical again.
276 containingGroup.ScriptSetPhysicsStatus(false);
277 Thread.Sleep(150); // longer than one heartbeat tick
278
279 // A kludge for the moment.
280 // Since compound linksets move the children but don't generate position updates to the
281 // simulator, it is possible for compound linkset children to have out-of-sync simulator
282 // and physical positions. The following causes the simulator to push the real child positions
283 // down into the physics engine to get everything synced.
284 containingGroup.UpdateGroupPosition(containingGroup.AbsolutePosition);
285 containingGroup.UpdateGroupRotationR(containingGroup.GroupRotation);
286
287 object[] parms2 = { rootPhysActor, null, linksetType };
288 ret = MakeIntError(rootPhysActor.Extension(PhysFunctSetLinksetType, parms2));
289 Thread.Sleep(150); // longer than one heartbeat tick
290
291 containingGroup.ScriptSetPhysicsStatus(true);
292 }
293 else
294 {
295 // Non-physical linksets don't have a physical instantiation so there is no state to
296 // worry about being updated.
297 object[] parms2 = { rootPhysActor, null, linksetType };
298 ret = MakeIntError(rootPhysActor.Extension(PhysFunctSetLinksetType, parms2));
299 }
300 }
301 else
302 {
303 m_log.WarnFormat("{0} physSetLinksetType: root part does not have a physics actor. rootName={1}, hostID={2}",
304 LogHeader, rootPart.Name, hostID);
305 }
306 }
307 else
308 {
309 m_log.WarnFormat("{0} physSetLinksetType: root part does not exist. RequestingPartName={1}, hostID={2}",
310 LogHeader, requestingPart.Name, hostID);
311 }
312 }
313 else
314 {
315 m_log.WarnFormat("{0} physSetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID);
316 }
317 return ret;
318 }
319
320 [ScriptInvocation]
321 public int physGetLinksetType(UUID hostID, UUID scriptID)
322 {
323 int ret = -1;
324 if (!Enabled) return ret;
325
326 PhysicsActor rootPhysActor;
327 if (GetRootPhysActor(hostID, out rootPhysActor))
328 {
329 object[] parms2 = { rootPhysActor, null };
330 ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinksetType, parms2));
331 }
332 else
333 {
334 m_log.WarnFormat("{0} physGetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID);
335 }
336 return ret;
337 }
338
339 [ScriptConstant]
340 public const int PHYS_LINK_TYPE_FIXED = 1234;
341 [ScriptConstant]
342 public const int PHYS_LINK_TYPE_HINGE = 4;
343 [ScriptConstant]
344 public const int PHYS_LINK_TYPE_SPRING = 9;
345 [ScriptConstant]
346 public const int PHYS_LINK_TYPE_6DOF = 6;
347 [ScriptConstant]
348 public const int PHYS_LINK_TYPE_SLIDER = 7;
349
350 // physChangeLinkType(integer linkNum, integer typeCode)
351 [ScriptInvocation]
352 public int physChangeLinkType(UUID hostID, UUID scriptID, int linkNum, int typeCode)
353 {
354 int ret = -1;
355 if (!Enabled) return ret;
356
357 PhysicsActor rootPhysActor;
358 PhysicsActor childPhysActor;
359
360 if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor))
361 {
362 object[] parms2 = { rootPhysActor, childPhysActor, typeCode };
363 ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkType, parms2));
364 }
365
366 return ret;
367 }
368
369 // physGetLinkType(integer linkNum)
370 [ScriptInvocation]
371 public int physGetLinkType(UUID hostID, UUID scriptID, int linkNum)
372 {
373 int ret = -1;
374 if (!Enabled) return ret;
375
376 PhysicsActor rootPhysActor;
377 PhysicsActor childPhysActor;
378
379 if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor))
380 {
381 object[] parms2 = { rootPhysActor, childPhysActor };
382 ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinkType, parms2));
383 }
384
385 return ret;
386 }
387
388 // physChangeLinkFixed(integer linkNum)
389 // Change the link between the root and the linkNum into a fixed, static physical connection.
390 [ScriptInvocation]
391 public int physChangeLinkFixed(UUID hostID, UUID scriptID, int linkNum)
392 {
393 int ret = -1;
394 if (!Enabled) return ret;
395
396 PhysicsActor rootPhysActor;
397 PhysicsActor childPhysActor;
398
399 if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor))
400 {
401 object[] parms2 = { rootPhysActor, childPhysActor , PHYS_LINK_TYPE_FIXED };
402 ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkType, parms2));
403 }
404
405 return ret;
406 }
407
408 // Code for specifying params.
409 // The choice if 14400 is arbitrary and only serves to catch parameter code misuse.
410 public const int PHYS_PARAM_MIN = 14401;
411
412 [ScriptConstant]
413 public const int PHYS_PARAM_FRAMEINA_LOC = 14401;
414 [ScriptConstant]
415 public const int PHYS_PARAM_FRAMEINA_ROT = 14402;
416 [ScriptConstant]
417 public const int PHYS_PARAM_FRAMEINB_LOC = 14403;
418 [ScriptConstant]
419 public const int PHYS_PARAM_FRAMEINB_ROT = 14404;
420 [ScriptConstant]
421 public const int PHYS_PARAM_LINEAR_LIMIT_LOW = 14405;
422 [ScriptConstant]
423 public const int PHYS_PARAM_LINEAR_LIMIT_HIGH = 14406;
424 [ScriptConstant]
425 public const int PHYS_PARAM_ANGULAR_LIMIT_LOW = 14407;
426 [ScriptConstant]
427 public const int PHYS_PARAM_ANGULAR_LIMIT_HIGH = 14408;
428 [ScriptConstant]
429 public const int PHYS_PARAM_USE_FRAME_OFFSET = 14409;
430 [ScriptConstant]
431 public const int PHYS_PARAM_ENABLE_TRANSMOTOR = 14410;
432 [ScriptConstant]
433 public const int PHYS_PARAM_TRANSMOTOR_MAXVEL = 14411;
434 [ScriptConstant]
435 public const int PHYS_PARAM_TRANSMOTOR_MAXFORCE = 14412;
436 [ScriptConstant]
437 public const int PHYS_PARAM_CFM = 14413;
438 [ScriptConstant]
439 public const int PHYS_PARAM_ERP = 14414;
440 [ScriptConstant]
441 public const int PHYS_PARAM_SOLVER_ITERATIONS = 14415;
442 [ScriptConstant]
443 public const int PHYS_PARAM_SPRING_AXIS_ENABLE = 14416;
444 [ScriptConstant]
445 public const int PHYS_PARAM_SPRING_DAMPING = 14417;
446 [ScriptConstant]
447 public const int PHYS_PARAM_SPRING_STIFFNESS = 14418;
448 [ScriptConstant]
449 public const int PHYS_PARAM_LINK_TYPE = 14419;
450 [ScriptConstant]
451 public const int PHYS_PARAM_USE_LINEAR_FRAMEA = 14420;
452 [ScriptConstant]
453 public const int PHYS_PARAM_SPRING_EQUILIBRIUM_POINT = 14421;
454
455 public const int PHYS_PARAM_MAX = 14421;
456
457 // Used when specifying a parameter that has settings for the three linear and three angular axis
458 [ScriptConstant]
459 public const int PHYS_AXIS_ALL = -1;
460 [ScriptConstant]
461 public const int PHYS_AXIS_LINEAR_ALL = -2;
462 [ScriptConstant]
463 public const int PHYS_AXIS_ANGULAR_ALL = -3;
464 [ScriptConstant]
465 public const int PHYS_AXIS_LINEAR_X = 0;
466 [ScriptConstant]
467 public const int PHYS_AXIS_LINEAR_Y = 1;
468 [ScriptConstant]
469 public const int PHYS_AXIS_LINEAR_Z = 2;
470 [ScriptConstant]
471 public const int PHYS_AXIS_ANGULAR_X = 3;
472 [ScriptConstant]
473 public const int PHYS_AXIS_ANGULAR_Y = 4;
474 [ScriptConstant]
475 public const int PHYS_AXIS_ANGULAR_Z = 5;
476
477 // physChangeLinkParams(integer linkNum, [ PHYS_PARAM_*, value, PHYS_PARAM_*, value, ...])
478 [ScriptInvocation]
479 public int physChangeLinkParams(UUID hostID, UUID scriptID, int linkNum, object[] parms)
480 {
481 int ret = -1;
482 if (!Enabled) return ret;
483
484 PhysicsActor rootPhysActor;
485 PhysicsActor childPhysActor;
486
487 if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor))
488 {
489 object[] parms2 = AddToBeginningOfArray(rootPhysActor, childPhysActor, parms);
490 ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkParams, parms2));
491 }
492
493 return ret;
494 }
495
496 private bool GetRootPhysActor(UUID hostID, out PhysicsActor rootPhysActor)
497 {
498 SceneObjectGroup containingGroup;
499 SceneObjectPart rootPart;
500 return GetRootPhysActor(hostID, out containingGroup, out rootPart, out rootPhysActor);
501 }
502
503 private bool GetRootPhysActor(UUID hostID, out SceneObjectGroup containingGroup, out SceneObjectPart rootPart, out PhysicsActor rootPhysActor)
504 {
505 bool ret = false;
506 rootPhysActor = null;
507 containingGroup = null;
508 rootPart = null;
509
510 SceneObjectPart requestingPart;
511
512 requestingPart = BaseScene.GetSceneObjectPart(hostID);
513 if (requestingPart != null)
514 {
515 // The type is is always on the root of a linkset.
516 containingGroup = requestingPart.ParentGroup;
517 if (containingGroup != null && !containingGroup.IsDeleted)
518 {
519 rootPart = containingGroup.RootPart;
520 if (rootPart != null)
521 {
522 rootPhysActor = rootPart.PhysActor;
523 if (rootPhysActor != null)
524 {
525 ret = true;
526 }
527 else
528 {
529 m_log.WarnFormat("{0} GetRootAndChildPhysActors: Root part does not have a physics actor. rootName={1}, hostID={2}",
530 LogHeader, rootPart.Name, hostID);
531 }
532 }
533 else
534 {
535 m_log.WarnFormat("{0} GetRootAndChildPhysActors: Root part does not exist. RequestingPartName={1}, hostID={2}",
536 LogHeader, requestingPart.Name, hostID);
537 }
538 }
539 else
540 {
541 m_log.WarnFormat("{0} GetRootAndChildPhysActors: Containing group missing or deleted. hostID={1}", LogHeader, hostID);
542 }
543 }
544 else
545 {
546 m_log.WarnFormat("{0} GetRootAndChildPhysActors: cannot find script object in scene. hostID={1}", LogHeader, hostID);
547 }
548
549 return ret;
550 }
551
552 // Find the root and child PhysActors based on the linkNum.
553 // Return 'true' if both are found and returned.
554 private bool GetRootAndChildPhysActors(UUID hostID, int linkNum, out PhysicsActor rootPhysActor, out PhysicsActor childPhysActor)
555 {
556 bool ret = false;
557 rootPhysActor = null;
558 childPhysActor = null;
559
560 SceneObjectGroup containingGroup;
561 SceneObjectPart rootPart;
562
563 if (GetRootPhysActor(hostID, out containingGroup, out rootPart, out rootPhysActor))
564 {
565 SceneObjectPart linkPart = containingGroup.GetLinkNumPart(linkNum);
566 if (linkPart != null)
567 {
568 childPhysActor = linkPart.PhysActor;
569 if (childPhysActor != null)
570 {
571 ret = true;
572 }
573 else
574 {
575 m_log.WarnFormat("{0} GetRootAndChildPhysActors: Link part has no physical actor. rootName={1}, hostID={2}, linknum={3}",
576 LogHeader, rootPart.Name, hostID, linkNum);
577 }
578 }
579 else
580 {
581 m_log.WarnFormat("{0} GetRootAndChildPhysActors: Could not find linknum part. rootName={1}, hostID={2}, linknum={3}",
582 LogHeader, rootPart.Name, hostID, linkNum);
583 }
584 }
585 else
586 {
587 m_log.WarnFormat("{0} GetRootAndChildPhysActors: Root part does not have a physics actor. rootName={1}, hostID={2}",
588 LogHeader, rootPart.Name, hostID);
589 }
590
591 return ret;
592 }
593
594 // Return an array of objects with the passed object as the first object of a new array
595 private object[] AddToBeginningOfArray(object firstOne, object secondOne, object[] prevArray)
596 {
597 object[] newArray = new object[2 + prevArray.Length];
598 newArray[0] = firstOne;
599 newArray[1] = secondOne;
600 prevArray.CopyTo(newArray, 2);
601 return newArray;
602 }
603
604 // Extension() returns an object. Convert that object into the integer error we expect to return.
605 private int MakeIntError(object extensionRet)
606 {
607 int ret = -1;
608 if (extensionRet != null)
609 {
610 try
611 {
612 ret = (int)extensionRet;
613 }
614 catch
615 {
616 ret = -1;
617 }
618 }
619 return ret;
620 }
621 }
622}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/BulletS/Properties/AssemblyInfo.cs
index 4f90eee..5a33bdf 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/Properties/AssemblyInfo.cs
@@ -1,6 +1,7 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4using Mono.Addins;
4 5
5// General Information about an assembly is controlled through the following 6// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 7// set of attributes. Change these attribute values to modify the information
@@ -31,3 +32,5 @@ using System.Runtime.InteropServices;
31// 32//
32[assembly: AssemblyVersion("0.8.2.*")] 33[assembly: AssemblyVersion("0.8.2.*")]
33 34
35[assembly: Addin("OpenSim.Region.PhysicsModule.BulletS", OpenSim.VersionInfo.VersionNumber)]
36[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BasicVehicles.cs
index 48e74eb..35eba29 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/BasicVehicles.cs
@@ -34,13 +34,13 @@ using NUnit.Framework;
34using log4net; 34using log4net;
35 35
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Region.Physics.BulletSPlugin; 37using OpenSim.Region.PhysicsModule.BulletS;
38using OpenSim.Region.Physics.Manager; 38using OpenSim.Region.PhysicsModules.SharedBase;
39using OpenSim.Tests.Common; 39using OpenSim.Tests.Common;
40 40
41using OpenMetaverse; 41using OpenMetaverse;
42 42
43namespace OpenSim.Region.Physics.BulletSPlugin.Tests 43namespace OpenSim.Region.PhysicsModule.BulletS.Tests
44{ 44{
45[TestFixture] 45[TestFixture]
46public class BasicVehicles : OpenSimTestCase 46public class BasicVehicles : OpenSimTestCase
diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTests.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTests.cs
index 35cbc1d..0be1f4c 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTests.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTests.cs
@@ -35,7 +35,7 @@ using log4net;
35 35
36using OpenSim.Tests.Common; 36using OpenSim.Tests.Common;
37 37
38namespace OpenSim.Region.Physics.BulletSPlugin.Tests 38namespace OpenSim.Region.PhysicsModule.BulletS.Tests
39{ 39{
40[TestFixture] 40[TestFixture]
41public class BulletSimTests : OpenSimTestCase 41public class BulletSimTests : OpenSimTestCase
diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTestsUtil.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs
index 775bca2..4eeea4d 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTestsUtil.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs
@@ -33,12 +33,13 @@ using System.Text;
33using Nini.Config; 33using Nini.Config;
34 34
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Region.Physics.Manager; 36using OpenSim.Region.PhysicsModules.SharedBase;
37using OpenSim.Region.Physics.Meshing; 37using OpenSim.Region.PhysicsModules.Meshing;
38using OpenSim.Region.Framework.Interfaces;
38 39
39using OpenMetaverse; 40using OpenMetaverse;
40 41
41namespace OpenSim.Region.Physics.BulletSPlugin.Tests 42namespace OpenSim.Region.PhysicsModule.BulletS.Tests
42{ 43{
43// Utility functions for building up and tearing down the sample physics environments 44// Utility functions for building up and tearing down the sample physics environments
44public static class BulletSimTestsUtil 45public static class BulletSimTestsUtil
@@ -78,22 +79,30 @@ public static class BulletSimTestsUtil
78 bulletSimConfig.Set("VehicleLoggingEnabled","True"); 79 bulletSimConfig.Set("VehicleLoggingEnabled","True");
79 } 80 }
80 81
81 PhysicsPluginManager physicsPluginManager;
82 physicsPluginManager = new PhysicsPluginManager();
83 physicsPluginManager.LoadPluginsFromAssemblies("Physics");
84
85 Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); 82 Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
86 83
87 PhysicsScene pScene = physicsPluginManager.GetPhysicsScene( 84 RegionInfo info = new RegionInfo();
88 "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent); 85 info.RegionName = "BSTestRegion";
86 info.RegionSizeX = info.RegionSizeY = info.RegionSizeZ = Constants.RegionSize;
87 OpenSim.Region.Framework.Scenes.Scene scene = new OpenSim.Region.Framework.Scenes.Scene(info);
88
89 IMesher mesher = new OpenSim.Region.PhysicsModules.Meshing.Meshmerizer();
90 INonSharedRegionModule mod = mesher as INonSharedRegionModule;
91 mod.Initialise(openSimINI);
92 mod.AddRegion(scene);
93 mod.RegionLoaded(scene);
89 94
90 BSScene bsScene = pScene as BSScene; 95 BSScene pScene = new BSScene();
96 mod = (pScene as INonSharedRegionModule);
97 mod.Initialise(openSimINI);
98 mod.AddRegion(scene);
99 mod.RegionLoaded(scene);
91 100
92 // Since the asset requestor is not initialized, any mesh or sculptie will be a cube. 101 // Since the asset requestor is not initialized, any mesh or sculptie will be a cube.
93 // In the future, add a fake asset fetcher to get meshes and sculpts. 102 // In the future, add a fake asset fetcher to get meshes and sculpts.
94 // bsScene.RequestAssetMethod = ???; 103 // bsScene.RequestAssetMethod = ???;
95 104
96 return bsScene; 105 return pScene;
97 } 106 }
98 107
99} 108}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/HullCreation.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/HullCreation.cs
index 5a5de11..c0cf19a 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/Tests/HullCreation.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/HullCreation.cs
@@ -34,13 +34,13 @@ using NUnit.Framework;
34using log4net; 34using log4net;
35 35
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Region.Physics.BulletSPlugin; 37using OpenSim.Region.PhysicsModule.BulletS;
38using OpenSim.Region.Physics.Manager; 38using OpenSim.Region.PhysicsModules.SharedBase;
39using OpenSim.Tests.Common; 39using OpenSim.Tests.Common;
40 40
41using OpenMetaverse; 41using OpenMetaverse;
42 42
43namespace OpenSim.Region.Physics.BulletSPlugin.Tests 43namespace OpenSim.Region.PhysicsModule.BulletS.Tests
44{ 44{
45[TestFixture] 45[TestFixture]
46public class HullCreation : OpenSimTestCase 46public class HullCreation : OpenSimTestCase
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/CTri.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/CTri.cs
index 4d84c44..7ad689e 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/CTri.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/CTri.cs
@@ -28,7 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30 30
31namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 31namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
32{ 32{
33 public class Wpoint 33 public class Wpoint
34 { 34 {
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Concavity.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Concavity.cs
index cc6383a..4140d25 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Concavity.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Concavity.cs
@@ -29,7 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31 31
32namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 32namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
33{ 33{
34 public static class Concavity 34 public static class Concavity
35 { 35 {
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexBuilder.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexBuilder.cs
index dfaede1..70c3a2b 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexBuilder.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexBuilder.cs
@@ -29,7 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Diagnostics; 30using System.Diagnostics;
31 31
32namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 32namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
33{ 33{
34 public class DecompDesc 34 public class DecompDesc
35 { 35 {
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexDecomposition.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexDecomposition.cs
index 2e2bb70..5046bce 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexDecomposition.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexDecomposition.cs
@@ -29,7 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Diagnostics; 30using System.Diagnostics;
31 31
32namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 32namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
33{ 33{
34 public delegate void ConvexDecompositionCallback(ConvexResult result); 34 public delegate void ConvexDecompositionCallback(ConvexResult result);
35 35
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexResult.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexResult.cs
index 87758b5..44e3e50 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexResult.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexResult.cs
@@ -28,7 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30 30
31namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 31namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
32{ 32{
33 public class ConvexResult 33 public class ConvexResult
34 { 34 {
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/HullClasses.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullClasses.cs
index d81df26..8a0164e 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/HullClasses.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullClasses.cs
@@ -28,7 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30 30
31namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 31namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
32{ 32{
33 public class HullResult 33 public class HullResult
34 { 34 {
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/HullTriangle.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullTriangle.cs
index 1119a75..d3f0052 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/HullTriangle.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullTriangle.cs
@@ -29,7 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Diagnostics; 30using System.Diagnostics;
31 31
32namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 32namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
33{ 33{
34 public class HullTriangle : int3 34 public class HullTriangle : int3
35 { 35 {
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/HullUtils.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullUtils.cs
index c9ccfe2..3903254 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/HullUtils.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullUtils.cs
@@ -29,7 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Diagnostics; 30using System.Diagnostics;
31 31
32namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 32namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
33{ 33{
34 public static class HullUtils 34 public static class HullUtils
35 { 35 {
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/LICENSE.txt b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/LICENSE.txt
index 714ae89..714ae89 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/LICENSE.txt
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/LICENSE.txt
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Plane.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Plane.cs
index d099676..da9ae0c 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Plane.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Plane.cs
@@ -27,7 +27,7 @@
27 27
28using System; 28using System;
29 29
30namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 30namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
31{ 31{
32 public class Plane 32 public class Plane
33 { 33 {
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/PlaneTri.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/PlaneTri.cs
index 31f0182..42f7a22 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/PlaneTri.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/PlaneTri.cs
@@ -29,7 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Diagnostics; 30using System.Diagnostics;
31 31
32namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 32namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
33{ 33{
34 public enum PlaneTriResult : int 34 public enum PlaneTriResult : int
35 { 35 {
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs
index c5867b2..c5867b2 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Quaternion.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Quaternion.cs
index 0ba8f17..045f620 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Quaternion.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Quaternion.cs
@@ -27,7 +27,7 @@
27 27
28using System; 28using System;
29 29
30namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 30namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
31{ 31{
32 public class Quaternion : float4 32 public class Quaternion : float4
33 { 33 {
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/README.txt b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/README.txt
index fc53ae7..fc53ae7 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/README.txt
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/README.txt
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/SplitPlane.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/SplitPlane.cs
index 9f06a9a..9f56bc5 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/SplitPlane.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/SplitPlane.cs
@@ -28,7 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30 30
31namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 31namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
32{ 32{
33 public class Rect3d 33 public class Rect3d
34 { 34 {
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/VertexLookup.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/VertexLookup.cs
index 6f17c9f..bfe11e5 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/VertexLookup.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/VertexLookup.cs
@@ -28,7 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30 30
31namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 31namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
32{ 32{
33 public class VertexPool 33 public class VertexPool
34 { 34 {
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float2.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float2.cs
index ce88fc8..e7358c1 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float2.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float2.cs
@@ -27,7 +27,7 @@
27 27
28using System; 28using System;
29 29
30namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 30namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
31{ 31{
32 public class float2 32 public class float2
33 { 33 {
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float3.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3.cs
index 4389114..fde9b32 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float3.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3.cs
@@ -27,7 +27,7 @@
27 27
28using System; 28using System;
29 29
30namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 30namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
31{ 31{
32 public class float3 : IEquatable<float3> 32 public class float3 : IEquatable<float3>
33 { 33 {
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float3x3.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3x3.cs
index 76cf063..c420fde 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float3x3.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3x3.cs
@@ -29,7 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Diagnostics; 30using System.Diagnostics;
31 31
32namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 32namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
33{ 33{
34 public class float3x3 34 public class float3x3
35 { 35 {
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float4.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4.cs
index fa60876..b2b6fd3 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float4.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4.cs
@@ -27,7 +27,7 @@
27 27
28using System; 28using System;
29 29
30namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 30namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
31{ 31{
32 public class float4 32 public class float4
33 { 33 {
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float4x4.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4x4.cs
index 7d1592f..087eba7 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float4x4.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4x4.cs
@@ -30,7 +30,7 @@ using System.Collections.Generic;
30using System.Linq; 30using System.Linq;
31using System.Text; 31using System.Text;
32 32
33namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 33namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
34{ 34{
35 public class float4x4 35 public class float4x4
36 { 36 {
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/int3.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int3.cs
index 9c5760d..90624eb 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/int3.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int3.cs
@@ -27,7 +27,7 @@
27 27
28using System; 28using System;
29 29
30namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 30namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
31{ 31{
32 public class int3 32 public class int3
33 { 33 {
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/int4.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int4.cs
index c2b32e5..e9320c0 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/int4.cs
+++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int4.cs
@@ -27,7 +27,7 @@
27 27
28using System; 28using System;
29 29
30namespace OpenSim.Region.Physics.ConvexDecompositionDotNet 30namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet
31{ 31{
32 public class int4 32 public class int4
33 { 33 {
diff --git a/OpenSim/Region/Physics/Meshing/HelperTypes.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/HelperTypes.cs
index 8cd8dcf..34a925d 100644
--- a/OpenSim/Region/Physics/Meshing/HelperTypes.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/HelperTypes.cs
@@ -30,8 +30,8 @@ using System.Collections.Generic;
30using System.Diagnostics; 30using System.Diagnostics;
31using System.Globalization; 31using System.Globalization;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.PhysicsModules.SharedBase;
34using OpenSim.Region.Physics.Meshing; 34using OpenSim.Region.PhysicsModules.Meshing;
35 35
36public class Vertex : IComparable<Vertex> 36public class Vertex : IComparable<Vertex>
37{ 37{
diff --git a/OpenSim/Region/Physics/Meshing/Mesh.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Mesh.cs
index e6b32e7..8c97f2f 100644
--- a/OpenSim/Region/Physics/Meshing/Mesh.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Mesh.cs
@@ -29,11 +29,11 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Runtime.InteropServices; 31using System.Runtime.InteropServices;
32using OpenSim.Region.Physics.Manager; 32using OpenSim.Region.PhysicsModules.SharedBase;
33using PrimMesher; 33using PrimMesher;
34using OpenMetaverse; 34using OpenMetaverse;
35 35
36namespace OpenSim.Region.Physics.Meshing 36namespace OpenSim.Region.PhysicsModules.Meshing
37{ 37{
38 public class Mesh : IMesh 38 public class Mesh : IMesh
39 { 39 {
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs
index ef6482a..bae3449 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs
@@ -28,8 +28,12 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
32using System.IO;
31using OpenSim.Framework; 33using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.PhysicsModules.SharedBase;
33using OpenMetaverse; 37using OpenMetaverse;
34using OpenMetaverse.StructuredData; 38using OpenMetaverse.StructuredData;
35using System.Drawing; 39using System.Drawing;
@@ -38,29 +42,12 @@ using System.IO.Compression;
38using PrimMesher; 42using PrimMesher;
39using log4net; 43using log4net;
40using Nini.Config; 44using Nini.Config;
41using System.Reflection; 45using Mono.Addins;
42using System.IO;
43 46
44namespace OpenSim.Region.Physics.Meshing 47namespace OpenSim.Region.PhysicsModules.Meshing
45{ 48{
46 public class MeshmerizerPlugin : IMeshingPlugin 49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "Meshmerizer")]
47 { 50 public class Meshmerizer : IMesher, INonSharedRegionModule
48 public MeshmerizerPlugin()
49 {
50 }
51
52 public string GetName()
53 {
54 return "Meshmerizer";
55 }
56
57 public IMesher GetMesher(IConfigSource config)
58 {
59 return new Meshmerizer(config);
60 }
61 }
62
63 public class Meshmerizer : IMesher
64 { 51 {
65 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
66 private static string LogHeader = "[MESH]"; 53 private static string LogHeader = "[MESH]";
@@ -72,6 +59,8 @@ namespace OpenSim.Region.Physics.Meshing
72#else 59#else
73 private const string baseDir = null; //"rawFiles"; 60 private const string baseDir = null; //"rawFiles";
74#endif 61#endif
62 private bool m_Enabled = false;
63
75 // If 'true', lots of DEBUG logging of asset parsing details 64 // If 'true', lots of DEBUG logging of asset parsing details
76 private bool debugDetail = false; 65 private bool debugDetail = false;
77 66
@@ -87,30 +76,79 @@ namespace OpenSim.Region.Physics.Meshing
87 // Mesh cache. Static so it can be shared across instances of this class 76 // Mesh cache. Static so it can be shared across instances of this class
88 private static Dictionary<ulong, Mesh> m_uniqueMeshes = new Dictionary<ulong, Mesh>(); 77 private static Dictionary<ulong, Mesh> m_uniqueMeshes = new Dictionary<ulong, Mesh>();
89 78
90 public Meshmerizer(IConfigSource config) 79 #region INonSharedRegionModule
80 public string Name
91 { 81 {
92 IConfig start_config = config.Configs["Startup"]; 82 get { return "Meshmerizer"; }
93 IConfig mesh_config = config.Configs["Mesh"]; 83 }
94 84
95 decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache"); 85 public Type ReplaceableInterface
96 cacheSculptMaps = start_config.GetBoolean("CacheSculptMaps", cacheSculptMaps); 86 {
97 if (mesh_config != null) 87 get { return null; }
98 { 88 }
99 useMeshiesPhysicsMesh = mesh_config.GetBoolean("UseMeshiesPhysicsMesh", useMeshiesPhysicsMesh);
100 debugDetail = mesh_config.GetBoolean("LogMeshDetails", debugDetail);
101 }
102 89
103 try 90 public void Initialise(IConfigSource source)
104 { 91 {
105 if (!Directory.Exists(decodedSculptMapPath)) 92 IConfig config = source.Configs["Startup"];
106 Directory.CreateDirectory(decodedSculptMapPath); 93 if (config != null)
107 }
108 catch (Exception e)
109 { 94 {
110 m_log.WarnFormat("[SCULPT]: Unable to create {0} directory: ", decodedSculptMapPath, e.Message); 95 string mesher = config.GetString("meshing", string.Empty);
96 if (mesher == Name)
97 {
98 m_Enabled = true;
99
100 IConfig mesh_config = source.Configs["Mesh"];
101
102 decodedSculptMapPath = config.GetString("DecodedSculptMapPath", "j2kDecodeCache");
103 cacheSculptMaps = config.GetBoolean("CacheSculptMaps", cacheSculptMaps);
104 if (mesh_config != null)
105 {
106 useMeshiesPhysicsMesh = mesh_config.GetBoolean("UseMeshiesPhysicsMesh", useMeshiesPhysicsMesh);
107 debugDetail = mesh_config.GetBoolean("LogMeshDetails", debugDetail);
108 }
109
110 try
111 {
112 if (!Directory.Exists(decodedSculptMapPath))
113 Directory.CreateDirectory(decodedSculptMapPath);
114 }
115 catch (Exception e)
116 {
117 m_log.WarnFormat("[SCULPT]: Unable to create {0} directory: ", decodedSculptMapPath, e.Message);
118 }
119
120 }
111 } 121 }
112 } 122 }
113 123
124 public void Close()
125 {
126 }
127
128 public void AddRegion(Scene scene)
129 {
130 if (!m_Enabled)
131 return;
132
133 scene.RegisterModuleInterface<IMesher>(this);
134 }
135
136 public void RemoveRegion(Scene scene)
137 {
138 if (!m_Enabled)
139 return;
140
141 scene.UnregisterModuleInterface<IMesher>(this);
142 }
143
144 public void RegionLoaded(Scene scene)
145 {
146 if (!m_Enabled)
147 return;
148 }
149 #endregion
150
151
114 /// <summary> 152 /// <summary>
115 /// creates a simple box mesh of the specified size. This mesh is of very low vertex count and may 153 /// creates a simple box mesh of the specified size. This mesh is of very low vertex count and may
116 /// be useful as a backup proxy when level of detail is not needed or when more complex meshes fail 154 /// be useful as a backup proxy when level of detail is not needed or when more complex meshes fail
diff --git a/OpenSim/Region/Physics/Meshing/PrimMesher.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/PrimMesher.cs
index 4049ee1..4049ee1 100644
--- a/OpenSim/Region/Physics/Meshing/PrimMesher.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/PrimMesher.cs
diff --git a/OpenSim/Region/Physics/Meshing/SculptMap.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMap.cs
index b3d9cb6..b3d9cb6 100644
--- a/OpenSim/Region/Physics/Meshing/SculptMap.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMap.cs
diff --git a/OpenSim/Region/Physics/Meshing/SculptMesh.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMesh.cs
index 4a7f3ad..4a7f3ad 100644
--- a/OpenSim/Region/Physics/Meshing/SculptMesh.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMesh.cs
diff --git a/OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs
index 11b89d2..d6ac8b2 100644
--- a/OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs
@@ -6,7 +6,7 @@ using Mono.Addins;
6// General Information about an assembly is controlled through the following 6// General Information about an assembly is controlled through the following
7// set of attributes. Change these attribute values to modify the information 7// set of attributes. Change these attribute values to modify the information
8// associated with an assembly. 8// associated with an assembly.
9[assembly: AssemblyTitle("OpenSim.Region.RegionCombinerModule")] 9[assembly: AssemblyTitle("OpenSim.Region.PhysicsModules.Meshing")]
10[assembly: AssemblyDescription("")] 10[assembly: AssemblyDescription("")]
11[assembly: AssemblyConfiguration("")] 11[assembly: AssemblyConfiguration("")]
12[assembly: AssemblyCompany("http://opensimulator.org")] 12[assembly: AssemblyCompany("http://opensimulator.org")]
@@ -21,7 +21,7 @@ using Mono.Addins;
21[assembly: ComVisible(false)] 21[assembly: ComVisible(false)]
22 22
23// The following GUID is for the ID of the typelib if this project is exposed to COM 23// The following GUID is for the ID of the typelib if this project is exposed to COM
24[assembly: Guid("73c166d2-c9d8-4ab8-af4e-89c41b4b58a9")] 24[assembly: Guid("4b7e35c2-a9dd-4b10-b778-eb417f4f6884")]
25 25
26// Version information for an assembly consists of the following four values: 26// Version information for an assembly consists of the following four values:
27// 27//
@@ -32,5 +32,5 @@ using Mono.Addins;
32// 32//
33[assembly: AssemblyVersion("0.8.2.*")] 33[assembly: AssemblyVersion("0.8.2.*")]
34 34
35[assembly: Addin("OpenSim.RegionModules.RegionCombinerModule", OpenSim.VersionInfo.VersionNumber)] 35[assembly: Addin("OpenSim.Region.PhysicsModules.Meshing", OpenSim.VersionInfo.VersionNumber)]
36[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] 36[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
diff --git a/OpenSim/Region/Physics/Manager/ZeroMesher.cs b/OpenSim/Region/PhysicsModules/Meshing/ZeroMesher.cs
index 890951f..09676c6 100644
--- a/OpenSim/Region/Physics/Manager/ZeroMesher.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/ZeroMesher.cs
@@ -26,9 +26,15 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Reflection;
29using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Region.Framework.Scenes;
32using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.PhysicsModules.SharedBase;
30using OpenMetaverse; 34using OpenMetaverse;
31using Nini.Config; 35using Nini.Config;
36using Mono.Addins;
37using log4net;
32 38
33/* 39/*
34 * This is the zero mesher. 40 * This is the zero mesher.
@@ -41,27 +47,67 @@ using Nini.Config;
41 * it's always availabe and thus the default in case of configuration errors 47 * it's always availabe and thus the default in case of configuration errors
42*/ 48*/
43 49
44namespace OpenSim.Region.Physics.Manager 50namespace OpenSim.Region.PhysicsModules.Meshing
45{ 51{
46 public class ZeroMesherPlugin : IMeshingPlugin 52
53 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ZeroMesher")]
54 public class ZeroMesher : IMesher, INonSharedRegionModule
47 { 55 {
48 public ZeroMesherPlugin() 56 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
57 private bool m_Enabled = false;
58
59 #region INonSharedRegionModule
60 public string Name
49 { 61 {
62 get { return "ZeroMesher"; }
50 } 63 }
51 64
52 public string GetName() 65 public Type ReplaceableInterface
53 { 66 {
54 return "ZeroMesher"; 67 get { return null; }
55 } 68 }
56 69
57 public IMesher GetMesher(IConfigSource config) 70 public void Initialise(IConfigSource source)
58 { 71 {
59 return new ZeroMesher(); 72 // TODO: Move this out of Startup
73 IConfig config = source.Configs["Startup"];
74 if (config != null)
75 {
76 // This is the default Mesher
77 string mesher = config.GetString("meshing", Name);
78 if (mesher == Name)
79 m_Enabled = true;
80 }
60 } 81 }
61 }
62 82
63 public class ZeroMesher : IMesher 83 public void Close()
64 { 84 {
85 }
86
87 public void AddRegion(Scene scene)
88 {
89 if (!m_Enabled)
90 return;
91
92 scene.RegisterModuleInterface<IMesher>(this);
93 }
94
95 public void RemoveRegion(Scene scene)
96 {
97 if (!m_Enabled)
98 return;
99
100 scene.UnregisterModuleInterface<IMesher>(this);
101 }
102
103 public void RegionLoaded(Scene scene)
104 {
105 if (!m_Enabled)
106 return;
107 }
108 #endregion
109
110 #region IMesher
65 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod) 111 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
66 { 112 {
67 return CreateMesh(primName, primShape, size, lod, false); 113 return CreateMesh(primName, primShape, size, lod, false);
@@ -93,5 +139,7 @@ namespace OpenSim.Region.Physics.Manager
93 public void ReleaseMesh(IMesh mesh) { } 139 public void ReleaseMesh(IMesh mesh) { }
94 public void ExpireReleaseMeshs() { } 140 public void ExpireReleaseMeshs() { }
95 public void ExpireFileCache() { } 141 public void ExpireFileCache() { }
142
143 #endregion
96 } 144 }
97} 145}
diff --git a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs
index 076da78..7869739 100644
--- a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs
@@ -27,6 +27,7 @@
27 27
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30using Mono.Addins;
30 31
31// Information about this assembly is defined by the following 32// Information about this assembly is defined by the following
32// attributes. 33// attributes.
@@ -56,3 +57,6 @@ using System.Runtime.InteropServices;
56// numbers with the '*' character (the default): 57// numbers with the '*' character (the default):
57 58
58[assembly : AssemblyVersion("0.8.2.*")] 59[assembly : AssemblyVersion("0.8.2.*")]
60
61[assembly: Addin("OpenSim.Region.PhysicsModule.ODE", OpenSim.VersionInfo.VersionNumber)]
62[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs
index 05eaf2a..b35c299 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs
@@ -31,10 +31,10 @@ using System.Reflection;
31using OpenMetaverse; 31using OpenMetaverse;
32using Ode.NET; 32using Ode.NET;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.PhysicsModules.SharedBase;
35using log4net; 35using log4net;
36 36
37namespace OpenSim.Region.Physics.OdePlugin 37namespace OpenSim.Region.PhysicsModule.ODE
38{ 38{
39 /// <summary> 39 /// <summary>
40 /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. 40 /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves.
@@ -511,7 +511,7 @@ namespace OpenSim.Region.Physics.OdePlugin
511 } 511 }
512 else 512 else
513 { 513 {
514 m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size for {0} in {1}", Name, _parent_scene.Name); 514 m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size for {0} in {1}", Name, _parent_scene.PhysicsSceneName);
515 } 515 }
516 } 516 }
517 517
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.c_comments b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.c_comments
index 1060aa6..1060aa6 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.c_comments
+++ b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.c_comments
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs
index 2342bfa..8f8e2bd 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs
@@ -46,9 +46,9 @@ using log4net;
46using OpenMetaverse; 46using OpenMetaverse;
47using Ode.NET; 47using Ode.NET;
48using OpenSim.Framework; 48using OpenSim.Framework;
49using OpenSim.Region.Physics.Manager; 49using OpenSim.Region.PhysicsModules.SharedBase;
50 50
51namespace OpenSim.Region.Physics.OdePlugin 51namespace OpenSim.Region.PhysicsModule.ODE
52{ 52{
53 public class ODEDynamics 53 public class ODEDynamics
54 { 54 {
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs
index bf003a8..54a2033 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs
@@ -50,9 +50,9 @@ using log4net;
50using OpenMetaverse; 50using OpenMetaverse;
51using Ode.NET; 51using Ode.NET;
52using OpenSim.Framework; 52using OpenSim.Framework;
53using OpenSim.Region.Physics.Manager; 53using OpenSim.Region.PhysicsModules.SharedBase;
54 54
55namespace OpenSim.Region.Physics.OdePlugin 55namespace OpenSim.Region.PhysicsModule.ODE
56{ 56{
57 /// <summary> 57 /// <summary>
58 /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. 58 /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves.
@@ -3428,7 +3428,7 @@ Console.WriteLine(" JointCreateFixed");
3428 { 3428 {
3429 m_log.WarnFormat( 3429 m_log.WarnFormat(
3430 "[ODE PRIM]: Could not get mesh/sculpt asset {0} for {1} at {2} in {3}", 3430 "[ODE PRIM]: Could not get mesh/sculpt asset {0} for {1} at {2} in {3}",
3431 _pbs.SculptTexture, Name, _position, _parent_scene.Name); 3431 _pbs.SculptTexture, Name, _position, _parent_scene.PhysicsSceneName);
3432 } 3432 }
3433 } 3433 }
3434 } 3434 }
diff --git a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs
index fa2ed3e..80f0fcf 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs
@@ -31,11 +31,11 @@ using System.Reflection;
31using System.Runtime.InteropServices; 31using System.Runtime.InteropServices;
32using System.Text; 32using System.Text;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.PhysicsModules.SharedBase;
35using Ode.NET; 35using Ode.NET;
36using log4net; 36using log4net;
37 37
38namespace OpenSim.Region.Physics.OdePlugin 38namespace OpenSim.Region.PhysicsModule.ODE
39{ 39{
40 /// <summary> 40 /// <summary>
41 /// Processes raycast requests as ODE is in a state to be able to do them. 41 /// Processes raycast requests as ODE is in a state to be able to do them.
@@ -172,7 +172,9 @@ namespace OpenSim.Region.Physics.OdePlugin
172 /// <param name="req"></param> 172 /// <param name="req"></param>
173 private void RayCast(ODERayCastRequest req) 173 private void RayCast(ODERayCastRequest req)
174 { 174 {
175 // limit ray lenght or collisions will take all avaiable stack space 175 // NOTE: limit ray lenght or collisions will take all avaiable stack space
176 // this value may still be too large, depending on machine configuration
177 // of maximum stack
176 float len = req.length; 178 float len = req.length;
177 if (len > 250f) 179 if (len > 250f)
178 len = 250f; 180 len = 250f;
@@ -441,4 +443,4 @@ namespace OpenSim.Region.Physics.OdePlugin
441 public float length; 443 public float length;
442 public RayCallback callbackMethod; 444 public RayCallback callbackMethod;
443 } 445 }
444} \ No newline at end of file 446}
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs b/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs
index b4a3c48..2eb7ba6 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs
@@ -29,10 +29,10 @@ using System;
29using OpenMetaverse; 29using OpenMetaverse;
30using Ode.NET; 30using Ode.NET;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager; 32using OpenSim.Region.PhysicsModules.SharedBase;
33using OpenSim.Region.Physics.OdePlugin; 33using OpenSim.Region.PhysicsModule.ODE;
34 34
35namespace OpenSim.Region.Physics.OdePlugin 35namespace OpenSim.Region.PhysicsModule.ODE
36{ 36{
37 class OdePhysicsJoint : PhysicsJoint 37 class OdePhysicsJoint : PhysicsJoint
38 { 38 {
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs
index 812b469..b00a5ab 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs
@@ -25,13 +25,11 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28// Ubit changes for varsize regions 28// changes for varsize regions
29// using a large Heightfield geometry for terrain 29// note that raycasts need to have limited range
30// ODE ode should handle it fine
31// EXCEPT raycasts, those need to have limited range
32// (even in normal regions) 30// (even in normal regions)
33// or aplication stack will just blowup 31// or aplication thread stack may just blowup
34 32// see RayCast(ODERayCastRequest req)
35 33
36//#define USE_DRAWSTUFF 34//#define USE_DRAWSTUFF
37//#define SPAM 35//#define SPAM
@@ -46,15 +44,19 @@ using System.Runtime.InteropServices;
46using System.Threading; 44using System.Threading;
47using log4net; 45using log4net;
48using Nini.Config; 46using Nini.Config;
47using Mono.Addins;
49using Ode.NET; 48using Ode.NET;
50using OpenMetaverse; 49using OpenMetaverse;
51#if USE_DRAWSTUFF 50#if USE_DRAWSTUFF
52using Drawstuff.NET; 51using Drawstuff.NET;
53#endif 52#endif
54using OpenSim.Framework; 53using OpenSim.Framework;
55using OpenSim.Region.Physics.Manager; 54using OpenSim.Region.PhysicsModules.SharedBase;
55using OpenSim.Region.Framework.Scenes;
56using OpenSim.Region.Framework.Interfaces;
57
56 58
57namespace OpenSim.Region.Physics.OdePlugin 59namespace OpenSim.Region.PhysicsModule.ODE
58{ 60{
59 public enum StatusIndicators : int 61 public enum StatusIndicators : int
60 { 62 {
@@ -109,9 +111,12 @@ namespace OpenSim.Region.Physics.OdePlugin
109 Rubber = 6 111 Rubber = 6
110 } 112 }
111 113
112 public class OdeScene : PhysicsScene 114 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ODEPhysicsScene")]
115 public class OdeScene : PhysicsScene, INonSharedRegionModule
113 { 116 {
114 private readonly ILog m_log; 117 private readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString());
118 private bool m_Enabled = false;
119
115 // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); 120 // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>();
116 121
117 /// <summary> 122 /// <summary>
@@ -298,7 +303,7 @@ namespace OpenSim.Region.Physics.OdePlugin
298 private int framecount = 0; 303 private int framecount = 0;
299 //private int m_returncollisions = 10; 304 //private int m_returncollisions = 10;
300 305
301 private readonly IntPtr contactgroup; 306 private IntPtr contactgroup;
302 307
303// internal IntPtr WaterGeom; 308// internal IntPtr WaterGeom;
304 309
@@ -530,19 +535,103 @@ namespace OpenSim.Region.Physics.OdePlugin
530 535
531 private ODERayCastRequestManager m_rayCastManager; 536 private ODERayCastRequestManager m_rayCastManager;
532 537
538
539 #region INonSharedRegionModule
540 public string Name
541 {
542 get { return "OpenDynamicsEngine"; }
543 }
544
545 public Type ReplaceableInterface
546 {
547 get { return null; }
548 }
549
550 public void Initialise(IConfigSource source)
551 {
552 // TODO: Move this out of Startup
553 IConfig config = source.Configs["Startup"];
554 if (config != null)
555 {
556 string physics = config.GetString("physics", string.Empty);
557 if (physics == Name)
558 {
559 m_Enabled = true;
560 m_config = source;
561
562 // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether
563 // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports
564 // will find it already loaded later on.
565 //
566 // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be
567 // controlled in Ode.NET.dll.config
568 if (Util.IsWindows())
569 Util.LoadArchSpecificWindowsDll("ode.dll");
570
571 // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to
572 // http://opensimulator.org/mantis/view.php?id=2750).
573 d.InitODE();
574
575 }
576 }
577
578 }
579
580 public void Close()
581 {
582 }
583
584 public void AddRegion(Scene scene)
585 {
586 if (!m_Enabled)
587 return;
588
589 EngineType = Name;
590 PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName;
591
592 scene.RegisterModuleInterface<PhysicsScene>(this);
593 Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ);
594 Initialise(extent);
595 InitialiseFromConfig(m_config);
596
597 // This may not be that good since terrain may not be avaiable at this point
598 base.Initialise(scene.PhysicsRequestAsset,
599 (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[(int)(extent.X * extent.Y)]),
600 (float)scene.RegionInfo.RegionSettings.WaterHeight);
601
602 }
603
604 public void RemoveRegion(Scene scene)
605 {
606 if (!m_Enabled)
607 return;
608 }
609
610 public void RegionLoaded(Scene scene)
611 {
612 if (!m_Enabled)
613 return;
614
615 mesher = scene.RequestModuleInterface<IMesher>();
616 if (mesher == null)
617 m_log.WarnFormat("[ODE SCENE]: No mesher in {0}. Things will not work well.", PhysicsSceneName);
618 }
619 #endregion
620
533 /// <summary> 621 /// <summary>
534 /// Initiailizes the scene 622 /// Initiailizes the scene
535 /// Sets many properties that ODE requires to be stable 623 /// Sets many properties that ODE requires to be stable
536 /// These settings need to be tweaked 'exactly' right or weird stuff happens. 624 /// These settings need to be tweaked 'exactly' right or weird stuff happens.
537 /// </summary> 625 /// </summary>
538 /// <param value="name">Name of the scene. Useful in debug messages.</param> 626 private void Initialise(Vector3 regionExtent)
539 public OdeScene(string engineType, string name)
540 { 627 {
541 m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + name); 628 WorldExtents.X = regionExtent.X;
542 629 m_regionWidth = (uint)regionExtent.X;
543 Name = name; 630 WorldExtents.Y = regionExtent.Y;
544 EngineType = engineType; 631 m_regionHeight = (uint)regionExtent.Y;
545 632
633 m_suportCombine = false;
634
546 nearCallback = near; 635 nearCallback = near;
547 triCallback = TriCallback; 636 triCallback = TriCallback;
548 triArrayCallback = TriArrayCallback; 637 triArrayCallback = TriArrayCallback;
@@ -582,7 +671,7 @@ namespace OpenSim.Region.Physics.OdePlugin
582 } 671 }
583#endif 672#endif
584 673
585 public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) 674 public void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent)
586 { 675 {
587 WorldExtents.X = regionExtent.X; 676 WorldExtents.X = regionExtent.X;
588 m_regionWidth = (uint)regionExtent.X; 677 m_regionWidth = (uint)regionExtent.X;
@@ -593,11 +682,10 @@ namespace OpenSim.Region.Physics.OdePlugin
593 } 682 }
594 683
595 // Initialize the mesh plugin 684 // Initialize the mesh plugin
596 public override void Initialise(IMesher meshmerizer, IConfigSource config) 685 public void Initialise(IMesher meshmerizer, IConfigSource config)
597 { 686 {
598 InitializeExtraStats(); 687 InitializeExtraStats();
599 688
600 mesher = meshmerizer;
601 m_config = config; 689 m_config = config;
602 // Defaults 690 // Defaults
603 691
@@ -725,11 +813,11 @@ namespace OpenSim.Region.Physics.OdePlugin
725 spaceGridMaxX = (int)(WorldExtents.X * spacesPerMeterX); 813 spaceGridMaxX = (int)(WorldExtents.X * spacesPerMeterX);
726 spaceGridMaxY = (int)(WorldExtents.Y * spacesPerMeterY); 814 spaceGridMaxY = (int)(WorldExtents.Y * spacesPerMeterY);
727 815
728 // ubit: limit number of spaces 816 // note: limit number of spaces
729 if (spaceGridMaxX > 24) 817 if (spaceGridMaxX > 24)
730 { 818 {
731 spaceGridMaxX = 24; 819 spaceGridMaxX = 24;
732 spacesPerMeterX = spaceGridMaxX / WorldExtents.X ; 820 spacesPerMeterX = spaceGridMaxX / WorldExtents.X;
733 } 821 }
734 if (spaceGridMaxY > 24) 822 if (spaceGridMaxY > 24)
735 { 823 {
@@ -1862,7 +1950,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1862 } 1950 }
1863 catch (AccessViolationException) 1951 catch (AccessViolationException)
1864 { 1952 {
1865 m_log.ErrorFormat("[ODE SCENE]: Unable to space collide {0}", Name); 1953 m_log.ErrorFormat("[ODE SCENE]: Unable to space collide {0}", PhysicsSceneName);
1866 } 1954 }
1867 1955
1868 //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); 1956 //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y);
@@ -3119,7 +3207,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3119 { 3207 {
3120 m_log.ErrorFormat( 3208 m_log.ErrorFormat(
3121 "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when moving", 3209 "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when moving",
3122 actor.Name, actor.LocalID, Name); 3210 actor.Name, actor.LocalID, PhysicsSceneName);
3123 3211
3124 RemoveCharacter(actor); 3212 RemoveCharacter(actor);
3125 actor.DestroyOdeStructures(); 3213 actor.DestroyOdeStructures();
@@ -3236,7 +3324,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3236 { 3324 {
3237 m_log.ErrorFormat( 3325 m_log.ErrorFormat(
3238 "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when updating position and velocity", 3326 "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when updating position and velocity",
3239 actor.Name, actor.LocalID, Name); 3327 actor.Name, actor.LocalID, PhysicsSceneName);
3240 3328
3241 RemoveCharacter(actor); 3329 RemoveCharacter(actor);
3242 actor.DestroyOdeStructures(); 3330 actor.DestroyOdeStructures();
@@ -3835,7 +3923,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3835 private void SetTerrain(float[] heightMap, Vector3 pOffset) 3923 private void SetTerrain(float[] heightMap, Vector3 pOffset)
3836 { 3924 {
3837 int startTime = Util.EnvironmentTickCount(); 3925 int startTime = Util.EnvironmentTickCount();
3838 m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0} with offset {1}", Name, pOffset); 3926 m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0} with offset {1}", PhysicsSceneName, pOffset);
3839 3927
3840 3928
3841 float[] _heightmap; 3929 float[] _heightmap;
@@ -3873,6 +3961,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3873 uint xt = 0; 3961 uint xt = 0;
3874 xx = 0; 3962 xx = 0;
3875 3963
3964
3876 for (uint x = 0; x < heightmapWidthSamples; x++) 3965 for (uint x = 0; x < heightmapWidthSamples; x++)
3877 { 3966 {
3878 if (x > 1 && xx < maxXX) 3967 if (x > 1 && xx < maxXX)
@@ -3951,7 +4040,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3951 } 4040 }
3952 4041
3953 m_log.DebugFormat( 4042 m_log.DebugFormat(
3954 "[ODE SCENE]: Setting terrain for {0} took {1}ms", Name, Util.EnvironmentTickCountSubtract(startTime)); 4043 "[ODE SCENE]: Setting terrain for {0} took {1}ms", PhysicsSceneName, Util.EnvironmentTickCountSubtract(startTime));
3955 } 4044 }
3956 4045
3957 public override void DeleteTerrain() 4046 public override void DeleteTerrain()
diff --git a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs
index 16404c6..6dc22bd 100644
--- a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs
@@ -30,51 +30,74 @@ using Nini.Config;
30using NUnit.Framework; 30using NUnit.Framework;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.PhysicsModules.SharedBase;
34using OpenSim.Region.Physics.OdePlugin; 34using OpenSim.Region.PhysicsModule.ODE;
35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Tests.Common; 37using OpenSim.Tests.Common;
36using log4net; 38using log4net;
37using System.Reflection; 39using System.Reflection;
38 40
39namespace OpenSim.Region.Physics.OdePlugin.Tests 41namespace OpenSim.Region.PhysicsModule.ODE.Tests
40{ 42{
41 [TestFixture] 43 [TestFixture]
42 public class ODETestClass : OpenSimTestCase 44 public class ODETestClass : OpenSimTestCase
43 { 45 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 47
46 private OpenSim.Region.Physics.OdePlugin.OdePlugin cbt; 48 //private OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt;
47 private PhysicsScene ps; 49 private PhysicsScene pScene;
48 private IMeshingPlugin imp;
49 50
50 [SetUp] 51 [SetUp]
51 public void Initialize() 52 public void Initialize()
52 { 53 {
53 IConfigSource TopConfig = new IniConfigSource(); 54 IConfigSource openSimINI = new IniConfigSource();
54 IConfig config = TopConfig.AddConfig("Startup"); 55 IConfig startupConfig = openSimINI.AddConfig("Startup");
55 config.Set("DecodedSculptMapPath","j2kDecodeCache"); 56 startupConfig.Set("physics", "OpenDynamicsEngine");
57 startupConfig.Set("DecodedSculptMapPath", "j2kDecodeCache");
58
59 Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
60
61 //PhysicsScene pScene = physicsPluginManager.GetPhysicsScene(
62 // "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent);
63 RegionInfo info = new RegionInfo();
64 info.RegionName = "ODETestRegion";
65 info.RegionSizeX = info.RegionSizeY = info.RegionSizeZ = Constants.RegionSize;
66 OpenSim.Region.Framework.Scenes.Scene scene = new OpenSim.Region.Framework.Scenes.Scene(info);
67
68 //IMesher mesher = new OpenSim.Region.PhysicsModules.Meshing.Meshmerizer();
69 //INonSharedRegionModule mod = mesher as INonSharedRegionModule;
70 //mod.Initialise(openSimINI);
71 //mod.AddRegion(scene);
72 //mod.RegionLoaded(scene);
73
74 pScene = new OdeScene();
75 Console.WriteLine("HERE " + (pScene == null ? "Null" : "Not null"));
76 INonSharedRegionModule mod = (pScene as INonSharedRegionModule);
77 Console.WriteLine("HERE " + (mod == null ? "Null" : "Not null"));
78 mod.Initialise(openSimINI);
79 mod.AddRegion(scene);
80 mod.RegionLoaded(scene);
56 81
57 // Loading ODEPlugin 82 // Loading ODEPlugin
58 cbt = new OdePlugin(); 83 //cbt = new OdePlugin();
59 // Loading Zero Mesher
60 imp = new ZeroMesherPlugin();
61 // Getting Physics Scene 84 // Getting Physics Scene
62 ps = cbt.GetScene("test"); 85 //ps = cbt.GetScene("test");
63 // Initializing Physics Scene. 86 // Initializing Physics Scene.
64 ps.Initialise(imp.GetMesher(TopConfig),null); 87 //ps.Initialise(imp.GetMesher(TopConfig), null, Vector3.Zero);
65 float[] _heightmap = new float[(int)Constants.RegionSize * (int)Constants.RegionSize]; 88 float[] _heightmap = new float[(int)Constants.RegionSize * (int)Constants.RegionSize];
66 for (int i = 0; i < ((int)Constants.RegionSize * (int)Constants.RegionSize); i++) 89 for (int i = 0; i < ((int)Constants.RegionSize * (int)Constants.RegionSize); i++)
67 { 90 {
68 _heightmap[i] = 21f; 91 _heightmap[i] = 21f;
69 } 92 }
70 ps.SetTerrain(_heightmap); 93 pScene.SetTerrain(_heightmap);
71 } 94 }
72 95
73 [TearDown] 96 [TearDown]
74 public void Terminate() 97 public void Terminate()
75 { 98 {
76 ps.DeleteTerrain(); 99 pScene.DeleteTerrain();
77 ps.Dispose(); 100 pScene.Dispose();
78 101
79 } 102 }
80 103
@@ -85,9 +108,9 @@ namespace OpenSim.Region.Physics.OdePlugin.Tests
85 Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f); 108 Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f);
86 Vector3 size = new Vector3(0.5f, 0.5f, 0.5f); 109 Vector3 size = new Vector3(0.5f, 0.5f, 0.5f);
87 Quaternion rot = Quaternion.Identity; 110 Quaternion rot = Quaternion.Identity;
88 PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true, 0); 111 PhysicsActor prim = pScene.AddPrimShape("CoolShape", newcube, position, size, rot, true, 0);
89 OdePrim oprim = (OdePrim)prim; 112 OdePrim oprim = (OdePrim)prim;
90 OdeScene pscene = (OdeScene) ps; 113 OdeScene pscene = (OdeScene)pScene;
91 114
92 Assert.That(oprim.m_taintadd); 115 Assert.That(oprim.m_taintadd);
93 116
@@ -95,7 +118,7 @@ namespace OpenSim.Region.Physics.OdePlugin.Tests
95 118
96 for (int i = 0; i < 58; i++) 119 for (int i = 0; i < 58; i++)
97 { 120 {
98 ps.Simulate(0.133f); 121 pScene.Simulate(0.133f);
99 122
100 Assert.That(oprim.prim_geom != (IntPtr)0); 123 Assert.That(oprim.prim_geom != (IntPtr)0);
101 124
@@ -119,9 +142,9 @@ namespace OpenSim.Region.Physics.OdePlugin.Tests
119 // Make sure we're not somewhere above the ground 142 // Make sure we're not somewhere above the ground
120 Assert.That(prim.Position.Z < 21.5f); 143 Assert.That(prim.Position.Z < 21.5f);
121 144
122 ps.RemovePrim(prim); 145 pScene.RemovePrim(prim);
123 Assert.That(oprim.m_taintremove); 146 Assert.That(oprim.m_taintremove);
124 ps.Simulate(0.133f); 147 pScene.Simulate(0.133f);
125 Assert.That(oprim.Body == (IntPtr)0); 148 Assert.That(oprim.Body == (IntPtr)0);
126 } 149 }
127 } 150 }
diff --git a/OpenSim/Region/Physics/ChOdePlugin/drawstuff.cs b/OpenSim/Region/PhysicsModules/Ode/drawstuff.cs
index 87ca446..87ca446 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/drawstuff.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/drawstuff.cs
diff --git a/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/POS/AssemblyInfo.cs
index fc1ffba..e3a3e35 100644
--- a/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/PhysicsModules/POS/AssemblyInfo.cs
@@ -27,6 +27,7 @@
27 27
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30using Mono.Addins;
30 31
31// Information about this assembly is defined by the following 32// Information about this assembly is defined by the following
32// attributes. 33// attributes.
@@ -56,3 +57,6 @@ using System.Runtime.InteropServices;
56// numbers with the '*' character (the default): 57// numbers with the '*' character (the default):
57 58
58[assembly : AssemblyVersion("0.8.2.*")] 59[assembly : AssemblyVersion("0.8.2.*")]
60
61[assembly: Addin("OpenSim.Region.PhysicsModule.POS", OpenSim.VersionInfo.VersionNumber)]
62[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/PhysicsModules/POS/POSCharacter.cs
index 40ab984..32469d9 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
+++ b/OpenSim/Region/PhysicsModules/POS/POSCharacter.cs
@@ -30,9 +30,9 @@ using System.Collections.Generic;
30using Nini.Config; 30using Nini.Config;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.PhysicsModules.SharedBase;
34 34
35namespace OpenSim.Region.Physics.POSPlugin 35namespace OpenSim.Region.PhysicsModule.POS
36{ 36{
37 public class POSCharacter : PhysicsActor 37 public class POSCharacter : PhysicsActor
38 { 38 {
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/PhysicsModules/POS/POSPrim.cs
index 782ba82..c190fab 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
+++ b/OpenSim/Region/PhysicsModules/POS/POSPrim.cs
@@ -30,9 +30,9 @@ using System.Collections.Generic;
30using Nini.Config; 30using Nini.Config;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.PhysicsModules.SharedBase;
34 34
35namespace OpenSim.Region.Physics.POSPlugin 35namespace OpenSim.Region.PhysicsModule.POS
36{ 36{
37 public class POSPrim : PhysicsActor 37 public class POSPrim : PhysicsActor
38 { 38 {
diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/PhysicsModules/POS/POSScene.cs
index 061304a..e6bcbf2 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSScene.cs
+++ b/OpenSim/Region/PhysicsModules/POS/POSScene.cs
@@ -29,31 +29,81 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using Nini.Config; 30using Nini.Config;
31using OpenMetaverse; 31using OpenMetaverse;
32using Mono.Addins;
32using OpenSim.Framework; 33using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.PhysicsModules.SharedBase;
35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces;
34 37
35namespace OpenSim.Region.Physics.POSPlugin 38namespace OpenSim.Region.PhysicsModule.POS
36{ 39{
37 public class POSScene : PhysicsScene 40 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "POSPhysicsScene")]
41 public class POSScene : PhysicsScene, INonSharedRegionModule
38 { 42 {
39 private List<POSCharacter> _characters = new List<POSCharacter>(); 43 private List<POSCharacter> _characters = new List<POSCharacter>();
40 private List<POSPrim> _prims = new List<POSPrim>(); 44 private List<POSPrim> _prims = new List<POSPrim>();
41 private float[] _heightMap; 45 private float[] _heightMap;
42 private const float gravity = -9.8f; 46 private const float gravity = -9.8f;
43 47
48 private bool m_Enabled = false;
44 //protected internal string sceneIdentifier; 49 //protected internal string sceneIdentifier;
45 50
46 public POSScene(string engineType, String _sceneIdentifier) 51 #region INonSharedRegionModule
52 public string Name
47 { 53 {
48 EngineType = engineType; 54 get { return "POS"; }
49 Name = EngineType + "/" + _sceneIdentifier;
50 //sceneIdentifier = _sceneIdentifier;
51 } 55 }
52 56
53 public override void Initialise(IMesher meshmerizer, IConfigSource config) 57 public Type ReplaceableInterface
54 { 58 {
59 get { return null; }
55 } 60 }
56 61
62 public void Initialise(IConfigSource source)
63 {
64 // TODO: Move this out of Startup
65 IConfig config = source.Configs["Startup"];
66 if (config != null)
67 {
68 string physics = config.GetString("physics", string.Empty);
69 if (physics == Name)
70 m_Enabled = true;
71 }
72
73 }
74
75 public void Close()
76 {
77 }
78
79 public void AddRegion(Scene scene)
80 {
81 if (!m_Enabled)
82 return;
83
84 EngineType = Name;
85 PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName;
86
87 scene.RegisterModuleInterface<PhysicsScene>(this);
88 base.Initialise(scene.PhysicsRequestAsset,
89 (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[Constants.RegionSize * Constants.RegionSize]),
90 (float)scene.RegionInfo.RegionSettings.WaterHeight);
91
92 }
93
94 public void RemoveRegion(Scene scene)
95 {
96 if (!m_Enabled)
97 return;
98 }
99
100 public void RegionLoaded(Scene scene)
101 {
102 if (!m_Enabled)
103 return;
104 }
105 #endregion
106
57 public override void Dispose() 107 public override void Dispose()
58 { 108 {
59 } 109 }
diff --git a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/SharedBase/AssemblyInfo.cs
index 33f60e4..33f60e4 100644
--- a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/AssemblyInfo.cs
diff --git a/OpenSim/Region/Physics/Manager/CollisionLocker.cs b/OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs
index cace4e4..6e658b5 100644
--- a/OpenSim/Region/Physics/Manager/CollisionLocker.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs
@@ -28,7 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30 30
31namespace OpenSim.Region.Physics.Manager 31namespace OpenSim.Region.PhysicsModules.SharedBase
32{ 32{
33 public class CollisionLocker 33 public class CollisionLocker
34 { 34 {
diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs
index e290dc9..88169bb 100644
--- a/OpenSim/Region/Physics/Manager/IMesher.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs
@@ -31,7 +31,7 @@ using System.Runtime.InteropServices;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenMetaverse; 32using OpenMetaverse;
33 33
34namespace OpenSim.Region.Physics.Manager 34namespace OpenSim.Region.PhysicsModules.SharedBase
35{ 35{
36 public interface IMesher 36 public interface IMesher
37 { 37 {
diff --git a/OpenSim/Region/Physics/Manager/IPhysicsParameters.cs b/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs
index 31a397c..fb0c9e2 100755
--- a/OpenSim/Region/Physics/Manager/IPhysicsParameters.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs
@@ -30,7 +30,7 @@ using System.Collections.Generic;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenMetaverse; 31using OpenMetaverse;
32 32
33namespace OpenSim.Region.Physics.Manager 33namespace OpenSim.Region.PhysicsModules.SharedBase
34{ 34{
35 public struct PhysParameterEntry 35 public struct PhysParameterEntry
36 { 36 {
diff --git a/OpenSim/Region/Physics/Manager/NullPhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs
index b52f1f6..432708c 100644
--- a/OpenSim/Region/Physics/Manager/NullPhysicsScene.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs
@@ -32,7 +32,7 @@ using Nini.Config;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34 34
35namespace OpenSim.Region.Physics.Manager 35namespace OpenSim.Region.PhysicsModules.SharedBase
36{ 36{
37 class NullPhysicsScene : PhysicsScene 37 class NullPhysicsScene : PhysicsScene
38 { 38 {
@@ -40,11 +40,6 @@ namespace OpenSim.Region.Physics.Manager
40 40
41 private static int m_workIndicator; 41 private static int m_workIndicator;
42 42
43 public override void Initialise(IMesher meshmerizer, IConfigSource config)
44 {
45 // Does nothing right now
46 }
47
48 public override PhysicsActor AddAvatar( 43 public override PhysicsActor AddAvatar(
49 string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) 44 string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
50 { 45 {
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
index 60f6480..edc41e4 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
@@ -32,7 +32,7 @@ using System.Reflection;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34 34
35namespace OpenSim.Region.Physics.Manager 35namespace OpenSim.Region.PhysicsModules.SharedBase
36{ 36{
37 public delegate void PositionUpdate(Vector3 position); 37 public delegate void PositionUpdate(Vector3 position);
38 public delegate void VelocityUpdate(Vector3 velocity); 38 public delegate void VelocityUpdate(Vector3 velocity);
diff --git a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs
index b685d04..ce2bf05 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs
@@ -30,7 +30,7 @@ using System.Collections.Generic;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenMetaverse; 31using OpenMetaverse;
32 32
33namespace OpenSim.Region.Physics.Manager 33namespace OpenSim.Region.PhysicsModules.SharedBase
34{ 34{
35 public enum PhysicsJointType : int 35 public enum PhysicsJointType : int
36 { 36 {
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs
index a9b30e1..1c0ad20 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs
@@ -35,7 +35,7 @@ using Nini.Config;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenMetaverse; 36using OpenMetaverse;
37 37
38namespace OpenSim.Region.Physics.Manager 38namespace OpenSim.Region.PhysicsModules.SharedBase
39{ 39{
40 public delegate void physicsCrash(); 40 public delegate void physicsCrash();
41 41
@@ -104,7 +104,7 @@ namespace OpenSim.Region.Physics.Manager
104 /// Useful in debug messages to distinguish one OdeScene instance from another. 104 /// Useful in debug messages to distinguish one OdeScene instance from another.
105 /// Usually set to include the region name that the physics engine is acting for. 105 /// Usually set to include the region name that the physics engine is acting for.
106 /// </summary> 106 /// </summary>
107 public string Name { get; protected set; } 107 public string PhysicsSceneName { get; protected set; }
108 108
109 /// <summary> 109 /// <summary>
110 /// A string identifying the family of this physics engine. Most common values returned 110 /// A string identifying the family of this physics engine. Most common values returned
@@ -123,6 +123,14 @@ namespace OpenSim.Region.Physics.Manager
123 123
124 public RequestAssetDelegate RequestAssetMethod { get; set; } 124 public RequestAssetDelegate RequestAssetMethod { get; set; }
125 125
126 protected void Initialise(RequestAssetDelegate m, float[] terrain, float waterHeight)
127 {
128 RequestAssetMethod = m;
129 SetTerrain(terrain);
130 SetWaterLevel(waterHeight);
131
132 }
133
126 public virtual void TriggerPhysicsBasedRestart() 134 public virtual void TriggerPhysicsBasedRestart()
127 { 135 {
128 physicsCrash handler = OnPhysicsCrash; 136 physicsCrash handler = OnPhysicsCrash;
@@ -132,17 +140,6 @@ namespace OpenSim.Region.Physics.Manager
132 } 140 }
133 } 141 }
134 142
135 // Deprecated. Do not use this for new physics engines.
136 public abstract void Initialise(IMesher meshmerizer, IConfigSource config);
137
138 // For older physics engines that do not implement non-legacy region sizes.
139 // If the physics engine handles the region extent feature, it overrides this function.
140 public virtual void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent)
141 {
142 // If not overridden, call the old initialization entry.
143 Initialise(meshmerizer, config);
144 }
145
146 /// <summary> 143 /// <summary>
147 /// Add an avatar 144 /// Add an avatar
148 /// </summary> 145 /// </summary>
diff --git a/OpenSim/Region/Physics/Manager/PhysicsSensor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs
index f480d71..da9c96c 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsSensor.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs
@@ -29,7 +29,7 @@ using System;
29using System.Timers; 29using System.Timers;
30using OpenMetaverse; 30using OpenMetaverse;
31 31
32namespace OpenSim.Region.Physics.Manager 32namespace OpenSim.Region.PhysicsModules.SharedBase
33{ 33{
34 [Flags] 34 [Flags]
35 public enum SenseType : uint 35 public enum SenseType : uint
diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs
index f60a636..76a82fa 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs
@@ -27,7 +27,7 @@
27 27
28using System; 28using System;
29 29
30namespace OpenSim.Region.Physics.Manager 30namespace OpenSim.Region.PhysicsModules.SharedBase
31{ 31{
32 /*public class PhysicsVector 32 /*public class PhysicsVector
33 { 33 {
diff --git a/OpenSim/Region/Physics/Manager/VehicleConstants.cs b/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs
index 8e24b4c..e850b11 100644
--- a/OpenSim/Region/Physics/Manager/VehicleConstants.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs
@@ -28,7 +28,7 @@
28using System; 28using System;
29using OpenMetaverse; 29using OpenMetaverse;
30 30
31namespace OpenSim.Region.Physics.Manager 31namespace OpenSim.Region.PhysicsModules.SharedBase
32{ 32{
33 public enum Vehicle : int 33 public enum Vehicle : int
34 { 34 {
diff --git a/OpenSim/Region/Physics/UbitMeshing/HelperTypes.cs b/OpenSim/Region/PhysicsModules/UbitMeshing/HelperTypes.cs
index 5dc1e78..5dc1e78 100644
--- a/OpenSim/Region/Physics/UbitMeshing/HelperTypes.cs
+++ b/OpenSim/Region/PhysicsModules/UbitMeshing/HelperTypes.cs
diff --git a/OpenSim/Region/Physics/UbitMeshing/Mesh.cs b/OpenSim/Region/PhysicsModules/UbitMeshing/Mesh.cs
index 0418893..0418893 100644
--- a/OpenSim/Region/Physics/UbitMeshing/Mesh.cs
+++ b/OpenSim/Region/PhysicsModules/UbitMeshing/Mesh.cs
diff --git a/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/UbitMeshing/Meshmerizer.cs
index c131c6f..c131c6f 100644
--- a/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs
+++ b/OpenSim/Region/PhysicsModules/UbitMeshing/Meshmerizer.cs
diff --git a/OpenSim/Region/Physics/UbitMeshing/PrimMesher.cs b/OpenSim/Region/PhysicsModules/UbitMeshing/PrimMesher.cs
index 8eb136b..8eb136b 100644
--- a/OpenSim/Region/Physics/UbitMeshing/PrimMesher.cs
+++ b/OpenSim/Region/PhysicsModules/UbitMeshing/PrimMesher.cs
diff --git a/OpenSim/Region/Physics/UbitMeshing/SculptMap.cs b/OpenSim/Region/PhysicsModules/UbitMeshing/SculptMap.cs
index 1c75db6..1c75db6 100644
--- a/OpenSim/Region/Physics/UbitMeshing/SculptMap.cs
+++ b/OpenSim/Region/PhysicsModules/UbitMeshing/SculptMap.cs
diff --git a/OpenSim/Region/Physics/UbitMeshing/SculptMesh.cs b/OpenSim/Region/PhysicsModules/UbitMeshing/SculptMesh.cs
index bc1375b..bc1375b 100644
--- a/OpenSim/Region/Physics/UbitMeshing/SculptMesh.cs
+++ b/OpenSim/Region/PhysicsModules/UbitMeshing/SculptMesh.cs
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/UbitOdePlugin/AssemblyInfo.cs
index d46341b..d46341b 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/PhysicsModules/UbitOdePlugin/AssemblyInfo.cs
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODECharacter.cs
index 0e2cbd2..ba38136 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODECharacter.cs
@@ -34,10 +34,10 @@ using System.Reflection;
34using OpenMetaverse; 34using OpenMetaverse;
35using OdeAPI; 35using OdeAPI;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Region.Physics.Manager; 37using OpenSim.Region.PhysicsModules.SharedBase;
38using log4net; 38using log4net;
39 39
40namespace OpenSim.Region.Physics.OdePlugin 40namespace OpenSim.Region.PhysicsModules.OdePlugin
41{ 41{
42 /// <summary> 42 /// <summary>
43 /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. 43 /// 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
index 3c952ae..36bb1e9 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
+++ b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODEDynamics.cs
@@ -48,9 +48,9 @@ using log4net;
48using OpenMetaverse; 48using OpenMetaverse;
49using OdeAPI; 49using OdeAPI;
50using OpenSim.Framework; 50using OpenSim.Framework;
51using OpenSim.Region.Physics.Manager; 51using OpenSim.Region.PhysicsModules.SharedBase;
52 52
53namespace OpenSim.Region.Physics.OdePlugin 53namespace OpenSim.Region.PhysicsModules.OdePlugin
54{ 54{
55 public class ODEDynamics 55 public class ODEDynamics
56 { 56 {
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODEMeshWorker.cs
index a6bdaa0..918c9db 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs
+++ b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODEMeshWorker.cs
@@ -10,13 +10,13 @@ using System.Reflection;
10using System.Runtime.InteropServices; 10using System.Runtime.InteropServices;
11using System.Text; 11using System.Text;
12using OpenSim.Framework; 12using OpenSim.Framework;
13using OpenSim.Region.Physics.Manager; 13using OpenSim.Region.PhysicsModules.SharedBase;
14using OdeAPI; 14using OdeAPI;
15using log4net; 15using log4net;
16using Nini.Config; 16using Nini.Config;
17using OpenMetaverse; 17using OpenMetaverse;
18 18
19namespace OpenSim.Region.Physics.OdePlugin 19namespace OpenSim.Region.PhysicsModules.OdePlugin
20{ 20{
21 public enum MeshState : byte 21 public enum MeshState : byte
22 { 22 {
@@ -930,4 +930,4 @@ namespace OpenSim.Region.Physics.OdePlugin
930 repData.actor.Name); 930 repData.actor.Name);
931 } 931 }
932 } 932 }
933} \ No newline at end of file 933}
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODEPrim.cs
index 8bcdd89..b52a242 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODEPrim.cs
@@ -55,9 +55,9 @@ using log4net;
55using OpenMetaverse; 55using OpenMetaverse;
56using OdeAPI; 56using OdeAPI;
57using OpenSim.Framework; 57using OpenSim.Framework;
58using OpenSim.Region.Physics.Manager; 58using OpenSim.Region.PhysicsModules.SharedBase;
59 59
60namespace OpenSim.Region.Physics.OdePlugin 60namespace OpenSim.Region.PhysicsModules.OdePlugin
61{ 61{
62 public class OdePrim : PhysicsActor 62 public class OdePrim : PhysicsActor
63 { 63 {
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODERayCastRequestManager.cs
index 73ababa..3ad9a47 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs
+++ b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODERayCastRequestManager.cs
@@ -31,12 +31,12 @@ using System.Reflection;
31using System.Runtime.InteropServices; 31using System.Runtime.InteropServices;
32using System.Text; 32using System.Text;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.PhysicsModules.SharedBase;
35using OdeAPI; 35using OdeAPI;
36using log4net; 36using log4net;
37using OpenMetaverse; 37using OpenMetaverse;
38 38
39namespace OpenSim.Region.Physics.OdePlugin 39namespace OpenSim.Region.PhysicsModules.OdePlugin
40{ 40{
41 /// <summary> 41 /// <summary>
42 /// Processes raycast requests as ODE is in a state to be able to do them. 42 /// Processes raycast requests as ODE is in a state to be able to do them.
@@ -680,4 +680,4 @@ namespace OpenSim.Region.Physics.OdePlugin
680 public RayFilterFlags filter; 680 public RayFilterFlags filter;
681 public Quaternion orientation; 681 public Quaternion orientation;
682 } 682 }
683} \ No newline at end of file 683}
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODESitAvatar.cs
index 672212f..d934d3e 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODESitAvatar.cs
+++ b/OpenSim/Region/PhysicsModules/UbitOdePlugin/ODESitAvatar.cs
@@ -31,12 +31,12 @@ using System.Reflection;
31using System.Runtime.InteropServices; 31using System.Runtime.InteropServices;
32using System.Text; 32using System.Text;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.PhysicsModules.SharedBase;
35using OdeAPI; 35using OdeAPI;
36using log4net; 36using log4net;
37using OpenMetaverse; 37using OpenMetaverse;
38 38
39namespace OpenSim.Region.Physics.OdePlugin 39namespace OpenSim.Region.PhysicsModules.OdePlugin
40{ 40{
41 /// <summary> 41 /// <summary>
42 /// </summary> 42 /// </summary>
@@ -353,4 +353,4 @@ namespace OpenSim.Region.Physics.OdePlugin
353 return; 353 return;
354 } 354 }
355 } 355 }
356} \ No newline at end of file 356}
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeApi.cs b/OpenSim/Region/PhysicsModules/UbitOdePlugin/OdeApi.cs
index 10d7d50..10d7d50 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeApi.cs
+++ b/OpenSim/Region/PhysicsModules/UbitOdePlugin/OdeApi.cs
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/PhysicsModules/UbitOdePlugin/OdeScene.cs
index e8c219c..9373d2b 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/PhysicsModules/UbitOdePlugin/OdeScene.cs
@@ -39,10 +39,11 @@ using log4net;
39using Nini.Config; 39using Nini.Config;
40using OdeAPI; 40using OdeAPI;
41using OpenSim.Framework; 41using OpenSim.Framework;
42using OpenSim.Region.Physics.Manager; 42using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.PhysicsModules.SharedBase;
43using OpenMetaverse; 44using OpenMetaverse;
44 45
45namespace OpenSim.Region.Physics.OdePlugin 46namespace OpenSim.Region.PhysicsModules.OdePlugin
46{ 47{
47 // colision flags of things others can colide with 48 // colision flags of things others can colide with
48 // rays, sensors, probes removed since can't be colided with 49 // rays, sensors, probes removed since can't be colided with
@@ -164,9 +165,9 @@ namespace OpenSim.Region.Physics.OdePlugin
164 165
165 166
166 167
167 public class OdeScene : PhysicsScene 168 public class OdeScene : PhysicsScene, INonSharedRegionModule
168 { 169 {
169 private readonly ILog m_log; 170 private readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + sceneIdentifier);
170 // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); 171 // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>();
171 172
172 public bool OdeUbitLib = false; 173 public bool OdeUbitLib = false;
@@ -324,18 +325,85 @@ namespace OpenSim.Region.Physics.OdePlugin
324 } 325 }
325 } 326 }
326 */ 327 */
328 #region INonSharedRegionModule
329 public string Name
330 {
331 get { return "UbitODE"; }
332 }
333
334 public Type ReplaceableInterface
335 {
336 get { return null; }
337 }
338
339 public void Initialise(IConfigSource source)
340 {
341 // TODO: Move this out of Startup
342 IConfig config = source.Configs["Startup"];
343 if (config != null)
344 {
345 string physics = config.GetString("physics", string.Empty);
346 if (physics == Name)
347 {
348 m_Enabled = true;
349 m_Config = source;
350 }
351 }
352
353 }
354
355 public void Close()
356 {
357 }
358
359 public void AddRegion(Scene scene)
360 {
361 if (!m_Enabled)
362 return;
363
364 EngineType = Name;
365 RegionName = scene.RegionInfo.RegionName;
366 PhysicsSceneName = EngineType + "/" + RegionName;
367
368 scene.RegisterModuleInterface<PhysicsScene>(this);
369 Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ);
370 RawInitialization();
371 Initialise(m_Config, extent);
372
373 base.Initialise(scene.PhysicsRequestAsset,
374 (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[scene.RegionInfo.RegionSizeX * scene.RegionInfo.RegionSizeY]),
375 (float)scene.RegionInfo.RegionSettings.WaterHeight);
376
377 }
378
379 public void RemoveRegion(Scene scene)
380 {
381 if (!m_Enabled)
382 return;
383 }
384
385 public void RegionLoaded(Scene scene)
386 {
387 if (!m_Enabled)
388 return;
389
390 mesher = scene.RequestModuleInterface<IMesher>();
391 if (mesher == null)
392 m_log.WarnFormat("{0} No mesher. Things will not work well.", LogHeader);
393
394 scene.PhysicsEnabled = true;
395 }
396 #endregion
397
327 /// <summary> 398 /// <summary>
328 /// Initiailizes the scene 399 /// Initiailizes the scene
329 /// Sets many properties that ODE requires to be stable 400 /// Sets many properties that ODE requires to be stable
330 /// These settings need to be tweaked 'exactly' right or weird stuff happens. 401 /// These settings need to be tweaked 'exactly' right or weird stuff happens.
331 /// </summary> 402 /// </summary>
332 public OdeScene(string sceneIdentifier) 403 private void RawInitialization()
333 { 404 {
334 m_log
335 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + sceneIdentifier);
336 405
337// checkThread(); 406// checkThread();
338 Name = sceneIdentifier;
339 407
340 OdeLock = new Object(); 408 OdeLock = new Object();
341 SimulationLock = new Object(); 409 SimulationLock = new Object();
@@ -415,7 +483,7 @@ namespace OpenSim.Region.Physics.OdePlugin
415 } 483 }
416 } 484 }
417 485
418 public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) 486 public void Initialise(IConfigSource config, Vector3 regionExtent)
419 { 487 {
420 WorldExtents.X = regionExtent.X; 488 WorldExtents.X = regionExtent.X;
421 m_regionWidth = (uint)regionExtent.X; 489 m_regionWidth = (uint)regionExtent.X;
@@ -423,14 +491,7 @@ namespace OpenSim.Region.Physics.OdePlugin
423 m_regionHeight = (uint)regionExtent.Y; 491 m_regionHeight = (uint)regionExtent.Y;
424 492
425 m_suportCombine = false; 493 m_suportCombine = false;
426 Initialise(meshmerizer, config);
427 }
428
429
430 public override void Initialise(IMesher meshmerizer, IConfigSource config)
431 {
432// checkThread(); 494// checkThread();
433 mesher = meshmerizer;
434 m_config = config; 495 m_config = config;
435 496
436 string ode_config = d.GetConfiguration(); 497 string ode_config = d.GetConfiguration();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 8f4e840..3f523a4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -54,7 +54,7 @@ using OpenSim.Region.Framework.Scenes;
54using OpenSim.Region.Framework.Scenes.Serialization; 54using OpenSim.Region.Framework.Scenes.Serialization;
55using OpenSim.Region.Framework.Scenes.Animation; 55using OpenSim.Region.Framework.Scenes.Animation;
56using OpenSim.Region.Framework.Scenes.Scripting; 56using OpenSim.Region.Framework.Scenes.Scripting;
57using OpenSim.Region.Physics.Manager; 57using OpenSim.Region.PhysicsModules.SharedBase;
58using OpenSim.Region.ScriptEngine.Shared; 58using OpenSim.Region.ScriptEngine.Shared;
59using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; 59using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
60using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 60using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
diff --git a/OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs b/OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs
deleted file mode 100644
index 9fac53e..0000000
--- a/OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Region.UserStatistics")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("42b28288-5fdd-478f-8903-8dccbbb2d5f9")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.8.2.*")]
33
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
index a139b9b..8f3cb80 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
@@ -35,7 +35,6 @@ using System.Timers;
35using Nini.Config; 35using Nini.Config;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
38using OpenSim.Framework.Communications;
39using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
40using OpenMetaverse; 39using OpenMetaverse;
41 40
diff --git a/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs b/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs
index 63730b3..d2da85f 100644
--- a/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs
@@ -32,7 +32,6 @@ using System.IO;
32using System.Reflection; 32using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Services.Interfaces; 35using OpenSim.Services.Interfaces;
37using OpenMetaverse; 36using OpenMetaverse;
38 37
diff --git a/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs b/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs
index d688299..20dc1cc 100644
--- a/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs
+++ b/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs
@@ -32,7 +32,7 @@ using System.Collections;
32using System.Reflection; 32using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35
36using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
37using OpenSim.Server.Base; 37using OpenSim.Server.Base;
38using OpenMetaverse; 38using OpenMetaverse;
diff --git a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs
index 74851a9..b7702a8 100644
--- a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs
@@ -33,7 +33,7 @@ using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.ServiceAuth; 35using OpenSim.Framework.ServiceAuth;
36using OpenSim.Framework.Communications; 36
37using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
38using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; 38using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
39using OpenSim.Server.Base; 39using OpenSim.Server.Base;
diff --git a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs
index d208f1e..6c6ccf9 100644
--- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs
@@ -32,7 +32,7 @@ using System.IO;
32using System.Reflection; 32using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35
36using OpenSim.Framework.ServiceAuth; 36using OpenSim.Framework.ServiceAuth;
37using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
38using GridRegion = OpenSim.Services.Interfaces.GridRegion; 38using GridRegion = OpenSim.Services.Interfaces.GridRegion;
diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs
index ffdd94a..b5ca1ad 100644
--- a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs
+++ b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs
@@ -32,7 +32,7 @@ using System.IO;
32using System.Reflection; 32using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35
36using OpenSim.Framework.ServiceAuth; 36using OpenSim.Framework.ServiceAuth;
37using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
38using GridRegion = OpenSim.Services.Interfaces.GridRegion; 38using GridRegion = OpenSim.Services.Interfaces.GridRegion;
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs
index b0615b8..f235446 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs
@@ -33,7 +33,7 @@ using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Framework.Communications; 36
37using OpenSim.Framework.Monitoring; 37using OpenSim.Framework.Monitoring;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39using OpenSim.Server.Base; 39using OpenSim.Server.Base;
diff --git a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs
index 3408f7a..7839a68 100644
--- a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs
@@ -33,7 +33,7 @@ using System.IO;
33using System.Reflection; 33using System.Reflection;
34using Nini.Config; 34using Nini.Config;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Communications; 36
37using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
38using OpenMetaverse; 38using OpenMetaverse;
39using Nwc.XmlRpc; 39using Nwc.XmlRpc;
diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs
index a0ac5f9..84c4efe 100644
--- a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs
+++ b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs
@@ -35,7 +35,7 @@ using System.Reflection;
35using Nini.Config; 35using Nini.Config;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
38using OpenSim.Framework.Communications; 38
39using OpenSim.Framework.ServiceAuth; 39using OpenSim.Framework.ServiceAuth;
40using OpenSim.Server.Base; 40using OpenSim.Server.Base;
41using OpenSim.Services.Interfaces; 41using OpenSim.Services.Interfaces;
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
index 70f1aee..939059d 100644
--- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
@@ -35,7 +35,7 @@ using System.Reflection;
35using System.Text; 35using System.Text;
36using Nini.Config; 36using Nini.Config;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Communications; 38
39using OpenSim.Services.Interfaces; 39using OpenSim.Services.Interfaces;
40using OpenMetaverse; 40using OpenMetaverse;
41using OpenMetaverse.StructuredData; 41using OpenMetaverse.StructuredData;
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs
index e474d41..1f14b32 100644
--- a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs
@@ -32,7 +32,7 @@ using System.IO;
32using System.Reflection; 32using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35
36using OpenSim.Framework.ServiceAuth; 36using OpenSim.Framework.ServiceAuth;
37using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
38using GridRegion = OpenSim.Services.Interfaces.GridRegion; 38using GridRegion = OpenSim.Services.Interfaces.GridRegion;
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
index 15a9fbe..3de0a20 100644
--- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
+++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
@@ -32,7 +32,7 @@ using System.IO;
32using System.Reflection; 32using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35
36using OpenSim.Framework.ServiceAuth; 36using OpenSim.Framework.ServiceAuth;
37using OpenSim.Server.Base; 37using OpenSim.Server.Base;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs
index 44b26d5..87c6810 100644
--- a/OpenSim/Services/HypergridService/GatekeeperService.cs
+++ b/OpenSim/Services/HypergridService/GatekeeperService.cs
@@ -131,8 +131,11 @@ namespace OpenSim.Services.HypergridService
131 else if (simulationService != string.Empty) 131 else if (simulationService != string.Empty)
132 m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args); 132 m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);
133 133
134 m_AllowedClients = serverConfig.GetString("AllowedClients", string.Empty); 134 string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "GatekeeperService" };
135 m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty); 135 m_AllowedClients = Util.GetConfigVarFromSections<string>(
136 config, "AllowedClients", possibleAccessControlConfigSections, string.Empty);
137 m_DeniedClients = Util.GetConfigVarFromSections<string>(
138 config, "DeniedClients", possibleAccessControlConfigSections, string.Empty);
136 m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); 139 m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true);
137 140
138 LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions); 141 LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions);
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 29199ae..c1b45b2 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -127,8 +127,12 @@ namespace OpenSim.Services.LLLoginService
127 m_DestinationGuide = m_LoginServerConfig.GetString ("DestinationGuide", string.Empty); 127 m_DestinationGuide = m_LoginServerConfig.GetString ("DestinationGuide", string.Empty);
128 m_AvatarPicker = m_LoginServerConfig.GetString ("AvatarPicker", string.Empty); 128 m_AvatarPicker = m_LoginServerConfig.GetString ("AvatarPicker", string.Empty);
129 129
130 m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty); 130 string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "LoginService" };
131 m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty); 131 m_AllowedClients = Util.GetConfigVarFromSections<string>(
132 config, "AllowedClients", possibleAccessControlConfigSections, string.Empty);
133 m_DeniedClients = Util.GetConfigVarFromSections<string>(
134 config, "DeniedClients", possibleAccessControlConfigSections, string.Empty);
135
132 m_MessageUrl = m_LoginServerConfig.GetString("MessageUrl", string.Empty); 136 m_MessageUrl = m_LoginServerConfig.GetString("MessageUrl", string.Empty);
133 m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time"); 137 m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time");
134 138
diff --git a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
index e6adcf7..1f6233d 100644
--- a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
@@ -37,7 +37,7 @@ using Nini.Config;
37using NUnit.Framework; 37using NUnit.Framework;
38using OpenMetaverse; 38using OpenMetaverse;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Framework.Communications; 40
41using OpenSim.Framework.Servers; 41using OpenSim.Framework.Servers;
42using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index b368822..5cd5b88 100644
--- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -32,11 +32,11 @@ using Nini.Config;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Data.Null; 33using OpenSim.Data.Null;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35
36using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38using OpenSim.Framework.Servers.HttpServer; 38using OpenSim.Framework.Servers.HttpServer;
39using OpenSim.Region.Physics.Manager; 39using OpenSim.Region.PhysicsModules.SharedBase;
40using OpenSim.Region.Framework; 40using OpenSim.Region.Framework;
41using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
@@ -48,6 +48,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory;
48using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; 48using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
49using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; 49using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
50using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence; 50using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence;
51using OpenSim.Region.PhysicsModule.BasicPhysics;
51using OpenSim.Services.Interfaces; 52using OpenSim.Services.Interfaces;
52using GridRegion = OpenSim.Services.Interfaces.GridRegion; 53using GridRegion = OpenSim.Services.Interfaces.GridRegion;
53 54
@@ -77,6 +78,8 @@ namespace OpenSim.Tests.Common
77 78
78 private CoreAssetCache m_cache; 79 private CoreAssetCache m_cache;
79 80
81 private PhysicsScene m_physicsScene;
82
80 public SceneHelpers() : this(null) {} 83 public SceneHelpers() : this(null) {}
81 84
82 public SceneHelpers(CoreAssetCache cache) 85 public SceneHelpers(CoreAssetCache cache)
@@ -97,6 +100,8 @@ namespace OpenSim.Tests.Common
97 100
98 m_cache = cache; 101 m_cache = cache;
99 102
103 m_physicsScene = StartPhysicsScene();
104
100 SimDataService 105 SimDataService
101 = OpenSim.Server.Base.ServerUtils.LoadPlugin<ISimulationDataService>("OpenSim.Tests.Common.dll", null); 106 = OpenSim.Server.Base.ServerUtils.LoadPlugin<ISimulationDataService>("OpenSim.Tests.Common.dll", null);
102 } 107 }
@@ -158,12 +163,16 @@ namespace OpenSim.Tests.Common
158 "basicphysics", "ZeroMesher", new IniConfigSource(), "test", regionExtent); 163 "basicphysics", "ZeroMesher", new IniConfigSource(), "test", regionExtent);
159 164
160 TestScene testScene = new TestScene( 165 TestScene testScene = new TestScene(
161 regInfo, m_acm, physicsScene, scs, SimDataService, m_estateDataService, configSource, null); 166 regInfo, m_acm, SimDataService, m_estateDataService, configSource, null);
162 167
163 INonSharedRegionModule godsModule = new GodsModule(); 168 INonSharedRegionModule godsModule = new GodsModule();
164 godsModule.Initialise(new IniConfigSource()); 169 godsModule.Initialise(new IniConfigSource());
165 godsModule.AddRegion(testScene); 170 godsModule.AddRegion(testScene);
166 171
172 // Add scene to physics
173 ((INonSharedRegionModule)m_physicsScene).AddRegion(testScene);
174 ((INonSharedRegionModule)m_physicsScene).RegionLoaded(testScene);
175
167 // Add scene to services 176 // Add scene to services
168 m_assetService.AddRegion(testScene); 177 m_assetService.AddRegion(testScene);
169 178
@@ -330,6 +339,19 @@ namespace OpenSim.Tests.Common
330 return presenceService; 339 return presenceService;
331 } 340 }
332 341
342 private static PhysicsScene StartPhysicsScene()
343 {
344 IConfigSource config = new IniConfigSource();
345 config.AddConfig("Startup");
346 config.Configs["Startup"].Set("physics", "basicphysics");
347
348 PhysicsScene pScene = new BasicScene();
349 INonSharedRegionModule mod = pScene as INonSharedRegionModule;
350 mod.Initialise(config);
351
352 return pScene;
353 }
354
333 /// <summary> 355 /// <summary>
334 /// Setup modules for a scene using their default settings. 356 /// Setup modules for a scene using their default settings.
335 /// </summary> 357 /// </summary>
diff --git a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs
index 2fbebc4..c62b58e 100644
--- a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs
@@ -27,7 +27,7 @@
27 27
28using System.Collections.Generic; 28using System.Collections.Generic;
29using OpenMetaverse; 29using OpenMetaverse;
30using OpenSim.Framework.Communications; 30
31using OpenSim.Region.Framework.Scenes; 31using OpenSim.Region.Framework.Scenes;
32using OpenSim.Services.Interfaces; 32using OpenSim.Services.Interfaces;
33 33
diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs
index 45acf91..1a93c9f 100644
--- a/OpenSim/Tests/Common/Mock/TestScene.cs
+++ b/OpenSim/Tests/Common/Mock/TestScene.cs
@@ -28,12 +28,12 @@
28using System; 28using System;
29using Nini.Config; 29using Nini.Config;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Framework.Communications; 31
32using OpenSim.Framework.Servers; 32using OpenSim.Framework.Servers;
33using OpenSim.Region.Framework; 33using OpenSim.Region.Framework;
34using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Physics.Manager; 36using OpenSim.Region.PhysicsModules.SharedBase;
37using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
38 38
39namespace OpenSim.Tests.Common 39namespace OpenSim.Tests.Common
@@ -41,10 +41,10 @@ namespace OpenSim.Tests.Common
41 public class TestScene : Scene 41 public class TestScene : Scene
42 { 42 {
43 public TestScene( 43 public TestScene(
44 RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene, 44 RegionInfo regInfo, AgentCircuitManager authen,
45 SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, 45 ISimulationDataService simDataService, IEstateDataService estateDataService,
46 IConfigSource config, string simulatorVersion) 46 IConfigSource config, string simulatorVersion)
47 : base(regInfo, authen, physicsScene, sceneGridService, simDataService, estateDataService, 47 : base(regInfo, authen, simDataService, estateDataService,
48 config, simulatorVersion) 48 config, simulatorVersion)
49 { 49 {
50 } 50 }
diff --git a/OpenSim/Tests/Common/OpenSimTestCase.cs b/OpenSim/Tests/Common/OpenSimTestCase.cs
index c1415af..9fea348 100644
--- a/OpenSim/Tests/Common/OpenSimTestCase.cs
+++ b/OpenSim/Tests/Common/OpenSimTestCase.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Tests.Common
38 [SetUp] 38 [SetUp]
39 public virtual void SetUp() 39 public virtual void SetUp()
40 { 40 {
41// TestHelpers.InMethod(); 41 //TestHelpers.InMethod();
42 // Disable logging for each test so that one where logging is enabled doesn't cause all subsequent tests 42 // Disable logging for each test so that one where logging is enabled doesn't cause all subsequent tests
43 // to have logging on if it failed with an exception. 43 // to have logging on if it failed with an exception.
44 TestHelpers.DisableLogging(); 44 TestHelpers.DisableLogging();
diff --git a/OpenSim/Tests/Performance/NPCPerformanceTests.cs b/OpenSim/Tests/Performance/NPCPerformanceTests.cs
index 747c992..e41f5d1 100644
--- a/OpenSim/Tests/Performance/NPCPerformanceTests.cs
+++ b/OpenSim/Tests/Performance/NPCPerformanceTests.cs
@@ -34,7 +34,7 @@ using Nini.Config;
34using NUnit.Framework; 34using NUnit.Framework;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Communications; 37
38using OpenSim.Region.CoreModules.Avatar.Attachments; 38using OpenSim.Region.CoreModules.Avatar.Attachments;
39using OpenSim.Region.CoreModules.Avatar.AvatarFactory; 39using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
40using OpenSim.Region.CoreModules.Framework.InventoryAccess; 40using OpenSim.Region.CoreModules.Framework.InventoryAccess;
diff --git a/bin/Physics/OpenSim.Region.Physics.BulletSPlugin.dll.config b/bin/OpenSim.Region.PhysicsModule.BulletS.dll.config
index 2763525..2763525 100755
--- a/bin/Physics/OpenSim.Region.Physics.BulletSPlugin.dll.config
+++ b/bin/OpenSim.Region.PhysicsModule.BulletS.dll.config
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 8df81cf..cab41f7 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -304,9 +304,9 @@
304 ;; - "Imprudence" has access 304 ;; - "Imprudence" has access
305 ;; - "Imprudence 1.3" has access 305 ;; - "Imprudence 1.3" has access
306 ;; - "Imprudence 1.3.1" has no access 306 ;; - "Imprudence 1.3.1" has no access
307 ; AllowedClients = 307 ; AllowedClients = ""
308 308
309 ;# {BannedClients} {} {Bar (|) separated list of banned clients} {} 309 ;# {DeniedClients} {} {Bar (|) separated list of denied clients} {}
310 ;; Bar (|) separated list of viewers which may not gain access to the regions. 310 ;; Bar (|) separated list of viewers which may not gain access to the regions.
311 ;; One can use a Substring of the viewer name to disable only certain 311 ;; One can use a Substring of the viewer name to disable only certain
312 ;; versions 312 ;; versions
@@ -314,7 +314,8 @@
314 ;; - "Imprudence" has no access 314 ;; - "Imprudence" has no access
315 ;; - "Imprudence 1.3" has no access 315 ;; - "Imprudence 1.3" has no access
316 ;; - "Imprudence 1.3.1" has access 316 ;; - "Imprudence 1.3.1" has access
317 ; BannedClients = 317 ;;
318 ; DeniedClients = ""
318 319
319 320
320[Map] 321[Map]
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index 05ea867..786c81b 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -531,6 +531,14 @@
531 ; many simultaneous requests, default is 30 and is currently applied only to assets 531 ; many simultaneous requests, default is 30 and is currently applied only to assets
532 ;MaxRequestConcurrency = 30 532 ;MaxRequestConcurrency = 30
533 533
534[AccessControl]
535 ; Viewer-based access control. |-separated list of allowed viewers.
536 ; AllowedClients = ""
537
538 ; Viewer-based access control. |-separated list of denied viewers.
539 ; No restrictions by default.
540 ; DeniedClients = ""
541
534 542
535[ClientStack.LindenUDP] 543[ClientStack.LindenUDP]
536 ; Set this to true to process incoming packets asynchronously. Networking is 544 ; 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 36025d5..82eaf1f 100644
--- a/bin/Robust.HG.ini.example
+++ b/bin/Robust.HG.ini.example
@@ -184,6 +184,26 @@
184 ;; This is a default that can be overwritten in some sections. 184 ;; This is a default that can be overwritten in some sections.
185 ; GatekeeperURI = "${Const|BaseURL}:${Const|PublicPort}" 185 ; GatekeeperURI = "${Const|BaseURL}:${Const|PublicPort}"
186 186
187[AccessControl]
188 ;# {AllowedClients} {} {Bar (|) separated list of allowed clients} {}
189 ;; Bar (|) separated list of viewers which may gain access to the regions.
190 ;; One can use a substring of the viewer name to enable only certain
191 ;; versions
192 ;; Example: Agent uses the viewer "Imprudence 1.3.2.0"
193 ;; - "Imprudence" has access
194 ;; - "Imprudence 1.3" has access
195 ;; - "Imprudence 1.3.1" has no access
196 ; AllowedClients = ""
197
198 ;# {DeniedClients} {} {Bar (|) separated list of denied clients} {}
199 ;; Bar (|) separated list of viewers which may not gain access to the regions.
200 ;; One can use a Substring of the viewer name to disable only certain
201 ;; versions
202 ;; Example: Agent uses the viewer "Imprudence 1.3.2.0"
203 ;; - "Imprudence" has no access
204 ;; - "Imprudence 1.3" has no access
205 ;; - "Imprudence 1.3.1" has access
206 ; DeniedClients = ""
187 207
188[DatabaseService] 208[DatabaseService]
189 ; PGSQL 209 ; PGSQL
@@ -482,23 +502,6 @@
482 SRV_IMServerURI = "${Const|BaseURL}:${Const|PublicPort}" 502 SRV_IMServerURI = "${Const|BaseURL}:${Const|PublicPort}"
483 SRV_GroupsServerURI = "${Const|BaseURL}:${Const|PublicPort}" 503 SRV_GroupsServerURI = "${Const|BaseURL}:${Const|PublicPort}"
484 504
485 ;; Regular expressions for controlling which client versions are accepted/denied.
486 ;; An empty string means nothing is checked.
487 ;;
488 ;; Example 1: allow only these 3 types of clients (any version of them)
489 ;; AllowedClients = "Imprudence|Hippo|Second Life"
490 ;;
491 ;; Example 2: allow all clients except these
492 ;; DeniedClients = "Twisted|Crawler|Cryolife|FuckLife|StreetLife|GreenLife|AntiLife|KORE-Phaze|Synlyfe|Purple Second Life|SecondLi |Emerald"
493 ;;
494 ;; Note that these are regular expressions, so every character counts.
495 ;; Also note that this is very weak security and should not be trusted as a reliable means
496 ;; for keeping bad clients out; modified clients can fake their identifiers.
497 ;;
498 ;;
499 ;AllowedClients = ""
500 ;DeniedClients = ""
501
502 ;# {DSTZone} {} {Override Daylight Saving Time rules} {* none local} "America/Los_Angeles;Pacific Standard Time" 505 ;# {DSTZone} {} {Override Daylight Saving Time rules} {* none local} "America/Los_Angeles;Pacific Standard Time"
503 ;; Viewers do not receive timezone information from the server - almost all (?) default to Pacific Standard Time 506 ;; Viewers do not receive timezone information from the server - almost all (?) default to Pacific Standard Time
504 ;; However, they do rely on the server to tell them whether it's Daylight Saving Time or not. 507 ;; However, they do rely on the server to tell them whether it's Daylight Saving Time or not.
@@ -595,23 +598,6 @@
595 ; If you run this gatekeeper server behind a proxy, set this to true 598 ; If you run this gatekeeper server behind a proxy, set this to true
596 ; HasProxy = false 599 ; HasProxy = false
597 600
598 ;; Regular expressions for controlling which client versions are accepted/denied.
599 ;; An empty string means nothing is checked.
600 ;;
601 ;; Example 1: allow only these 3 types of clients (any version of them)
602 ;; AllowedClients = "Imprudence|Hippo|Second Life"
603 ;;
604 ;; Example 2: allow all clients except these
605 ;; DeniedClients = "Twisted|Crawler|Cryolife|FuckLife|StreetLife|GreenLife|AntiLife|KORE-Phaze|Synlyfe|Purple Second Life|SecondLi |Emerald"
606 ;;
607 ;; Note that these are regular expressions, so every character counts.
608 ;; Also note that this is very weak security and should not be trusted as a reliable means
609 ;; for keeping bad clients out; modified clients can fake their identifiers.
610 ;;
611 ;;
612 ;AllowedClients = ""
613 ;DeniedClients = ""
614
615 ;; Are foreign visitors allowed? 601 ;; Are foreign visitors allowed?
616 ;ForeignAgentsAllowed = true 602 ;ForeignAgentsAllowed = true
617 ;; 603 ;;
diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example
index 284e969..8d6496d 100644
--- a/bin/Robust.ini.example
+++ b/bin/Robust.ini.example
@@ -145,6 +145,27 @@
145 ;ConsolePass = secret 145 ;ConsolePass = secret
146 ;ConsolePort = 0 146 ;ConsolePort = 0
147 147
148[AccessControl]
149 ;# {AllowedClients} {} {Bar (|) separated list of allowed clients} {}
150 ;; Bar (|) separated list of viewers which may gain access to the regions.
151 ;; One can use a substring of the viewer name to enable only certain
152 ;; versions
153 ;; Example: Agent uses the viewer "Imprudence 1.3.2.0"
154 ;; - "Imprudence" has access
155 ;; - "Imprudence 1.3" has access
156 ;; - "Imprudence 1.3.1" has no access
157 ; AllowedClients = ""
158
159 ;# {DeniedClients} {} {Bar (|) separated list of denied clients} {}
160 ;; Bar (|) separated list of viewers which may not gain access to the regions.
161 ;; One can use a Substring of the viewer name to disable only certain
162 ;; versions
163 ;; Example: Agent uses the viewer "Imprudence 1.3.2.0"
164 ;; - "Imprudence" has no access
165 ;; - "Imprudence 1.3" has no access
166 ;; - "Imprudence 1.3.1" has access
167 ; DeniedClients = ""
168
148 169
149[DatabaseService] 170[DatabaseService]
150 ; PGSQL 171 ; PGSQL
@@ -431,23 +452,6 @@
431 ; If you run this login server behind a proxy, set this to true 452 ; If you run this login server behind a proxy, set this to true
432 ; HasProxy = false 453 ; HasProxy = false
433 454
434 ;; Regular expressions for controlling which client versions are accepted/denied.
435 ;; An empty string means nothing is checked.
436 ;;
437 ;; Example 1: allow only these 3 types of clients (any version of them)
438 ;; AllowedClients = "Imprudence|Hippo|Second Life"
439 ;;
440 ;; Example 2: allow all clients except these
441 ;; DeniedClients = "Twisted|Crawler|Cryolife|FuckLife|StreetLife|GreenLife|AntiLife|KORE-Phaze|Synlyfe|Purple Second Life|SecondLi |Emerald"
442 ;;
443 ;; Note that these are regular expressions, so every character counts.
444 ;; Also note that this is very weak security and should not be trusted as a reliable means
445 ;; for keeping bad clients out; modified clients can fake their identifiers.
446 ;;
447 ;;
448 ;AllowedClients = ""
449 ;DeniedClients = ""
450
451 ;# {DSTZone} {} {Override Daylight Saving Time rules} {* none local} "America/Los_Angeles;Pacific Standard Time" 455 ;# {DSTZone} {} {Override Daylight Saving Time rules} {* none local} "America/Los_Angeles;Pacific Standard Time"
452 ;; Viewers do not listen to timezone sent by the server. They use Pacific Standard Time instead, 456 ;; Viewers do not listen to timezone sent by the server. They use Pacific Standard Time instead,
453 ;; but rely on the server to calculate Daylight Saving Time. Sending another DST than US Pacific 457 ;; but rely on the server to calculate Daylight Saving Time. Sending another DST than US Pacific
diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example
index 179be94..76d7a99 100644
--- a/bin/config-include/StandaloneCommon.ini.example
+++ b/bin/config-include/StandaloneCommon.ini.example
@@ -145,23 +145,6 @@
145 ;; Set minimum fee to publish classified 145 ;; Set minimum fee to publish classified
146 ; ClassifiedFee = 0 146 ; ClassifiedFee = 0
147 147
148 ;; Regular expressions for controlling which client versions are accepted/denied.
149 ;; An empty string means nothing is checked.
150 ;;
151 ;; Example 1: allow only these 3 types of clients (any version of them)
152 ;; AllowedClients = "Imprudence|Hippo|Second Life"
153 ;;
154 ;; Example 2: allow all clients except these
155 ;; DeniedClients = "Twisted|Crawler|Cryolife|FuckLife|StreetLife|GreenLife|AntiLife|KORE-Phaze|Synlyfe|Purple Second Life|SecondLi |Emerald"
156 ;;
157 ;; Note that these are regular expressions, so every character counts.
158 ;; Also note that this is very weak security and should not be trusted as a reliable means
159 ;; for keeping bad clients out; modified clients can fake their identifiers.
160 ;;
161 ;;
162 ;AllowedClients = ""
163 ;DeniedClients = ""
164
165 ; Basic Login Service Dos Protection Tweaks 148 ; Basic Login Service Dos Protection Tweaks
166 ; ; 149 ; ;
167 ; ; Some Grids/Users use a transparent proxy that makes use of the X-Forwarded-For HTTP Header, If you do, set this to true 150 ; ; Some Grids/Users use a transparent proxy that makes use of the X-Forwarded-For HTTP Header, If you do, set this to true
diff --git a/prebuild.xml b/prebuild.xml
index 2c43683..a9b9336 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -107,6 +107,7 @@
107 <Reference name="log4net" path="../../bin/"/> 107 <Reference name="log4net" path="../../bin/"/>
108 <Reference name="Mono.Addins" path="../../bin/"/> 108 <Reference name="Mono.Addins" path="../../bin/"/>
109 <Reference name="Mono.Addins.Setup" path="../../bin/"/> 109 <Reference name="Mono.Addins.Setup" path="../../bin/"/>
110 <Reference name="LukeSkywalker.IPNetwork" path="../../bin/"/>
110 <Reference name="SmartThreadPool"/> 111 <Reference name="SmartThreadPool"/>
111 <Files> 112 <Files>
112 <Match pattern="*.cs" recurse="false"/> 113 <Match pattern="*.cs" recurse="false"/>
@@ -324,58 +325,6 @@
324 </Files> 325 </Files>
325 </Project> 326 </Project>
326 327
327 <Project frameworkVersion="v4_0" name="OpenSim.Framework.RegionLoader.Web" path="OpenSim/Framework/RegionLoader/Web" type="Library">
328 <Configuration name="Debug">
329 <Options>
330 <OutputPath>../../../../bin/</OutputPath>
331 </Options>
332 </Configuration>
333 <Configuration name="Release">
334 <Options>
335 <OutputPath>../../../../bin/</OutputPath>
336 </Options>
337 </Configuration>
338
339 <ReferencePath>../../../../bin/</ReferencePath>
340 <Reference name="System"/>
341 <Reference name="System.Xml"/>
342 <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
343 <Reference name="XMLRPC" path="../../../../bin/"/>
344 <Reference name="OpenSim.Framework"/>
345 <Reference name="OpenSim.Framework.Console"/>
346 <Reference name="Nini" path="../../../../bin/"/>
347 <Reference name="log4net" path="../../../../bin/"/>
348 <Files>
349 <Match pattern="*.cs" recurse="true"/>
350 </Files>
351 </Project>
352
353 <Project frameworkVersion="v4_0" name="OpenSim.Framework.RegionLoader.Filesystem" path="OpenSim/Framework/RegionLoader/Filesystem" type="Library">
354 <Configuration name="Debug">
355 <Options>
356 <OutputPath>../../../../bin/</OutputPath>
357 </Options>
358 </Configuration>
359 <Configuration name="Release">
360 <Options>
361 <OutputPath>../../../../bin/</OutputPath>
362 </Options>
363 </Configuration>
364
365 <ReferencePath>../../../../bin/</ReferencePath>
366 <Reference name="System"/>
367 <Reference name="System.Xml"/>
368 <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
369 <Reference name="log4net" path="../../../../bin/"/>
370 <Reference name="XMLRPC" path="../../../../bin/"/>
371 <Reference name="OpenSim.Framework"/>
372 <Reference name="OpenSim.Framework.Console"/>
373 <Reference name="Nini" path="../../../../bin/"/>
374 <Files>
375 <Match pattern="*.cs" recurse="true"/>
376 </Files>
377 </Project>
378
379 <Project frameworkVersion="v4_0" name="OpenSim.Framework.Servers" path="OpenSim/Framework/Servers" type="Library"> 328 <Project frameworkVersion="v4_0" name="OpenSim.Framework.Servers" path="OpenSim/Framework/Servers" type="Library">
380 <Configuration name="Debug"> 329 <Configuration name="Debug">
381 <Options> 330 <Options>
@@ -410,167 +359,7 @@
410 </Files> 359 </Files>
411 </Project> 360 </Project>
412 361
413 <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.Manager" path="OpenSim/Region/Physics/Manager" type="Library"> 362 <Project frameworkVersion="v4_0" name="OpenSim.Region.PhysicsModules.UbitOdePlugin" path="OpenSim/Region/PhysicsModules/UbitOdePlugin" type="Library">
414 <Configuration name="Debug">
415 <Options>
416 <OutputPath>../../../../bin/</OutputPath>
417 </Options>
418 </Configuration>
419 <Configuration name="Release">
420 <Options>
421 <OutputPath>../../../../bin/</OutputPath>
422 </Options>
423 </Configuration>
424
425 <ReferencePath>../../../../bin/</ReferencePath>
426 <Reference name="System"/>
427 <Reference name="System.Xml"/>
428 <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
429 <Reference name="OpenSim.Framework"/>
430 <Reference name="OpenSim.Framework.Console"/>
431 <Reference name="nunit.framework" path="../../../../bin/"/>
432 <Reference name="Nini" path="../../../../bin/"/>
433 <Reference name="log4net" path="../../../../bin/"/>
434
435 <Files>
436 <Match pattern="*.cs" recurse="false"/>
437 </Files>
438 </Project>
439
440 <!-- Physics Plug-ins -->
441 <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.BasicPhysicsPlugin" path="OpenSim/Region/Physics/BasicPhysicsPlugin" type="Library">
442 <Configuration name="Debug">
443 <Options>
444 <OutputPath>../../../../bin/Physics/</OutputPath>
445 </Options>
446 </Configuration>
447 <Configuration name="Release">
448 <Options>
449 <OutputPath>../../../../bin/Physics/</OutputPath>
450 </Options>
451 </Configuration>
452
453 <ReferencePath>../../../../bin/</ReferencePath>
454 <Reference name="System"/>
455 <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
456 <Reference name="Nini" path="../../../../bin/"/>
457 <Reference name="OpenSim.Framework"/>
458 <Reference name="OpenSim.Region.Physics.Manager"/>
459 <Files>
460 <Match pattern="*.cs" recurse="true"/>
461 </Files>
462 </Project>
463
464 <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.POSPlugin" path="OpenSim/Region/Physics/POSPlugin" type="Library">
465 <Configuration name="Debug">
466 <Options>
467 <OutputPath>../../../../bin/Physics/</OutputPath>
468 </Options>
469 </Configuration>
470 <Configuration name="Release">
471 <Options>
472 <OutputPath>../../../../bin/Physics/</OutputPath>
473 </Options>
474 </Configuration>
475
476 <ReferencePath>../../../../bin/</ReferencePath>
477 <Reference name="System"/>
478 <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
479 <Reference name="Nini" path="../../../../bin/"/>
480 <Reference name="OpenSim.Framework"/>
481 <Reference name="OpenSim.Region.Physics.Manager"/>
482 <Files>
483 <Match pattern="*.cs" recurse="true"/>
484 </Files>
485 </Project>
486
487 <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.OdePlugin" path="OpenSim/Region/Physics/OdePlugin" type="Library">
488 <Configuration name="Debug">
489 <Options>
490 <OutputPath>../../../../bin/Physics/</OutputPath>
491 </Options>
492 </Configuration>
493 <Configuration name="Release">
494 <Options>
495 <OutputPath>../../../../bin/Physics/</OutputPath>
496 </Options>
497 </Configuration>
498
499 <ReferencePath>../../../../bin/</ReferencePath>
500 <Reference name="System"/>
501 <Reference name="System.Core"/>
502 <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
503 <Reference name="Nini" path="../../../../bin/"/>
504 <Reference name="OpenSim.Framework"/>
505 <Reference name="OpenSim.Framework.Console"/>
506 <Reference name="OpenSim.Region.Physics.Manager"/>
507 <Reference name="Ode.NET" path="../../../../bin/"/>
508 <Reference name="log4net" path="../../../../bin/"/>
509
510 <Files>
511 <Match pattern="*.cs" recurse="true">
512 <Exclude name="Tests" pattern="Tests"/>
513 </Match>
514 </Files>
515 </Project>
516
517 <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.ConvexDecompositionDotNet" path="OpenSim/Region/Physics/ConvexDecompositionDotNet" type="Library">
518 <Configuration name="Debug">
519 <Options>
520 <OutputPath>../../../../bin/</OutputPath>
521 </Options>
522 </Configuration>
523 <Configuration name="Release">
524 <Options>
525 <OutputPath>../../../../bin/</OutputPath>
526 </Options>
527 </Configuration>
528
529 <ReferencePath>../../../../bin/</ReferencePath>
530 <Reference name="System"/>
531 <Reference name="System.Core"/>
532 <Reference name="System.Data"/>
533 <Reference name="System.Xml"/>
534
535 <Files>
536 <Match pattern="*.cs" recurse="true">
537 <Exclude name="Tests" pattern="Tests"/>
538 </Match>
539 </Files>
540 </Project>
541
542 <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.ChOdePlugin" path="OpenSim/Region/Physics/ChOdePlugin" type="Library">
543 <Configuration name="Debug">
544 <Options>
545 <OutputPath>../../../../bin/Physics/</OutputPath>
546 </Options>
547 </Configuration>
548 <Configuration name="Release">
549 <Options>
550 <OutputPath>../../../../bin/Physics/</OutputPath>
551 </Options>
552 </Configuration>
553
554 <ReferencePath>../../../../bin/</ReferencePath>
555 <Reference name="System"/>
556 <Reference name="System.Core"/>
557 <Reference name="OpenMetaverseTypes.dll"/>
558 <Reference name="Nini.dll" />
559 <Reference name="OpenSim.Framework"/>
560 <Reference name="OpenSim.Framework.Console"/>
561 <Reference name="OpenSim.Region.Physics.Manager"/>
562 <Reference name="OpenSim.Region.Physics.ConvexDecompositionDotNet"/>
563 <Reference name="Ode.NET.dll" />
564 <Reference name="log4net.dll"/>
565
566 <Files>
567 <Match pattern="*.cs" recurse="true">
568 <Exclude name="Tests" pattern="Tests"/>
569 </Match>
570 </Files>
571 </Project>
572
573 <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.UbitOdePlugin" path="OpenSim/Region/Physics/UbitOdePlugin" type="Library">
574 <Configuration name="Debug"> 363 <Configuration name="Debug">
575 <Options> 364 <Options>
576 <OutputPath>../../../../bin/Physics/</OutputPath> 365 <OutputPath>../../../../bin/Physics/</OutputPath>
@@ -590,8 +379,9 @@
590 379
591 <Reference name="OpenSim.Framework"/> 380 <Reference name="OpenSim.Framework"/>
592 <Reference name="OpenSim.Framework.Console"/> 381 <Reference name="OpenSim.Framework.Console"/>
593 <Reference name="OpenSim.Region.Physics.Manager"/> 382 <Reference name="OpenSim.Region.Framework"/>
594 <Reference name="OpenSim.Region.Physics.ConvexDecompositionDotNet"/> 383 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
384 <Reference name="OpenSim.Region.PhysicsModules.ConvexDecompositionDotNet"/>
595 <Reference name="log4net" path="../../../../bin/"/> 385 <Reference name="log4net" path="../../../../bin/"/>
596 386
597 <Files> 387 <Files>
@@ -601,7 +391,7 @@
601 </Files> 391 </Files>
602 </Project> 392 </Project>
603 393
604 <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.Meshing" path="OpenSim/Region/Physics/Meshing" type="Library"> 394 <Project frameworkVersion="v4_0" name="OpenSim.Region.PhysicsModules.UbitMeshing" path="OpenSim/Region/PhysicsModules/UbitMeshing" type="Library">
605 <Configuration name="Debug"> 395 <Configuration name="Debug">
606 <Options> 396 <Options>
607 <OutputPath>../../../../bin/Physics/</OutputPath> 397 <OutputPath>../../../../bin/Physics/</OutputPath>
@@ -623,38 +413,8 @@
623 <Reference name="Nini" path="../../../../bin/"/> 413 <Reference name="Nini" path="../../../../bin/"/>
624 <Reference name="OpenSim.Framework"/> 414 <Reference name="OpenSim.Framework"/>
625 <Reference name="OpenSim.Framework.Console"/> 415 <Reference name="OpenSim.Framework.Console"/>
626 <Reference name="OpenSim.Region.Physics.Manager"/> 416 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
627 <Reference name="log4net" path="../../../../bin/"/> 417 <Reference name="OpenSim.Region.PhysicsModules.ConvexDecompositionDotNet"/>
628
629 <Files>
630 <Match pattern="*.cs" recurse="true"/>
631 </Files>
632 </Project>
633
634 <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.UbitMeshing" path="OpenSim/Region/Physics/UbitMeshing" type="Library">
635 <Configuration name="Debug">
636 <Options>
637 <OutputPath>../../../../bin/Physics/</OutputPath>
638 </Options>
639 </Configuration>
640 <Configuration name="Release">
641 <Options>
642 <OutputPath>../../../../bin/Physics/</OutputPath>
643 </Options>
644 </Configuration>
645
646 <ReferencePath>../../../../bin/</ReferencePath>
647 <Reference name="System"/>
648 <Reference name="System.Drawing"/>
649 <Reference name="CSJ2K" path="../../../../bin/"/>
650 <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
651 <Reference name="OpenMetaverse" path="../../../../bin/"/>
652 <Reference name="OpenMetaverse.StructuredData" path="../../../../bin/"/>
653 <Reference name="Nini" path="../../../../bin/"/>
654 <Reference name="OpenSim.Framework"/>
655 <Reference name="OpenSim.Framework.Console"/>
656 <Reference name="OpenSim.Region.Physics.Manager"/>
657 <Reference name="OpenSim.Region.Physics.ConvexDecompositionDotNet"/>
658 <Reference name="log4net" path="../../../../bin/"/> 418 <Reference name="log4net" path="../../../../bin/"/>
659 <Reference name="zlib.net" path="../../../../bin/"/> 419 <Reference name="zlib.net" path="../../../../bin/"/>
660 420
@@ -698,49 +458,33 @@
698 </Project> 458 </Project>
699 459
700 460
701 <Project frameworkVersion="v4_0" name="OpenSim.Framework.Communications" path="OpenSim/Framework/Communications" type="Library"> 461 <Project frameworkVersion="v4_0" name="OpenSim.Region.PhysicsModules.SharedBase" path="OpenSim/Region/PhysicsModules/SharedBase" type="Library">
702 <Configuration name="Debug"> 462 <Configuration name="Debug">
703 <Options> 463 <Options>
704 <OutputPath>../../../bin/</OutputPath> 464 <OutputPath>../../../../bin/</OutputPath>
705 </Options> 465 </Options>
706 </Configuration> 466 </Configuration>
707 <Configuration name="Release"> 467 <Configuration name="Release">
708 <Options> 468 <Options>
709 <OutputPath>../../../bin/</OutputPath> 469 <OutputPath>../../../../bin/</OutputPath>
710 </Options> 470 </Options>
711 </Configuration> 471 </Configuration>
712 472
713 <ReferencePath>../../../bin/</ReferencePath> 473 <ReferencePath>../../../../bin/</ReferencePath>
714 <Reference name="System"/> 474 <Reference name="System"/>
715 <Reference name="System.Core"/>
716 <Reference name="System.Xml"/> 475 <Reference name="System.Xml"/>
717 <Reference name="System.Web"/> 476 <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
718 <Reference name="OpenSim.Data"/>
719 <Reference name="OpenSim.Framework"/> 477 <Reference name="OpenSim.Framework"/>
720 <Reference name="OpenSim.Framework.AssetLoader.Filesystem"/>
721 <Reference name="OpenSim.Framework.Console"/> 478 <Reference name="OpenSim.Framework.Console"/>
722 <Reference name="OpenSim.Framework.Monitoring"/> 479 <Reference name="nunit.framework" path="../../../../bin/"/>
723 <Reference name="OpenSim.Framework.Servers"/> 480 <Reference name="Nini" path="../../../../bin/"/>
724 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 481 <Reference name="log4net" path="../../../../bin/"/>
725 <Reference name="OpenSim.Services.Interfaces"/>
726 <Reference name="OpenMetaverseTypes" path="../../../bin/"/>
727 <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
728 <!-- FIXME: The OpenMetaverse.dll reference can be dropped when the TransferRequestPacket reference is removed from the code -->
729 <Reference name="OpenMetaverse" path="../../../bin/"/>
730 <Reference name="LukeSkywalker.IPNetwork" path="../../../bin/"/>
731 <Reference name="Nini" path="../../../bin/"/>
732 <Reference name="XMLRPC" path="../../../bin/"/>
733 <Reference name="log4net" path="../../../bin/"/>
734 482
735 <Files> 483 <Files>
736 <Match pattern="*.cs" recurse="true"> 484 <Match pattern="*.cs" recurse="false"/>
737 <Exclude name="Tests" pattern="Tests"/>
738 </Match>
739 <Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/>
740 </Files> 485 </Files>
741 </Project> 486 </Project>
742 487
743
744 <Project frameworkVersion="v4_0" name="OpenSim.Region.Framework" path="OpenSim/Region/Framework" type="Library"> 488 <Project frameworkVersion="v4_0" name="OpenSim.Region.Framework" path="OpenSim/Region/Framework" type="Library">
745 <Configuration name="Debug"> 489 <Configuration name="Debug">
746 <Options> 490 <Options>
@@ -765,18 +509,16 @@
765 <Reference name="OpenSim.Services.Interfaces"/> 509 <Reference name="OpenSim.Services.Interfaces"/>
766 <Reference name="OpenSim.Framework"/> 510 <Reference name="OpenSim.Framework"/>
767 <Reference name="OpenSim.Capabilities"/> 511 <Reference name="OpenSim.Capabilities"/>
768 <Reference name="OpenSim.Framework.Communications"/>
769 <Reference name="OpenSim.Data"/> 512 <Reference name="OpenSim.Data"/>
770 <Reference name="OpenSim.Framework.Console"/> 513 <Reference name="OpenSim.Framework.Console"/>
771 <Reference name="OpenSim.Framework.Monitoring"/> 514 <Reference name="OpenSim.Framework.Monitoring"/>
772 <Reference name="OpenSim.Framework.Serialization"/> 515 <Reference name="OpenSim.Framework.Serialization"/>
773 <Reference name="OpenSim.Framework.Servers"/> 516 <Reference name="OpenSim.Framework.Servers"/>
774 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 517 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
775 <Reference name="OpenSim.Region.Physics.Manager"/> 518 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
776 519
777 <!-- For scripting in funny languages by default --> 520 <!-- For scripting in funny languages by default -->
778 <Reference name="XMLRPC" path="../../../bin/"/> 521 <Reference name="XMLRPC" path="../../../bin/"/>
779 <Reference name="OpenSim.Framework.Communications"/>
780 <Reference name="Nini" path="../../../bin/"/> 522 <Reference name="Nini" path="../../../bin/"/>
781 <Reference name="log4net" path="../../../bin/"/> 523 <Reference name="log4net" path="../../../bin/"/>
782 <Reference name="DotNetOpenMail" path="../../../bin/"/> 524 <Reference name="DotNetOpenMail" path="../../../bin/"/>
@@ -789,8 +531,6 @@
789 </Files> 531 </Files>
790 </Project> 532 </Project>
791 533
792 <!-- OpenSim.Framework.Communications -->
793
794 <!-- OGS projects --> 534 <!-- OGS projects -->
795 535
796 536
@@ -943,7 +683,6 @@
943 <Reference name="OpenSim.Data"/> 683 <Reference name="OpenSim.Data"/>
944 <Reference name="OpenSim.Framework"/> 684 <Reference name="OpenSim.Framework"/>
945 <Reference name="OpenSim.Capabilities"/> 685 <Reference name="OpenSim.Capabilities"/>
946 <Reference name="OpenSim.Framework.Communications"/>
947 <Reference name="OpenSim.Framework.Console"/> 686 <Reference name="OpenSim.Framework.Console"/>
948 <Reference name="OpenSim.Framework.Monitoring"/> 687 <Reference name="OpenSim.Framework.Monitoring"/>
949 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 688 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
@@ -1603,41 +1342,6 @@
1603 </Files> 1342 </Files>
1604 </Project> 1343 </Project>
1605 1344
1606 <Project frameworkVersion="v4_0" name="OpenSim.Region.ClientStack" path="OpenSim/Region/ClientStack" type="Library">
1607 <Configuration name="Debug">
1608 <Options>
1609 <OutputPath>../../../bin/</OutputPath>
1610 </Options>
1611 </Configuration>
1612 <Configuration name="Release">
1613 <Options>
1614 <OutputPath>../../../bin/</OutputPath>
1615 </Options>
1616 </Configuration>
1617
1618 <ReferencePath>../../../bin/</ReferencePath>
1619 <Reference name="System"/>
1620 <Reference name="System.Xml"/>
1621 <Reference name="OpenMetaverseTypes" path="../../../bin/"/>
1622 <Reference name="OpenSim.Region.Framework"/>
1623 <Reference name="OpenSim.Framework"/>
1624 <Reference name="OpenSim.Data"/>
1625 <Reference name="OpenSim.Framework.Console"/>
1626 <Reference name="OpenSim.Framework.Monitoring"/>
1627 <Reference name="OpenSim.Framework.Servers"/>
1628 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
1629 <Reference name="OpenSim.Framework.Communications"/>
1630 <Reference name="OpenSim.Region.Physics.Manager"/>
1631 <Reference name="OpenSim.Services.Interfaces"/>
1632 <Reference name="XMLRPC" path="../../../bin/"/>
1633 <Reference name="Nini" path="../../../bin/"/>
1634 <Reference name="log4net" path="../../../bin/"/>
1635
1636 <Files>
1637 <Match pattern="*.cs" recurse="false"/>
1638 </Files>
1639 </Project>
1640
1641 <!-- ClientStack Plugins --> 1345 <!-- ClientStack Plugins -->
1642 <Project frameworkVersion="v4_0" name="OpenSim.Region.ClientStack.LindenUDP" path="OpenSim/Region/ClientStack/Linden/UDP" type="Library"> 1346 <Project frameworkVersion="v4_0" name="OpenSim.Region.ClientStack.LindenUDP" path="OpenSim/Region/ClientStack/Linden/UDP" type="Library">
1643 <Configuration name="Debug"> 1347 <Configuration name="Debug">
@@ -1667,14 +1371,13 @@
1667 <Reference name="OpenSim.Framework.Servers"/> 1371 <Reference name="OpenSim.Framework.Servers"/>
1668 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 1372 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
1669 <Reference name="OpenSim.Framework.Console"/> 1373 <Reference name="OpenSim.Framework.Console"/>
1670 <Reference name="OpenSim.Framework.Communications"/>
1671 <Reference name="OpenSim.Region.ClientStack"/>
1672 <Reference name="OpenSim.Region.Framework"/> 1374 <Reference name="OpenSim.Region.Framework"/>
1673 <Reference name="OpenSim.Services.Interfaces"/> 1375 <Reference name="OpenSim.Services.Interfaces"/>
1674 <Reference name="Nini" path="../../../../../bin/"/> 1376 <Reference name="Nini" path="../../../../../bin/"/>
1675 <Reference name="log4net" path="../../../../../bin/"/> 1377 <Reference name="log4net" path="../../../../../bin/"/>
1676 <Reference name="C5" path="../../../../../bin/"/> 1378 <Reference name="C5" path="../../../../../bin/"/>
1677 <Reference name="Nini" path="../../../../../bin/"/> 1379 <Reference name="Nini" path="../../../../../bin/"/>
1380 <Reference name="Mono.Addins" path="../../../../../bin/"/>
1678 1381
1679 <Files> 1382 <Files>
1680 <Match pattern="*.cs" recurse="true"> 1383 <Match pattern="*.cs" recurse="true">
@@ -1715,7 +1418,7 @@
1715 <Reference name="OpenSim.Framework.Servers"/> 1418 <Reference name="OpenSim.Framework.Servers"/>
1716 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 1419 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
1717 <Reference name="OpenSim.Framework.Console"/> 1420 <Reference name="OpenSim.Framework.Console"/>
1718 <Reference name="OpenSim.Region.Physics.Manager"/> 1421 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
1719 <Reference name="OpenSim.Services.Interfaces"/> 1422 <Reference name="OpenSim.Services.Interfaces"/>
1720 <Reference name="Mono.Addins" path="../../../../../bin/"/> 1423 <Reference name="Mono.Addins" path="../../../../../bin/"/>
1721 <Reference name="Nini" path="../../../../../bin/"/> 1424 <Reference name="Nini" path="../../../../../bin/"/>
@@ -1762,7 +1465,6 @@
1762 <Reference name="OpenSim.Capabilities"/> 1465 <Reference name="OpenSim.Capabilities"/>
1763 <Reference name="OpenSim.Data"/> 1466 <Reference name="OpenSim.Data"/>
1764 <Reference name="OpenSim.Framework"/> 1467 <Reference name="OpenSim.Framework"/>
1765 <Reference name="OpenSim.Framework.Communications"/>
1766 <Reference name="OpenSim.Framework.Console"/> 1468 <Reference name="OpenSim.Framework.Console"/>
1767 <Reference name="OpenSim.Framework.Monitoring"/> 1469 <Reference name="OpenSim.Framework.Monitoring"/>
1768 <Reference name="OpenSim.Framework.Serialization"/> 1470 <Reference name="OpenSim.Framework.Serialization"/>
@@ -1770,7 +1472,7 @@
1770 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 1472 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
1771 <Reference name="OpenSim.Region.ClientStack.LindenUDP"/> 1473 <Reference name="OpenSim.Region.ClientStack.LindenUDP"/>
1772 <Reference name="OpenSim.Region.Framework"/> 1474 <Reference name="OpenSim.Region.Framework"/>
1773 <Reference name="OpenSim.Region.Physics.Manager"/> 1475 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
1774 <Reference name="OpenSim.Server.Base"/> 1476 <Reference name="OpenSim.Server.Base"/>
1775 <Reference name="OpenSim.Server.Handlers"/> 1477 <Reference name="OpenSim.Server.Handlers"/>
1776 <Reference name="OpenSim.Services.Connectors"/> 1478 <Reference name="OpenSim.Services.Connectors"/>
@@ -1782,7 +1484,6 @@
1782 1484
1783 <!-- For scripting in funny languages by default --> 1485 <!-- For scripting in funny languages by default -->
1784 <Reference name="XMLRPC" path="../../../bin/"/> 1486 <Reference name="XMLRPC" path="../../../bin/"/>
1785 <Reference name="OpenSim.Framework.Communications"/>
1786 <Reference name="Nini" path="../../../bin/"/> 1487 <Reference name="Nini" path="../../../bin/"/>
1787 <Reference name="log4net" path="../../../bin/"/> 1488 <Reference name="log4net" path="../../../bin/"/>
1788 <Reference name="DotNetOpenMail" path="../../../bin/"/> 1489 <Reference name="DotNetOpenMail" path="../../../bin/"/>
@@ -1800,44 +1501,6 @@
1800 </Files> 1501 </Files>
1801 </Project> 1502 </Project>
1802 1503
1803 <Project frameworkVersion="v4_0" name="OpenSim.Region.RegionCombinerModule" path="OpenSim/Region/RegionCombinerModule" type="Library">
1804 <Configuration name="Debug">
1805 <Options>
1806 <OutputPath>../../../bin/</OutputPath>
1807 </Options>
1808 </Configuration>
1809 <Configuration name="Release">
1810 <Options>
1811 <OutputPath>../../../bin/</OutputPath>
1812 </Options>
1813 </Configuration>
1814
1815 <ReferencePath>../../../bin/</ReferencePath>
1816 <Reference name="System"/>
1817 <Reference name="System.Xml"/>
1818 <Reference name="OpenMetaverseTypes" path="../../../bin/"/>
1819 <Reference name="OpenMetaverse" path="../../../bin/"/>
1820 <Reference name="OpenSim.Framework"/>
1821 <Reference name="OpenSim.Framework.Communications"/>
1822 <Reference name="OpenSim.Region.Framework"/>
1823 <Reference name="OpenSim.Server.Base"/>
1824 <Reference name="OpenSim.Server.Handlers"/>
1825 <Reference name="OpenSim.Framework.Console"/>
1826 <Reference name="OpenSim.Region.Physics.Manager"/>
1827 <Reference name="OpenSim.Framework.Communications"/>
1828 <Reference name="OpenSim.Region.CoreModules"/>
1829 <Reference name="Nini" path="../../../bin/"/>
1830 <Reference name="log4net" path="../../../bin/"/>
1831
1832 <!-- To allow regions to have mono addins -->
1833 <Reference name="Mono.Addins" path="../../../bin/"/>
1834
1835 <Files>
1836 <Match pattern="*.cs" recurse="true"/>
1837 <Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/>
1838 </Files>
1839 </Project>
1840
1841 <Project frameworkVersion="v4_0" name="OpenSim.Region.OptionalModules" path="OpenSim/Region/OptionalModules" type="Library"> 1504 <Project frameworkVersion="v4_0" name="OpenSim.Region.OptionalModules" path="OpenSim/Region/OptionalModules" type="Library">
1842 <Configuration name="Debug"> 1505 <Configuration name="Debug">
1843 <Options> 1506 <Options>
@@ -1853,6 +1516,7 @@
1853 <ReferencePath>../../../bin/</ReferencePath> 1516 <ReferencePath>../../../bin/</ReferencePath>
1854 <Reference name="System"/> 1517 <Reference name="System"/>
1855 <Reference name="System.Core"/> 1518 <Reference name="System.Core"/>
1519 <Reference name="System.Data"/>
1856 <Reference name="System.Xml"/> 1520 <Reference name="System.Xml"/>
1857 <Reference name="System.Drawing"/> 1521 <Reference name="System.Drawing"/>
1858 <Reference name="System.Web"/> 1522 <Reference name="System.Web"/>
@@ -1861,9 +1525,9 @@
1861 <Reference name="OpenMetaverseTypes" path="../../../bin/"/> 1525 <Reference name="OpenMetaverseTypes" path="../../../bin/"/>
1862 <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/> 1526 <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
1863 <Reference name="OpenMetaverse" path="../../../bin/"/> 1527 <Reference name="OpenMetaverse" path="../../../bin/"/>
1528 <Reference name="Mono.Data.SqliteClient" path="../../../bin/"/>
1864 <Reference name="OpenSim.Capabilities"/> 1529 <Reference name="OpenSim.Capabilities"/>
1865 <Reference name="OpenSim.Framework"/> 1530 <Reference name="OpenSim.Framework"/>
1866 <Reference name="OpenSim.Framework.Communications"/>
1867 <Reference name="OpenSim.Data"/> 1531 <Reference name="OpenSim.Data"/>
1868 <Reference name="OpenSim.Framework.Console"/> 1532 <Reference name="OpenSim.Framework.Console"/>
1869 <Reference name="OpenSim.Framework.Monitoring"/> 1533 <Reference name="OpenSim.Framework.Monitoring"/>
@@ -1874,7 +1538,7 @@
1874 <Reference name="OpenSim.Region.Framework.Interfaces"/> 1538 <Reference name="OpenSim.Region.Framework.Interfaces"/>
1875 <Reference name="OpenSim.Region.Framework.Scenes"/> 1539 <Reference name="OpenSim.Region.Framework.Scenes"/>
1876 <Reference name="OpenSim.Region.Framework"/> 1540 <Reference name="OpenSim.Region.Framework"/>
1877 <Reference name="OpenSim.Region.Physics.Manager"/> 1541 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
1878 <Reference name="OpenSim.Server.Base"/> 1542 <Reference name="OpenSim.Server.Base"/>
1879 <Reference name="OpenSim.Server.Handlers"/> 1543 <Reference name="OpenSim.Server.Handlers"/>
1880 <Reference name="OpenSim.Services.Connectors"/> 1544 <Reference name="OpenSim.Services.Connectors"/>
@@ -1884,7 +1548,6 @@
1884 1548
1885 <!-- For scripting in funny languages by default --> 1549 <!-- For scripting in funny languages by default -->
1886 <Reference name="XMLRPC" path="../../../bin/"/> 1550 <Reference name="XMLRPC" path="../../../bin/"/>
1887 <Reference name="OpenSim.Framework.Communications"/>
1888 <Reference name="Nini" path="../../../bin/"/> 1551 <Reference name="Nini" path="../../../bin/"/>
1889 <Reference name="log4net" path="../../../bin/"/> 1552 <Reference name="log4net" path="../../../bin/"/>
1890 <Reference name="DotNetOpenMail" path="../../../bin/"/> 1553 <Reference name="DotNetOpenMail" path="../../../bin/"/>
@@ -1926,7 +1589,7 @@
1926 </Files> 1589 </Files>
1927 </Project> 1590 </Project>
1928 1591
1929 <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.ConvexDecompositionDotNet" path="OpenSim/Region/Physics/ConvexDecompositionDotNet" type="Library"> 1592 <Project frameworkVersion="v4_0" name="OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet" path="OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet" type="Library">
1930 <Configuration name="Debug"> 1593 <Configuration name="Debug">
1931 <Options> 1594 <Options>
1932 <OutputPath>../../../../bin/</OutputPath> 1595 <OutputPath>../../../../bin/</OutputPath>
@@ -1951,16 +1614,131 @@
1951 </Files> 1614 </Files>
1952 </Project> 1615 </Project>
1953 1616
1954 <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.BulletSPlugin" path="OpenSim/Region/Physics/BulletSPlugin" type="Library"> 1617 <Project frameworkVersion="v4_0" name="OpenSim.Region.PhysicsModules.Meshing" path="OpenSim/Region/PhysicsModules/Meshing" type="Library">
1955 <Configuration name="Debug"> 1618 <Configuration name="Debug">
1956 <Options> 1619 <Options>
1957 <OutputPath>../../../../bin/Physics/</OutputPath> 1620 <OutputPath>../../../../bin/</OutputPath>
1621 </Options>
1622 </Configuration>
1623 <Configuration name="Release">
1624 <Options>
1625 <OutputPath>../../../../bin/</OutputPath>
1626 </Options>
1627 </Configuration>
1628
1629 <ReferencePath>../../../../bin/</ReferencePath>
1630 <Reference name="System"/>
1631 <Reference name="System.Drawing"/>
1632 <Reference name="CSJ2K" path="../../../../bin/"/>
1633 <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
1634 <Reference name="OpenMetaverse" path="../../../../bin/"/>
1635 <Reference name="OpenMetaverse.StructuredData" path="../../../../bin/"/>
1636 <Reference name="Nini" path="../../../../bin/"/>
1637 <Reference name="OpenSim.Framework"/>
1638 <Reference name="OpenSim.Framework.Console"/>
1639 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
1640 <Reference name="OpenSim.Region.Framework"/>
1641 <Reference name="Mono.Addins" path="../../../../bin/"/>
1642 <Reference name="log4net" path="../../../../bin/"/>
1643
1644 <Files>
1645 <Match pattern="*.cs" recurse="true"/>
1646 </Files>
1647 </Project>
1648
1649 <!-- Physics Plug-ins -->
1650 <Project frameworkVersion="v4_0" name="OpenSim.Region.PhysicsModule.BasicPhysics" path="OpenSim/Region/PhysicsModules/BasicPhysics" type="Library">
1651 <Configuration name="Debug">
1652 <Options>
1653 <OutputPath>../../../../bin/</OutputPath>
1654 </Options>
1655 </Configuration>
1656 <Configuration name="Release">
1657 <Options>
1658 <OutputPath>../../../../bin/</OutputPath>
1659 </Options>
1660 </Configuration>
1661
1662 <ReferencePath>../../../../bin/</ReferencePath>
1663 <Reference name="System"/>
1664 <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
1665 <Reference name="Nini" path="../../../../bin/"/>
1666 <Reference name="OpenSim.Framework"/>
1667 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
1668 <Reference name="OpenSim.Region.Framework"/>
1669 <Reference name="Mono.Addins" path="../../../../bin/"/>
1670 <Files>
1671 <Match pattern="*.cs" recurse="true"/>
1672 </Files>
1673 </Project>
1674
1675 <Project frameworkVersion="v4_0" name="OpenSim.Region.PhysicsModule.POS" path="OpenSim/Region/PhysicsModules/POS" type="Library">
1676 <Configuration name="Debug">
1677 <Options>
1678 <OutputPath>../../../../bin/</OutputPath>
1679 </Options>
1680 </Configuration>
1681 <Configuration name="Release">
1682 <Options>
1683 <OutputPath>../../../../bin/</OutputPath>
1684 </Options>
1685 </Configuration>
1686
1687 <ReferencePath>../../../../bin/</ReferencePath>
1688 <Reference name="System"/>
1689 <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
1690 <Reference name="Nini" path="../../../../bin/"/>
1691 <Reference name="OpenSim.Framework"/>
1692 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
1693 <Reference name="OpenSim.Region.Framework"/>
1694 <Reference name="Mono.Addins" path="../../../../bin/"/>
1695 <Files>
1696 <Match pattern="*.cs" recurse="true"/>
1697 </Files>
1698 </Project>
1699
1700 <Project frameworkVersion="v4_0" name="OpenSim.Region.PhysicsModule.Ode" path="OpenSim/Region/PhysicsModules/Ode" type="Library">
1701 <Configuration name="Debug">
1702 <Options>
1703 <OutputPath>../../../../bin/</OutputPath>
1704 </Options>
1705 </Configuration>
1706 <Configuration name="Release">
1707 <Options>
1708 <OutputPath>../../../../bin/</OutputPath>
1709 </Options>
1710 </Configuration>
1711
1712 <ReferencePath>../../../../bin/</ReferencePath>
1713 <Reference name="System"/>
1714 <Reference name="System.Core"/>
1715 <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
1716 <Reference name="Nini" path="../../../../bin/"/>
1717 <Reference name="OpenSim.Framework"/>
1718 <Reference name="OpenSim.Framework.Console"/>
1719 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
1720 <Reference name="OpenSim.Region.Framework"/>
1721 <Reference name="Mono.Addins" path="../../../../bin/"/>
1722 <Reference name="Ode.NET" path="../../../../bin/"/>
1723 <Reference name="log4net" path="../../../../bin/"/>
1724
1725 <Files>
1726 <Match pattern="*.cs" recurse="true">
1727 <Exclude name="Tests" pattern="Tests"/>
1728 </Match>
1729 </Files>
1730 </Project>
1731
1732 <Project frameworkVersion="v4_0" name="OpenSim.Region.PhysicsModule.BulletS" path="OpenSim/Region/PhysicsModules/BulletS" type="Library">
1733 <Configuration name="Debug">
1734 <Options>
1735 <OutputPath>../../../../bin/</OutputPath>
1958 <AllowUnsafe>true</AllowUnsafe> 1736 <AllowUnsafe>true</AllowUnsafe>
1959 </Options> 1737 </Options>
1960 </Configuration> 1738 </Configuration>
1961 <Configuration name="Release"> 1739 <Configuration name="Release">
1962 <Options> 1740 <Options>
1963 <OutputPath>../../../../bin/Physics/</OutputPath> 1741 <OutputPath>../../../../bin/</OutputPath>
1964 <AllowUnsafe>true</AllowUnsafe> 1742 <AllowUnsafe>true</AllowUnsafe>
1965 </Options> 1743 </Options>
1966 </Configuration> 1744 </Configuration>
@@ -1974,12 +1752,11 @@
1974 <Reference name="OpenSim.Framework"/> 1752 <Reference name="OpenSim.Framework"/>
1975 <Reference name="OpenSim.Framework.Monitoring"/> 1753 <Reference name="OpenSim.Framework.Monitoring"/>
1976 <Reference name="OpenSim.Region.Framework"/> 1754 <Reference name="OpenSim.Region.Framework"/>
1977 <Reference name="OpenSim.Region.CoreModules"/>
1978 <Reference name="OpenSim.Region.OptionalModules"/>
1979 <Reference name="OpenSim.Framework.Console"/> 1755 <Reference name="OpenSim.Framework.Console"/>
1980 <Reference name="OpenSim.Region.Physics.Manager"/> 1756 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
1981 <Reference name="OpenSim.Region.Physics.Meshing" path="../../../../bin/Physics/"/> 1757 <Reference name="OpenSim.Region.PhysicsModules.Meshing" path="../../../../bin/"/>
1982 <Reference name="OpenSim.Region.Physics.ConvexDecompositionDotNet"/> 1758 <Reference name="OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet"/>
1759 <Reference name="Mono.Addins" path="../../../../bin/"/>
1983 <Reference name="BulletXNA.dll" path="../../../../bin/"/> 1760 <Reference name="BulletXNA.dll" path="../../../../bin/"/>
1984 <Reference name="log4net.dll" path="../../../../bin/"/> 1761 <Reference name="log4net.dll" path="../../../../bin/"/>
1985 1762
@@ -2014,15 +1791,13 @@
2014 <Reference name="OpenMetaverse" path="../../../bin/"/> 1791 <Reference name="OpenMetaverse" path="../../../bin/"/>
2015 <Reference name="OpenSim.Framework"/> 1792 <Reference name="OpenSim.Framework"/>
2016 <Reference name="OpenSim.Data"/> 1793 <Reference name="OpenSim.Data"/>
2017 <Reference name="OpenSim.Framework.Communications"/>
2018 <Reference name="OpenSim.Framework.Console"/> 1794 <Reference name="OpenSim.Framework.Console"/>
2019 <Reference name="OpenSim.Framework.Monitoring"/> 1795 <Reference name="OpenSim.Framework.Monitoring"/>
2020 <Reference name="OpenSim.Framework.Servers"/> 1796 <Reference name="OpenSim.Framework.Servers"/>
2021 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 1797 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
2022 <Reference name="OpenSim.Region.Framework"/> 1798 <Reference name="OpenSim.Region.Framework"/>
2023 <Reference name="OpenSim.Region.CoreModules"/> 1799 <Reference name="OpenSim.Region.CoreModules"/>
2024 <Reference name="OpenSim.Region.ClientStack"/> 1800 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
2025 <Reference name="OpenSim.Region.Physics.Manager"/>
2026 <Reference name="OpenSim.Server.Base"/> 1801 <Reference name="OpenSim.Server.Base"/>
2027 <Reference name="OpenSim.Services.Base"/> 1802 <Reference name="OpenSim.Services.Base"/>
2028 <Reference name="OpenSim.Services.Interfaces"/> 1803 <Reference name="OpenSim.Services.Interfaces"/>
@@ -2055,7 +1830,6 @@
2055 <Reference name="OpenMetaverseTypes" path="../../../bin/"/> 1830 <Reference name="OpenMetaverseTypes" path="../../../bin/"/>
2056 <Reference name="Nini" path="../../../bin/"/> 1831 <Reference name="Nini" path="../../../bin/"/>
2057 <Reference name="OpenSim"/> 1832 <Reference name="OpenSim"/>
2058 <Reference name="OpenSim.Region.ClientStack"/>
2059 <Reference name="OpenSim.Region.CoreModules"/> 1833 <Reference name="OpenSim.Region.CoreModules"/>
2060 <Reference name="OpenSim.Region.Framework"/> 1834 <Reference name="OpenSim.Region.Framework"/>
2061 <Reference name="OpenSim.Framework"/> 1835 <Reference name="OpenSim.Framework"/>
@@ -2091,7 +1865,6 @@
2091 <Reference name="OpenSim.Framework"/> 1865 <Reference name="OpenSim.Framework"/>
2092 <Reference name="OpenSim.Framework.Servers"/> 1866 <Reference name="OpenSim.Framework.Servers"/>
2093 <Reference name="OpenSim.Region.Framework"/> 1867 <Reference name="OpenSim.Region.Framework"/>
2094 <Reference name="OpenSim.Region.ClientStack"/>
2095 <Reference name="System"/> 1868 <Reference name="System"/>
2096 <Reference name="System.Xml"/> 1869 <Reference name="System.Xml"/>
2097 <Reference name="log4net" path="../../../bin/"/> 1870 <Reference name="log4net" path="../../../bin/"/>
@@ -2125,10 +1898,8 @@
2125 <Reference name="Nini" path="../../../bin/"/> 1898 <Reference name="Nini" path="../../../bin/"/>
2126 <Reference name="XMLRPC" path="../../../bin/"/> 1899 <Reference name="XMLRPC" path="../../../bin/"/>
2127 <Reference name="OpenSim"/> 1900 <Reference name="OpenSim"/>
2128 <Reference name="OpenSim.Region.ClientStack"/>
2129 <Reference name="OpenSim.Region.Framework"/> 1901 <Reference name="OpenSim.Region.Framework"/>
2130 <Reference name="OpenSim.Region.CoreModules"/> 1902 <Reference name="OpenSim.Region.CoreModules"/>
2131 <Reference name="OpenSim.Framework.Communications"/>
2132 <Reference name="OpenSim.Framework"/> 1903 <Reference name="OpenSim.Framework"/>
2133 <Reference name="OpenSim.Framework.Servers"/> 1904 <Reference name="OpenSim.Framework.Servers"/>
2134 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 1905 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
@@ -2144,42 +1915,6 @@
2144 1915
2145 <!-- Scene Server API Example Apps --> 1916 <!-- Scene Server API Example Apps -->
2146 1917
2147 <Project frameworkVersion="v4_0" name="OpenSim.Region.DataSnapshot" path="OpenSim/Region/DataSnapshot" type="Library">
2148 <Configuration name="Debug">
2149 <Options>
2150 <OutputPath>../../../bin/</OutputPath>
2151 </Options>
2152 </Configuration>
2153 <Configuration name="Release">
2154 <Options>
2155 <OutputPath>../../../bin/</OutputPath>
2156 </Options>
2157 </Configuration>
2158
2159 <ReferencePath>../../../bin/</ReferencePath>
2160 <Reference name="System"/>
2161 <Reference name="System.Core"/>
2162 <Reference name="System.Xml"/>
2163 <Reference name="System.Data"/>
2164 <Reference name="OpenSim.Capabilities"/>
2165 <Reference name="OpenSim.Framework"/>
2166 <Reference name="OpenSim.Framework.Communications"/>
2167 <Reference name="OpenSim.Framework.Console"/>
2168 <Reference name="OpenSim.Framework.Servers"/>
2169 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
2170 <Reference name="OpenSim.Region.Framework"/>
2171 <Reference name="OpenSim.Region.CoreModules"/>
2172 <Reference name="OpenSim.Services.Interfaces"/>
2173 <Reference name="OpenMetaverseTypes" path="../../../bin/"/>
2174 <Reference name="OpenMetaverse" path="../../../bin/"/>
2175 <Reference name="Nini" path="../../../bin/"/>
2176 <Reference name="Mono.Addins" path="../../../bin/"/>
2177 <Reference name="log4net" path="../../../bin/"/>
2178 <Files>
2179 <Match pattern="*.cs" recurse="true"/>
2180 </Files>
2181 </Project>
2182
2183 <!-- Data Base Modules --> 1918 <!-- Data Base Modules -->
2184 <Project frameworkVersion="v4_0" name="OpenSim.Data.MySQL" path="OpenSim/Data/MySQL" type="Library"> 1919 <Project frameworkVersion="v4_0" name="OpenSim.Data.MySQL" path="OpenSim/Data/MySQL" type="Library">
2185 <Configuration name="Debug"> 1920 <Configuration name="Debug">
@@ -2316,7 +2051,6 @@
2316 <Reference name="OpenMetaverseTypes" path="../../../../bin/"/> 2051 <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
2317 <Reference name="OpenSim"/> 2052 <Reference name="OpenSim"/>
2318 <Reference name="OpenSim.Framework"/> 2053 <Reference name="OpenSim.Framework"/>
2319 <Reference name="OpenSim.Framework.Communications"/>
2320 <Reference name="OpenSim.Region.Framework"/> 2054 <Reference name="OpenSim.Region.Framework"/>
2321 <Reference name="OpenSim.Region.CoreModules"/> 2055 <Reference name="OpenSim.Region.CoreModules"/>
2322 <Reference name="OpenSim.Framework.Console"/> 2056 <Reference name="OpenSim.Framework.Console"/>
@@ -2353,7 +2087,6 @@
2353 <Reference name="OpenMetaverseTypes" path="../../../../../../bin/"/> 2087 <Reference name="OpenMetaverseTypes" path="../../../../../../bin/"/>
2354 <Reference name="OpenSim"/> 2088 <Reference name="OpenSim"/>
2355 <Reference name="OpenSim.Framework"/> 2089 <Reference name="OpenSim.Framework"/>
2356 <Reference name="OpenSim.Framework.Communications"/>
2357 <Reference name="OpenSim.Region.Framework"/> 2090 <Reference name="OpenSim.Region.Framework"/>
2358 <Reference name="OpenSim.Region.CoreModules"/> 2091 <Reference name="OpenSim.Region.CoreModules"/>
2359 <Reference name="OpenSim.Framework.Console"/> 2092 <Reference name="OpenSim.Framework.Console"/>
@@ -2390,12 +2123,11 @@
2390 <Reference name="OpenMetaverse.StructuredData" path="../../../../../../bin/"/> 2123 <Reference name="OpenMetaverse.StructuredData" path="../../../../../../bin/"/>
2391 <Reference name="OpenSim"/> 2124 <Reference name="OpenSim"/>
2392 <Reference name="OpenSim.Framework"/> 2125 <Reference name="OpenSim.Framework"/>
2393 <Reference name="OpenSim.Framework.Communications"/>
2394 <Reference name="OpenSim.Framework.Console"/> 2126 <Reference name="OpenSim.Framework.Console"/>
2395 <Reference name="OpenSim.Framework.Monitoring"/> 2127 <Reference name="OpenSim.Framework.Monitoring"/>
2396 <Reference name="OpenSim.Region.Framework"/> 2128 <Reference name="OpenSim.Region.Framework"/>
2397 <Reference name="OpenSim.Region.CoreModules"/> 2129 <Reference name="OpenSim.Region.CoreModules"/>
2398 <Reference name="OpenSim.Region.Physics.Manager"/> 2130 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
2399 <Reference name="OpenSim.Services.Interfaces"/> 2131 <Reference name="OpenSim.Services.Interfaces"/>
2400 <Reference name="OpenSim.Services.Connectors"/> 2132 <Reference name="OpenSim.Services.Connectors"/>
2401 <Reference name="OpenSim.Region.ScriptEngine.Shared"/> 2133 <Reference name="OpenSim.Region.ScriptEngine.Shared"/>
@@ -2458,7 +2190,6 @@
2458 <Reference name="OpenMetaverseTypes" path="../../../../../bin/"/> 2190 <Reference name="OpenMetaverseTypes" path="../../../../../bin/"/>
2459 <Reference name="OpenSim"/> 2191 <Reference name="OpenSim"/>
2460 <Reference name="OpenSim.Framework"/> 2192 <Reference name="OpenSim.Framework"/>
2461 <Reference name="OpenSim.Framework.Communications"/>
2462 <Reference name="OpenSim.Region.Framework"/> 2193 <Reference name="OpenSim.Region.Framework"/>
2463 <Reference name="OpenSim.Region.CoreModules"/> 2194 <Reference name="OpenSim.Region.CoreModules"/>
2464 <Reference name="OpenSim.Framework.Console"/> 2195 <Reference name="OpenSim.Framework.Console"/>
@@ -2498,7 +2229,6 @@
2498 <Reference name="OpenMetaverseTypes" path="../../../../../../bin/"/> 2229 <Reference name="OpenMetaverseTypes" path="../../../../../../bin/"/>
2499 <Reference name="OpenSim"/> 2230 <Reference name="OpenSim"/>
2500 <Reference name="OpenSim.Framework"/> 2231 <Reference name="OpenSim.Framework"/>
2501 <Reference name="OpenSim.Framework.Communications"/>
2502 <Reference name="OpenSim.Region.Framework"/> 2232 <Reference name="OpenSim.Region.Framework"/>
2503 <Reference name="OpenSim.Region.CoreModules"/> 2233 <Reference name="OpenSim.Region.CoreModules"/>
2504 <Reference name="OpenSim.Framework.Console"/> 2234 <Reference name="OpenSim.Framework.Console"/>
@@ -2534,7 +2264,6 @@
2534 <Reference name="OpenMetaverse.StructuredData" path="../../../../bin/"/> 2264 <Reference name="OpenMetaverse.StructuredData" path="../../../../bin/"/>
2535 <Reference name="OpenSim"/> 2265 <Reference name="OpenSim"/>
2536 <Reference name="OpenSim.Framework"/> 2266 <Reference name="OpenSim.Framework"/>
2537 <Reference name="OpenSim.Framework.Communications"/>
2538 <Reference name="OpenSim.Region.Framework"/> 2267 <Reference name="OpenSim.Region.Framework"/>
2539 <Reference name="OpenSim.Region.CoreModules"/> 2268 <Reference name="OpenSim.Region.CoreModules"/>
2540 <Reference name="OpenSim.Framework.Console"/> 2269 <Reference name="OpenSim.Framework.Console"/>
@@ -2558,55 +2287,6 @@
2558 </Files> 2287 </Files>
2559 </Project> 2288 </Project>
2560 2289
2561 <Project frameworkVersion="v4_0" name="OpenSim.Region.UserStatistics" path="OpenSim/Region/UserStatistics" type="Library">
2562 <Configuration name="Debug">
2563 <Options>
2564 <OutputPath>../../../bin/</OutputPath>
2565 </Options>
2566 </Configuration>
2567 <Configuration name="Release">
2568 <Options>
2569 <OutputPath>../../../bin/</OutputPath>
2570 </Options>
2571 </Configuration>
2572
2573 <ReferencePath>../../../bin/</ReferencePath>
2574 <Reference name="System"/>
2575 <Reference name="System.Data"/>
2576 <Reference name="System.Xml"/>
2577 <Reference name="System.Drawing"/>
2578 <Reference name="System.Runtime.Remoting"/>
2579 <Reference name="System.Web"/>
2580 <Reference name="OpenMetaverseTypes" path="../../../bin/"/>
2581 <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
2582 <Reference name="OpenMetaverse" path="../../../bin/"/>
2583 <Reference name="OpenSim.Capabilities"/>
2584 <Reference name="OpenSim.Framework"/>
2585 <Reference name="OpenSim.Data"/>
2586 <Reference name="OpenSim.Region.Framework"/>
2587 <Reference name="OpenSim.Region.CoreModules"/>
2588 <Reference name="OpenSim.Framework.Console"/>
2589 <Reference name="OpenSim.Framework.Monitoring"/>
2590 <Reference name="OpenSim.Framework.Servers"/>
2591 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
2592 <Reference name="OpenSim.Region.Physics.Manager"/>
2593 <Reference name="Mono.Data.SqliteClient" path="../../../bin/"/>
2594 <Reference name="Mono.Addins" path="../../../bin/"/>
2595
2596 <!-- For scripting in funny languages by default -->
2597 <Reference name="XMLRPC" path="../../../bin/"/>
2598 <Reference name="OpenSim.Framework.Communications"/>
2599 <Reference name="Nini" path="../../../bin/"/>
2600 <Reference name="log4net" path="../../../bin/"/>
2601 <Reference name="DotNetOpenMail" path="../../../bin/"/>
2602
2603 <Files>
2604 <Match pattern="*.cs" recurse="true">
2605 <Exclude name="Tests" pattern="Tests"/>
2606 </Match>
2607 </Files>
2608 </Project>
2609
2610 <!-- Addons --> 2290 <!-- Addons -->
2611 2291
2612 <Project frameworkVersion="v4_0" name="OpenSim.Addons.OfflineIM" path="OpenSim/Addons/OfflineIM" type="Library"> 2292 <Project frameworkVersion="v4_0" name="OpenSim.Addons.OfflineIM" path="OpenSim/Addons/OfflineIM" type="Library">
@@ -2845,7 +2525,6 @@
2845 <Reference name="OpenSim.Data"/> 2525 <Reference name="OpenSim.Data"/>
2846 <Reference name="OpenSim.Data.Null"/> 2526 <Reference name="OpenSim.Data.Null"/>
2847 <Reference name="OpenSim.Framework"/> 2527 <Reference name="OpenSim.Framework"/>
2848 <Reference name="OpenSim.Framework.Communications"/>
2849 <Reference name="OpenSim.Framework.Console"/> 2528 <Reference name="OpenSim.Framework.Console"/>
2850 <Reference name="OpenSim.Framework.Servers"/> 2529 <Reference name="OpenSim.Framework.Servers"/>
2851 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 2530 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
@@ -2854,7 +2533,8 @@
2854 <Reference name="OpenSim.Region.ClientStack.LindenUDP"/> 2533 <Reference name="OpenSim.Region.ClientStack.LindenUDP"/>
2855 <Reference name="OpenSim.Region.Framework"/> 2534 <Reference name="OpenSim.Region.Framework"/>
2856 <Reference name="OpenSim.Region.OptionalModules"/> 2535 <Reference name="OpenSim.Region.OptionalModules"/>
2857 <Reference name="OpenSim.Region.Physics.Manager"/> 2536 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
2537 <Reference name="OpenSim.Region.PhysicsModule.BasicPhysics"/>
2858 <Reference name="OpenSim.Region.ScriptEngine.Shared"/> 2538 <Reference name="OpenSim.Region.ScriptEngine.Shared"/>
2859 <Reference name="OpenSim.Server.Base"/> 2539 <Reference name="OpenSim.Server.Base"/>
2860 <Reference name="OpenSim.Services.Interfaces"/> 2540 <Reference name="OpenSim.Services.Interfaces"/>
@@ -3173,7 +2853,6 @@
3173 <Reference name="OpenSim.Data.Null"/> 2853 <Reference name="OpenSim.Data.Null"/>
3174 <Reference name="OpenSim.Framework"/> 2854 <Reference name="OpenSim.Framework"/>
3175 <Reference name="OpenSim.Framework.Serialization"/> 2855 <Reference name="OpenSim.Framework.Serialization"/>
3176 <Reference name="OpenSim.Framework.Communications"/>
3177 <Reference name="OpenSim.Framework.Console"/> 2856 <Reference name="OpenSim.Framework.Console"/>
3178 <Reference name="OpenSim.Framework.Monitoring"/> 2857 <Reference name="OpenSim.Framework.Monitoring"/>
3179 <Reference name="OpenSim.Framework.Servers"/> 2858 <Reference name="OpenSim.Framework.Servers"/>
@@ -3181,7 +2860,7 @@
3181 <Reference name="OpenSim.Region.Framework"/> 2860 <Reference name="OpenSim.Region.Framework"/>
3182 <Reference name="OpenSim.Region.CoreModules"/> 2861 <Reference name="OpenSim.Region.CoreModules"/>
3183 <Reference name="OpenSim.Region.OptionalModules"/> 2862 <Reference name="OpenSim.Region.OptionalModules"/>
3184 <Reference name="OpenSim.Region.Physics.Manager"/> 2863 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
3185 <Reference name="OpenSim.Region.ScriptEngine.Shared"/> 2864 <Reference name="OpenSim.Region.ScriptEngine.Shared"/>
3186 <Reference name="OpenSim.Region.ScriptEngine.XEngine"/> 2865 <Reference name="OpenSim.Region.ScriptEngine.XEngine"/>
3187 <Reference name="OpenSim.Services.Interfaces"/> 2866 <Reference name="OpenSim.Services.Interfaces"/>
@@ -3193,7 +2872,6 @@
3193 2872
3194 <!-- For scripting in funny languages by default --> 2873 <!-- For scripting in funny languages by default -->
3195 <Reference name="XMLRPC" path="../../../bin/"/> 2874 <Reference name="XMLRPC" path="../../../bin/"/>
3196 <Reference name="OpenSim.Framework.Communications"/>
3197 <Reference name="Nini" path="../../../bin/"/> 2875 <Reference name="Nini" path="../../../bin/"/>
3198 <Reference name="log4net" path="../../../bin/"/> 2876 <Reference name="log4net" path="../../../bin/"/>
3199 <Reference name="DotNetOpenMail" path="../../../bin/"/> 2877 <Reference name="DotNetOpenMail" path="../../../bin/"/>
@@ -3252,7 +2930,6 @@
3252 <Reference name="OpenSim.Data"/> 2930 <Reference name="OpenSim.Data"/>
3253 <Reference name="OpenSim.Framework"/> 2931 <Reference name="OpenSim.Framework"/>
3254 <Reference name="OpenSim.Framework.Serialization"/> 2932 <Reference name="OpenSim.Framework.Serialization"/>
3255 <Reference name="OpenSim.Framework.Communications"/>
3256 <Reference name="OpenSim.Framework.Console"/> 2933 <Reference name="OpenSim.Framework.Console"/>
3257 <Reference name="OpenSim.Framework.Monitoring"/> 2934 <Reference name="OpenSim.Framework.Monitoring"/>
3258 <Reference name="OpenSim.Framework.Servers"/> 2935 <Reference name="OpenSim.Framework.Servers"/>
@@ -3262,7 +2939,7 @@
3262 <Reference name="OpenSim.Region.Framework.Interfaces"/> 2939 <Reference name="OpenSim.Region.Framework.Interfaces"/>
3263 <Reference name="OpenSim.Region.CoreModules"/> 2940 <Reference name="OpenSim.Region.CoreModules"/>
3264 <Reference name="OpenSim.Region.OptionalModules"/> 2941 <Reference name="OpenSim.Region.OptionalModules"/>
3265 <Reference name="OpenSim.Region.Physics.Manager"/> 2942 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
3266 <Reference name="OpenSim.Region.ScriptEngine.Shared"/> 2943 <Reference name="OpenSim.Region.ScriptEngine.Shared"/>
3267 <Reference name="OpenSim.Services.AvatarService"/> 2944 <Reference name="OpenSim.Services.AvatarService"/>
3268 <Reference name="OpenSim.Services.Interfaces"/> 2945 <Reference name="OpenSim.Services.Interfaces"/>
@@ -3274,7 +2951,6 @@
3274 2951
3275 <!-- For scripting in funny languages by default --> 2952 <!-- For scripting in funny languages by default -->
3276 <Reference name="XMLRPC" path="../../../bin/"/> 2953 <Reference name="XMLRPC" path="../../../bin/"/>
3277 <Reference name="OpenSim.Framework.Communications"/>
3278 <Reference name="Nini" path="../../../bin/"/> 2954 <Reference name="Nini" path="../../../bin/"/>
3279 <Reference name="log4net" path="../../../bin/"/> 2955 <Reference name="log4net" path="../../../bin/"/>
3280 <Reference name="DotNetOpenMail" path="../../../bin/"/> 2956 <Reference name="DotNetOpenMail" path="../../../bin/"/>
@@ -3319,18 +2995,16 @@
3319 <Reference name="OpenSim.Capabilities"/> 2995 <Reference name="OpenSim.Capabilities"/>
3320 <Reference name="OpenSim.Data"/> 2996 <Reference name="OpenSim.Data"/>
3321 <Reference name="OpenSim.Framework"/> 2997 <Reference name="OpenSim.Framework"/>
3322 <Reference name="OpenSim.Framework.Communications"/>
3323 <Reference name="OpenSim.Framework.Console"/> 2998 <Reference name="OpenSim.Framework.Console"/>
3324 <Reference name="OpenSim.Framework.Monitoring"/> 2999 <Reference name="OpenSim.Framework.Monitoring"/>
3325 <Reference name="OpenSim.Framework.Servers"/> 3000 <Reference name="OpenSim.Framework.Servers"/>
3326 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 3001 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
3327 <Reference name="OpenSim.Framework.Serialization"/> 3002 <Reference name="OpenSim.Framework.Serialization"/>
3328 <Reference name="OpenSim.Region.ClientStack"/>
3329 <Reference name="OpenSim.Region.ClientStack.LindenCaps"/> 3003 <Reference name="OpenSim.Region.ClientStack.LindenCaps"/>
3330 <Reference name="OpenSim.Region.Framework"/> 3004 <Reference name="OpenSim.Region.Framework"/>
3331 <Reference name="OpenSim.Region.CoreModules"/> 3005 <Reference name="OpenSim.Region.CoreModules"/>
3332 <Reference name="OpenSim.Region.OptionalModules"/> 3006 <Reference name="OpenSim.Region.OptionalModules"/>
3333 <Reference name="OpenSim.Region.Physics.Manager"/> 3007 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
3334 <Reference name="OpenSim.Services.Interfaces"/> 3008 <Reference name="OpenSim.Services.Interfaces"/>
3335 3009
3336 <!-- Unit tests --> 3010 <!-- Unit tests -->
@@ -3341,7 +3015,6 @@
3341 3015
3342 <!-- For scripting in funny languages by default --> 3016 <!-- For scripting in funny languages by default -->
3343 <Reference name="XMLRPC" path="../../../bin/"/> 3017 <Reference name="XMLRPC" path="../../../bin/"/>
3344 <Reference name="OpenSim.Framework.Communications"/>
3345 <Reference name="Nini" path="../../../bin/"/> 3018 <Reference name="Nini" path="../../../bin/"/>
3346 <Reference name="log4net" path="../../../bin/"/> 3019 <Reference name="log4net" path="../../../bin/"/>
3347 <Reference name="DotNetOpenMail" path="../../../bin/"/> 3020 <Reference name="DotNetOpenMail" path="../../../bin/"/>
@@ -3382,7 +3055,6 @@
3382 <Reference name="OpenMetaverse.StructuredData" path="../../../../../bin/"/> 3055 <Reference name="OpenMetaverse.StructuredData" path="../../../../../bin/"/>
3383 <Reference name="OpenSim.Capabilities"/> 3056 <Reference name="OpenSim.Capabilities"/>
3384 <Reference name="OpenSim.Framework"/> 3057 <Reference name="OpenSim.Framework"/>
3385 <Reference name="OpenSim.Framework.Communications"/>
3386 <Reference name="OpenSim.Framework.Monitoring"/> 3058 <Reference name="OpenSim.Framework.Monitoring"/>
3387 <Reference name="OpenSim.Framework.Servers"/> 3059 <Reference name="OpenSim.Framework.Servers"/>
3388 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 3060 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
@@ -3421,9 +3093,7 @@
3421 <Reference name="OpenMetaverse" path="../../../../../../bin/"/> 3093 <Reference name="OpenMetaverse" path="../../../../../../bin/"/>
3422 <Reference name="OpenMetaverseTypes" path="../../../../../../bin/"/> 3094 <Reference name="OpenMetaverseTypes" path="../../../../../../bin/"/>
3423 <Reference name="OpenSim.Framework"/> 3095 <Reference name="OpenSim.Framework"/>
3424 <Reference name="OpenSim.Framework.Communications"/>
3425 <Reference name="OpenSim.Framework.Monitoring"/> 3096 <Reference name="OpenSim.Framework.Monitoring"/>
3426 <Reference name="OpenSim.Region.ClientStack"/>
3427 <Reference name="OpenSim.Region.ClientStack.LindenUDP"/> 3097 <Reference name="OpenSim.Region.ClientStack.LindenUDP"/>
3428 <Reference name="OpenSim.Region.CoreModules"/> 3098 <Reference name="OpenSim.Region.CoreModules"/>
3429 <Reference name="OpenSim.Region.Framework"/> 3099 <Reference name="OpenSim.Region.Framework"/>
@@ -3453,7 +3123,6 @@
3453 <Reference name="System.Core"/> 3123 <Reference name="System.Core"/>
3454 <Reference name="System.Xml"/> 3124 <Reference name="System.Xml"/>
3455 <Reference name="OpenSim.Framework"/> 3125 <Reference name="OpenSim.Framework"/>
3456 <Reference name="OpenSim.Framework.Communications"/>
3457 <Reference name="OpenSim.Framework.Servers"/> 3126 <Reference name="OpenSim.Framework.Servers"/>
3458 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 3127 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
3459 <Reference name="OpenSim.Region.CoreModules"/> 3128 <Reference name="OpenSim.Region.CoreModules"/>
@@ -3495,7 +3164,7 @@
3495 TODO: this is kind of lame, we basically build a duplicate 3164 TODO: this is kind of lame, we basically build a duplicate
3496 assembly but with tests added in, just because we can't resolve cross-bin-dir-refs. 3165 assembly but with tests added in, just because we can't resolve cross-bin-dir-refs.
3497 --> 3166 -->
3498 <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.OdePlugin.Tests" path="OpenSim/Region/Physics/OdePlugin/Tests" type="Library"> 3167 <Project frameworkVersion="v4_0" name="OpenSim.Region.PhysicsModule.Ode.Tests" path="OpenSim/Region/PhysicsModules/Ode/Tests" type="Library">
3499 <Configuration name="Debug"> 3168 <Configuration name="Debug">
3500 <Options> 3169 <Options>
3501 <OutputPath>../../../../../bin/</OutputPath> 3170 <OutputPath>../../../../../bin/</OutputPath>
@@ -3514,8 +3183,9 @@
3514 <Reference name="Nini" path="../../../../../bin/"/> 3183 <Reference name="Nini" path="../../../../../bin/"/>
3515 <Reference name="OpenSim.Framework"/> 3184 <Reference name="OpenSim.Framework"/>
3516 <Reference name="OpenSim.Framework.Console"/> 3185 <Reference name="OpenSim.Framework.Console"/>
3517 <Reference name="OpenSim.Region.Physics.Manager"/> 3186 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
3518 <Reference name="OpenSim.Region.Physics.OdePlugin" path="../../../../../bin/Physics/"/> 3187 <Reference name="OpenSim.Region.PhysicsModule.Ode"/>
3188 <Reference name="OpenSim.Region.Framework"/>
3519 <Reference name="OpenSim.Tests.Common"/> 3189 <Reference name="OpenSim.Tests.Common"/>
3520 <Reference name="Ode.NET" path="../../../../../bin/"/> 3190 <Reference name="Ode.NET" path="../../../../../bin/"/>
3521 <Reference name="nunit.framework" path="../../../../../bin/"/> 3191 <Reference name="nunit.framework" path="../../../../../bin/"/>
@@ -3526,7 +3196,7 @@
3526 </Files> 3196 </Files>
3527 </Project> 3197 </Project>
3528 3198
3529 <Project frameworkVersion="v4_0" name="OpenSim.Region.Physics.BulletSPlugin.Tests" path="OpenSim/Region/Physics/BulletSPlugin/Tests" type="Library"> 3199 <Project frameworkVersion="v4_0" name="OpenSim.Region.PhysicsModule.BulletS.Tests" path="OpenSim/Region/PhysicsModules/BulletS/Tests" type="Library">
3530 <Configuration name="Debug"> 3200 <Configuration name="Debug">
3531 <Options> 3201 <Options>
3532 <OutputPath>../../../../../bin/</OutputPath> 3202 <OutputPath>../../../../../bin/</OutputPath>
@@ -3549,10 +3219,10 @@
3549 <Reference name="OpenMetaverseTypes" path="../../../../../bin/"/> 3219 <Reference name="OpenMetaverseTypes" path="../../../../../bin/"/>
3550 <Reference name="OpenSim.Framework"/> 3220 <Reference name="OpenSim.Framework"/>
3551 <Reference name="OpenSim.Tests.Common"/> 3221 <Reference name="OpenSim.Tests.Common"/>
3552 <Reference name="OpenSim.Region.CoreModules"/> 3222 <Reference name="OpenSim.Region.Framework"/>
3553 <Reference name="OpenSim.Region.Physics.Meshing" path="../../../../../bin/Physics/"/> 3223 <Reference name="OpenSim.Region.PhysicsModules.Meshing"/>
3554 <Reference name="OpenSim.Region.Physics.Manager"/> 3224 <Reference name="OpenSim.Region.PhysicsModules.SharedBase"/>
3555 <Reference name="OpenSim.Region.Physics.BulletSPlugin" path="../../../../../bin/Physics/"/> 3225 <Reference name="OpenSim.Region.PhysicsModule.BulletS"/>
3556 3226
3557 <Files> 3227 <Files>
3558 <Match pattern="*.cs" recurse="false"/> 3228 <Match pattern="*.cs" recurse="false"/>
@@ -3631,7 +3301,6 @@
3631 <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/> 3301 <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
3632 <Reference name="XMLRPC" path="../../../bin/"/> 3302 <Reference name="XMLRPC" path="../../../bin/"/>
3633 <Reference name="OpenSim.Framework"/> 3303 <Reference name="OpenSim.Framework"/>
3634 <Reference name="OpenSim.Framework.Communications"/>
3635 <Reference name="OpenSim.Framework.Console"/> 3304 <Reference name="OpenSim.Framework.Console"/>
3636 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 3305 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
3637 <Reference name="OpenSim.Region.CoreModules"/> 3306 <Reference name="OpenSim.Region.CoreModules"/>
@@ -3671,7 +3340,6 @@
3671 <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/> 3340 <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
3672 <Reference name="XMLRPC" path="../../../bin/"/> 3341 <Reference name="XMLRPC" path="../../../bin/"/>
3673 <Reference name="OpenSim.Framework"/> 3342 <Reference name="OpenSim.Framework"/>
3674 <Reference name="OpenSim.Framework.Communications"/>
3675 <Reference name="OpenSim.Framework.Console"/> 3343 <Reference name="OpenSim.Framework.Console"/>
3676 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 3344 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
3677 <Reference name="OpenSim.Region.CoreModules"/> 3345 <Reference name="OpenSim.Region.CoreModules"/>