Ejemplo n.º 1
0
        /// <summary>
        /// Set up a scene. If it's more then one scene, use the same CommunicationsManager to link regions
        /// or a different, to get a brand new scene with new shared region modules.
        /// </summary>
        /// <param name="name">Name of the region</param>
        /// <param name="id">ID of the region</param>
        /// <param name="x">X co-ordinate of the region</param>
        /// <param name="y">Y co-ordinate of the region</param>
        /// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
        /// <returns></returns>
        public static TestScene SetupScene(string name, UUID id, uint x, uint y, CoreAssetCache cache)
        {
            Console.WriteLine("Setting up test scene {0}", name);

            // We must set up a console otherwise setup of some modules may fail
            MainConsole.Instance = new MockConsole("TEST PROMPT");

            RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1");

            regInfo.RegionName = name;
            regInfo.RegionID   = id;

            AgentCircuitManager       acm = new AgentCircuitManager();
            SceneCommunicationService scs = new SceneCommunicationService();

            ISimulationDataService simDataService    = OpenSim.Server.Base.ServerUtils.LoadPlugin <ISimulationDataService>("OpenSim.Tests.Common.dll", null);
            IEstateDataService     estateDataService = null;
            IConfigSource          configSource      = new IniConfigSource();

            TestScene testScene = new TestScene(
                regInfo, acm, scs, simDataService, estateDataService, null, false, configSource, null);

            IRegionModule godsModule = new GodsModule();

            godsModule.Initialise(testScene, new IniConfigSource());
            testScene.AddModule(godsModule.Name, godsModule);

            LocalAssetServicesConnector assetService = StartAssetService(testScene, cache);

            StartAuthenticationService(testScene);
            LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene);

            StartGridService(testScene);
            LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene);
            LocalPresenceServicesConnector    presenceService    = StartPresenceService(testScene);

            inventoryService.PostInitialise();
            assetService.PostInitialise();
            userAccountService.PostInitialise();
            presenceService.PostInitialise();

            testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random();
            testScene.SetModuleInterfaces();

            testScene.LandChannel = new TestLandChannel(testScene);
            testScene.LoadWorldMap();

            PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();

            physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
            testScene.PhysicsScene
                = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test");

            testScene.RegionInfo.EstateSettings = new EstateSettings();
            testScene.LoginsDisabled            = false;
            testScene.RegisterRegionWithGrid();

            return(testScene);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get a new physics scene.
        /// </summary>
        /// <param name="engine">The name of the physics engine to use</param>
        /// <param name="meshEngine">The name of the mesh engine to use</param>
        /// <param name="config">The configuration data to pass to the physics and mesh engines</param>
        /// <param name="osSceneIdentifier">
        /// The name of the OpenSim scene this physics scene is serving.  This will be used in log messages.
        /// </param>
        /// <returns></returns>
        protected PhysicsScene GetPhysicsScene(
            string engine, string meshEngine, IConfigSource config, string osSceneIdentifier, Vector3 regionExtent)
        {
            PhysicsPluginManager physicsPluginManager;

            physicsPluginManager = new PhysicsPluginManager();
            physicsPluginManager.LoadPluginsFromAssemblies("Physics");

            return(physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier, regionExtent));
        }
Ejemplo n.º 3
0
        // 'engineName' is the Bullet engine to use. Either null (for unmanaged), "BulletUnmanaged" or "BulletXNA"
        // 'params' is a set of keyValue pairs to set in the engine's configuration file (override defaults)
        //      May be 'null' if there are no overrides.
        public static BSScene CreateBasicPhysicsEngine(Dictionary <string, string> paramOverrides)
        {
            IConfigSource openSimINI    = new IniConfigSource();
            IConfig       startupConfig = openSimINI.AddConfig("Startup");

            startupConfig.Set("physics", "BulletSim");
            startupConfig.Set("meshing", "Meshmerizer");
            startupConfig.Set("cacheSculptMaps", "false"); // meshmerizer shouldn't save maps

            IConfig bulletSimConfig = openSimINI.AddConfig("BulletSim");

            // If the caller cares, specify the bullet engine otherwise it will default to "BulletUnmanaged".
            // bulletSimConfig.Set("BulletEngine", "BulletUnmanaged");
            // bulletSimConfig.Set("BulletEngine", "BulletXNA");
            bulletSimConfig.Set("MeshSculptedPrim", "false");
            bulletSimConfig.Set("ForceSimplePrimMeshing", "true");
            if (paramOverrides != null)
            {
                foreach (KeyValuePair <string, string> kvp in paramOverrides)
                {
                    bulletSimConfig.Set(kvp.Key, kvp.Value);
                }
            }

            // If a special directory exists, put detailed logging therein.
            // This allows local testing/debugging without having to worry that the build engine will output logs.
            if (Directory.Exists("physlogs"))
            {
                bulletSimConfig.Set("PhysicsLoggingDir", "./physlogs");
                bulletSimConfig.Set("PhysicsLoggingEnabled", "True");
                bulletSimConfig.Set("PhysicsLoggingDoFlush", "True");
                bulletSimConfig.Set("VehicleLoggingEnabled", "True");
            }

            PhysicsPluginManager physicsPluginManager;

            physicsPluginManager = new PhysicsPluginManager();
            physicsPluginManager.LoadPluginsFromAssemblies("Physics");

            Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);

            PhysicsScene pScene = physicsPluginManager.GetPhysicsScene(
                "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent);

            BSScene bsScene = pScene as BSScene;

            // Since the asset requestor is not initialized, any mesh or sculptie will be a cube.
            // In the future, add a fake asset fetcher to get meshes and sculpts.
            // bsScene.RequestAssetMethod = ???;

            return(bsScene);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Get a new physics scene.
        /// </summary>
        /// <param name="engine">The name of the physics engine to use</param>
        /// <param name="meshEngine">The name of the mesh engine to use</param>
        /// <param name="config">The configuration data to pass to the physics and mesh engines</param>
        /// <param name="osSceneIdentifier">
        /// The name of the OpenSim scene this physics scene is serving.  This will be used in log messages.
        /// </param>
        /// <returns></returns>
        protected PhysicsScene GetPhysicsScene(
            string engine, string meshEngine, IConfigSource config, string osSceneIdentifier)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }

            PhysicsPluginManager physicsPluginManager;

            physicsPluginManager = new PhysicsPluginManager();
            physicsPluginManager.LoadPluginsFromAssemblies("Physics");

            return(physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Set up a test scene
        /// </summary>
        /// <param name="name">Name of the region</param>
        /// <param name="id">ID of the region</param>
        /// <param name="x">X co-ordinate of the region</param>
        /// <param name="y">Y co-ordinate of the region</param>
        /// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
        /// <param name="startServices">Start associated threads for the services used by the scene</param>
        /// <returns></returns>
        public static TestScene SetupScene(
            string name, UUID id, uint x, uint y, TestCommunicationsManager cm, bool startServices)
        {
            Console.WriteLine("Setting up test scene {0}", name);

            RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1");

            regInfo.RegionName = name;
            regInfo.RegionID   = id;

            AgentCircuitManager       acm = new AgentCircuitManager();
            SceneCommunicationService scs = new SceneCommunicationService(cm);

            StorageManager sm           = new StorageManager("OpenSim.Data.Null.dll", "", "");
            IConfigSource  configSource = new IniConfigSource();

            TestScene testScene = new TestScene(
                regInfo, acm, cm, scs, sm, null, false, false, false, configSource, null);

            IRegionModule capsModule = new CapabilitiesModule();

            capsModule.Initialise(testScene, new IniConfigSource());
            testScene.AddModule(capsModule.Name, capsModule);

            IRegionModule godsModule = new GodsModule();

            godsModule.Initialise(testScene, new IniConfigSource());
            testScene.AddModule(godsModule.Name, godsModule);

            testScene.SetModuleInterfaces();

            testScene.LandChannel = new TestLandChannel();
            testScene.LoadWorldMap();

            PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();

            physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
            testScene.PhysicsScene
                = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test");

            if (startServices)
            {
                cm.StartServices();
            }

            return(testScene);
        }
Ejemplo n.º 6
0
        public void Initialise(Scene scene, IConfigSource source, ISimulationBase openSimBase)
        {
            IConfig PhysConfig    = source.Configs["Physics"];
            IConfig MeshingConfig = source.Configs["Meshing"];
            string  engine        = "";
            string  meshEngine    = "";
            string  Path          = "Physics";

            if (PhysConfig != null)
            {
                Path       = PhysConfig.GetString("PathToPhysicsAssemblies", Path);
                engine     = PhysConfig.GetString("DefaultPhysicsEngine", "AuroraOpenDynamicsEngine");
                meshEngine = MeshingConfig.GetString("DefaultMeshingEngine", "Meshmerizer");
                string regionName          = scene.RegionInfo.RegionName.Trim().Replace(' ', '_');
                string RegionPhysicsEngine = PhysConfig.GetString("Region_" + regionName + "_PhysicsEngine", String.Empty);
                if (RegionPhysicsEngine != "")
                {
                    engine = RegionPhysicsEngine;
                }
                string RegionMeshingEngine = MeshingConfig.GetString("Region_" + regionName + "_MeshingEngine", String.Empty);
                if (RegionMeshingEngine != "")
                {
                    meshEngine = RegionMeshingEngine;
                }
            }
            else
            {
                //Load Sane defaults
                engine     = "AuroraOpenDynamicsEngine";
                meshEngine = "Meshmerizer";
            }
            PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();

            physicsPluginManager.LoadPluginsFromAssemblies(Path);

            PhysicsScene pScene = physicsPluginManager.GetPhysicsScene(engine, meshEngine, source, scene.RegionInfo);

            scene.PhysicsScene = pScene;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Set up a scene. If it's more then one scene, use the same CommunicationsManager to link regions
        /// or a different, to get a brand new scene with new shared region modules.
        /// </summary>
        /// <param name="name">Name of the region</param>
        /// <param name="id">ID of the region</param>
        /// <param name="x">X co-ordinate of the region</param>
        /// <param name="y">Y co-ordinate of the region</param>
        /// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
        /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param>
        /// <returns></returns>
        public static TestScene SetupScene(
            string name, UUID id, uint x, uint y, String realServices)
        {
            bool newScene = false;

            Console.WriteLine("Setting up test scene {0}", name);

            // REFACTORING PROBLEM!
            //// If cm is the same as our last commsManager used, this means the tester wants to link
            //// regions. In this case, don't use the sameshared region modules and dont initialize them again.
            //// Also, no need to start another MainServer and MainConsole instance.
            //if (cm == null || cm != commsManager)
            //{
            //    System.Console.WriteLine("Starting a brand new scene");
            //    newScene = true;
            MainConsole.Instance = new MockConsole("TEST PROMPT");
            //    MainServer.Instance = new BaseHttpServer(980);
            //    commsManager = cm;
            //}

            // We must set up a console otherwise setup of some modules may fail
            RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1");

            regInfo.RegionName = name;
            regInfo.RegionID   = id;

            AgentCircuitManager       acm = new AgentCircuitManager();
            SceneCommunicationService scs = new SceneCommunicationService();

            ISimulationDataService simDataService    = OpenSim.Server.Base.ServerUtils.LoadPlugin <ISimulationDataService>("OpenSim.Tests.Common.dll", null);
            IEstateDataService     estateDataService = null;
            IConfigSource          configSource      = new IniConfigSource();

            TestScene testScene = new TestScene(
                regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null);

            INonSharedRegionModule capsModule = new CapabilitiesModule();

            capsModule.Initialise(new IniConfigSource());
            testScene.AddRegionModule(capsModule.Name, capsModule);
            capsModule.AddRegion(testScene);

            IRegionModule godsModule = new GodsModule();

            godsModule.Initialise(testScene, new IniConfigSource());
            testScene.AddModule(godsModule.Name, godsModule);
            realServices = realServices.ToLower();
            // IConfigSource config = new IniConfigSource();

            // If we have a brand new scene, need to initialize shared region modules
            if ((m_assetService == null && m_inventoryService == null) || newScene)
            {
                if (realServices.Contains("asset"))
                {
                    StartAssetService(testScene, true);
                }
                else
                {
                    StartAssetService(testScene, false);
                }

                // For now, always started a 'real' authentication service
                StartAuthenticationService(testScene, true);

                if (realServices.Contains("inventory"))
                {
                    StartInventoryService(testScene, true);
                }
                else
                {
                    StartInventoryService(testScene, false);
                }

                StartGridService(testScene, true);
                StartUserAccountService(testScene);
                StartPresenceService(testScene);
            }
            // If not, make sure the shared module gets references to this new scene
            else
            {
                m_assetService.AddRegion(testScene);
                m_assetService.RegionLoaded(testScene);
                m_inventoryService.AddRegion(testScene);
                m_inventoryService.RegionLoaded(testScene);
                m_userAccountService.AddRegion(testScene);
                m_userAccountService.RegionLoaded(testScene);
                m_presenceService.AddRegion(testScene);
                m_presenceService.RegionLoaded(testScene);
            }

            m_inventoryService.PostInitialise();
            m_assetService.PostInitialise();
            m_userAccountService.PostInitialise();
            m_presenceService.PostInitialise();
            testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random();
            testScene.SetModuleInterfaces();

            testScene.LandChannel = new TestLandChannel(testScene);
            testScene.LoadWorldMap();

            PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();

            physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
            testScene.PhysicsScene
                = physicsPluginManager.GetPhysicsScene("basicphysics", "MarchingCubes", "ZeroMesher", new IniConfigSource(), "test");

            // It's really not a good idea to use static variables as they carry over between tests, leading to
            // problems that are extremely hard to debug.  Really, these static fields need to be eliminated -
            // tests using multiple regions that need to share modules need to find another solution.
            m_assetService       = null;
            m_inventoryService   = null;
            m_gridService        = null;
            m_userAccountService = null;
            m_presenceService    = null;

            testScene.RegionInfo.EstateSettings = new EstateSettings();
            testScene.LoginsDisabled            = false;

            return(testScene);
        }
        /// <summary>
        /// Set up a scene.
        /// </summary>
        /// <param name="name">Name of the region</param>
        /// <param name="id">ID of the region</param>
        /// <param name="x">X co-ordinate of the region</param>
        /// <param name="y">Y co-ordinate of the region</param>
        /// <param name="configSource"></param>
        /// <returns></returns>
        public TestScene SetupScene(
            string name, UUID id, uint x, uint y, IConfigSource configSource)
        {
            Console.WriteLine("Setting up test scene {0}", name);

            // We must set up a console otherwise setup of some modules may fail
            MainConsole.Instance = new MockConsole();

            RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1");

            regInfo.RegionName = name;
            regInfo.RegionID   = id;

            SceneCommunicationService scs = new SceneCommunicationService();

            TestScene testScene = new TestScene(
                regInfo, m_acm, scs, m_simDataService, m_estateDataService, configSource, null);

            INonSharedRegionModule godsModule = new GodsModule();

            godsModule.Initialise(new IniConfigSource());
            godsModule.AddRegion(testScene);

            // Add scene to services
            m_assetService.AddRegion(testScene);

            if (m_cache != null)
            {
                m_cache.AddRegion(testScene);
                m_cache.RegionLoaded(testScene);
                testScene.AddRegionModule(m_cache.Name, m_cache);
            }

            m_assetService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_assetService.Name, m_assetService);

            m_authenticationService.AddRegion(testScene);
            m_authenticationService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_authenticationService.Name, m_authenticationService);

            m_inventoryService.AddRegion(testScene);
            m_inventoryService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_inventoryService.Name, m_inventoryService);

            m_gridService.AddRegion(testScene);
            m_gridService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_gridService.Name, m_gridService);

            m_userAccountService.AddRegion(testScene);
            m_userAccountService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService);

            m_presenceService.AddRegion(testScene);
            m_presenceService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_presenceService.Name, m_presenceService);

            testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random();
            testScene.SetModuleInterfaces();

            testScene.LandChannel = new TestLandChannel(testScene);
            testScene.LoadWorldMap();

            PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();

            physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
            testScene.PhysicsScene
                = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test");

            testScene.RegionInfo.EstateSettings = new EstateSettings();
            testScene.LoginsEnabled             = true;
            testScene.RegisterRegionWithGrid();

            SceneManager.Add(testScene);

            return(testScene);
        }