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); } }
public void destroyDebugInterface(RendererPlugin rendererPlugin, SimSubScene subScene) { if (drawingSurface != null) { rendererPlugin.destroyDebugDrawingSurface(drawingSurface); drawingSurface = null; } }
public void createDebugInterface(RendererPlugin rendererPlugin, SimSubScene subScene) { drawingSurface = rendererPlugin.createDebugDrawingSurface("BEPUikDebugSurface", subScene); if (drawingSurface != null) { drawingSurface.setDepthTesting(depthTesting); } }
/// <summary> /// Callback for when the scene is unloading. Will clear all SimObject instances. /// </summary> /// <param name="controller"></param> /// <param name="scene"></param> private void SceneController_OnSceneUnloading(SceneController controller, SimScene scene) { if (simObjectManager != null) { simObjectManager.Dispose(); simObjectManager = null; subScene = null; } }
void MedicalController_OnLoopUpdate(Clock time) { //This is only active if the scene is not null and the debug visualizers are setup SimSubScene subScene = currentScene.getDefaultSubScene(); foreach (DebugInterface debugInterface in pluginManager.DebugInterfaces) { debugInterface.renderDebug(subScene); } }
public void sceneLoaded(SimScene scene) { SimSubScene subScene = scene.getDefaultSubScene(); if (subScene != null) { drawingSurface = rendererPlugin.createDebugDrawingSurface(name + "DebugSurface", subScene); drawingSurface.setDepthTesting(false); drawingSurface.setVisible(visible); } }
/// <summary> /// Register this class with the factory to be built. /// </summary> /// <param name="subscene">The subscene to add this definition to.</param> /// <param name="instance">The SimObject that will get the product.</param> public override void registerScene(SimSubScene subscene, SimObjectBase instance) { if (subscene.hasSimElementManagerType(typeof(OgreSceneManager))) { OgreSceneManager sceneManager = subscene.getSimElementManager <OgreSceneManager>(); sceneManager.getOgreFactory().addSceneNodeDefinition(instance, this); } else { Log.Default.sendMessage("Cannot add SceneNodeDefinition {0} to SimSubScene {1} because it does not contain an OgreSceneManager.", LogLevel.Warning, OgreInterface.PluginName); } }
public override void registerScene(SimSubScene subscene, SimObjectBase instance) { if (subscene.hasSimElementManagerType(typeof(BEPUikScene))) { BEPUikScene sceneManager = subscene.getSimElementManager <BEPUikScene>(); sceneManager.IkFactory.addControl(this, instance); } else { Log.Default.sendMessage("Cannot add BEPUikDragControl {0} to SimSubScene {1} because it does not contain a BEPUikScene.", LogLevel.Warning, BEPUikInterface.PluginName, Name, subscene.Name); } }
public override void registerScene(SimSubScene subscene, SimObjectBase instance) { if (subscene.hasSimElementManagerType(typeof(BulletScene))) { BulletScene sceneManager = subscene.getSimElementManager <BulletScene>(); sceneManager.getBulletFactory().addRigidBody(this, instance); } else { Log.Default.sendMessage("Cannot add RigidBodyDefinition {0} to SimSubScene {1} because it does not contain a BulletSceneManager.", LogLevel.Warning, BulletInterface.PluginName, Name, subscene.Name); } }
public override void registerScene(SimSubScene subscene, SimObjectBase instance) { if (subscene.hasSimElementManagerType(typeof(BehaviorManager))) { BehaviorManager behaviorManager = subscene.getSimElementManager <BehaviorManager>(); behaviorManager.getBehaviorFactory().addBehaviorDefinition(instance, this); } else { Log.Default.sendMessage("Cannot add BehaviorDefinition {0} to SimSubScene {1} because it does not contain a BehaviorManager.", LogLevel.Warning, "Behavior", Name, subscene.Name); } }
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; } }
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; } }
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); } } }
public SceneView createSceneView(SimSubScene subScene, String name, Vector3 positon, Vector3 lookAt, int zIndex) { if (subScene.hasSimElementManagerType(typeof(OgreSceneManager))) { OgreSceneManager sceneManager = subScene.getSimElementManager <OgreSceneManager>(); OgreSceneView camControl = new OgreSceneView(name, sceneManager, OgreRenderTarget, zIndex); camControl.Translation = positon; camControl.LookAt = lookAt; return(camControl); } else { Log.Default.sendMessage("Cannot create a camera in the subscene {0} named {1} because the subscene has no OgreSceneManager.", LogLevel.Warning, OgreInterface.PluginName, subScene.Name, name); return(null); } }
public void renderDebug(SimSubScene subScene) { if (enabled) { BehaviorManager manager = subScene.getSimElementManager <BehaviorManager>(); if (manager != null) { manager.renderDebugInfo(drawingSurface); } } else if (clearSurface) { clearSurface = false; drawingSurface.clearAll(); } }
public void renderDebug(SimSubScene subScene) { if (enabled) { BEPUikScene sceneManager = subScene.getSimElementManager <BEPUikScene>(); if (sceneManager != null) { sceneManager.drawDebug(drawingSurface, drawMode); } } else if (clearDebugSurface) { drawingSurface.clearAll(); clearDebugSurface = false; } }
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); }
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); } } }
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(); } }
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(); }
public void renderDebug(SimSubScene subScene) { if (enabled) { BulletScene sceneManager = subScene.getSimElementManager <BulletScene>(); if (sceneManager != null) { sceneManager.drawDebug(drawingSurface); } } else if (firstFrameDisabled) { BulletScene sceneManager = subScene.getSimElementManager <BulletScene>(); if (sceneManager != null) { sceneManager.clearDebug(drawingSurface); } firstFrameDisabled = false; } }
/// <summary> /// Create a new DebugDrawingSurface named name in the specified scene /// that renders in the specified way. /// </summary> /// <param name="name">The name of the DrawingSurface. Must be unique.</param> /// <param name="sceneName">The name of the scene to create the surface into.</param> /// <param name="drawingType">The DrawingType of the surface.</param> /// <returns>A new DebugDrawingSurface configured appropriatly.</returns> public DebugDrawingSurface createDebugDrawingSurface(String name, SimSubScene scene) { if (scene != null) { if (scene.hasSimElementManagerType(typeof(OgreSceneManager))) { return(new OgreDebugSurface(name, scene.getSimElementManager <OgreSceneManager>().SceneManager)); } else { Log.Default.sendMessage("Could not find an OgreSceneManager in the SimSubScene {0}. Could not create OgreDebugSurface.", LogLevel.Error, PluginName, scene.Name); return(null); } } else { Log.Default.sendMessage("Could not create OgreDebugSurface. SimSubScene was null.", LogLevel.Error, PluginName); return(null); } }
private KinectIKBone createKinectBone(JointType jointType, String boneSimObjectName, String translationSimObjectName, KinectIKBone parent, SimScene scene, SimSubScene subScene) { return(createKinectBone(jointType, boneSimObjectName, translationSimObjectName, parent, Vector3.Zero, scene, subScene)); }
/// <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()); }
void standaloneController_SceneLoaded(SimScene scene) { this.scene = scene; this.subScene = scene.getDefaultSubScene(); }
void standaloneController_SceneUnloading(SimScene scene) { scene = null; subScene = null; }
public SceneView createSceneView(SimSubScene subScene, String name, Vector3 position, Vector3 lookAt) { return(createSceneView(subScene, name, position, lookAt, OgreRenderTarget.getNumViewports())); }
private KinectIKFace createKinectFace(String boneSimObjectName, String translationSimObjectName, KinectIKBone parent, Vector3 additionalOffset, SimScene scene, SimSubScene subScene) { dragControl.BoneSimObjectName = boneSimObjectName; var targetSimObject = medicalController.getSimObject(dragControl.BoneSimObjectName); var ikBone = targetSimObject.getElement("IKBone") as BEPUikBone; ikBone.Pinned = false; dragSimObjectDefinition.Name = "KinectFaceControl"; dragSimObjectDefinition.Enabled = allowMovement; dragSimObjectDefinition.Translation = medicalController.getSimObject(translationSimObjectName).Translation + additionalOffset; SimObjectBase instance = dragSimObjectDefinition.register(subScene); medicalController.addSimObject(instance); scene.buildScene(); ikDragSimObjects.Add(instance); float distanceToParent = 0; if (parent != null) { distanceToParent = (instance.Translation - parent.Translation).length(); } return(new KinectIKFace(parent, distanceToParent, instance)); }