Ejemplo n.º 1
0
        void InitTexture(int pWidth, int pHeight, Color pColor)
        {
            // pixels
            mTargetPixels = CocoData.CreateArray <Color32> (pWidth * pHeight, pColor);

            // target texture
            mTargetTexture = new Texture2D(pWidth, pHeight, TextureFormat.ARGB32, false);
            mTargetTexture.SetPixels32(mTargetPixels);
            mTargetTexture.Apply();
            TargetMaterial.SetTexture(mTargetMaterialProperty, mTargetTexture);
        }
Ejemplo n.º 2
0
        /**
         * Create Texture (Color32), faster but only support ARGB32
         */
        public static Texture2D CreateColor32Texture(int width, int height, bool applied, TextureFormat format, Color32 color32)
        {
            switch (format)
            {
            case TextureFormat.ARGB32:
                Texture2D texture = new Texture2D(width, height, TextureFormat.ARGB32, false);
                texture.SetPixels32(CocoData.CreateArray <Color32> (width * height, color32));
                if (applied)
                {
                    texture.Apply();
                }
                return(texture);
            }

            Debug.LogError("CocoTexture->CreateColor32Texture: texture format [" + format + "] NOT supported.");
            return(null);
        }