private const long CALCULATOR_FRAME_TIMEOUT = 60; //number of frames to pass before a calculator can be recycled private static GrabbingInfoCalculator getCalculator(GrabbingInfoSettings settings, Hand hand, InteractionObject volume) { HandObjectPair key = new HandObjectPair(hand.Id, volume); long frameId = hand.Frame.Id; int index = -1; if (!_indexMap.TryGetValue(key, out index)) { for (int i = 0; i < _calculators.Count; i++) { if (_calculators[i].lastUpdatedFrameId < frameId - CALCULATOR_FRAME_TIMEOUT) { _calculators[i].reset(settings, volume); _indexMap[key] = i; return(_calculators[i]); } } GrabbingInfoCalculator newCalculator = new GrabbingInfoCalculator(settings, volume); _indexMap[key] = _calculators.Count; _calculators.Add(newCalculator); return(newCalculator); } return(_calculators[index]); }
public static float getGrabStrength(GrabbingInfoSettings settings, Hand hand, InteractionObject volume, bool isCurrentlyGrabbing) { GrabbingInfoCalculator calculator = getCalculator(settings, hand, volume); calculator.ensureUpdated(hand, isCurrentlyGrabbing); return(calculator.grabValue); }
public CurvedFilteredValueCalculator(GrabbingInfoCalculator info, T settings, ValueType valueType) : base(info, settings, valueType) { }
public HandRotationRateCalculator(GrabbingInfoCalculator info, GrabbingInfoSettings.HandRotationRateSettings settings, ValueType valueType) : base(info, settings, valueType) { }
public ValueCalculator(GrabbingInfoCalculator infoCalculator, T settings, ValueType valueType) { _infoCalculator = infoCalculator; _settings = settings; _valueType = valueType; }
public HandPalmDistanceReleaseCalculator(GrabbingInfoCalculator info, GrabbingInfoSettings.HandPalmDistanceReleaseSetting settings, ValueType valueType) : base(info, settings, valueType) { }
public HandPalmDirectionCalculator(GrabbingInfoCalculator info, GrabbingInfoSettings.HandPalmDirectionSetting settings, ValueType valueType) : base(info, settings, valueType) { }
public FingerReleasingSpeedCalculator(GrabbingInfoCalculator info, GrabbingInfoSettings.FingerReleasingSpeedSetting settings, ValueType valueType) : base(info, settings, valueType) { }
public FingerGrabbingPoseCalculator(GrabbingInfoCalculator info, GrabbingInfoSettings.FingerGrabbingPoseSetting settings, ValueType valueType) : base(info, settings, valueType) { }
public FingerProximityCalculator(GrabbingInfoCalculator info, GrabbingInfoSettings.FingerProximitySetting settings, ValueType valueType) : base(info, settings, valueType) { }