<commit_before>﻿/* OSVR-Unity Connection
 * 
 * <http://sensics.com/osvr>
 * Copyright 2014 Sensics, Inc.
 * All rights reserved.
 * 
 * Final version intended to be licensed under Apache v2.0
 */
/// <summary>
/// Author: <NAME>
/// Email: <EMAIL> || <EMAIL>
/// </summary>

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections;

namespace OSVR
{
    namespace MonoGame
    {
        public enum Eye { Left, Right };

        public class VREye
        {
            private IInterfaceSignal<PoseReport> poseSignal;
            public IInterfaceSignal<PoseReport> PoseSignal 
            { 
                get { return poseSignal; } 
                set { poseSignal = value; } 
            }

            private readonly DeviceDescriptor deviceDescriptor;

            public Eye Eye { get; private set; }

            /// <summary>
            /// Eye rotation around the Y axis, in radians
            /// </summary>
            public float EyeRotationY { get; set; }

            /// <summary>
            /// Eye roll around the Z axis, in radians
            /// </summary>
            public float EyeRoll { get; set; }

            public Vector3 Translation { get; set; }
            
            public bool RotatePi { get; set; }

            // TODO: Should we cache this transform and recalculate it
            // on an Update method?
            public Matrix Transform
            {
                get
                {
                    // orientation matrix
                    var orientationRotation = Matrix.CreateFromQuaternion(this.poseSignal.Value.Rotation);
                    var target = Vector3.Transform(Vector3.Forward, orientationRotation);
                    var upPoint = Vector3.Transform(Vector3.Up, orientationRotation);
                    var viewMatrix = Matrix.CreateLookAt(Vector3.Zero, target, upPoint);
<commit_msg>Support for positional tracking in VREye's Transform calculation. Removed Matrix.CreateLookAt and now just inverting the translation/rotation.<commit_after>﻿/* OSVR-Unity Connection
 * 
 * <http://sensics.com/osvr>
 * Copyright 2014 Sensics, Inc.
 * All rights reserved.
 * 
 * Final version intended to be licensed under Apache v2.0
 */
/// <summary>
/// Author: <NAME>
/// Email: <EMAIL> || <EMAIL>
/// </summary>

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections;

namespace OSVR
{
    namespace MonoGame
    {
        public enum Eye { Left, Right };

        public class VREye
        {
            private IInterfaceSignal<PoseReport> poseSignal;
            public IInterfaceSignal<PoseReport> PoseSignal 
            { 
                get { return poseSignal; } 
                set { poseSignal = value; } 
            }

            private readonly DeviceDescriptor deviceDescriptor;

            public Eye Eye { get; private set; }

            /// <summary>
            /// Eye rotation around the Y axis, in radians
            /// </summary>
            public float EyeRotationY { get; set; }

            /// <summary>
            /// Eye roll around the Z axis, in radians
            /// </summary>
            public float EyeRoll { get; set; }

            public Vector3 Translation { get; set; }
            
            public bool RotatePi { get; set; }

            // TODO: Should we cache this transform and recalculate it
            // on an Update method?
            public Matrix Transform
            {
                get
                {
                    // orientation matrix
                    var translation = Matrix.CreateTranslation(Vector3.Negate(this.poseSignal.Value.Position));
                    var rotation = Matrix.CreateFromQuaternion(Quaternion.Inverse(this.poseSignal.Value.Rotation));
                    var viewMatrix = rotation * translation;

{'fraction_non_alphanumeric': 0.08988186954288649, 'fraction_numerical': 0.005136106831022085, 'mean_word_length': 1.6825068870523416, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2253463', 'n_tokens_mistral': 999, 'n_tokens_neox': 929, 'n_words': 297}