/// <summary>
    /// Draws the Unity GUI.
    /// </summary>
    public void OnGUI()
    {
        GUI.color = Color.white;
        if (GUI.Button(new Rect(Screen.width - 160, 20, 140, 80), "<size=30>Clear</size>"))
        {
            m_dynamicMesh.Clear();
            m_tangoApplication.Tango3DRClear();
        }

        string text = m_isEnabled ? "Pause" : "Resume";

        if (GUI.Button(new Rect(Screen.width - 160, 120, 140, 80), "<size=30>" + text + "</size>"))
        {
            m_isEnabled = !m_isEnabled;
            m_tangoApplication.Set3DReconstructionEnabled(m_isEnabled);
        }

        if (GUI.Button(new Rect(Screen.width - 160, 220, 140, 80), "<size=30>Export</size>"))
        {
            string filepath = "/sdcard/DemoMesh.obj";
            m_dynamicMesh.ExportMeshToObj(filepath);
            Debug.Log(filepath);

            /*
             *  switch scene to car design scene here
             */
        }
    }
Пример #2
0
    /// <summary>
    /// Draws the Unity GUI.
    /// </summary>

    /// <summary>
    /// Called after the application gets paused or resumed.
    /// </summary>
    /// <param name="pauseStatus">
    /// If set to <c>true</c> this is the pause event, otherwise this is the resume event.
    /// </param>
    public void OnApplicationPause(bool pauseStatus)
    {
        // Since motion tracking is lost when disconnected from Tango, any
        // existing 3D reconstruction state no longer is lined up with the
        // real world. Best we can do is clear the state.
        m_dynamicMesh.Clear();
        m_tangoApplication.Tango3DRClear();
    }
    /// <summary>
    /// Draws the Unity GUI.
    /// </summary>
    public void OnGUI()
    {
        GUI.color = Color.white;
        if (GUI.Button(new Rect(Screen.width - 160, 20, 140, 80), "<size=30>Clear</size>"))
        {
            m_dynamicMesh.Clear();
            m_tangoApplication.Tango3DRClear();
        }

        string text = m_isEnabled ? "Pause" : "Resume";

        if (GUI.Button(new Rect(Screen.width - 160, 120, 140, 80), "<size=30>" + text + "</size>"))
        {
            m_isEnabled = !m_isEnabled;
            m_tangoApplication.Set3DReconstructionEnabled(m_isEnabled);
        }

        if (GUI.Button(new Rect(Screen.width - 160, 220, 140, 80), "<size=30>Export</size>"))
        {
            var    fileName = Guid.NewGuid().ToString();
            string filepath = string.Format("/sdcard/{0}.obj", fileName);
            m_dynamicMesh.ExportMeshToObj(filepath);
            Debug.Log(filepath);
        }
    }
Пример #4
0
    /// <summary>
    /// Draws the Unity GUI.
    /// </summary>
    public void OnGUI()
    {
        GUI.color = Color.white;
        if (GUI.Button(new Rect(Screen.width - 160, 20, 140, 80), "<size=30>Clear</size>"))
        {
            AndroidHelper.ShowAndroidToastMessage("register");
            m_dynamicMesh.Clear();
            m_tangoApplication.Tango3DRClear();

            // ABOVE THIS IS THE ORIGIANL CODE

            //AndroidHelper.ShowAndroidToastMessage("register");
            //AssetDatabase.CreateAsset( m_dynamicMesh, "testPath.obj" );
            //AssetDatabase.SaveAssets();
        }

        string text = m_isEnabled ? "Pause" : "Resume";

        if (GUI.Button(new Rect(Screen.width - 160, 120, 140, 80), "<size=30>" + text + "</size>"))
        {
            m_isEnabled = !m_isEnabled;
            m_tangoApplication.Set3DReconstructionEnabled(m_isEnabled);
        }

        if (GUI.Button(new Rect(Screen.width - 160, 220, 140, 80), "<size=30>save</size>"))
        {
            AndroidHelper.ShowAndroidToastMessage("register");
            m_dynamicMesh.SendMessage("DoExportPLY", true);
        }
    }
Пример #5
0
    /// <summary>
    /// Draws the Unity GUI.
    /// </summary>
    public void OnGUI()
    {
        GUI.color = Color.white;
        if (GUI.Button(new Rect(Screen.width - 160, 20, 140, 80), "<size=30>Clear</size>"))
        {
            m_dynamicMesh.Clear();
            m_tangoApplication.Tango3DRClear();
        }

        string text = m_isEnabled ? "Pause" : "Resume";

        if (GUI.Button(new Rect(Screen.width - 160, 120, 140, 80), "<size=30>" + text + "</size>"))
        {
            m_isEnabled = !m_isEnabled;
            m_tangoApplication.Set3DReconstructionEnabled(m_isEnabled);
        }

        if (GUI.Button(new Rect(Screen.width - 160, 220, 140, 80), "<size=30>Export</size>"))
        {
            string filepath = dataWriter.exportPath + "/" + exportName + ".obj";
            m_dynamicMesh.ExportMeshToObj(filepath);
            Debug.Log(filepath);
        }

        string poseStatus = m_poseEnabled ? "Pose is on" : "Pose is off";

        if (GUI.Button(new Rect(Screen.width - 160, 320, 140, 80), "<size=24>" + poseStatus + "</size>"))
        {
            // Toggle
            m_poseEnabled = !m_poseEnabled;
            dataWriter.poseIsRecording = m_poseEnabled;
        }

        string depthStatus = m_depthEnabled ? "Depth is on" : "Depth is off";

        if (GUI.Button(new Rect(Screen.width - 160, 420, 140, 80), "<size=24>" + depthStatus + "</size>"))
        {
            // Toggle
            m_depthEnabled = !m_depthEnabled;
            dataWriter.depthIsRecording = m_depthEnabled;
        }

        string imageStatus = m_imageEnabled ? "Image is on" : "Image is off";

        if (GUI.Button(new Rect(Screen.width - 160, 520, 140, 80), "<size=24>" + imageStatus + "</size>"))
        {
            // Toggle
            m_imageEnabled = !m_imageEnabled;
            dataWriter.imageIsRecording = m_imageEnabled;
        }
    }
Пример #6
0
    /// <summary>
    /// Draws the Unity GUI.
    /// </summary>
    public void OnGUI()
    {
        GUI.color = Color.white;
        if (GUI.Button(new Rect(Screen.width - 160, 20, 140, 80), "<size=30>Clear</size>"))
        {
            m_dynamicMesh.Clear();
            m_tangoApplication.Tango3DRClear();
        }

        string text = m_isEnabled ? "Pause" : "Resume";

        if (GUI.Button(new Rect(Screen.width - 160, 120, 140, 80), "<size=30>" + text + "</size>"))
        {
            m_isEnabled = !m_isEnabled;
            m_tangoApplication.Set3DReconstructionEnabled(m_isEnabled);

            GameObject smode = GameObject.FindGameObjectsWithTag("ScanMode")[0];
            smode.active = false;

            GameObject pmode = GameObject.FindGameObjectsWithTag("PlayMode")[0];
            pmode.active = true;
        }

        if (GUI.Button(new Rect(Screen.width - 160, 220, 140, 80), "<size=30>Export</size>"))
        {
            string filepath = "/sdcard/CourierDropMap.obj";
            m_dynamicMesh.ExportMeshToObj(filepath);
            Debug.Log(filepath);

            /*
             *  switch scene to car design scene here
             */

            Application.LoadLevel(m_mainMapScene);
        }
    }
    /// <summary>
    /// Draws the Unity GUI.
    /// </summary>
    public void OnGUI()
    {
        GUI.color = Color.white;
        if (GUI.Button(new Rect(Screen.width - 160, 20, 140, 80), "<size=30>Clear</size>"))
        {
            m_dynamicMesh.Clear();
            m_tangoApplication.Tango3DRClear();
        }

        string text = m_isEnabled ? "Pause" : "Resume";

        if (GUI.Button(new Rect(Screen.width - 160, 120, 140, 80), "<size=30>" + text + "</size>"))
        {
            m_isEnabled = !m_isEnabled;
            m_tangoApplication.Set3DReconstructionEnabled(m_isEnabled);
        }
    }
Пример #8
0
 private void OnClearClick()
 {
     _dynamicMesh.Clear();
     _tangoApplication.Tango3DRClear();
 }
Пример #9
0
    /// <summary>
    /// Draws the Unity GUI.
    /// </summary>
    public void OnGUI()
    {
        //Menu Bar
        GUI.Label(new Rect(0, -10, Screen.width, Screen.height), recordingMenu);
        if (GUI.Button(new Rect(10, 10, 75, 75), backArrow, material))
        {
            showContinue = true;
        }
        if (showContinue)
        {
            m_tangoApplication.Set3DReconstructionEnabled(false);
            GUI.Label(new Rect((Screen.width / 2) - 480, (Screen.height / 2) - 300, 960, 600), continueMessage);
            if (GUI.Button(new Rect((Screen.width / 2) - 175, (Screen.height / 2) + 100, 200, 100), continueButton, material))
            {
                SceneManager.LoadScene(0);
            }
            if (GUI.Button(new Rect((Screen.width / 2) + 75, (Screen.height / 2) + 100, 200, 100), cancel, material))
            {
                showContinue = false;
            }
        }
        LineRenderer lineRenderer = GetComponent <LineRenderer>();

        //Delete button
        if (GUI.Button(new Rect(60, Screen.height - 200, 140, 140), clear, material))
        {
            showDelete = true;
        }
        if (showDelete)
        {
            m_tangoApplication.Set3DReconstructionEnabled(false);
            GUI.Label(new Rect((Screen.width / 2) - 480, (Screen.height / 2) - 300, 960, 600), deleteMessage);
            if (GUI.Button(new Rect((Screen.width / 2) - 175, (Screen.height / 2) + 100, 200, 100), delete, material))
            {
                m_dynamicMesh.Clear();
                m_tangoApplication.Tango3DRClear();
                measurePointStart.transform.position = new Vector3(0, -22, 0);
                measurePointEnd.transform.position   = new Vector3(0, -22, 0);
                lineRenderer.SetPosition(0, measurePointStart.transform.position);
                lineRenderer.SetPosition(1, measurePointEnd.transform.position);
                dist        = 0;
                distanceOut = null;
                GUI.Label(new Rect(Screen.width - 360, 420, 340, 50), "");
                showDelete = false;
            }
            if (GUI.Button(new Rect((Screen.width / 2) + 75, (Screen.height / 2) + 100, 200, 100), cancel, material))
            {
                showDelete = false;
            }
        }


        Texture text = m_isEnabled ? pause : resume;

        if (GUI.Button(new Rect(Screen.width - 200, Screen.height - 200, 140, 140), text, material))
        {
            m_isEnabled = !m_isEnabled;
            m_tangoApplication.Set3DReconstructionEnabled(m_isEnabled);
        }


        if (!m_isEnabled)
        {
            GUI.Button(new Rect(Screen.width / 2 - 10, Screen.height / 2 - 10, 20, 20), circle, material);

            // Save Button to show the message
            if (GUI.Button(new Rect(Screen.width - 400, Screen.height - 200, 140, 140), save, material))
            {
                showSave = true;
            }

            // Start Point Button
            if (GUI.Button(new Rect(Screen.width - 160, 180, 140, 140), start, material))
            {
                setStartPoint();
            }

            // End Point Button
            if (GUI.Button(new Rect(Screen.width - 160, 380, 140, 140), end, material))
            {
                setEndPoint();
            }
        }

        if (measurePointStart.transform.position.y != -22 && measurePointEnd.transform.position.y != -22)
        {
            dist = Vector3.Distance(measurePointStart.transform.position, measurePointEnd.transform.position);
            double inches, inc;
            int    feet;
            inc    = dist * 39.3701;
            inches = inc % 12;
            feet   = (int)inc / 12;

            GUI.color        = Color.black;
            GUI.contentColor = Color.gray;

            int measurement = PlayerPrefs.GetInt("Feet");
            if (measurement == 1)
            {
                GUI.Label(new Rect(Screen.width - 450, 620, 450, 100), string.Format("<size=70>{0} ft {1} in</size>", feet.ToString(), inches.ToString("n2")));
            }
            if (measurement == 0)
            {
                GUI.Label(new Rect(Screen.width - 450, 620, 450, 100), string.Format("<size=70>{0} meters</size>", dist.ToString("n3")));
            }
        }

        if (showSave)
        {
            GUI.Label(new Rect((Screen.width / 2) - 480, (Screen.height / 2) - 300, 960, 600), saveMessage);

            Invoke("saveMesh", 1);
        }
    }