/// <summary> /// Use this for initialization. /// Init all the data for depth texture construct /// </summary> private void Start() { camera.depthTextureMode = DepthTextureMode.Depth; m_tex = new Texture2D(m_DepthBufferWidth, m_DepthBufferHeight); m_colorArr = new Color[m_DepthBufferWidth * m_DepthBufferHeight]; m_zmeter = new float[m_DepthBufferWidth * m_DepthBufferHeight]; m_depthArr_int = new int[m_DepthBufferWidth * m_DepthBufferHeight]; m_tangoCam = m_camObj.GetComponent <Tango.Synchronizer>() as Tango.Synchronizer; for (int i = 0; i < m_DepthBufferWidth * m_DepthBufferHeight; i++) { m_colorArr[i] = Color.blue; } }
// Update is called once per frame void Update() { if (Time.captureFramerate < timeout) { if (result == false) { Tango.Synchronizer depthImageAccessor = depthImageSource.GetComponent <Tango.Synchronizer>(); int [] depthImageBuffer = new int[depthImageAccessor.getDepthBufferSize()]; double timestamp = 0; result = depthImageAccessor.getDepthBuffer(ref depthImageBuffer, ref timestamp); if (result) { Debug.Log("Depth buffer is available. Reported timestamp:" + timestamp); } } } }