@@ -40,12 +40,13 @@ public partial class MainWindow : System.Windows.Window
40
40
private int oscPort = 7110 ;
41
41
private const int skeletonCount = 6 ;
42
42
private const int pointScale = 1000 ;
43
+ private bool showSkeleton = true ;
43
44
44
45
// Outputs
46
+ private bool capturing = true ;
45
47
private UdpWriter osc ;
46
48
private StreamWriter fileWriter ;
47
49
private Stopwatch stopwatch ;
48
- private bool capturing = true ;
49
50
private static List < String > oscMapping = new List < String > { "" ,
50
51
"head" , "neck" , "torso" , "waist" ,
51
52
"l_collar" , "l_shoulder" , "l_elbow" , "l_wrist" , "l_hand" , "l_fingertip" ,
@@ -215,6 +216,7 @@ private void WindowLoaded(object sender, System.Windows.RoutedEventArgs e)
215
216
System . Windows . MessageBox . Show ( "Failed to parse the oscPort argument: " + args [ index + 1 ] ) ;
216
217
}
217
218
}
219
+ if ( "showSkeleton" . ToLower ( ) . Equals ( args [ index ] ) ) showSkeleton = StringToBool ( args [ index + 1 ] ) ;
218
220
}
219
221
220
222
// Initialisation
@@ -420,39 +422,51 @@ private void SensorAllFramesReady(object sender, AllFramesReadyEventArgs e)
420
422
}
421
423
422
424
private void SensorFrameHelper ( Boolean allFrames ) {
423
-
424
- using ( DrawingContext dc = this . drawingGroup . Open ( ) )
425
+ if ( capturing )
425
426
{
426
- // Draw a transparent background to set the render size
427
- dc . DrawRectangle ( Brushes . Black , null , new System . Windows . Rect ( 0.0 , 0.0 , RenderWidth , RenderHeight ) ) ;
428
-
429
- if ( skeletons . Length != 0 )
427
+ foreach ( Skeleton skel in skeletons )
430
428
{
431
- foreach ( Skeleton skel in skeletons )
429
+ if ( skel . TrackingState == SkeletonTrackingState . Tracked )
432
430
{
433
- RenderClippedEdges ( skel , dc ) ;
431
+ SendSkeleton ( skel . TrackingId , skel ) ;
432
+ if ( allFrames && faceTracking )
433
+ SendFaceTracking ( skel . TrackingId , skel ) ;
434
+ }
435
+ }
436
+ }
434
437
435
- if ( skel . TrackingState == SkeletonTrackingState . Tracked )
436
- {
437
- this . DrawBonesAndJoints ( skel , dc ) ;
438
- SendSkeleton ( skel . TrackingId , skel ) ;
439
- if ( allFrames )
440
- SendFaceTracking ( skel . TrackingId , skel ) ;
441
- }
442
- else if ( skel . TrackingState == SkeletonTrackingState . PositionOnly )
438
+ if ( showSkeleton )
439
+ {
440
+ using ( DrawingContext dc = this . drawingGroup . Open ( ) )
441
+ {
442
+ // Draw a transparent background to set the render size
443
+ dc . DrawRectangle ( Brushes . Black , null , new System . Windows . Rect ( 0.0 , 0.0 , RenderWidth , RenderHeight ) ) ;
444
+
445
+ if ( skeletons . Length != 0 )
446
+ {
447
+ foreach ( Skeleton skel in skeletons )
443
448
{
444
- dc . DrawEllipse (
445
- this . centerPointBrush ,
446
- null ,
447
- this . SkeletonPointToScreen ( skel . Position ) ,
448
- BodyCenterThickness ,
449
- BodyCenterThickness ) ;
449
+ RenderClippedEdges ( skel , dc ) ;
450
+
451
+ if ( skel . TrackingState == SkeletonTrackingState . Tracked )
452
+ {
453
+ this . DrawBonesAndJoints ( skel , dc ) ;
454
+ }
455
+ else if ( skel . TrackingState == SkeletonTrackingState . PositionOnly )
456
+ {
457
+ dc . DrawEllipse (
458
+ this . centerPointBrush ,
459
+ null ,
460
+ this . SkeletonPointToScreen ( skel . Position ) ,
461
+ BodyCenterThickness ,
462
+ BodyCenterThickness ) ;
463
+ }
450
464
}
451
465
}
452
- }
453
466
454
- // prevent drawing outside of our render area
455
- this . drawingGroup . ClipGeometry = new RectangleGeometry ( new System . Windows . Rect ( 0.0 , 0.0 , RenderWidth , RenderHeight ) ) ;
467
+ // prevent drawing outside of our render area
468
+ this . drawingGroup . ClipGeometry = new RectangleGeometry ( new System . Windows . Rect ( 0.0 , 0.0 , RenderWidth , RenderHeight ) ) ;
469
+ }
456
470
}
457
471
}
458
472
@@ -625,6 +639,17 @@ private void CheckBoxSeatedModeChanged(object sender, System.Windows.RoutedEvent
625
639
}
626
640
}
627
641
642
+ /// <summary>
643
+ /// Handles the checking or unchecking of the seated mode combo box
644
+ /// </summary>
645
+ /// <param name="sender">object sending the event</param>
646
+ /// <param name="e">event arguments</param>
647
+ private void CheckBoxShowSkeletonChanged ( object sender , System . Windows . RoutedEventArgs e )
648
+ {
649
+ this . showSkeleton = this . checkBoxShowSkeleton . IsChecked . GetValueOrDefault ( ) ;
650
+ }
651
+
652
+
628
653
void SendFaceTracking ( int user , Skeleton s )
629
654
{
630
655
if ( ! faceTrackers . ContainsKey ( user ) )
0 commit comments