Exemplo n.º 1
0
        private void LoadTextures(GraphicsDevice device, IProgressReceiver progressReceiver,
                                  McResourcePack resourcePack, bool isFirst)
        {
            progressReceiver.UpdateProgress(0, $"Loading textures: {resourcePack.Manifest?.Name ?? "Unknown"}");

            if (!isFirst)
            {
                Atlas.LoadResourcePackOnTop(device,
                                            ActiveResourcePacks.First().TexturesAsBitmaps.Where(x => x.Key.StartsWith("block")).ToArray(),
                                            resourcePack.TexturesAsBitmaps.Where(x => x.Key.StartsWith("block")).ToArray(),
                                            resourcePack.TextureMetas,
                                            progressReceiver);
            }
            else
            {
                Atlas.GenerateAtlas(device, resourcePack.TexturesAsBitmaps.Where(x => x.Key.StartsWith("block")).ToArray(),
                                    resourcePack.TextureMetas,
                                    progressReceiver);


                //Atlas.Atlas.Save("atlas.png", ImageFormat.Png);
            }

            //  if (!isFirst)
            {
                progressReceiver.UpdateProgress(0, $"Loading UI textures: {resourcePack.Manifest?.Name ?? "Unknown"}");
                Alex.GuiRenderer.LoadResourcePackTextures(resourcePack, progressReceiver);
            }
        }