11using System.Collections;
12using System.Collections.Generic;
23 private Hand _rightHand =
new Hand();
27 return _maxKeyframeTime - _minKeyframeTime;
32 private float _minKeyframeTime = 0f;
34 get {
return _minKeyframeTime; }
38 private float _maxKeyframeTime = 0f;
40 get {
return _maxKeyframeTime; }
51 Debug.Log(
"Loading " + frames.Count +
" frames.");
53 _minKeyframeTime = (float)(frames[0] .Timestamp *
NS_TO_S);
54 _maxKeyframeTime = (float)(frames[frames.Count - 1].Timestamp *
NS_TO_S);
59 foreach (var frame
in frames) {
60 float keyframeTime = (float)(frame.Timestamp *
NS_TO_S - _minKeyframeTime);
67 _frameCurves.CompressCurves();
70 Debug.Log(
"Finished loading frames.");
73 public override bool Sample(
float time,
Frame toFill,
bool clampTimeToValid =
true) {
76 if (!clampTimeToValid && outsideDataBounds(timeToSample)) {
80 _frameCurves.
Sample(timeToSample, toFill, _leftHand, _rightHand);
85 private bool outsideDataBounds(
float time) {
The Frame class represents a set of hand and finger tracking data detected in a single frame.
The Hand class reports the physical characteristics of a detected hand.
const double NS_TO_S
Converts nanoseconds to seconds. Leap frames store timestamps in nanoseconds.
override bool Sample(float time, Frame toFill, bool clampTimeToValid=true)
Samples the recording at the given time. Caller must provide a frame object that will be filled with ...
override void LoadFrames(List< Frame > frames)
Loads the provided sequential frame data into this recording representation.
VectorHand Animation Curve data struct for a Leap frame.
void AddKeyframes(float keyframeTime, Frame frame)
Adds keyframe data from the provided frame to this animation data at the time specified in seconds.
void Sample(float time, Frame intoFrame, Hand intoLeftHand, Hand intoRightHand)
Samples the data in these VectorFrameCurves at the specified time into the provided frame.