Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        if (maskType == Omek.ImageType.IMAGE_TYPE_COLOR)
        {
            regularImageData = BeckonData.Image.RGB;
        }
        else if (maskType == Omek.ImageType.IMAGE_TYPE_DEPTH)
        {
            regularImageData = BeckonData.Image.Depth;
        }

        TryToCreateTexture();

        Update();
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        if (!BeckonManager.BeckonInstance.IsInit())
        {
            return;
        }

        m_firstFrame = true;

        if (imageType == ImageType.IMAGE_TYPE_COLOR)
        {
            regularImageData = BeckonData.Image.RGB;
        }
        else if (imageType == ImageType.IMAGE_TYPE_DEPTH)
        {
            regularImageData = BeckonData.Image.Depth;
        }
        OmekFramework.Common.BasicTypes.CommonDefines.ImageFormat regularImageFormat = null;
        if (regularImageData.GetImageFormat(out regularImageFormat).IsError())
        {
            Debug.LogError("Error reading texture size.");
        }

        else
        {
            // create a texture and a color32[] to back it.
            m_texture            = new Texture2D(regularImageFormat.m_width, regularImageFormat.m_height, TextureFormat.ARGB32, false);
            m_pixels             = new Color32[regularImageFormat.m_width * regularImageFormat.m_height];
            m_texture.filterMode = FilterMode.Bilinear;
            m_texture.wrapMode   = TextureWrapMode.Clamp;

            m_texture.SetPixels32(m_pixels);
            m_texture.Apply();

            // set the texture in the material or GUITexture
            if (renderer)
            {
                renderer.material.mainTexture = m_texture;
            }
            else if (GetComponent(typeof(GUITexture)))
            {
                GUITexture gui = GetComponent(typeof(GUITexture)) as GUITexture;
                gui.texture = m_texture;
            }
        }
        Update();
    }