Beispiel #1
0
        void DoUnpack(TextureChannel singleChannel = TextureChannel.RGBA)
        {
            if (!PackerShadersExist)
            {
                return;
            }

            var channelTextures = new Dictionary <string, Texture2D>();

            if (singleChannel == TextureChannel.RGBA)
            {
                channelTextures = PoiHelpers.UnpackTextureToChannels(unpackSource, unpackInvert, UnpackSize);
            }
            else
            {
                channelTextures[singleChannel.ToString().ToLower()] = unpackSource.GetChannelAsTexture(singleChannel, unpackInvert, UnpackSize);
            }


            string pingPath = null;

            pingPath = SaveTextures(channelTextures, pingPath);

            Debug.Log(LOG_PREFIX + "Finished unpacking texture at " + pingPath);
            PoiHelpers.PingAssetAtPath(pingPath);
        }
Beispiel #2
0
        void DoPack()
        {
            if (!PackerShadersExist)
            {
                return;
            }

            Texture2D red   = packRed;
            Texture2D green = packGreen;
            Texture2D blue  = packBlue;
            Texture2D alpha = packAlpha;

            if (showChannelPicker)
            {
                red   = packRed.GetChannelAsTexture(redTexChan, unpackInvert);
                green = packGreen.GetChannelAsTexture(greenTexChan, unpackInvert);
                blue  = packBlue.GetChannelAsTexture(blueTexChan, unpackInvert);
                alpha = packAlpha.GetChannelAsTexture(alphaTexChan, unpackInvert);
            }

            Texture2D packResult = PoiHelpers.PackTextures(PackSize, red, green, blue, alpha, redInvert, greenInvert, blueInvert, alphaInvert);

            if (packResult)
            {
                string path = $"{savePath}/Packed/{packedName}.png";
                packResult.SaveTextureAsset(path, true);
                Debug.Log(LOG_PREFIX + "Finished packing texture at " + path);
                PoiHelpers.PingAssetAtPath(path);
            }
        }