Ejemplo n.º 1
0
 private void SceneController_OnSceneLoaded(SceneController controller, SimScene scene)
 {
     sceneViewController.createCameras(scene);
     lightManager.sceneLoaded(scene);
     //var vrFramework = scene.Scope.Resolve<OgreFramework>();
     var subScene     = scene.getDefaultSubScene();
     var sceneManager = subScene.getSimElementManager <OgreSceneManager>();
     //vrFramework.Init(OgrePlugin.Root.getSingleton(), sceneManager.SceneManager);
 }
Ejemplo n.º 2
0
        internal IEnumerable <SceneBuildStatus> changeSceneStatus(String file, ResourceProvider resourceProvider)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            sceneViewController.resetAllCameraPositions();
            unloadScene();
            SimObjectErrorManager.Clear();

            foreach (var status in medicalController.openScene(file, resourceProvider))
            {
                yield return(status);
            }

            SimSubScene defaultScene = medicalController.CurrentScene.getDefaultSubScene();

            if (BeforeSceneLoadProperties != null)
            {
                BeforeSceneLoadProperties.Invoke(medicalController.CurrentScene);
            }
            if (defaultScene != null)
            {
                OgreSceneManager ogreScene = defaultScene.getSimElementManager <OgreSceneManager>();

                SimulationScene medicalScene = defaultScene.getSimElementManager <SimulationScene>();
                sceneViewController.createFromPresets(medicalScene.WindowPresets.Default, false);

                sceneViewController.createCameras(medicalController.CurrentScene);
                lightManager.sceneLoaded(medicalController.CurrentScene);

                if (SceneLoaded != null)
                {
                    SceneLoaded.Invoke(medicalController.CurrentScene);
                }

                anatomyController.sceneLoaded();
            }

            if (SimObjectErrorManager.HasErrors)
            {
                NotificationManager.showCallbackNotification("Errors loading the scene.\nClick for details.", MessageBoxIcons.Error, showLoadErrorGui);
            }

            sw.Stop();
            Logging.Log.Debug("Scene '{0}' loaded in {1} ms", file, sw.ElapsedMilliseconds);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Callback for when the scene is loaded.
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="scene"></param>
 private void sceneController_OnSceneLoaded(SceneController controller, SimScene scene)
 {
     sceneViewController.createCameras(scene);
     lightManager.sceneLoaded(scene);
     selectionMovementTools.sceneLoaded(scene);
 }
        private IEnumerable <IdleStatus> finishInitialization(String defaultModel)
        {
            yield return(IdleStatus.Ok);

            splashScreen.updateStatus(15, "Loading Resources");

            VirtualFileSystem.Instance.addArchive(OgreModelEditorConfig.VFSRoot);

            emptyResourceManager = pluginManager.createScratchResourceManager();
            liveResourceManager  = pluginManager.createLiveResourceManager("Scene");
            resourceManager      = pluginManager.createScratchResourceManager();

            yield return(IdleStatus.Ok);

            splashScreen.updateStatus(40, "Creating GUI");

            //Initialize controllers
            modelController = new ModelController(this);

            //Create the GUI
            consoleWindow = new LogWindow();
            guiManager.addManagedDialog(consoleWindow);
            consoleWindow.Visible = true;
            Log.Default.addLogListener(consoleWindow);

            virtualTextureDebugger = new VirtualTextureDebugger(virtualTextureLink.VirtualTextureManager);
            guiManager.addManagedDialog(virtualTextureDebugger);

            textureCompiler            = new TextureCompilerGUI(pluginManager, mainWindow);
            textureCompiler.CurrentSrc = OgreModelEditorConfig.LastTextureCompilerSourceDirectory;
            guiManager.addManagedDialog(textureCompiler);

            materialEditor = new MDIObjectEditor("Materials", "MaterialEditor", false);
            guiManager.addManagedDialog(materialEditor);
            materialEditor.CurrentDockLocation = DockLocation.Left;
            materialEditor.Visible             = true;
            materialEditor.EditInterface       = materialController.EditInterface;

            yield return(IdleStatus.Ok);

            splashScreen.updateStatus(70, "Creating Scene");

            //Create a simple scene to use to show the models
            SimSceneDefinition         sceneDefiniton = new SimSceneDefinition();
            OgreSceneManagerDefinition ogreScene      = new OgreSceneManagerDefinition("Ogre");
            SimSubSceneDefinition      mainSubScene   = new SimSubSceneDefinition("Main");

            sceneDefiniton.addSimElementManagerDefinition(ogreScene);
            sceneDefiniton.addSimSubSceneDefinition(mainSubScene);
            mainSubScene.addBinding(ogreScene);
            sceneDefiniton.DefaultSubScene = "Main";

            scene = sceneDefiniton.createScene();
            sceneViewController.createCameras(scene);
            lightManager.sceneLoaded(scene);
            objectMover.sceneLoaded(scene);
            virtualTextureLink.sceneLoaded(scene);

            yield return(IdleStatus.Ok);

            if (!String.IsNullOrEmpty(defaultModel))
            {
                splashScreen.updateStatus(80, "Loading Model");

                openModel(defaultModel);

                yield return(IdleStatus.Ok);
            }

            splashScreen.updateStatus(100, "Loaded");

            splashScreen.hide();

            yield return(IdleStatus.Ok);
        }