Esempio n. 1
0
    void BuildAtlas(string name, TextureFormat format = TextureFormat.RGBA32, Color defaultColor = default(Color), bool linear = false)
    {
        textureList.Sort(CompareBySize);
        AtlasCreator.Atlas[] atlasList = AtlasCreator.CreateAtlas(name, textureList.ToArray(), null, format, defaultColor, linear);
        if ((atlasList.Length > 1) || (GameSettings.Instance.rendering.debugTextureAtlas))
        {
            for (int i = 0; i < atlasList.Length; i++)
            {
                AtlasCreator.SaveAtlas(atlasList[i], i + name);
            }
        }
        atlas = atlasList[0];
        textureList.Clear();

        texIndexToAtlasIndex = new Dictionary <int, int>();
        nameToAtlasIndex     = new Dictionary <string, int>();
        for (int i = 0; i < atlas.uvRects.Length; i++)
        {
            nameToAtlasIndex[atlas.uvRects[i].name] = i;
        }

        foreach (var item in texIndexToName)
        {
            if (nameToAtlasIndex.ContainsKey(item.Value))
            {
                texIndexToAtlasIndex[item.Key] = nameToAtlasIndex[item.Value];
            }
            else
            {
                Debug.LogError("What the f**k");
            }
        }

        //AtlasCreator.SaveAtlas(atlas, name);
    }
Esempio n. 2
0
    public void BuildAtlas(string name, TextureFormat format = TextureFormat.RGBA32, Color defaultColor = default(Color), bool linear = false)
    {
        AtlasCreator.Atlas[] atlasList = AtlasCreator.CreateAtlas(name, textureList.ToArray(), null, format, defaultColor, linear);
        atlas = atlasList[0];
        textureList.Clear();

        texIndexToAtlasIndex = new Dictionary <int, int>();
        nameToAtlasIndex     = new Dictionary <string, int>();
        for (int i = 0; i < atlas.uvRects.Length; i++)
        {
            nameToAtlasIndex[atlas.uvRects[i].name] = i;
        }

        foreach (var item in texIndexToName)
        {
            texIndexToAtlasIndex[item.Key] = nameToAtlasIndex[item.Value];
        }

        //AtlasCreator.SaveAtlas(atlas, name);
    }
Esempio n. 3
0
    public void BuildAtlas(string name, TextureFormat format = TextureFormat.RGBA32, Color defaultColor = default(Color), bool linear = false)
    {
        AtlasCreator.Atlas[] atlasList = AtlasCreator.CreateAtlas(name, textureList.ToArray(), null, format, defaultColor, linear);
        atlas = atlasList[0];
        textureList.Clear();

        texIndexToAtlasIndex = new Dictionary<int, int>();
        nameToAtlasIndex = new Dictionary<string, int>();
        for (int i = 0; i < atlas.uvRects.Length; i++)
        {
            nameToAtlasIndex[atlas.uvRects[i].name] = i;
        }

        foreach (var item in texIndexToName)
        {
            texIndexToAtlasIndex[item.Key] = nameToAtlasIndex[item.Value];
        }

        //AtlasCreator.SaveAtlas(atlas, name);
    }
Esempio n. 4
0
    void BuildAtlas(string name, TextureFormat format = TextureFormat.RGBA32, Color defaultColor = default(Color), bool linear = false)
    {
        textureList.Sort(CompareBySize);
        AtlasCreator.Atlas[] atlasList = AtlasCreator.CreateAtlas(name, textureList.ToArray(), null, format, defaultColor, linear);
        if((atlasList.Length > 1) || (GameSettings.Instance.rendering.debugTextureAtlas))
        {
            for(int i = 0; i < atlasList.Length; i++)
            {
                AtlasCreator.SaveAtlas(atlasList[i], i+name);
            }
        }
        atlas = atlasList[0];
        textureList.Clear();

        texIndexToAtlasIndex = new Dictionary<int, int>();
        nameToAtlasIndex = new Dictionary<string, int>();
        for (int i = 0; i < atlas.uvRects.Length; i++)
        {
            nameToAtlasIndex[atlas.uvRects[i].name] = i;
        }

        foreach (var item in texIndexToName)
        {
            if(nameToAtlasIndex.ContainsKey(item.Value))
                texIndexToAtlasIndex[item.Key] = nameToAtlasIndex[item.Value];
            else
            {
                Debug.LogError("What the f**k");
            }
        }

        //AtlasCreator.SaveAtlas(atlas, name);
    }