コード例 #1
0
    /// <summary>
    /// Update is called once per frame.
    /// Running filter, filling out the buffer and pass to the shader each frame.
    /// </summary>
    private void Update()
    {
        m_tangoCam.getDepthBuffer(ref m_depthArr_int, ref m_timeStamp);
//        if (m_preTimeStamp == m_timeStamp)
//        {
//            return;
//        }
//        m_preTimeStamp = m_timeStamp;
        _GetZFromRaw(ref m_zmeter, m_depthArr_int);
        if (m_isUsingFilter)
        {
            Helper.Filter(m_zmeter, m_filterArr, 2);
        }
        for (int i = 0; i < m_DepthBufferWidth * m_DepthBufferHeight; i++)
        {
            if (m_isUsingFilter)
            {
                m_colorArr[i].r = (float)((float)m_filterArr[i] / (float)m_top);
                m_colorArr[i].g = (float)((float)m_filterArr[i] / (float)m_top);
                m_colorArr[i].b = (float)((float)m_filterArr[i] / (float)m_top);
                m_colorArr[i].a = 1.0f;
            }
            else
            {
                m_colorArr[i].r = (float)((float)m_zmeter[i] / (float)m_top);
                m_colorArr[i].g = (float)((float)m_zmeter[i] / (float)m_top);
                m_colorArr[i].b = (float)((float)m_zmeter[i] / (float)m_top);
                m_colorArr[i].a = 1.0f;
            }
        }
        m_tex.SetPixels(m_colorArr);
        m_tex.Apply();
        m_depthOcclusionMaterial.SetTexture("_ColorTex", m_videoOverlayRenderer.frameTexture);
        m_depthOcclusionMaterial.SetTexture("_DepthTex", m_tex);
    }
コード例 #2
0
 // 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);
             }
         }
     }
 }