public override void render(float elapsedTime) { Device d3dDevice = GuiController.Instance.D3dDevice; TgcKinectSkeletonData data = tgcKinect.update(); if (data.Active) { tgcKinect.DebugSkeleton.render(data.Current.KinectSkeleton); Vector3 headPos = TgcKinectUtils.toVector3(data.Current.KinectSkeleton.Joints[JointType.Head].Position); Vector3 centerPos = TgcKinectUtils.toVector3(data.Current.KinectSkeleton.Joints[JointType.HipCenter].Position); float length = Vector3.Length(headPos - centerPos); BigLogger.log("Length", length); BigLogger.log("HipCenter", data.Current.CenterPos); BigLogger.log("RightHandPos", data.Current.RightHandPos); BigLogger.log("LefttHandPos", data.Current.LefttHandPos); BigLogger.renderLog(); } GuiController.Instance.UserVars["tracking"] = data.Active.ToString(); center.render(); bounds.render(); }
public override void render(float elapsedTime) { Device d3dDevice = GuiController.Instance.D3dDevice; //Tomar tracking de kinect TgcKinectSkeletonData data = tgcKinect.update(); if (data.Active) { //Aplicar datos de kinect a mesh mesh.KinectSkeleton = data.Current.KinectSkeleton; bool renderMesh = (bool)GuiController.Instance.Modifiers["mesh"]; if (renderMesh) { mesh.animateAndRender(); } //Render de esqueleto bool renderSkeleton = (bool)GuiController.Instance.Modifiers["skeleton"]; if (renderSkeleton) { tgcKinect.DebugSkeleton.render(data.Current.KinectSkeleton); } } }
public override void render(float elapsedTime) { Device d3dDevice = GuiController.Instance.D3dDevice; //Velocidad de movimiento 2D tgcKinect.Hands2dSpeed = new Vector2((float)GuiController.Instance.Modifiers["speedX"], (float)GuiController.Instance.Modifiers["speedY"]); //Actualizar estado de kinect TgcKinectSkeletonData data = tgcKinect.update(); if (data.Active) { //Render de esqueleto debug tgcKinect.DebugSkeleton.render(data.Current.KinectSkeleton); //Debug de pos de manos bool showValues = (bool)GuiController.Instance.Modifiers["showValues"]; if (showValues) { BigLogger.log("RightHandPos", data.Current.RightHandPos); BigLogger.log("LefttHandPos", data.Current.LefttHandPos); BigLogger.renderLog(); } //Dibujar cursores rightHandPointer.Position = data.Current.RightHandPos; leftHandPointer.Position = data.Current.LefttHandPos; GuiController.Instance.Drawer2D.beginDrawSprite(); rightHandPointer.render(); leftHandPointer.render(); GuiController.Instance.Drawer2D.endDrawSprite(); } //Dibujar limites de escena center.render(); bounds.render(); }
public override void render(float elapsedTime) { Device d3dDevice = GuiController.Instance.D3dDevice; //Tomar tracking de kinect TgcKinectSkeletonData data = tgcKinect.update(); if (data.Active) { //Render de esqueleto tgcKinect.DebugSkeleton.render(data.Current.KinectSkeleton); //Analizar gestos Gesture gesture; if (gestureAnalizer.analize(data, out gesture)) { switch (gesture.Type) { //Gesto de abrir cajon case GestureType.OpenZ: //Buscar si fue cerca de algun cajon valido foreach (GestureLocker cajon in cajones) { if (cajon.validateGesture(gesture)) { cajon.open(); break; } } break; //Gesto de cerrar cajon case GestureType.CloseZ: //Buscar si fue cerca de algun cajon valido foreach (GestureLocker cajon in cajones) { if (cajon.validateGesture(gesture)) { cajon.close(); break; } } break; } } } //Dibujar cajones foreach (GestureLocker l in cajones) { l.update(); l.HandleSphere.render(); l.Mesh.render(); l.Mesh.BoundingBox.render(); } //Dibujar BoundingSphere de manos del esqueleto data.Current.RightHandSphere.render(); data.Current.LeftHandSphere.render(); //Dibujar mueble mueble.render(); center.render(); sceneBounds.render(); }
public override void render(float elapsedTime) { Device d3dDevice = GuiController.Instance.D3dDevice; TgcKinectSkeletonData data = tgcKinect.update(); if (data.Active) { //render esqueleto kinect tgcKinect.DebugSkeleton.render(data.Current.KinectSkeleton); //Analizar gestos Gesture gesture; if (gestureAnalizer.analize(data, out gesture)) { switch (gesture.Type) { //Gesto de abrir cajon case GestureType.OpenZ: abrirCajon(gesture.Pos); break; //Gesto de cerrar cajon case GestureType.CloseZ: cerrarCajon(gesture.Pos); break; } } } foreach (TgcMesh m in _meshes) { m.render(); } if (GuiController.Instance.D3dInput.keyPressed(Microsoft.DirectX.DirectInput.Key.Z)) { foreach (CajonFocus cajon in cajones) { cajon.open(); } } if (GuiController.Instance.D3dInput.keyPressed(Microsoft.DirectX.DirectInput.Key.X)) { foreach (CajonFocus cajon in cajones) { cajon.close(); } } foreach (CajonFocus cajon in cajones) { cajon.update(); cajon.render(); } /* * foreach (FocusSet c in _conjuntos) * { * //c.animate(); * //c.Render(); * } */ center.render(); bounds.render(); }
public override void render(float elapsedTime) { Device d3dDevice = GuiController.Instance.D3dDevice; showAcumTime += elapsedTime; TgcKinectSkeletonData data = tgcKinect.update(); if (data.Active) { tgcKinect.DebugSkeleton.render(data.Current.KinectSkeleton); //Buscar gesto en mano derecha TgcKinectSkeletonData.AnalysisData rAnalysisData = data.HandsAnalysisData[TgcKinectSkeletonData.RIGHT_HAND]; if (showAcumTime > 0.3f) { showAcumTime = 0; estadisticas = "Diff AvgZ: " + printFloat(rAnalysisData.Z.DiffAvg) + ", AvgZ: " + printFloat(rAnalysisData.Z.Avg) + ", varX: " + printFloat(rAnalysisData.X.Variance) + " varY: " + printFloat(rAnalysisData.Y.Variance); posicion = "Pos rHand: " + TgcParserUtils.printVector3(data.Current.RightHandSphere.Center); } GuiController.Instance.Text3d.drawText(estadisticas, 50, 150, Color.Yellow); GuiController.Instance.Text3d.drawText(posicion, 50, 200, Color.Yellow); if (gestoDetectado) { acumTime += elapsedTime; if (acumTime > 1) { gestoDetectado = false; text.Color = Color.Red; text.Text = "Nada"; } } else { /* * if ((rAnalysisData.Z.Max - rAnalysisData.Z.Min) > 10f) * { * gestoDetectado = true; * acumTime = 0; * text.Color = Color.Green; * text.Text = "Abriendo cajon"; * } */ float diff = (float)GuiController.Instance.Modifiers["diff"]; //Gesto de abrir cajon if (rAnalysisData.Z.DiffAvg < diff && FastMath.Abs(rAnalysisData.X.Variance) < 5f && FastMath.Abs(rAnalysisData.Y.Variance) < 10f) { gestoDetectado = true; acumTime = 0; text.Color = Color.Green; text.Text = "Abriendo cajon"; } } } text.render(); }
public override void render(float elapsedTime) { Device d3dDevice = GuiController.Instance.D3dDevice; //Tomar tracking de kinect TgcKinectSkeletonData data = tgcKinect.update(); if (data.Active) { //Render de esqueleto tgcKinect.DebugSkeleton.render(data.Current.KinectSkeleton); if (Vector3.Length(data.Current.CenterPos - sceneCenter) <= 30f) { sceneCenterBox.Color = Color.Red; sceneCenterBox.updateValues(); //Analizar gestos Gesture gesture; if (gestureAnalizer.analize(data, out gesture)) { switch (gesture.Type) { case GestureType.OpenLeft: if (door.validateGesture(gesture)) { door.open(); } break; case GestureType.OpenRight: if (door.validateGesture(gesture)) { door.close(); } break; } } } else { sceneCenterBox.Color = Color.Blue; sceneCenterBox.updateValues(); } } //Dibujar puerta door.update(); door.Mesh.render(); //Dibujar BoundingSphere de manos del esqueleto data.Current.RightHandSphere.render(); data.Current.LeftHandSphere.render(); //Dibujar mueble mueble.render(); sceneBounds.render(); sceneCenterBox.render(); }