Example #1
0
    public void SaveFOVPointsToScriptableObj()
    {
        int key = Convert.ToInt32(distHMDEye);

        if (FOVPointsSave.fOVPts == null) // test if list has been initialized
        {
            FOVPointsSave.fOVPts = new List <FOVPoints>();
        }
        FOVPoints FOVpt = null;

        if (FOVPointsSave.fOVPts.Count > 0)
        {
            FOVpt = FOVPointsSave.fOVPts.FirstOrDefault(p => p.id == key); // look for object with the choosen id
        }
        if (FOVpt == null)
        {
            FOVpt              = new FOVPoints();
            FOVpt.id           = key;
            FOVpt.points       = pointingSystem.handPoints;
            FOVpt.selectedAxes = pointingSystem.selectedAxes;
            FOVPointsSave.fOVPts.Add(FOVpt);
        }
        else
        {
            FOVpt.points       = pointingSystem.handPoints;
            FOVpt.selectedAxes = pointingSystem.selectedAxes;
        }
    }
Example #2
0
    void Start()
    {
        // Get the good Point in the scriptable object and draw the lineRenderer
        FOVPoints pt = FOVPointsSave.fOVPts.FirstOrDefault(p => p.id == Convert.ToInt32(FOVPointsSave.previous_HMDeye_distance));

        if (pt != null)
        {
            List <Vector3> lst;
            Color          color;
            if (acuity)
            {
                lst   = pt.acuityFieldPoints;
                color = Color.red;
            }
            else
            {
                lst   = pt.points;
                color = Color.blue;
            }
            // Setup the LineRenderer with color, width and hide it from the user bot not the operator
            lr                  = GetComponent <LineRenderer>();
            lr.material         = new Material(Shader.Find("Sprites/Default"));
            lr.widthMultiplier  = 0.02f;
            lr.gameObject.layer = 11; // 11 = OperatorUI

            DrawFOV(lr, lst, color);
        }
        else
        {
            print("No points to print for this HMD eye distance. Please verify the OpticianCalibration Scene and add points for the distance" + FOVPointsSave.previous_HMDeye_distance / 2 + ".");
        }
    }
Example #3
0
    // function to reset points for one eye-lens distance value set for the slider
    public void ResetFOVPoints()
    {
        FOVPoints fov = FOVPointsSave.fOVPts[Convert.ToInt32(distHMDEye)];

        fov.points.Clear();
        fov.selectedAxes.Clear();
        fov.acuityFieldPoints.Clear();
    }
Example #4
0
    // Function to load points from the scriptable object FOVPoints
    //     also draw the LineRenderer paths from the points
    private void LoadFOVPoints()
    {
        distHMDEye = FOVPointsSave.previous_HMDeye_distance;
        FOVPoints FOVpt = null;

        if (FOVPointsSave.fOVPts.Count > 0)
        {
            FOVpt = FOVPointsSave.fOVPts.FirstOrDefault(p => p.id == Convert.ToInt32(distHMDEye)); // look for object with the choosen id
        }
        if (FOVpt != null)
        {
            pointingSystem.handPoints   = FOVpt.points;
            pointingSystem.selectedAxes = FOVpt.selectedAxes;
            DrawFOV(lineRenderer, pointingSystem.handPoints, Color.blue);
            pointingSystem.isCalibEnded = true;
        }
    }
Example #5
0
    void Update()
    {
        if (calibrationIsOver)
        {
            radialMenu.SetActive(false);
            FOVPoints pt = FOVPointsSave.fOVPts.FirstOrDefault(p => p.id == Convert.ToInt32(distHMDEye));
            if (pt != null)
            {
                pt.acuityFieldPoints = savedTargetposList;
            }

            DrawFOV(lineRendererAcuity, savedTargetposList, Color.red);
            landoltC.SetActive(false);
            arrowImage.enabled = false;
            explainText.text   = "Calibration is over";
        }
        else
        {
            if (isFOVCalibEnded)
            {
                UpdateAcuityCalibration();
            }
            else
            {
                if (pointingSystem.start)
                {
                    if (pointingSystem.isCalibEnded)
                    {
                        distHMDEye = FOVPointsSave.previous_HMDeye_distance;
                        FOVPoints pt = FOVPointsSave.fOVPts.FirstOrDefault(p => p.id == Convert.ToInt32(distHMDEye));
                        if (pt != null)
                        {
                            if (pt.points.Count != 0)
                            {
                                saveButton.interactable = true;
                                if (pointingSystem.selectedAxes.Count > 3)
                                {
                                    pointingSystem.StartButton.SetActive(false);
                                    lineRenderer.loop         = true;
                                    isFOVCalibEnded           = true;
                                    pt.selectedAxes           = pointingSystem.selectedAxes;
                                    pointingSystem.selectAxes = true;
                                }
                            }
                        }

                        // DrawFOV(lineRenderer, pointingSystem.handPoints, Color.blue);
                        FOVTarget.SetActive(false);
                    }
                }
                else
                {
                    explainText.text = "Please connect a controller to start.";
                }
            }
        }
        if (Input.GetKeyDown(KeyCode.R))
        {
            Scene scene = SceneManager.GetActiveScene();
            SceneManager.LoadScene(scene.name);
            // FIXME: Restart system
            // TODO: Ask Romain for his solution
        }
    }