/// <summary> /// Capture a snapshot of simulated hand data based on current state. /// </summary> public bool UpdateHandData(SimulatedHandData handDataLeft, SimulatedHandData handDataRight) { SimulateUserInput(); bool handDataChanged = false; // TODO: DateTime.UtcNow can be quite imprecise, better use Stopwatch.GetTimestamp // https://stackoverflow.com/questions/2143140/c-sharp-datetime-now-precision long timestamp = DateTime.UtcNow.Ticks; // Cache the generator delegates so we don't gc alloc every frame if (generatorLeft == null) { generatorLeft = HandStateLeft.FillCurrentFrame; } if (generatorRight == null) { generatorRight = HandStateRight.FillCurrentFrame; } handDataChanged |= handDataLeft.UpdateWithTimestamp(timestamp, HandStateLeft.IsTracked, HandStateLeft.IsPinching, generatorLeft); handDataChanged |= handDataRight.UpdateWithTimestamp(timestamp, HandStateRight.IsTracked, HandStateRight.IsPinching, generatorRight); return(handDataChanged); }
/// <summary> /// Capture a snapshot of simulated hand data based on current state. /// </summary> public bool UpdateHandData(SimulatedHandData handDataLeft, SimulatedHandData handDataRight, SimulatedHandData handDataGaze, MouseDelta mouseDelta) { SimulateUserInput(mouseDelta); HandStateLeft.Update(); HandStateRight.Update(); HandStateGaze.Update(); bool handDataChanged = false; // Cache the generator delegates so we don't gc alloc every frame if (generatorLeft == null) { generatorLeft = HandStateLeft.FillCurrentFrame; } if (generatorRight == null) { generatorRight = HandStateRight.FillCurrentFrame; } if (generatorGaze == null) { generatorGaze = HandStateGaze.FillCurrentFrame; } handDataChanged |= handDataLeft.Update(HandStateLeft.IsTracked, HandStateLeft.IsPinching, generatorLeft); handDataChanged |= handDataRight.Update(HandStateRight.IsTracked, HandStateRight.IsPinching, generatorRight); handDataChanged |= handDataGaze.Update(HandStateGaze.IsTracked, HandStateGaze.IsPinching, generatorGaze); return(handDataChanged); }