Main entry point for the Tango Service. This component handles nearly all communication with the underlying TangoService. You must have one of these in your scene for Tango to work. Customization of the Tango connection can be done in the Unity editor or by programatically setting the member flags. This sends out events to Components that derive from the ITangoPose, ITangoDepth, etc. interfaces and register themselves via Register. This also sends out events to callbacks passed in through RegisterOnTangoConnect, RegisterOnTangoDisconnect, and RegisterPermissionsCallback. Note: To connect to the Tango Service, you should call InitApplication after properly registering everything.
Inheritance: UnityEngine.MonoBehaviour
コード例 #1
0
    // Use this for initialization
    void Start ()
    {
        // Initialize some variables
        m_tangoRotation = Quaternion.Euler(90,0,0);
        m_tangoPosition = Vector3.zero;
        m_startPosition = transform.position;
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        if(m_tangoApplication != null)
        {
            // Request Tango permissions
            m_tangoApplication.RegisterPermissionsCallback(PermissionsCallback);
            m_tangoApplication.RequestNecessaryPermissionsAndConnect();
            m_tangoApplication.Register(this);
        }
        else
        {
            Debug.Log("No Tango Manager found in scene.");
        }

        m_uwTss = new Matrix4x4();
        m_uwTss.SetColumn (0, new Vector4 (1.0f, 0.0f, 0.0f, 0.0f));
        m_uwTss.SetColumn (1, new Vector4 (0.0f, 0.0f, 1.0f, 0.0f));
        m_uwTss.SetColumn (2, new Vector4 (0.0f, 1.0f, 0.0f, 0.0f));
        m_uwTss.SetColumn (3, new Vector4 (0.0f, 0.0f, 0.0f, 1.0f));
        
        m_dTuc = new Matrix4x4();
        m_dTuc.SetColumn (0, new Vector4 (1.0f, 0.0f, 0.0f, 0.0f));
        m_dTuc.SetColumn (1, new Vector4 (0.0f, 1.0f, 0.0f, 0.0f));
        m_dTuc.SetColumn (2, new Vector4 (0.0f, 0.0f, -1.0f, 0.0f));
        m_dTuc.SetColumn (3, new Vector4 (0.0f, 0.0f, 0.0f, 1.0f));


        Application.targetFrameRate = 60;

    }
コード例 #2
0
    /// <summary>
    /// Use this for initialization.
    /// </summary>
    public void Start() 
    {
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        m_tangoApplication.Register(this);

        m_uwTss.SetColumn (0, new Vector4 (1.0f, 0.0f, 0.0f, 0.0f));
        m_uwTss.SetColumn (1, new Vector4 (0.0f, 0.0f, 1.0f, 0.0f));
        m_uwTss.SetColumn (2, new Vector4 (0.0f, 1.0f, 0.0f, 0.0f));
        m_uwTss.SetColumn (3, new Vector4 (0.0f, 0.0f, 0.0f, 1.0f));

        m_cTuc.SetColumn (0, new Vector4 (1.0f, 0.0f, 0.0f, 0.0f));
        m_cTuc.SetColumn (1, new Vector4 (0.0f, -1.0f, 0.0f, 0.0f));
        m_cTuc.SetColumn (2, new Vector4 (0.0f, 0.0f, 1.0f, 0.0f));
        m_cTuc.SetColumn (3, new Vector4 (0.0f, 0.0f, 0.0f, 1.0f));

        m_triangles = new int[VERT_COUNT];
        // Assign triangles, note: this is just for visualizing point in the mesh data.
        for (int i = 0; i < VERT_COUNT; i++)
        {
            m_triangles[i] = i;
        }

        m_mesh = GetComponent<MeshFilter>().mesh;
        m_mesh.Clear();
        m_mesh.triangles = m_triangles;
        m_mesh.RecalculateBounds();
        m_mesh.RecalculateNormals();
       
    }
コード例 #3
0
 /// <summary>
 /// Use this for initialization.
 /// </summary>
 public void Start()
 {
     m_marker.SetActive(false);
     m_pointCloud = FindObjectOfType<TangoPointCloud>();
     m_pointCloudFloor = FindObjectOfType<TangoPointCloudFloor>();
     m_tangoApplication = FindObjectOfType<TangoApplication>();
 }
コード例 #4
0
    /// <summary>
    /// Draw motion tracking options.
    /// </summary>
    /// <param name="tangoApplication">Tango application.</param>
    private void _DrawMotionTrackingOptions(TangoApplication tangoApplication)
    {
        tangoApplication.m_enableMotionTracking = EditorGUILayout.Toggle("Enable Motion Tracking", 
                                                                         tangoApplication.m_enableMotionTracking);
        if (tangoApplication.m_enableMotionTracking)
        {
            EditorGUI.indentLevel++;
            tangoApplication.m_motionTrackingAutoReset = EditorGUILayout.Toggle("Auto Reset", 
                                                                                tangoApplication.m_motionTrackingAutoReset);

            tangoApplication.m_enableADFLoading = EditorGUILayout.Toggle("Load ADF",
                                                                         tangoApplication.m_enableADFLoading);
            tangoApplication.m_enableAreaLearning = EditorGUILayout.Toggle("Area Learning", 
                                                                           tangoApplication.m_enableAreaLearning);

            tangoApplication.m_enableCloudADF = EditorGUILayout.Toggle("Cloud ADF", tangoApplication.m_enableCloudADF);
            if (tangoApplication.m_enableCloudADF)
            {
                tangoApplication.m_cloudApiKey = EditorGUILayout.TextField("Cloud API Key", tangoApplication.m_cloudApiKey);
            }

            EditorGUI.indentLevel--;
        }
        EditorGUILayout.Space();
    }
コード例 #5
0
ファイル: TangoUx.cs プロジェクト: gitunit/project-tango-poc
 /// <summary>
 /// Start this instance.
 /// </summary>
 public void Start()
 {
     m_tangoApplication = GetComponent<TangoApplication>();
     m_tangoApplication.Register(this);
     AndroidHelper.InitTangoUx();
     SetHoldPosture(m_holdPosture);
 }
コード例 #6
0
    // Use this for initialization
    void Start()
    {
        // Prevent the screen from sleeping
        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        // Initialize some variables
        m_tangoRotation = Quaternion.identity;
        m_tangoPosition = Vector3.zero;
        m_startPosition = transform.position;
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        if(m_tangoApplication != null)
        {
            // Request Tango permissions
            m_tangoApplication.RegisterPermissionsCallback(PermissionsCallback);
            m_tangoApplication.RequestNecessaryPermissionsAndConnect();
            m_tangoApplication.Register(this);
        }
        else
        {
            Debug.Log("No Tango Manager found in scene.");
        }

        //sp = new SerialPort( "baka", 9600, Parity.None, 8, StopBits.One);

        //sp.Open();

        //sp.ReadTimeout = 50;
    }
コード例 #7
0
    /// <summary>
    /// Draw motion tracking options.
    /// </summary>
    /// <param name="tangoApplication">Tango application.</param>
    private void _DrawMotionTrackingOptions(TangoApplication tangoApplication)
    {
        tangoApplication.m_enableMotionTracking = EditorGUILayout.Toggle("Enable Motion Tracking",
                                                                         tangoApplication.m_enableMotionTracking);
        if (tangoApplication.m_enableMotionTracking)
        {
            EditorGUI.indentLevel++;
            tangoApplication.m_motionTrackingAutoReset = EditorGUILayout.Toggle("Auto Reset",
                                                                                tangoApplication.m_motionTrackingAutoReset);

            tangoApplication.m_useLowLatencyIMUIntegration = EditorGUILayout.Toggle("Low Latency Pose",
                                                                                    tangoApplication.m_useLowLatencyIMUIntegration);

            tangoApplication.m_enableAreaLearning = EditorGUILayout.Toggle("Area Learning",
                                                                           tangoApplication.m_enableAreaLearning);
            if (tangoApplication.m_enableAreaLearning)
            {
                EditorGUI.indentLevel++;
                tangoApplication.m_useExperimentalADF = EditorGUILayout.Toggle("High Accuracy (Experimental)",
                                                                               tangoApplication.m_useExperimentalADF);
                EditorGUI.indentLevel--;
            }

            EditorGUI.indentLevel--;
        }
        EditorGUILayout.Space();
    }
コード例 #8
0
    /// <summary>
    /// Start this instance.
    /// </summary>
    private void Start()
    {
        Application.targetFrameRate = 60;

        m_tangoApplication = FindObjectOfType<TangoApplication>();

        if(m_tangoApplication != null)
        {
            if(AndroidHelper.IsTangoCorePresent())
            {
                // Request Tango permissions
                m_tangoApplication.RegisterPermissionsCallback(_OnTangoApplicationPermissionsEvent);
                m_tangoApplication.RequestNecessaryPermissionsAndConnect();
                m_tangoApplication.Register(this);
            }
            else
            {
                // If no Tango Core is present let's tell the user to install it!
                StartCoroutine(_InformUserNoTangoCore());
            }
        }
        else
        {
            Debug.Log("No Tango Manager found in scene.");
        }
    }
コード例 #9
0
 /// <summary>
 /// Check for a usable tango application component in the scene. Draw warning if 
 /// one could not be found.
 /// 
 /// Should be called first before using any other TangoPrefabInspectorHelper function
 /// during a given frame, to determine if a valid TangoApplication reference exists
 /// with which to call other TangoPrefabInspectorHelper methods.
 /// </summary>
 /// <returns><c>true</c>, if a tango application on an active GameObject can be identified, 
 /// <c>false</c> otherwise.</returns>
 /// <param name="inspectedBehaviour">Prefab behavior that's being inspected.</param>
 /// <param name="tangoApplication">Prefab inspector's reference to Tango Application, or
 /// null if no Tango Application on an active GameObject can be identified.</param>
 public static bool CheckForTangoApplication(MonoBehaviour inspectedBehaviour,
                                             ref TangoApplication tangoApplication)
 {
     if (tangoApplication == null || !tangoApplication.gameObject.activeInHierarchy)
     {
         tangoApplication = GameObject.FindObjectOfType<TangoApplication>();
     }
     
     // Note: .isActiveAndEnabled is the appropriate thing to check here because all Register() 
     // calls on existing Tango prefabs are called in Start(), which won't occur until both the
     // behaviour is enabled and the game object it is attached to is active.
     // 
     // Conversely, if any of the tango prefabs called Register() in Awake(), the correct thing
     // to check against would be .gameObject.activeInHeirarchy, since Awake is called when the
     // game object it is attached to is active, regardless of whether the behaviour itself is
     // enabled.
     if (tangoApplication == null && inspectedBehaviour.isActiveAndEnabled)
     {
         EditorGUILayout.HelpBox("Could not find an active TangoApplication component in the scene.\n\n"
                                 + "Component will not function correctly if it cannot find "
                                 + "an active TangoApplication component at runtime.",
                                 MessageType.Warning);
         return false;
     }
     
     return tangoApplication != null;
 }
コード例 #10
0
 /// <summary>
 /// Use this for initialization.
 /// </summary>
 private void Start() 
 {
     m_currentFPS = 0;
     m_framesSinceUpdate = 0;
     m_currentTime = 0.0f;
     m_fpsText = "FPS = Calculating";
     m_tangoApplication = FindObjectOfType<TangoApplication>();
 }
コード例 #11
0
 // Use this for initialization
 void Start()
 {
     m_tangoApplication = FindObjectOfType<TangoApplication>();
     m_btnGuiText.text = "Start";
     m_btnGuiText.color = m_txtStartColour;
     ColorBlock cb = m_btnStartStop.colors;
     cb.normalColor = m_btnStartColour;
     m_btnStartStop.colors = cb;
 }
コード例 #12
0
 /// <summary>
 /// Unity start override function.
 /// 
 /// We register this object as a listener to the pose callbacks.
 /// </summary>
 public void Start()
 {
     m_tangoApplication = FindObjectOfType<TangoApplication>();
     
     if (m_tangoApplication != null)
     {
         m_tangoApplication.Register(this);
     }
 }
コード例 #13
0
 /// <summary>
 /// Use this for initialization.
 /// </summary>
 private void Start()
 {
     m_currentFPS = 0;
     m_framesSinceUpdate = 0;
     m_currentTime = 0.0f;
     m_FPSText = "FPS = Calculating";
     m_label = new Rect((Screen.width * 0.025f) - 50, (Screen.height * 0.96f) - 25, 600.0f, 50.0f);
     m_tangoApplication = FindObjectOfType<TangoApplication>();
 }
コード例 #14
0
 /// <summary>
 /// Unity Start() callback, we set up some initial values here.
 /// </summary>
 void Start () 
 {
     m_currentFPS = 0;
     m_framesSinceUpdate = 0;
     m_currentTime = 0.0f;
     m_FPSText = "FPS = Calculating";
     m_label = new Rect(Screen.width * 0.025f - 50, Screen.height * 0.96f - 25, 600.0f, 50.0f);
     m_tangoApplication = FindObjectOfType<TangoApplication>();
     m_tangoServiceVersion = TangoApplication.GetTangoServiceVersion();
 }
コード例 #15
0
 /// <summary>
 /// Start this instance.
 /// </summary>
 public void Start()
 {
     m_tangoApplication = GetComponent <TangoApplication>();
     m_tangoApplication.RegisterPermissionsCallback(_OnTangoPermissionsEvent);
     m_tangoApplication.RegisterOnTangoConnect(_OnTangoServiceConnected);
     m_tangoApplication.RegisterOnTangoDisconnect(_OnTangoServiceDisconnected);
     m_tangoApplication.Register(this);
     AndroidHelper.InitTangoUx();
     SetHoldPosture(m_holdPosture);
 }
コード例 #16
0
 /// <summary>
 /// Perform constructor logic.
 /// </summary>
 private void Awake()
 {
     if (m_instance != null)
     {
         Destroy(this);
         return;
     }
     m_instance = this;
     InitApplication();
     DontDestroyOnLoad(gameObject);
 }
コード例 #17
0
    /// @cond
    /// <summary>
    /// Use this for initialization.
    /// </summary>
    public void Start()
    {
        m_pointCloud = FindObjectOfType<TangoPointCloud>();
        m_tangoApplication = FindObjectOfType<TangoApplication>();

        // All child objects are disabled until the floor is found.
        foreach (Transform t in transform)
        {
            t.gameObject.SetActive(false);
        }
    }
コード例 #18
0
 void Start () {
     tangoApplication = FindObjectOfType<TangoApplication>();
     if(tangoApplication != null) {
         if(AndroidHelper.IsTangoCorePresent()) {
             // Request Tango permissions
             tangoApplication.RegisterPermissionsCallback(_OnTangoApplicationPermissionsEvent);
             tangoApplication.RequestNecessaryPermissionsAndConnect();
         }
     } else {
         Debug.Log("No Tango Manager found in scene.");
     }
 }
コード例 #19
0
        /// <summary>
        /// Checks whether depth permissions are selected and draws a warning if they are not.
        /// </summary>
        /// <returns><c>true</c>, if depth permissions are enabled, <c>false</c> otherwise.</returns>
        /// <param name="tangoApplication">Prefab inspector's reference to Tango Application.</param>
        public static bool CheckDepthPermissions(TangoApplication tangoApplication)
        {
            bool hasPermissions = tangoApplication.m_enableDepth;

            if (!hasPermissions)
            {
                EditorGUILayout.HelpBox("This component needs Depth to be enabled in TangoApplication to function.",
                                        MessageType.Warning);
            }

            return(hasPermissions);
        }
コード例 #20
0
    /// <summary>
    /// Raises the enable event.
    /// </summary>
    private void OnEnable()
    {
        m_tangoApplication = (TangoApplication)target;

        // Fixup the old state of TangoApplication before there were two checkboxes.  If only m_enableVideoOverlay was
        // set, then that meant to use the Byte Buffer method.
        if (m_tangoApplication.m_enableVideoOverlay && !m_tangoApplication.m_videoOverlayUseByteBufferMethod
            && !m_tangoApplication.m_videoOverlayUseTextureIdMethod)
        {
            m_tangoApplication.m_videoOverlayUseByteBufferMethod = true;
        }
    }
コード例 #21
0
        /// <summary>
        /// Checks whether 3D Reconstruction permissions are selected and draws a warning if they are not.
        /// </summary>
        /// <returns><c>true</c>, if 3D Reconstruction permissions are enabled, <c>false</c> otherwise.</returns>
        /// <param name="tangoApplication">Prefab inspector's reference to Tango Application.</param>
        public static bool Check3dReconstructionPermissions(TangoApplication tangoApplication)
        {
            bool hasPermissions = tangoApplication.m_enable3DReconstruction;

            if (!hasPermissions)
            {
                EditorGUILayout.HelpBox("This component needs 3D Reconstruction to be enabled in "
                                        + "TangoApplication to function.",
                                        MessageType.Warning);
            }

            return(hasPermissions);
        }
コード例 #22
0
 /// <summary>
 /// Checks whether motion tracking permissions are selected and draws a warning if they are not.
 /// </summary>
 /// <returns><c>true</c>, if motion tracking permissions are enabled, <c>false</c> otherwise.</returns>
 /// <param name="tangoApplication">Prefab inspector's reference to Tango Application.</param>
 public static bool CheckMotionTrackingPermissions(TangoApplication tangoApplication)
 {
     bool hasPermissions = tangoApplication.m_enableMotionTracking;
     
     if (!hasPermissions)
     {
         EditorGUILayout.HelpBox("This component needs motion tracking to be enabled in "
                                 + "TangoApplication to function.",
                                 MessageType.Warning);
     }
     
     return hasPermissions;
 }
コード例 #23
0
    // Use this for initialization
    void Start () {
        Statics.currentTangoState = TangoPoseStates.Connecting;

        tangoApplication = FindObjectOfType<TangoApplication>();
        if (tangoApplication == null) {
            tangoApplication = FindObjectOfType<TangoApplication>();
        }
        tangoApplication.InitProviders(Statics.curADFId);
        tangoApplication.Register(this);
        tangoApplication.ConnectToService();

        startingRotation = transform.rotation;
    }
コード例 #24
0
        /// <summary>
        /// Checks whether motion tracking permissions are selected and draws a warning if they are not.
        /// </summary>
        /// <returns><c>true</c>, if motion tracking permissions are enabled, <c>false</c> otherwise.</returns>
        /// <param name="tangoApplication">Prefab inspector's reference to Tango Application.</param>
        public static bool CheckMotionTrackingPermissions(TangoApplication tangoApplication)
        {
            bool hasPermissions = tangoApplication.m_enableMotionTracking;

            if (!hasPermissions)
            {
                EditorGUILayout.HelpBox("This component needs motion tracking to be enabled in "
                                        + "TangoApplication to function.",
                                        MessageType.Warning);
            }

            return(hasPermissions);
        }
コード例 #25
0
    /// <summary>
    /// Draw motion tracking options.
    /// </summary>
    /// <param name="tangoApplication">Tango application.</param>
    private void _DrawMotionTrackingOptions(TangoApplication tangoApplication)
    {
        tangoApplication.m_enableMotionTracking = EditorGUILayout.Toggle(
            "Enable Motion Tracking", tangoApplication.m_enableMotionTracking);
        if (tangoApplication.m_enableMotionTracking)
        {
            ++EditorGUI.indentLevel;
            tangoApplication.m_motionTrackingAutoReset = EditorGUILayout.Toggle(
                "Auto Reset", tangoApplication.m_motionTrackingAutoReset);
            --EditorGUI.indentLevel;
        }

        EditorGUILayout.Space();
    }
コード例 #26
0
    /// <summary>
    /// Set up cameras.
    /// </summary>
    private void Start()
    {
        Application.targetFrameRate = 60;
        EnableCamera();

        m_tangoApplication = FindObjectOfType<TangoApplication>();

        m_textures = m_tangoApplication.GetVideoOverlayTextureYUV();

        // Pass YUV textures to shader for process.
        m_screenMaterial.SetTexture("_YTex", m_textures.m_videoOverlayTextureY);
        m_screenMaterial.SetTexture("_UTex", m_textures.m_videoOverlayTextureCb);
        m_screenMaterial.SetTexture("_VTex", m_textures.m_videoOverlayTextureCr);

        m_tangoApplication.Register(this);
    }
コード例 #27
0
 // Use this for initialization
 void Start()
 {
     // Initialize some variables
     m_tangoRotation = Quaternion.identity;
     m_tangoPosition = Vector3.zero;
     m_startPosition = transform.position;
     m_tangoApplication = FindObjectOfType<TangoApplication>();
     if (m_tangoApplication != null) {
         // Request Tango permissions
         m_tangoApplication.RegisterPermissionsCallback(PermissionsCallback);
         m_tangoApplication.RequestNecessaryPermissionsAndConnect();
         m_tangoApplication.Register(this);
     } else {
         Debug.Log("No Tango Manager found in scene.");
     }
 }
コード例 #28
0
    /// <summary>
    /// Initialize the AR Screen.
    /// </summary>
    private void Start()
    {
        // Constant matrix converting start of service frame to Unity world frame.
        m_uwTss = new Matrix4x4();
        m_uwTss.SetColumn (0, new Vector4 (1.0f, 0.0f, 0.0f, 0.0f));
        m_uwTss.SetColumn (1, new Vector4 (0.0f, 0.0f, 1.0f, 0.0f));
        m_uwTss.SetColumn (2, new Vector4 (0.0f, 1.0f, 0.0f, 0.0f));
        m_uwTss.SetColumn (3, new Vector4 (0.0f, 0.0f, 0.0f, 1.0f));
        
        // Constant matrix converting Unity world frame frame to device frame.
        m_cTuc.SetColumn (0, new Vector4 (1.0f, 0.0f, 0.0f, 0.0f));
        m_cTuc.SetColumn (1, new Vector4 (0.0f, -1.0f, 0.0f, 0.0f));
        m_cTuc.SetColumn (2, new Vector4 (0.0f, 0.0f, 1.0f, 0.0f));
        m_cTuc.SetColumn (3, new Vector4 (0.0f, 0.0f, 0.0f, 1.0f));

        m_tangoApplication = FindObjectOfType<TangoApplication>();
        
        if(m_tangoApplication != null)
        {
            if(AndroidHelper.IsTangoCorePresent())
            {
                // Request Tango permissions
                m_tangoApplication.RegisterPermissionsCallback(_OnTangoApplicationPermissionsEvent);
                m_tangoApplication.RequestNecessaryPermissionsAndConnect();
                m_tangoApplication.Register(this);
            }
            else
            {
                // If no Tango Core is present let's tell the user to install it.
                Debug.Log("Tango Core is outdated.");
            }
        }
        else
        {
            Debug.Log("No Tango Manager found in scene.");
        }
        if(m_tangoApplication != null)
        {
            m_textures = m_tangoApplication.GetVideoOverlayTextureYUV();
            // Pass YUV textures to shader for process.
            m_screenMaterial.SetTexture("_YTex", m_textures.m_videoOverlayTextureY);
            m_screenMaterial.SetTexture("_UTex", m_textures.m_videoOverlayTextureCb);
            m_screenMaterial.SetTexture("_VTex", m_textures.m_videoOverlayTextureCr);
        }
        
        m_tangoApplication.Register(this);
    }
コード例 #29
0
        /// <summary>
        /// Checks whether video overlay permissions are selected and draws a warning if they are not.
        /// </summary>
        /// <returns><c>true</c>, if appropriate video permissions are enabled, <c>false</c> otherwise.</returns>
        /// <param name="tangoApplication">Prefab inspector's reference to Tango Application.</param>
        /// <param name="textureIdMethodRequired"><c>true</c> if texture ID method is required.</param>
        /// <param name="byteBufferMethodRequired"><c>true</c> if byte buffer method is required.</param>
        public static bool CheckVideoOverlayPermissions(TangoApplication tangoApplication,
                                                        bool textureIdMethodRequired, bool byteBufferMethodRequired)
        {
            bool hasNeededVideoPermissions = tangoApplication.m_enableVideoOverlay;

            if (textureIdMethodRequired && !tangoApplication.m_videoOverlayUseTextureMethod)
            {
                hasNeededVideoPermissions = false;
            }
            else if (byteBufferMethodRequired && !tangoApplication.m_videoOverlayUseByteBufferMethod)
            {
                hasNeededVideoPermissions = false;
            }

            if (!hasNeededVideoPermissions)
            {
                if (textureIdMethodRequired || byteBufferMethodRequired)
                {
                    string requirementsString;
                    if (textureIdMethodRequired && byteBufferMethodRequired)
                    {
                        requirementsString = "\"Both\"";
                    }
                    else if (textureIdMethodRequired)
                    {
                        requirementsString = "\"Texture ID\" or \"Both\"";
                    }
                    else
                    {
                        requirementsString = "\"Raw Bytes\" or \"Both\"";
                    }

                    EditorGUILayout.HelpBox("This component needs Video Overlay to be enabled and set to method of "
                                            + requirementsString
                                            + " in TangoApplication to function.",
                                            MessageType.Warning);
                }
                else
                {
                    EditorGUILayout.HelpBox("This component needs Video Overlay to be enabled in "
                                            + "TangoApplication to function.",
                                            MessageType.Warning);
                }
            }

            return(hasNeededVideoPermissions);
        }
コード例 #30
0
 /// <summary>
 /// Use this to initialize.
 /// </summary>
 public void Start()
 {
     tangoApplication = FindObjectOfType<TangoApplication>();
     if (tangoApplication != null)
     {
         if (AndroidHelper.IsTangoCorePresent())
         {
             // Request Tango permissions
             tangoApplication.Register(this);
             tangoApplication.RequestPermissions();
         }
     }
     else
     {
         Debug.Log("No Tango Manager found in scene.");
     }
 }
コード例 #31
0
        /// <summary>
        /// Checks whether area description permissions are selected (on the assumption we're
        /// dealing with a prefab that has an m_useAreaDescriptionPose option) and draws
        /// a warning if they seem to be set inappropriately.
        /// </summary>
        /// <returns><c>true</c>, if area description permissions are enabled, <c>false</c> otherwise.</returns>
        /// <param name="tangoApplication">Prefab inspector's reference to Tango Application.</param>
        /// <param name="shouldUsePermissions">If set to <c>true</c> should use permissions.</param>
        public static bool CheckAreaDescriptionPermissions(TangoApplication tangoApplication,
                                                           bool shouldUsePermissions)
        {
            bool hasPermissions = tangoApplication.m_enableAreaDescriptions;

            if (!hasPermissions && shouldUsePermissions)
            {
                EditorGUILayout.HelpBox("\"Use Area Description Pose\" option selected but active "
                                        + "TangoApplication component does not have Area "
                                        + "Descriptions enabled.",
                                        MessageType.Warning);
            }
            else if (hasPermissions && !shouldUsePermissions)
            {
                EditorGUILayout.HelpBox("TangoApplication has Area Descriptions enabled but \"Use "
                                        + "Area Description Pose\" option is not selected.\n\n"
                                        + "If left as-is, this script will use the Start of Service "
                                        + "pose even if an area description is loaded and/or area learning is enabled",
                                        MessageType.Warning);
            }

            return(hasPermissions == tangoApplication.m_enableAreaDescriptions);
        }
コード例 #32
0
    /// <summary>
    /// Initialize the AR Screen.
    /// </summary>
    public void Start()
    {
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        m_arCameraPostProcess = gameObject.GetComponent<ARCameraPostProcess>();
        if (m_tangoApplication != null)
        {
            m_tangoApplication.Register(this);

            // Pass YUV textures to shader for process.
            m_textures = m_tangoApplication.GetVideoOverlayTextureYUV();
            m_screenMaterial.SetTexture("_YTex", m_textures.m_videoOverlayTextureY);
            m_screenMaterial.SetTexture("_UTex", m_textures.m_videoOverlayTextureCb);
            m_screenMaterial.SetTexture("_VTex", m_textures.m_videoOverlayTextureCr);
        }

        if (m_enableOcclusion) 
        {
            TangoPointCloud pointCloud = FindObjectOfType<TangoPointCloud>();
            if (pointCloud != null)
            {
                Renderer renderer = pointCloud.GetComponent<Renderer>();
                renderer.enabled = true;

                // Set the renderpass as background renderqueue's number minus one. YUV2RGB shader executes in 
                // Background queue which is 1000.
                // But since we want to write depth data to Z buffer before YUV2RGB shader executes so that YUV2RGB 
                // data ignores Ztest from the depth data we set renderqueue of PointCloud as 999.
                renderer.material.renderQueue = BACKGROUND_RENDER_QUEUE - 1;
                renderer.material.SetFloat("point_size", POINTCLOUD_SPLATTER_UPSAMPLE_SIZE);
                pointCloud.m_updatePointsMesh = true;
            }
            else
            {
                Debug.Log("Point Cloud data is not available, occlusion is not possible.");
            }
        }
    }
コード例 #33
0
    /// <summary>
    /// Use this for initialization.
    /// </summary>
    public void Start()
    {
        Statics.currentTangoState = TangoPoseStates.Connecting;

        tangoApplication = FindObjectOfType<TangoApplication>();
        if (tangoApplication == null)
        {
            tangoApplication = FindObjectOfType<TangoApplication>();
        }
        tangoApplication.Register(this);
        tangoApplication.Startup(AreaDescription.ForUUID(Statics.curADFId));

        startingRotation = transform.rotation;
    }
コード例 #34
0
    /// <summary>
    /// Start is called on the frame when a script is enabled.
    /// </summary>
    public void Start()
    {
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        m_tangoARScreen = GetComponent<TangoARScreen>();

        if (m_tangoApplication != null)
        {
            if (AndroidHelper.IsTangoCorePresent())
            {
                // Request Tango permissions
                m_tangoApplication.Register(this);
                m_tangoApplication.RequestPermissions();
            }
            else
            {
                // If no Tango Core is present let's tell the user to install it!
                StartCoroutine(_InformUserNoTangoCore());
            }
        }
        else
        {
            Debug.Log("No Tango Manager found in scene.");
        }
    }
コード例 #35
0
    /// <summary>
    /// Unity Start() callback, we set up some initial values here.
    /// </summary>
    public void Start()
    {
        m_currentFPS = 0;
        m_framesSinceUpdate = 0;
        m_currentTime = 0.0f;
        m_fpsText = "FPS = Calculating";
        m_tangoApplication = FindObjectOfType<TangoApplication>();
        m_tangoPose = FindObjectOfType<TangoARPoseController>();
        m_arCameraPostProcess = FindObjectOfType<ARCameraPostProcess>();
        m_tangoServiceVersion = TangoApplication.GetTangoServiceVersion();

        m_tangoApplication.Register(this);
    }
コード例 #36
0
 /// <summary>
 /// Draw depth options.
 /// </summary>
 /// <param name="tangoApplication">Tango application.</param>
 private void _DrawDepthOptions(TangoApplication tangoApplication)
 {
     tangoApplication.m_enableDepth = EditorGUILayout.Toggle("Enable Depth", tangoApplication.m_enableDepth);
     EditorGUILayout.Space();
 }
コード例 #37
0
 /// <summary>
 /// Raises the enable event.
 /// </summary>
 private void OnEnable()
 {
     m_tangoApplication = (TangoApplication)target;
 }