示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EyePositions"/> class.
 /// </summary>
 /// <param name="leftEye">The eye position of the left eye, see <see cref="SingleEyePosition"/>.</param>
 /// <param name="leftEyeNormalized">The normalized eye position of the left eye, see <see cref="SingleEyePosition"/>.</param>
 /// <param name="rightEye">The eye position of the right eye, see <see cref="SingleEyePosition"/>.</param>
 /// <param name="rightEyeNormalized">The normalized eye position of the right eye, see <see cref="SingleEyePosition"/>.</param>
 /// <param name="sequentialId">The sequential ID of the eye position data.</param>
 /// <param name="timestamp">The timestamp of the frame the event was received, in seconds (<see cref="Time.time"/>).</param>
 public EyePositions(SingleEyePosition leftEye, SingleEyePosition leftEyeNormalized,
                     SingleEyePosition rightEye, SingleEyePosition rightEyeNormalized, double sequentialId, float timestamp)
 {
     LeftEye            = leftEye;
     LeftEyeNormalized  = leftEyeNormalized;
     RightEye           = rightEye;
     RightEyeNormalized = rightEyeNormalized;
     SequentialId       = sequentialId;
     Timestamp          = timestamp;
 }
示例#2
0
        protected override void HandleEvent(IEnumerable <Behavior> eventBehaviors, float frameTimestamp, GameViewInfo gameViewInfo)
        {
            // Note that this method is called on a worker thread, so we MAY NOT access any game objects from here.
            // The data is stored in the Last property and used from the main thread.
            foreach (var behavior in eventBehaviors)
            {
                EyePositionDataEventParams eventParams;
                if (behavior.TryGetEyePositionDataEventParams(out eventParams))
                {
                    var left           = new SingleEyePosition(eventParams.HasLeftEyePosition != EyeXBoolean.False, (float)eventParams.LeftEyeX, (float)eventParams.LeftEyeY, (float)eventParams.LeftEyeZ);
                    var leftNormalized = new SingleEyePosition(eventParams.HasLeftEyePosition != EyeXBoolean.False, (float)eventParams.LeftEyeXNormalized, (float)eventParams.LeftEyeYNormalized, (float)eventParams.LeftEyeZNormalized);

                    var right           = new SingleEyePosition(eventParams.HasRightEyePosition != EyeXBoolean.False, (float)eventParams.RightEyeX, (float)eventParams.RightEyeY, (float)eventParams.RightEyeZ);
                    var rightNormalized = new SingleEyePosition(eventParams.HasRightEyePosition != EyeXBoolean.False, (float)eventParams.RightEyeXNormalized, (float)eventParams.RightEyeYNormalized, (float)eventParams.RightEyeZNormalized);

                    Last = new EyePositions(left, leftNormalized, right, rightNormalized, eventParams.Timestamp, frameTimestamp);
                }
            }
        }