Exemplo n.º 1
0
        /// <summary>
        /// This uses Multi-Threaded TextureScale class (included) to re-size the visual map, it also adjusts the alpha channel by multiplying each pixel by the alpha level you set with the window controls
        /// </summary>
        private void rescaleMap()
        {
            smallScaledMap = newScaledMap;

            if (alpha < 0.95f)
            {
                var pix = smallScaledMap.GetPixels32();

                for (int i = 0; i < pix.Length; i++)
                {
                    pix[i].a = (byte)(pix[i].a * alpha);
                }

                smallScaledMap.SetPixels32(pix);
                smallScaledMap.Apply();

                pix = null;
            }

            switch (rescaleType)
            {
            case 0:
                TextureScale.Bilinear(smallScaledMap, visualHeight * 2, visualHeight);
                break;

            case 1:
                TextureScale.Point(smallScaledMap, visualHeight * 2, visualHeight);
                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// This uses Multi-Threaded TextureScale class (included) to re-size the visual map, it also adjusts the alpha channel by multiplying each pixel by the alpha level you set with the window controls
        /// </summary>
        private void rescaleMap()
        {
            if (File.Exists("saves/" + HighLogic.SaveFolder + "/ResearchBodies/" + currentDetailLevel + "_" + Body.bodyName + ".cache"))
            {
                byte[]    bytes = File.ReadAllBytes("saves/" + HighLogic.SaveFolder + "/ResearchBodies/" + currentDetailLevel + "_" + Body.bodyName + ".cache");
                Texture2D tex   = new Texture2D(visualHeight * 2, visualHeight);
                tex.LoadImage(bytes);
                smallScaledMap = tex;
                return;
            }

            smallScaledMap = newScaledMap;

            if (alpha < 0.95f)
            {
                var pix = smallScaledMap.GetPixels32();

                for (int i = 0; i < pix.Length; i++)
                {
                    pix[i].a = (byte)(pix[i].a * alpha);
                }

                smallScaledMap.SetPixels32(pix);
                smallScaledMap.Apply();

                pix = null;
            }

            switch (rescaleType)
            {
            case 0:
                TextureScale.Bilinear(smallScaledMap, visualHeight * 2, visualHeight);
                break;

            case 1:
                TextureScale.Point(smallScaledMap, visualHeight * 2, visualHeight);
                break;

            default:
                break;
            }
        }