// UpdateGeometry
    public void UpdateGeometry()
    {
        if (MagShowGeometry == false)
        {
            return;
        }
        if (CameraController == null)
        {
            return;
        }
        if ((GeometryReference == null) || (GeometryCompass == null))
        {
            return;
        }

        // All set, we can update the geometry with camera and positon values
        Quaternion q = Quaternion.identity;

        if ((CameraController != null) && (CameraController.PredictionOn == true))
        {
            OVRDeviceImposter.GetPredictedOrientation(0, ref q);
        }
        else
        {
            OVRDeviceImposter.GetOrientation(0, ref q);
        }

        Vector3 v = GeometryCompass.transform.localEulerAngles;

        v.y = -q.eulerAngles.y + CurEulerRef.y;
        GeometryCompass.transform.localEulerAngles = v;

        // Set the color of the marker to red if we are calibrating
        if (GeometryReferenceMarkMat != null)
        {
            Color c = Color.green;

            if (OVRDeviceImposter.IsMagYawCorrectionInProgress(0) == true)
            {
                c = Color.red;
            }

            GeometryReferenceMarkMat.SetColor("_Color", c);
        }
    }
    // GUIMagYawDriftCorrection
    public void GUIMagYawDriftCorrection(int xLoc, int yLoc,
                                         int xWidth, int yWidth,
                                         ref OVRGUI guiHelper)
    {
        string strMagCal = "";
        Color  c         = Color.red;
        int    xloc      = xLoc;
        int    xwidth    = xWidth;

        switch (MagCalState)
        {
        case (MagCalibrationState.MagDisabled):
            strMagCal = "Mag Calibration OFF";
            break;

        case (MagCalibrationState.MagManualGetReady):
            strMagCal = "Manual Calibration: Look Forward, Press 'Z'..";
            c         = Color.white;
            xloc     -= 40;
            xwidth   += 150;
            break;

        case (MagCalibrationState.MagCalibrating):
            if (MagCalTimerFlash > 0.2f)
            {
                FormatCalibratingString(ref strMagCal);
            }

            MagCalTimerFlash -= Time.deltaTime;
            if (MagCalTimerFlash < 0.0f)
            {
                MagCalTimerFlash += 0.5f;
            }

            c       = Color.white;
            xloc   -= 40;
            xwidth += 150;
            break;

        case (MagCalibrationState.MagCalibrated):
            strMagCal         = "Mag Calibrated";
            MagCalTimerFlash -= Time.deltaTime;
            if (MagCalTimerFlash < 0.0f)
            {
                MagCalTimerFlash += 0.5f;
            }

            c = Color.yellow;
            break;

        case (MagCalibrationState.MagReady):
            if (OVRDeviceImposter.IsMagYawCorrectionInProgress(0) == true)
            {
                if (MagCalTimerFlash > 0.2f)
                {
                    strMagCal = "Mag CORRECTING...";
                    strMagCal = System.String.Format("Mag CORRECTING (deg)... {0:F3}",
                                                     OVRDeviceImposter.GetYawErrorAngle(0));
                }

                MagCalTimerFlash -= Time.deltaTime;
                if (MagCalTimerFlash < 0.0f)
                {
                    MagCalTimerFlash += 0.5f;
                }

                xloc   -= 40;
                xwidth += 150;

                c = Color.red;
            }
            else
            {
                strMagCal = "Mag Correction ON";
                c         = Color.green;
            }

            break;
        }

        guiHelper.StereoBox(xloc, yLoc, xwidth, yWidth, ref strMagCal, c);
    }