Exemplo n.º 1
0
        //Methods below taken from ModTools
        // https://github.com/bloodypenguin/Skylines-ModTools
        private static void DumpAPR(string assetName, Texture2D aprMap, string ap, string pp, string rp, bool extract)
        {
            if (aprMap == null)
            {
                return;
            }

            if (extract)
            {
                var length = aprMap.width * aprMap.height;
                var a1     = new Color32[length].Invert();
                var p1     = new Color32[length].Invert();
                var r1     = new Color32[length].Invert();
                aprMap.ExtractChannels(a1, p1, r1, null, true, true, true, true, true, false, false);

                if (NetDumpPanel.instance.skiptextureExport.isChecked)
                {
                    //checks to see if the textures are the default color
                    if (IsAlphaDefault(a1.ColorsToTexture(aprMap.width, aprMap.height)) == false)
                    {
                        TextureUtil.DumpTextureToPNG(a1.ColorsToTexture(aprMap.width, aprMap.height), ap);
                    }

                    if (IsPavementOrRoadDefault(p1.ColorsToTexture(aprMap.width, aprMap.height)) == false)
                    {
                        TextureUtil.DumpTextureToPNG(p1.ColorsToTexture(aprMap.width, aprMap.height), pp);
                    }
                    if (IsPavementOrRoadDefault(r1.ColorsToTexture(aprMap.width, aprMap.height)) == false)
                    {
                        TextureUtil.DumpTextureToPNG(r1.ColorsToTexture(aprMap.width, aprMap.height), rp);
                    }
                }
                else
                {
                    TextureUtil.DumpTextureToPNG(a1.ColorsToTexture(aprMap.width, aprMap.height), ap);
                    TextureUtil.DumpTextureToPNG(p1.ColorsToTexture(aprMap.width, aprMap.height), pp);
                    TextureUtil.DumpTextureToPNG(r1.ColorsToTexture(aprMap.width, aprMap.height), rp);
                }
            }
            else
            {
                TextureUtil.DumpTextureToPNG(aprMap, $"{assetName}_APR");
            }
        }
Exemplo n.º 2
0
 private static void DumpMainTex(string assetName, Texture2D mainTex, bool extract = true)
 {
     if (mainTex == null)
     {
         return;
     }
     if (extract)
     {
         var length = mainTex.width * mainTex.height;
         var r      = new Color32[length].Invert();
         mainTex.ExtractChannels(r, r, r, null, false, false, false, false, false, false, false);
         TextureUtil.DumpTextureToPNG(r.ColorsToTexture(mainTex.width, mainTex.height), $"{assetName}_d");
     }
     else
     {
         TextureUtil.DumpTextureToPNG(mainTex, $"{assetName}_MainTex");
     }
 }
Exemplo n.º 3
0
 private static void DumpXYS(string assetName, Texture2D xysMap, bool extract = true)
 {
     if (xysMap == null)
     {
         return;
     }
     if (extract)
     {
         var length = xysMap.width * xysMap.height;
         var r1     = new Color32[length].Invert();
         var b1     = new Color32[length].Invert();
         xysMap.ExtractChannels(r1, r1, b1, null, false, false, true, false, false, true, false);
         TextureUtil.DumpTextureToPNG(r1.ColorsToTexture(xysMap.width, xysMap.height), $"{assetName}_n");
         TextureUtil.DumpTextureToPNG(b1.ColorsToTexture(xysMap.width, xysMap.height), $"{assetName}_s");
     }
     else
     {
         TextureUtil.DumpTextureToPNG(xysMap, $"{assetName}_XYS");
     }
 }
Exemplo n.º 4
0
 private static void DumpACI(string assetName, Texture2D aciMap, bool extract = true)
 {
     if (aciMap == null)
     {
         return;
     }
     if (extract)
     {
         var length = aciMap.width * aciMap.height;
         var r      = new Color32[length].Invert();
         var g      = new Color32[length].Invert();
         var b      = new Color32[length].Invert();
         aciMap.ExtractChannels(r, g, b, null, true, true, true, true, true, false, false);
         TextureUtil.DumpTextureToPNG(r.ColorsToTexture(aciMap.width, aciMap.height), $"{assetName}_a");
         TextureUtil.DumpTextureToPNG(g.ColorsToTexture(aciMap.width, aciMap.height), $"{assetName}_c");
         TextureUtil.DumpTextureToPNG(b.ColorsToTexture(aciMap.width, aciMap.height), $"{assetName}_i");
     }
     else
     {
         TextureUtil.DumpTextureToPNG(aciMap, $"{assetName}_ACI");
     }
 }
Exemplo n.º 5
0
 private static void DumpAPR(string assetName, Texture2D aprMap, bool extract = true)
 {
     if (aprMap == null)
     {
         return;
     }
     if (extract)
     {
         var length = aprMap.width * aprMap.height;
         var a1     = new Color32[length].Invert();
         var p1     = new Color32[length].Invert();
         var r1     = new Color32[length].Invert();
         aprMap.ExtractChannels(a1, p1, r1, null, true, true, true, true, true, false, false);
         TextureUtil.DumpTextureToPNG(a1.ColorsToTexture(aprMap.width, aprMap.height), $"{assetName}_a");
         TextureUtil.DumpTextureToPNG(p1.ColorsToTexture(aprMap.width, aprMap.height), $"{assetName}_p");
         TextureUtil.DumpTextureToPNG(r1.ColorsToTexture(aprMap.width, aprMap.height), $"{assetName}_r");
     }
     else
     {
         TextureUtil.DumpTextureToPNG(aprMap, $"{assetName}_APR");
     }
 }