Пример #1
0
    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]);
    }
Пример #2
0
    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);
    }
Пример #3
0
 public CurvedFilteredValueCalculator(GrabbingInfoCalculator info, T settings, ValueType valueType) : base(info, settings, valueType)
 {
 }
Пример #4
0
 public HandRotationRateCalculator(GrabbingInfoCalculator info, GrabbingInfoSettings.HandRotationRateSettings settings, ValueType valueType) : base(info, settings, valueType)
 {
 }
Пример #5
0
 public ValueCalculator(GrabbingInfoCalculator infoCalculator, T settings, ValueType valueType)
 {
     _infoCalculator = infoCalculator;
     _settings       = settings;
     _valueType      = valueType;
 }
Пример #6
0
 public HandPalmDistanceReleaseCalculator(GrabbingInfoCalculator info, GrabbingInfoSettings.HandPalmDistanceReleaseSetting settings, ValueType valueType) : base(info, settings, valueType)
 {
 }
Пример #7
0
 public HandPalmDirectionCalculator(GrabbingInfoCalculator info, GrabbingInfoSettings.HandPalmDirectionSetting settings, ValueType valueType) : base(info, settings, valueType)
 {
 }
Пример #8
0
 public FingerReleasingSpeedCalculator(GrabbingInfoCalculator info, GrabbingInfoSettings.FingerReleasingSpeedSetting settings, ValueType valueType) : base(info, settings, valueType)
 {
 }
Пример #9
0
 public FingerGrabbingPoseCalculator(GrabbingInfoCalculator info, GrabbingInfoSettings.FingerGrabbingPoseSetting settings, ValueType valueType) : base(info, settings, valueType)
 {
 }
Пример #10
0
 public FingerProximityCalculator(GrabbingInfoCalculator info, GrabbingInfoSettings.FingerProximitySetting settings, ValueType valueType) : base(info, settings, valueType)
 {
 }