コード例 #1
0
ファイル: KudanTracker.cs プロジェクト: taofangcx/WireLoop
        /// <summary>
        /// Method used to draw the debug GUI in the upper-left portion of the screen.
        /// </summary>
        void OnGUI()
        {
            // Display debug GUI with tracking information
            if (_displayDebugGUI)
            {
                GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(_debugGUIScale, _debugGUIScale, 1f));
                GUILayout.BeginVertical("box");

                                #if UNITY_EDITOR
                GUILayout.Label("WireLoop AR", UnityEditor.EditorStyles.boldLabel);
                                #else
                GUILayout.Label("WireLoop AR");
                                #endif

                // Tracking status
                if (_trackerPlugin != null && _trackerPlugin.IsTrackingRunning())
                {
                    GUI.color = Color.green;
                    GUILayout.Label("Tracker is running");
                }
                else
                {
                    GUI.color = Color.red;
                    GUILayout.Label("Tracker NOT running");
                }
                GUI.color = Color.white;

                /*Edited by Sandesh HEGDE to remove the GUI
                 * /
                 *
                 *
                 * // Screen resolution
                 * //GUILayout.Label("Screen: " + Screen.width + "x" + Screen.height);
                 *
                 * // Frame rates
                 *
                 * /*
                 * if (_trackerPlugin != null)
                 * {
                 *      GUILayout.Label("Camera rate:  " + _trackerPlugin.CameraFrameRate.ToString("F2") + "hz");
                 *      GUILayout.Label("Tracker rate: " + _trackerPlugin.TrackerFrameRate.ToString("F2") + "hz");
                 *      GUILayout.Label("App rate: " + _trackerPlugin.AppFrameRate.ToString("F2") + "hz");
                 * }
                 *
                 */

                if (_trackerPlugin != null && _trackerPlugin.IsTrackingRunning())
                {
                    // Texture image and resolution
                    if (_currentTrackingMethod != null)
                    {
                        //GUILayout.Label("Method: " + _currentTrackingMethod.Name);
                        _currentTrackingMethod.DebugGUI(_debugGUIScale);
                    }
                }
            }
        }
コード例 #2
0
ファイル: KudanTracker.cs プロジェクト: yuen33/KudanDemo
        void OnGUI()
        {
            // Display debug GUI with tracking information
            if (_displayDebugGUI)
            {
                GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(_debugGuiScale, _debugGuiScale, 1f));
                GUILayout.BeginVertical("box");
#if UNITY_EDITOR
                GUILayout.Label("KUDAN AR", UnityEditor.EditorStyles.boldLabel);
#else
                GUILayout.Label("KUDAN AR");
#endif
                // Tracking status
                if (_trackerPlugin != null && _trackerPlugin.IsTrackingRunning())
                {
                    GUI.color = Color.green;
                    GUILayout.Label("Tracker is running");
                }
                else
                {
                    GUI.color = Color.red;
                    GUILayout.Label("Tracker NOT running");
                }
                GUI.color = Color.white;

                // Screen resolution
                GUILayout.Label("Screen: " + Screen.width + "x" + Screen.height);

                // Frame rates
                if (_trackerPlugin != null)
                {
                    GUILayout.Label("Camera rate:  " + _trackerPlugin.CameraFrameRate.ToString("F2") + "hz");
                    GUILayout.Label("Tracker rate: " + _trackerPlugin.TrackerFrameRate.ToString("F2") + "hz");
                    GUILayout.Label("App rate: " + _trackerPlugin.AppFrameRate.ToString("F2") + "hz");
                }

                if (_trackerPlugin != null && _trackerPlugin.IsTrackingRunning())
                {
                    // Texture image and resolution
                    Texture finalTexture = _trackerPlugin.GetTrackingTexture();
                    if (finalTexture != null)
                    {
                        GUILayout.Label("Texture: " + finalTexture.width + "x" + finalTexture.height);
                        Rect r = GUILayoutUtility.GetRect(finalTexture.width / 4f, finalTexture.height / 4f);
                        GUI.DrawTexture(r, finalTexture, ScaleMode.ScaleToFit);
                    }

                    if (_currentTrackingMethod != null)
                    {
                        GUILayout.Label("Method: " + _currentTrackingMethod.Name);
                        _currentTrackingMethod.DebugGUI(_debugGuiScale);
                    }
                }
            }
        }