コード例 #1
0
    void OnGUI()
    {
        if (_player == null || _frames == null)
        {
            return;
        }

        Event e = Event.current;

        switch (e.type)
        {
        case EventType.Repaint:
        {
            for (int i = 0; i < _frames.Length; ++i)
            {
                lock (_frames[i]) {
                    if (_frames [i].arrived)
                    {
                        Resize((int)_frames [i].size.x, (int)_frames [i].size.y, _frames [i].components, i);
                        if (_processor == null)
                        {
                            if (m_Texture [i] == null)
                            {
                                Debug.LogError("The GstTexture does not have a texture assigned and will not paint.");
                            }
                            else
                            {
                                _frames [i].Eyegaze = Player.RTPGetEyegaze(i);
                                _player.BlitTexture(m_Texture [i].GetNativeTexturePtr(), m_Texture [i].width, m_Texture [i].height, i);
                            }
                        }
                        else
                        {
                            _processor.Process(_player);
                        }
                        _frames [i].arrived = false;
                        Timestamp [i]       = _player.GetLastImageTimestamp(i);

                        //For Nakakura's work
                        //_player.SendRTPMetaToHost(i,"127.0.0.1",60000);

                        _triggerOnFrameBlitted(i);
                        OnFrameCaptured(i);
                    }
                }
            }
            break;
        }
        }
    }
コード例 #2
0
    void OnGUI()
    {
        if (_player == null || _frames == null)
        {
            return;
        }

        Event e = Event.current;

        switch (e.type)
        {
        case EventType.Repaint:
        {
            for (int i = 0; i < _frames.Length; ++i)
            {
                lock (_frames[i]) {
                    if (_frames [i].arrived)
                    {
                        Resize((int)_frames [i].size.x, (int)_frames [i].size.y, _frames [i].components, i);
                        //if (_processor == null) {
                        if (m_Texture [i] == null)
                        {
                            Debug.LogError("The GstTexture does not have a texture assigned and will not paint.");
                        }
                        else
                        {
                            lock (_player) {
                                m_ecount = Player.RTPGetEyegazeCount(i);
                                if (_frames[i].Eyegaze == null || _frames[i].Eyegaze.Count != m_ecount)
                                {
                                    _frames[i].Eyegaze = new List <List <Vector4> >(m_ecount);
                                    for (int j = 0; j < m_ecount; ++j)
                                    {
                                        _frames[i].Eyegaze.Add(new List <Vector4>());
                                    }
                                }
                                for (int eidx = 0; eidx < m_ecount; ++eidx)
                                {
                                    int levels = Player.RTPGetEyegazeLevels(i, eidx);
                                    if (_frames[i].Eyegaze[eidx] == null || levels != _frames[i].Eyegaze[eidx].Count)
                                    {
                                        m_levels = levels;
                                        for (int l = 0; l < m_levels; ++l)
                                        {
                                            _frames[i].Eyegaze[eidx].Add(Vector4.zero);
                                        }
                                    }
                                    for (int l = 0; l < m_levels; ++l)
                                    {
                                        _frames[i].Eyegaze[eidx][l] = Player.RTPGetEyegaze(i, eidx, l);
                                    }
                                }
                                _player.BlitTexture(m_Texture [i].GetNativeTexturePtr(), m_Texture [i].width, m_Texture [i].height, i);
                            }
                        }

                        /*	} else {
                         *              _processor.Process (_player);
                         *              _player.BlitTexture (m_Texture [i].GetNativeTexturePtr (), m_Texture [i].width/GetScaler(_frames[i].components), m_Texture [i].height, i);
                         *      }*/
                        _frames [i].arrived = false;
                        Timestamp [i]       = _player.GetLastImageTimestamp(i);

                        //For Nakakura's work
                        //_player.SendRTPMetaToHost(i,"127.0.0.1",60000);

                        _triggerOnFrameBlitted(i);
                        OnFrameCaptured(i);
                    }
                }
            }
            break;
        }
        }
    }