public override void Initialize(IApplication application) { base.Initialize(application); LeapMotionService leapMotionService = new LeapMotionService(); WaveServices.RegisterService(leapMotionService); leapMotionService.StartSensor(LeapFeatures.Hands | LeapFeatures.CameraImages); ScreenContext screenContext = new ScreenContext(new MyScene()); WaveServices.ScreenContextManager.To(screenContext); }
/// <summary> /// Initialize this instance. /// </summary> protected override void Initialize() { base.Initialize(); this.leapService = WaveServices.GetService <LeapMotionService>(); if (this.leapService == null) { Console.WriteLine("You need to register the LeapMotion service."); } if (!this.leapService.IsReady) { Console.WriteLine("You need to call to start method before."); } this.lineBatch = this.RenderManager.FindLayer(DefaultLayers.Opaque).LineBatch3D; }
/// <summary> /// Initialize this instance. /// </summary> protected override void Initialize() { base.Initialize(); this.leapService = WaveServices.GetService <LeapMotionService>(); if (this.leapService == null) { throw new InvalidOperationException("You need to register the LeapMotion service."); } if (!this.leapService.IsReady) { throw new InvalidOperationException("You need to call to start method before."); } this.InitializeHierachy(); }
/// <summary> /// Initialize the LeapMotionRig entity hierarchy. /// </summary> protected override void Initialize() { base.Initialize(); this.LeapService = WaveServices.GetService <LeapMotionService>(); if (this.LeapService == null) { Console.WriteLine("You need to register the LeapMotion service."); } if (!this.LeapService.IsReady) { Console.WriteLine("You need to call to start method before."); } if (this.TrackingSpace == null) { this.TrackingSpace = this.ConfigureRootAnchor("TrackingSpace"); } this.TrackingSpaceTransform = this.TrackingSpace.FindComponent <Transform3D>(); if (this.LeftHandAnchor == null) { this.LeftHandAnchor = this.ConfigureHandAnchor(this.TrackingSpace, "LeftHand"); } this.LeftHandRig = this.LeftHandAnchor.FindComponent <HandRig>(); this.LeftHandTransform = this.LeftHandAnchor.FindComponent <Transform3D>(); if (this.RightHandAnchor == null) { this.RightHandAnchor = this.ConfigureHandAnchor(this.TrackingSpace, "RightHand"); } this.RightHandRig = this.RightHandAnchor.FindComponent <HandRig>(); this.RightHandTransform = this.RightHandAnchor.FindComponent <Transform3D>(); }
protected override void CreateScene() { Matrix m = Matrix.Identity; Vector3 forward = m.Forward; Vector3 backward = m.Backward; //WaveServices.ScreenContextManager.SetDiagnosticsActive(true); this.Load(WaveContent.Scenes.MyScene); var vrCamera = this.EntityManager.Find("VRCamera"); this.cameraRig = vrCamera.FindComponent <VRCameraRig>(); cameraRig.Monoscopic = false; cameraRig.VRMode = VRMode.AttachedMode; cameraRig.BackgroundColor = Color.CornflowerBlue; var cardboard = new CardboardVRProvider() { IsBarrelDistortionEnabled = true, IsNeckDisplacementEnabled = true, }; vrCamera.AddComponent(cardboard); FreeCamera3D freeCamera3D = new FreeCamera3D("freeCam", Vector3.One * 4, Vector3.Zero); var cam3D = freeCamera3D.Entity.FindComponent <Camera3D>(); cam3D.Viewport = new Viewport(0, 0, 0.2f, 0.2f); cam3D.ClearFlags = ClearFlags.DepthAndStencil; cam3D.CameraOrder = 10; this.EntityManager.Add(freeCamera3D); ////var oculus = new OculusVRProvider() ////{ //// ShowHMDMirrorTexture = true ////}; ////vrCamera.AddComponent(oculus); var leapMotionService = new LeapMotionService(); WaveServices.RegisterService(leapMotionService); leapMotionService.StartSensor(LeapFeatures.Hands | LeapFeatures.HMDMode); ////this.toggleSwitch = new ToggleSwitch(); ////this.toggleSwitch.Toggled += toggleSwitch_Toggled; ////this.EntityManager.Add(this.toggleSwitch); ////videos = new VideoInfo[2]; ////WaveServices.VideoPlayer.Play(videos[0]); ////WaveServices.VideoPlayer.IsLooped = true; ////var screenMaterial = this.Assets.LoadModel<MaterialModel>(WaveContent.Assets.Material.TVScreenMaterial); ////(screenMaterial.Material as StandardMaterial).Diffuse = WaveServices.VideoPlayer.VideoTexture; }
/// <summary> /// Initialize the LeapMotionRig entity hierarchy. /// </summary> protected override void Initialize() { base.Initialize(); this.LeapService = WaveServices.GetService<LeapMotionService>(); if (this.LeapService == null) { Console.WriteLine("You need to register the LeapMotion service."); } if (!this.LeapService.IsReady) { Console.WriteLine("You need to call to start method before."); } if (this.TrackingSpace == null) { this.TrackingSpace = this.ConfigureRootAnchor("TrackingSpace"); } this.TrackingSpaceTransform = this.TrackingSpace.FindComponent<Transform3D>(); if (this.LeftHandAnchor == null) { this.LeftHandAnchor = this.ConfigureHandAnchor(this.TrackingSpace, "LeftHand"); } this.LeftHandRig = this.LeftHandAnchor.FindComponent<HandRig>(); this.LeftHandTransform = this.LeftHandAnchor.FindComponent<Transform3D>(); if (this.RightHandAnchor == null) { this.RightHandAnchor = this.ConfigureHandAnchor(this.TrackingSpace, "RightHand"); } this.RightHandRig = this.RightHandAnchor.FindComponent<HandRig>(); this.RightHandTransform = this.RightHandAnchor.FindComponent<Transform3D>(); }
/// <summary> /// Initialize this instance. /// </summary> protected override void Initialize() { base.Initialize(); this.leapService = WaveServices.GetService <LeapMotionService>(); if (this.leapService == null) { Console.WriteLine("You need to register the LeapMotion service."); return; } if (!this.leapService.IsReady) { Console.WriteLine("You need to call to start method before."); return; } Color rightColor = Color.LightGreen; Color leftColor = Color.LightBlue; float defaultScale = 0.018f; float palmScale = 0.025f; this.entities = new Dictionary <string, Entity>(); // Hands foreach (HandType handType in Enum.GetValues(typeof(HandType))) { string handName = handType.ToString(); Color color = (handType == HandType.R) ? rightColor : leftColor; // Palm this.entities.Add(string.Format("{0}Palm", handName), this.CreateNode(handName, color, palmScale)); this.entities.Add(string.Format("{0}Palm1", handName), this.CreateNode(handName, color, defaultScale)); string edgePalm1 = string.Format("{0}{1}{2}_To_{0}Palm1", handName, Finger.FingerType.TYPE_THUMB, Finger.FingerJoint.JOINT_MCP); this.entities.Add(edgePalm1, this.CreateEdge(handName)); string edgePalm2 = string.Format("{0}Palm1_To_{0}{1}{2}", handName, Finger.FingerType.TYPE_PINKY, Finger.FingerJoint.JOINT_MCP); this.entities.Add(edgePalm2, this.CreateEdge(handName)); // Fingers string beforeMCPFinger = string.Empty; foreach (Finger.FingerType fingerType in Enum.GetValues(typeof(Finger.FingerType))) { string beforeNodeName = string.Empty; foreach (Finger.FingerJoint jointType in Enum.GetValues(typeof(Finger.FingerJoint))) { string nodeName = string.Format("{0}_{1}_{2}", handName, fingerType, jointType).ToLowerInvariant(); this.entities.Add(nodeName, this.CreateNode(handName, color, defaultScale)); if (!string.IsNullOrEmpty(beforeNodeName)) { string edgeName = string.Format("{0}_To_{1}", beforeNodeName, nodeName).ToLowerInvariant(); this.entities.Add(edgeName, this.CreateEdge(handName)); } if (jointType == Finger.FingerJoint.JOINT_MCP && !string.IsNullOrEmpty(beforeMCPFinger)) { string edgeName = string.Format("{0}_To_{1}", beforeMCPFinger, nodeName).ToLowerInvariant(); this.entities.Add(edgeName, this.CreateEdge(handName)); } beforeNodeName = nodeName; if (jointType == Finger.FingerJoint.JOINT_MCP) { beforeMCPFinger = nodeName; } } } } foreach (Entity e in this.entities.Values) { this.Owner.AddChild(e); } }
/// <summary> /// Initialize this instance. /// </summary> protected override void Initialize() { base.Initialize(); this.leapService = WaveServices.GetService<LeapMotionService>(); if (this.leapService == null) { throw new InvalidOperationException("You need to register the LeapMotion service."); } if (!this.leapService.IsReady) { throw new InvalidOperationException("You need to call to start method before."); } this.InitializeHierachy(); }