public GlassProfile LoadDefault()
        {
            GlassProfile profile = new GlassProfile();

            GlassProfile.LenseProperty leftDefault = new GlassProfile.LenseProperty();
            leftDefault.PosX     = -0.0315f;
            leftDefault.PosY     = 0.0f;
            leftDefault.PosZ     = 0.0f;
            leftDefault.RotX     = 0.0f;
            leftDefault.RotY     = 0.45f;
            leftDefault.RotZ     = 0.0f;
            leftDefault.FovUp    = 10.0f;
            leftDefault.FovDown  = 10.0f;
            profile.LeftProperty = leftDefault;

            GlassProfile.LenseProperty rightDefault = new GlassProfile.LenseProperty();
            rightDefault.PosX     = 0.0315f;
            rightDefault.PosY     = 0.0f;
            rightDefault.PosZ     = 0.0f;
            rightDefault.RotX     = 0.0f;
            rightDefault.RotY     = -0.45f;
            rightDefault.RotZ     = 0.0f;
            rightDefault.FovUp    = 10.0f;
            rightDefault.FovDown  = 10.0f;
            profile.RightProperty = rightDefault;

            return(profile);
        }
        public GlassProfile LoadProfile(string path)
        {
            GlassProfile profile = new GlassProfile();

            string propertyString = System.IO.File.ReadAllText(path);

            List <JsonObject> jsons = JsonObjectUtility.BuildJsonList(propertyString);

            JsonObject first = jsons[0];
            object     leftProperty;

            first.TryGetValue("LeftEye", out leftProperty);

            GlassProfile.LenseProperty left = new GlassProfile.LenseProperty();
            left.Init((JsonObject)leftProperty);

            profile.LeftProperty = left;

            object rightProperty;

            first.TryGetValue("RightEye", out rightProperty);

            GlassProfile.LenseProperty right = new GlassProfile.LenseProperty();
            right.Init((JsonObject)rightProperty);

            profile.RightProperty = right;

            return(profile);
        }
Esempio n. 3
0
        public void UpdateLenseProperty(GlassProfile.LenseProperty property)
        {
            Vector3 localPos = new Vector3(property.PosX, property.PosY, property.PosZ);

            _camera.transform.localPosition = localPos;

            Vector3 localRot = new Vector3(property.RotX, property.RotY, property.RotZ);

            _camera.transform.localEulerAngles = localRot;
        }
Esempio n. 4
0
        void Awake()
        {
            RenderController.Instance.Register(this);
            GlassProfileManager.Instance.Register(this);
            _camera = GetComponent <Camera>();

            UpdateLenseSeperation(GlassProfileManager.Instance.CustomProfile().LenseSeperationLeft);
            UpdateLenseSeperation(GlassProfileManager.Instance.CustomProfile().LenseSeperationRight);

            GlassProfile.LenseProperty property = _eyeID == Eye.Left ? GlassProfileManager.Instance.CustomProfile().LeftProperty :
                                                  GlassProfileManager.Instance.CustomProfile().RightProperty;

            UpdateLenseProperty(property);

            UpdateRenderMode(RenderController.Instance.Mode);
        }
        public GlassProfile LoadProfileConf(string pach)
        {
            GlassProfile  profile       = new GlassProfile();
            List <string> dataList      = new List <string>();
            List <string> dataListLeft  = new List <string>();
            List <string> dataListRight = new List <string>();
            string        txt           = File.ReadAllText(pach).ToString();
            StreamReader  stringData    = new StreamReader(pach);
            string        line          = stringData.ReadLine();

            for (int i = 0; i < txt.Length; i++)
            {
                if (line != null)
                {
                    line = stringData.ReadLine();
                    if (line != null)
                    {
                        string[] sArray = line.Split(new char[1] {
                            '='
                        });
                        foreach (var item in sArray)
                        {
                            if (item.Contains("0"))
                            {
                                dataList.Add(item);
                            }
                        }
                    }
                }
            }
            for (int i = 0; i < dataList.Count; i++)
            {
                if (i < dataList.Count / 2)
                {
                    dataListLeft.Add(dataList[i]);
                }
                else
                {
                    dataListRight.Add(dataListRight[i]);
                }
            }
            GlassProfile.LenseProperty LeftData = new GlassProfile.LenseProperty();
            LeftData.InitConf(dataListLeft);
            GlassProfile.LenseProperty RightData = new GlassProfile.LenseProperty();
            RightData.InitConf(dataListRight);
            return(profile);
        }
Esempio n. 6
0
        private IEnumerator Initialize()
        {
            // Plugin must be initialized OnStart in order to properly
            // get a valid surface
            GameObject mainCameraGo = GameObject.FindWithTag("MainCamera");

            if (mainCameraGo)
            {
                Debug.Log("Camera with MainCamera tag found.");
                if (!disableInput)
                {
                    Debug.Log("Will use translation and orientation from the MainCamera.");
                    transform.position = mainCameraGo.transform.position;
                    transform.rotation = mainCameraGo.transform.rotation;
                }
            }

            // Attach gaze to left eye
            headCamera = GameObject.Find("Main Camera");
            AttachGazeInputToEventSystem();
            AttachGazeCursorToHead();
            AttachPhysicsRayCasterToHead();
            InitializeGazeInput();

            headPositon  = head.transform.position;
            headRotation = head.transform.rotation;


            // adjust the left/right camera position rotation
            GlassProfileManager.Instance.Register(this);

            GlassProfile.LenseProperty property = GlassProfileManager.Instance.CustomProfile().LeftProperty;
            leftCamera.transform.localPosition    = new Vector3(property.PosX, property.PosY, property.PosZ);
            leftCamera.transform.localEulerAngles = new Vector3(property.RotX, property.RotY, property.RotZ);
            UpdateCameraFov(leftCamera, property.FovUp, property.FovDown);

            property = GlassProfileManager.Instance.CustomProfile().RightProperty;
            rightCamera.transform.localPosition    = new Vector3(property.PosX, property.PosY, property.PosZ);
            rightCamera.transform.localEulerAngles = new Vector3(property.RotX, property.RotY, property.RotZ);
            UpdateCameraFov(rightCamera, property.FovUp, property.FovDown);

            // start ar/gl
            GL.Clear(false, true, Color.black);

            yield return(StartCoroutine(plugin.Initialize()));

            InitializeEyes();
            InitializeOverlays();

            if (settings.trackPosition)
            {
                plugin.SetTrackingMode(LarPlugin.TrackingMode.TRACKING_POSITION);
            }
            else
            {
                plugin.SetTrackingMode(LarPlugin.TrackingMode.TRACKING_ORIENTATION);
            }

            plugin.SetVSyncCount((int)settings.vSyncCount);
            QualitySettings.vSyncCount = (int)settings.vSyncCount;

            plugin.SetFieldOfView((float)leftCamera.fieldOfView * Mathf.Deg2Rad);
        }