Пример #1
0
        public void AddMessage(Message message)
        {
            if (!VisualizationUtils.AssertMessageType <OccupancyGridMsg>(message, m_Topic))
            {
                return;
            }

            m_Message        = (OccupancyGridMsg)message;
            m_TextureIsDirty = true;

            if (m_IsDrawingEnabled && Time.time > m_LastDrawingFrameTime)
            {
                Redraw();
            }

            m_LastDrawingFrameTime = Time.time;
        }
        public virtual void AddMessage(Message message)
        {
            if (!VisualizationUtils.AssertMessageType <ImageMsg>(message, m_Topic))
            {
                return;
            }

            this.message     = (ImageMsg)message;
            m_Texture2D      = null;
            m_CheapTexture2D = null;
            m_Width          = (int)this.message.width;
            m_Height         = (int)this.message.height;
            m_Encoding       = this.message.encoding;
            //m_CheapTextureMaterial.SetFloat("_gray", this.message.GetNumChannels() == 1 ? 1.0f : 0.0f);
            m_CheapTextureMaterial.SetFloat("_convertBGR", this.message.EncodingRequiresBGRConversion() ? 1.0f : 0.0f);

            // if anyone wants to know about the texture, notify them
            if (m_OnChangeCallbacks.Count > 0)
            {
                GetTexture();
            }
        }