public SkeletonReplay(Stream stream) { BinaryReader reader = new BinaryReader(stream); int frameNumber = 0; while (reader.BaseStream.Position != reader.BaseStream.Length) { ReplaySkeletonFrame frame = new ReplaySkeletonFrame(reader, frameNumber++); frames.Add(frame); } reader.Dispose(); stream.Dispose(); }
public void Draw(ReplaySkeletonFrame frame) { rootCanvas.Children.Clear(); foreach (ReplaySkeletonData skeleton in frame.Skeletons) { if (skeleton.TrackingState != SkeletonTrackingState.Tracked) continue; Plot(JointID.HandLeft, skeleton.Joints); Trace(JointID.HandLeft, JointID.WristLeft, skeleton.Joints); Plot(JointID.WristLeft, skeleton.Joints); Trace(JointID.WristLeft, JointID.ElbowLeft, skeleton.Joints); Plot(JointID.ElbowLeft, skeleton.Joints); Trace(JointID.ElbowLeft, JointID.ShoulderLeft, skeleton.Joints); Plot(JointID.ShoulderLeft, skeleton.Joints); Trace(JointID.ShoulderLeft, JointID.ShoulderCenter, skeleton.Joints); Plot(JointID.ShoulderCenter, skeleton.Joints); Trace(JointID.ShoulderCenter, JointID.Head, skeleton.Joints); Plot(JointID.Head, JointID.ShoulderCenter, skeleton.Joints); Trace(JointID.ShoulderCenter, JointID.ShoulderRight, skeleton.Joints); Plot(JointID.ShoulderRight, skeleton.Joints); Trace(JointID.ShoulderRight, JointID.ElbowRight, skeleton.Joints); Plot(JointID.ElbowRight, skeleton.Joints); Trace(JointID.ElbowRight, JointID.WristRight, skeleton.Joints); Plot(JointID.WristRight, skeleton.Joints); Trace(JointID.WristRight, JointID.HandRight, skeleton.Joints); Plot(JointID.HandRight, skeleton.Joints); Trace(JointID.ShoulderCenter, JointID.Spine, skeleton.Joints); Plot(JointID.Spine, skeleton.Joints); Trace(JointID.Spine, JointID.HipCenter, skeleton.Joints); Plot(JointID.HipCenter, skeleton.Joints); Trace(JointID.HipCenter, JointID.HipLeft, skeleton.Joints); Plot(JointID.HipLeft, skeleton.Joints); Trace(JointID.HipLeft, JointID.KneeLeft, skeleton.Joints); Plot(JointID.KneeLeft, skeleton.Joints); Trace(JointID.KneeLeft, JointID.AnkleLeft, skeleton.Joints); Plot(JointID.AnkleLeft, skeleton.Joints); Trace(JointID.AnkleLeft, JointID.FootLeft, skeleton.Joints); Plot(JointID.FootLeft, skeleton.Joints); Trace(JointID.HipCenter, JointID.HipRight, skeleton.Joints); Plot(JointID.HipRight, skeleton.Joints); Trace(JointID.HipRight, JointID.KneeRight, skeleton.Joints); Plot(JointID.KneeRight, skeleton.Joints); Trace(JointID.KneeRight, JointID.AnkleRight, skeleton.Joints); Plot(JointID.AnkleRight, skeleton.Joints); Trace(JointID.AnkleRight, JointID.FootRight, skeleton.Joints); Plot(JointID.FootRight, skeleton.Joints); } }