Пример #1
0
        void controller_SceneLoaded(SimScene scene)
        {
            var simScene = scene.getDefaultSubScene().getSimElementManager <SimulationScene>();

            AllowPosing = simScene.AllowIK;

            ikScene = scene.getDefaultSubScene().getSimElementManager <BEPUikScene>();
            togglePicking();
        }
Пример #2
0
        public virtual void createSceneView(SimScene scene)
        {
            Log.Info("Creating SceneView for {0}.", name);
            SimSubScene defaultScene = scene.getDefaultSubScene();

            sceneView = window.createSceneView(defaultScene, name, cameraMover.Translation, cameraMover.LookAt, zIndexStart + zOffset++);
            sceneView.setDimensions(sceneViewportLocation.x, sceneViewportLocation.y, sceneViewportSize.Width, sceneViewportSize.Height);
            if (vpBackground != null)
            {
                vpBackground.setDimensions(sceneViewportLocation.x, sceneViewportLocation.y, sceneViewportSize.Width, sceneViewportSize.Height);
            }
            sceneView.BackgroundColor = backColor;
            sceneView.setNearClipDistance(1.0f);
            sceneView.setFarClipDistance(1000.0f);
            sceneView.FovY            = fovY;
            sceneView.ClearEveryFrame = clearEveryFrame;
            sceneView.setRenderingMode(renderingMode);
            cameraMover.setCamera(new CameraPositioner(sceneView, MinNearDistance, NearPlaneWorld, NearFarLength));
            sceneView.RenderingStarted += sceneView_RenderingStarted;
            sceneView.RenderingEnded   += sceneView_RenderingEnded;
            sceneView.SchemeName        = schemeName;
            if (CameraCreated != null)
            {
                CameraCreated.Invoke(this);
            }
        }
Пример #3
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);
 }
Пример #4
0
 private void createDebugVisualizers()
 {
     if (!firstShow && currentScene != null)
     {
         medicalController.OnLoopUpdate += MedicalController_OnLoopUpdate;
         foreach (DebugInterface debugInterface in pluginManager.DebugInterfaces)
         {
             debugInterface.createDebugInterface(pluginManager.RendererPlugin, currentScene.getDefaultSubScene());
         }
     }
 }
Пример #5
0
        public void sceneLoaded(SimScene scene)
        {
            SimSubScene subScene = scene.getDefaultSubScene();

            if (subScene != null)
            {
                drawingSurface = rendererPlugin.createDebugDrawingSurface(name + "DebugSurface", subScene);
                drawingSurface.setDepthTesting(false);
                drawingSurface.setVisible(visible);
            }
        }
Пример #6
0
 public void destroyScene()
 {
     if (scene != null)
     {
         foreach (DebugInterface debugInterface in controller.PluginManager.DebugInterfaces)
         {
             debugInterface.destroyDebugInterface(controller.PluginManager.RendererPlugin, scene.getDefaultSubScene());
         }
         if (OnSceneUnloading != null)
         {
             OnSceneUnloading.Invoke(this, scene);
         }
         scene.Scope.Dispose();
         scene.Dispose();
         scene = null;
         if (OnSceneUnloaded != null)
         {
             OnSceneUnloaded.Invoke(this, null);
         }
     }
 }
Пример #7
0
        public void sceneUnloading(SimScene scene)
        {
            SimSubScene subScene = scene.getDefaultSubScene();

            if (subScene != null && manualObject != null)
            {
                OgreSceneManager sceneManager = subScene.getSimElementManager <OgreSceneManager>();
                sceneManager.SceneManager.getRootSceneNode().removeChild(sceneNode);
                sceneNode.detachObject(manualObject);
                sceneManager.SceneManager.destroyManualObject(manualObject);
                sceneManager.SceneManager.destroySceneNode(sceneNode);
                manualObject = null;
                sceneNode    = null;
            }
        }
Пример #8
0
        public void sceneLoaded(SimScene scene)
        {
            if (!activeSceneLights.ContainsKey(scene))
            {
                SimSubScene subScene = scene.getDefaultSubScene();

                if (subScene.hasSimElementManagerType(typeof(OgreSceneManager)))
                {
                    OgreSceneManager sceneManager = subScene.getSimElementManager <OgreSceneManager>();
                    Light            light        = sceneManager.SceneManager.createLight("CameraLight");
                    LightMover       lightMover   = new LightMover(light);
                    sceneManager.SceneManager.addSceneListener(lightMover);
                    activeSceneLights.Add(scene, lightMover);
                }
            }
        }
Пример #9
0
        internal void destroyCamera(SimScene scene)
        {
            if (cameraPositioner != null)
            {
                SimSubScene      defaultScene = scene.getDefaultSubScene();
                OgreSceneManager sceneManager = defaultScene.getSimElementManager <OgreSceneManager>();

                renderTexture.destroyViewport(vp);
                vp = null;

                node.detachObject(camera);
                sceneManager.SceneManager.destroyCamera(camera);
                sceneManager.SceneManager.destroySceneNode(node);
                cameraPositioner = null;
            }
        }
Пример #10
0
        /// <summary>
        /// Create a model.
        /// </summary>
        /// <param name="meshName">The name of the mesh to load.</param>
        /// <param name="scene">The scene to load the mesh into.</param>
        public void createModel(String meshName, SimScene scene)
        {
            entityDefintion.MeshName = meshName;
            currentSimObject         = simObjectDefinition.register(scene.getDefaultSubScene());
            Stopwatch sw = new Stopwatch();

            sw.Start();
            scene.buildScene(SceneBuildOptions.None);
            sw.Stop();
            Log.Info("Scene loaded in {0} ms.", sw.ElapsedMilliseconds);
            entity = ((SceneNodeElement)currentSimObject.getElement("EntityNode")).getNodeObject("Entity") as Entity;
            readModelInfo();
            entity.setDisplaySkeleton(showSkeleton);
            selectableModel.ModelObject = currentSimObject;
            controller.ObjectMover.clearMovableObjects();
            controller.ObjectMover.addMovableObject("model", selectableModel);
        }
Пример #11
0
        public void sceneLoaded(SimScene scene)
        {
            SimSubScene subScene = scene.getDefaultSubScene();

            if (subScene != null)
            {
                OgreSceneManager sceneManager = subScene.getSimElementManager <OgreSceneManager>();
                manualObject = sceneManager.SceneManager.createManualObject(name + "__MeasurementManualObject");
                manualObject.setRenderQueueGroup(95);
                manualObject.RedrawRequired += manualObject_RedrawRequired;
                sceneNode = sceneManager.SceneManager.createSceneNode(name + "__MeasurementManualObjectSceneNode");
                sceneNode.attachObject(manualObject);
                sceneNode.setVisible(visible);
                sceneNode.setPosition(origin);
                sceneManager.SceneManager.getRootSceneNode().addChild(sceneNode);
                redraw();
            }
        }
Пример #12
0
        public void sceneLoaded(SimScene scene)
        {
            destroyMenu();

            SimulationScene simScene = scene.getDefaultSubScene().getSimElementManager <SimulationScene>();

            presetWindows = simScene.WindowPresets;

            windowMenu         = Gui.Instance.createWidgetT("PopupMenu", "PopupMenu", 0, 0, 1000, 1000, Align.Default, "Overlapped", "LayerMenu") as PopupMenu;
            windowMenu.Visible = false;
            foreach (SceneViewWindowPresetSet preset in presetWindows.PresetSets)
            {
                MenuItem item = windowMenu.addItem(preset.Name, MenuItemType.Normal);
                item.UserObject        = preset.Name;
                item.MouseButtonClick += item_MouseButtonClick;
            }
            windowMenu.Closed += new MyGUIEvent(windowMenu_Closed);
        }
Пример #13
0
        public void sceneUnloading(SimScene scene)
        {
            if (scene != null && activeSceneLights.ContainsKey(scene))
            {
                SimSubScene subScene = scene.getDefaultSubScene();

                if (subScene.hasSimElementManagerType(typeof(OgreSceneManager)))
                {
                    LightMover lightMover = activeSceneLights[scene];

                    OgreSceneManager sceneManager = subScene.getSimElementManager <OgreSceneManager>();
                    sceneManager.SceneManager.destroyLight(lightMover.Light);
                    sceneManager.SceneManager.removeSceneListener(lightMover);

                    activeSceneLights.Remove(scene);
                }
            }
        }
Пример #14
0
        public void createIkControls(SimScene scene)
        {
            if (!canConnectToScene())
            {
                return;
            }

            var subScene = scene.getDefaultSubScene();

            ikDebug = medicalController.PluginManager.RendererPlugin.createDebugDrawingSurface("KinectIKDebug", subScene);
            ikDebug.setVisible(debugVisible);

            hips = createKinectBone(JointType.SpineBase, "Pelvis", "Pelvis", null, scene, subScene);
            KinectIKBone hipsLeft  = createKinectBone(JointType.HipRight, "Pelvis", "Pelvis", hips, new Vector3(15, 0, 0), scene, subScene);
            KinectIKBone hipsRight = createKinectBone(JointType.HipLeft, "Pelvis", "Pelvis", hips, new Vector3(-15, 0, 0), scene, subScene);

            KinectIKBone neck = createKinectBone(JointType.SpineShoulder, "UpperTSpineMover", "UpperTSpineMover", hips, scene, subScene);
            KinectIKBone leftShoulderSpine  = createKinectBone(JointType.ShoulderRight, "UpperTSpineMover", "LeftScapula", neck, Vector3.Zero, scene, subScene, "SpineShoulder");
            KinectIKBone rightShoulderSpine = createKinectBone(JointType.ShoulderLeft, "UpperTSpineMover", "RightScapula", neck, Vector3.Zero, scene, subScene, "SpineShoulder");
            KinectIKBone skull = createKinectBone(JointType.Head, "CSpineMover", "CSpineMover", neck, scene, subScene);

            KinectIKBone leftKnee  = createKinectBone(JointType.KneeRight, "LeftFemur", "LeftFemurTibiaJoint", hipsLeft, scene, subScene);
            KinectIKBone leftAnkle = createKinectBone(JointType.AnkleRight, "LeftTibia", "LeftTibiaFootBaseJoint", leftKnee, scene, subScene);
            KinectIKBone leftFoot  = createKinectBone(JointType.FootRight, "LeftFootBase", "LeftFootBase", leftAnkle, new Vector3(0, -2, 5), scene, subScene);

            KinectIKBone rightKnee  = createKinectBone(JointType.KneeLeft, "RightFemur", "RightFemurTibiaJoint", hipsRight, scene, subScene);
            KinectIKBone rightAnkle = createKinectBone(JointType.AnkleLeft, "RightTibia", "RightTibiaFootBaseJoint", rightKnee, scene, subScene);
            KinectIKBone rightFoot  = createKinectBone(JointType.FootLeft, "RightFootBase", "RightFootBase", rightAnkle, new Vector3(0, -2, 5), scene, subScene);

            KinectIKBone leftShoulder = createKinectBone(JointType.ShoulderRight, "LeftScapula", "LeftScapula", neck, scene, subScene);
            KinectIKBone leftElbow    = createKinectBone(JointType.ElbowRight, "LeftHumerus", "LeftHumerusUlnaJoint", leftShoulder, scene, subScene);
            KinectIKBone leftWrist    = createKinectBone(JointType.WristRight, "LeftUlna", "LeftRadiusHandBaseJoint", leftElbow, scene, subScene);
            KinectIKBone leftThumb    = createKinectBone(JointType.ThumbRight, "LeftHandBase", "LeftHandBase", leftWrist, new Vector3(10, 0, 0), scene, subScene);
            KinectIKBone leftHand     = createKinectBone(JointType.HandRight, "LeftHandBase", "LeftHandBase", leftWrist, new Vector3(0, -15, 2), scene, subScene);

            KinectIKBone rightShoulder = createKinectBone(JointType.ShoulderLeft, "RightScapula", "RightScapula", neck, scene, subScene);
            KinectIKBone rightElbow    = createKinectBone(JointType.ElbowLeft, "RightHumerus", "RightHumerusUlnaJoint", rightShoulder, scene, subScene);
            KinectIKBone rightWrist    = createKinectBone(JointType.WristLeft, "RightUlna", "RightRadiusHandBaseJoint", rightElbow, scene, subScene);
            KinectIKBone rightThumb    = createKinectBone(JointType.ThumbLeft, "RightHandBase", "RightHandBase", rightWrist, new Vector3(-10, 0, 0), scene, subScene);
            KinectIKBone rightHand     = createKinectBone(JointType.HandLeft, "RightHandBase", "RightHandBase", rightWrist, new Vector3(0, -15, 2), scene, subScene);

            face             = createKinectFace("CSpineMover", "CSpineMover", skull, Vector3.Forward * 20, scene, subScene);
            face.JawTracking = jawTracking;
        }
Пример #15
0
        internal void createCamera(SimScene scene, FeedbackCameraPositioner cameraPositioner)
        {
            this.cameraPositioner = cameraPositioner;
            SimSubScene      defaultScene = scene.getDefaultSubScene();
            OgreSceneManager sceneManager = defaultScene.getSimElementManager <OgreSceneManager>();

            camera = sceneManager.SceneManager.createCamera("VirtualTexturing.FeedbackBufferCamera" + id);
            camera.setNearClipDistance(1.0f);
            camera.setAutoAspectRatio(true);
            camera.setFOVy(new Degree(10.0f));
            node = sceneManager.SceneManager.createSceneNode("VirtualTexturing.FeedbackBufferCameraNode" + id);
            node.attachObject(camera);

            vp = renderTexture.addViewport(camera);
            vp.setMaterialScheme(Scheme);
            vp.setVisibilityMask(visibilityMask);
            vp.setBackgroundColor(new Engine.Color(0.0f, 0.0f, 0.0f, 1.0f));
            vp.clear();
        }
Пример #16
0
        /// <summary>
        /// Load the scene in the given ScenePackage.
        /// </summary>
        /// <param name="scenePackage">The ScenePackage to load.</param>
        public IEnumerable <SceneBuildStatus> loadSceneCo(ScenePackage scenePackage, SceneBuildOptions options = SceneBuildOptions.SingleUseDefinitions)
        {
            this.scenePackage = scenePackage;
            yield return(new SceneBuildStatus()
            {
                Message = "Setting up Resources"
            });

            sceneResourceManager.changeResourcesToMatch(scenePackage.ResourceManager);
            sceneResourceManager.initializeResources();

            scene       = scenePackage.SceneDefinition.createScene();
            scene.Scope = pluginManager.GlobalScope.ServiceProvider.CreateScope();
            if (OnSceneLoading != null)
            {
                OnSceneLoading.Invoke(this, scene);
            }
            currentSimObjects = scenePackage.SimObjectManagerDefinition.createSimObjectManager(scene.getDefaultSubScene());
            if (dynamicMode)
            {
                foreach (var status in scene.buildSceneStatus(options))
                {
                    yield return(status);
                }
            }
            else
            {
                scene.buildStaticScene();
            }
            if (OnSceneLoaded != null)
            {
                OnSceneLoaded.Invoke(this, scene);
            }
            foreach (DebugInterface debugInterface in pluginManager.DebugInterfaces)
            {
                debugInterface.createDebugInterface(pluginManager.RendererPlugin, scene.getDefaultSubScene());
            }
        }
Пример #17
0
 void sceneUnloading(SimScene scene)
 {
     currentScene = null;
     if (!firstShow)
     {
         foreach (DebugInterface debugInterface in pluginManager.DebugInterfaces)
         {
             debugInterface.destroyDebugInterface(pluginManager.RendererPlugin, scene.getDefaultSubScene());
         }
     }
 }
Пример #18
0
 private void createDebugVisualizers()
 {
     if (!firstShow && currentScene != null)
     {
         foreach (DebugInterface debugInterface in pluginManager.DebugInterfaces)
         {
             debugInterface.createDebugInterface(pluginManager.RendererPlugin, currentScene.getDefaultSubScene());
         }
     }
 }
Пример #19
0
 void standaloneController_SceneLoaded(SimScene scene)
 {
     this.scene    = scene;
     this.subScene = scene.getDefaultSubScene();
 }
Пример #20
0
 public void sceneChanged(SimScene scene)
 {
     bulletScene = scene.getDefaultSubScene().getSimElementManager <BulletScene>();
 }
Пример #21
0
 /// <summary>
 /// Callback for when the scene is loading. Will create all instances
 /// and add them to their selectables.
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="scene"></param>
 private void SceneController_OnSceneLoading(SceneController controller, SimScene scene)
 {
     this.subScene    = scene.getDefaultSubScene();
     simObjectManager = simObjectManagerDefiniton.createSimObjectManager(scene.getDefaultSubScene());
 }
        /// <summary>
        /// Load the scene in the given ScenePackage.
        /// </summary>
        /// <param name="scenePackage">The ScenePackage to load.</param>
        public IEnumerable <SceneBuildStatus> loadScene(ScenePackage scenePackage, SceneBuildOptions options)
        {
            currentScenePackage = scenePackage;
            yield return(new SceneBuildStatus()
            {
                Message = "Setting up Resources"
            });

            sceneResourceManager.changeResourcesToMatch(scenePackage.ResourceManager);
            sceneResourceManager.initializeResources();

            currentScene = scenePackage.SceneDefinition.createScene();
            if (OnSceneLoading != null)
            {
                OnSceneLoading.Invoke(this, currentScene);
            }
            currentSimObjects = scenePackage.SimObjectManagerDefinition.createSimObjectManager(currentScene.getDefaultSubScene());
            foreach (var status in currentScene.buildSceneStatus(options))
            {
                yield return(status);
            }
            if (OnSceneLoaded != null)
            {
                OnSceneLoaded.Invoke(this, currentScene);
            }
        }
 void sceneController_OnSceneLoaded(SceneController controller, SimScene scene)
 {
     debugSurface = renderer.createDebugDrawingSurface("EditInterfaceRenderer", scene.getDefaultSubScene());
     if (debugSurface != null)
     {
         debugSurface.moveOrigin(currentOrigin);
         debugSurface.setOrientation(currentRotation);
     }
 }
Пример #24
0
 void standaloneController_SceneUnloading(SimScene scene)
 {
     medicalController.OnLoopUpdate -= MedicalController_OnLoopUpdate;
     currentScene = null;
     if (!firstShow)
     {
         foreach (DebugInterface debugInterface in pluginManager.DebugInterfaces)
         {
             debugInterface.destroyDebugInterface(pluginManager.RendererPlugin, scene.getDefaultSubScene());
         }
     }
 }
 public void createDebugObjects(SimScene scene)
 {
     debugDrawer = medicalController.PluginManager.RendererPlugin.createDebugDrawingSurface("KinectDebug", scene.getDefaultSubScene());
 }
Пример #26
0
 public void createScene()
 {
     scene       = sceneDefinition.createScene();
     scene.Scope = pluginManager.GlobalScope.ServiceProvider.CreateScope(); //Disposed in destroyscene
     if (OnSceneLoading != null)
     {
         OnSceneLoading.Invoke(this, scene);
     }
     createSimObjects();
     if (OnSceneLoaded != null)
     {
         OnSceneLoaded.Invoke(this, scene);
     }
     foreach (DebugInterface debugInterface in controller.PluginManager.DebugInterfaces)
     {
         debugInterface.createDebugInterface(controller.PluginManager.RendererPlugin, scene.getDefaultSubScene());
     }
 }