Browse Source

Added Forearm Position to output.
Fixed Exception when calling device.stop() in destruktor.

Daniel Kauth 11 years ago
parent
commit
17174b5b78
2 changed files with 20 additions and 3 deletions
  1. 1 1
      bbiwarg/DataSource/VideoHandle.cs
  2. 19 2
      bbiwarg/Graphics/Output.cs

+ 1 - 1
bbiwarg/DataSource/VideoHandle.cs

@@ -33,7 +33,7 @@ namespace bbiwarg.DataSource
 
         ~VideoHandle() 
         {
-            inputProvider.stop();
+            //inputProvider.stop();
         }
 
         public void nextFrame() 

+ 19 - 2
bbiwarg/Graphics/Output.cs

@@ -39,6 +39,12 @@ namespace bbiwarg.Graphics
 
         protected override void OnRenderFrame(FrameEventArgs e)
         {
+            if (!inputProvider.isActive())
+            {
+                inputProvider.stop();
+                return;
+            }
+
             base.OnRenderFrame(e);
             GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
             Matrix4 modelview = Matrix4.LookAt(Vector3.Zero, -Vector3.UnitZ, Vector3.UnitY);
@@ -74,10 +80,11 @@ namespace bbiwarg.Graphics
                     ++numFingersDetected;
             }
 
-            pointData = new float[(4 + 3) * (2 + numFingersDetected)];
+            pointData = new float[(4 + 3) * (3 + numFingersDetected)];
             Color y = Color.Yellow;
             Vector palmPosition = videoHandle.getPalmPosition3D(1);
             Vector foreFingerPosition = videoHandle.pixel2VertexPosition(foreFingerDetection.getForeFingerPosition3D(1));
+            Vector foreArmPosition = inputProvider.getForearmPosition3D(1);
 
             pointData[0] = palmPosition[0];
             pointData[1] = palmPosition[1];
@@ -88,7 +95,17 @@ namespace bbiwarg.Graphics
             pointData[5] = y.B / 255.0f;
             pointData[6] = y.A / 255.0f;
 
-            int index = 7;
+            pointData[7] = foreArmPosition[0];
+            pointData[8] = foreArmPosition[1];
+            pointData[9] = -foreArmPosition[2];
+
+            pointData[10] = y.R / 255.0f;
+            pointData[11] = y.G / 255.0f;
+            pointData[12] = y.B / 255.0f;
+            pointData[13] = y.A / 255.0f;
+
+
+            int index = 14;
             Vector[] fingerPositions = inputProvider.getFingerTipPositions3D(1);
             for (int i = 0; i < fingerStatus.Length; ++i)
             {