示例#1
0
        public void RegisterConfig(JointDeltaConfig config)
        {
            bool containsKeyAlready = _requestors.ContainsKey(config.InstanceID);

            Assert.IsFalse(containsKeyAlready,
                           "Trying to register multiple configs with the same id into " +
                           "JointDeltaProvider.");

            _requestors.Add(config.InstanceID, new List <HandJointId>(config.JointIDs));

            // Check if any new joints added, if so then add to cache
            foreach (var joint in config.JointIDs)
            {
                if (!_poseDataCache.ContainsKey(joint))
                {
                    _poseDataCache.Add(joint, new PoseData[2]
                    {
                        new PoseData(), new PoseData()
                    });

                    // New joint tracked, so write current data
                    PoseData toWrite = _poseDataCache[joint][CurDataIndex];
                    toWrite.IsValid = Hand.GetJointPose(joint, out toWrite.Pose);
                }
            }
        }
        protected virtual void Start()
        {
            this.BeginStart(ref _started);

            Assert.IsNotNull(Hand);
            Assert.IsNotNull(FeatureConfigs);
            Assert.IsNotNull(_timeProvider);

            IList <HandJointId> allTrackedJoints = new List <HandJointId>();

            foreach (var config in FeatureConfigs)
            {
                allTrackedJoints.Add(config.Feature);
                _featureStates.Add(config, new JointRotationFeatureState());
            }
            _jointDeltaConfig = new JointDeltaConfig(GetInstanceID(), allTrackedJoints);

            bool foundAspect = Hand.GetHandAspect(out JointDeltaProvider aspect);

            Assert.IsTrue(foundAspect);
            JointDeltaProvider = aspect;

            _lastUpdateTime = _timeProvider();
            this.EndStart(ref _started);
        }
示例#3
0
 public void UnRegisterConfig(JointDeltaConfig config)
 {
     _requestors.Remove(config.InstanceID);
 }