Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        protected virtual void OpenDelayed()
        {
            // Fix the size.
            if (m_SizeRead <= 0)
            {
                m_SizeRead = 64;
            }
            // Fix points.
            if (points.Length == 0)
            {
                int i = 2;
                points = new BlobsID3D[i];
                while (i-- > 0)
                {
                    points[i]          = new BlobsID3D();
                    points[i].poseName = (i == 0)?"Left_Hand":"Right_Hand";
                    points[i].id       = i;
                    points[i].OnStart(this);
                }
            }
            // Open the steam.
            if (m_UsbStream == null)
            {
                // Fix VID & PID
                if (vId * pId == 0)
                {
                    vId = 0x1f3b; pId = 0x10ff;
                }
                //
                m_UsbStream = new
#if UNITY_EDITOR || UNITY_STANDALONE_WIN
                              HidStream
#elif UNITY_ANDROID
                              UsbStream
#endif

                                  (vId, pId, /*0x1f3b,0x10ff,*/ 0);
                //
                m_UsbStream.readBufferSize = m_SizeRead;
                m_UsbStream.SetOnStreamOpenListener(this);
#if !UNITY_EDITOR && UNITY_ANDROID
                ((UsbStream)m_UsbStream).SetInterfaceFilters(3, 0, 1);
#endif
#if UNITY_EDITOR || UNITY_STANDALONE_WIN
                if (safeReadMode)
                {
                    if (m_BufferRead == null)
                    {
                        m_BufferRead = new byte[m_SizeRead];
                    }
                }
                else
#endif
                {
                    m_UsbStream.SetOnStreamReadListener(this);
                }
            }
            m_UsbStream.Open();
        }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 public virtual void OnBlobUpdate(BlobsID3D blob)
 {
     position = blob.position;
 }
Exemple #3
0
 /// <summary>
 ///
 /// </summary>
 public virtual void SwapPoints(int lhs, int rhs)
 {
     BlobsID3D b = points[lhs]; points[lhs] = points[rhs]; points[rhs] = b;
 }