コード例 #1
0
        public static Model LoadObject(string id)
        {
            Model obj = null;

            LoadingTaskMan.DoLoadingTaskSynchronous($"LOAD_OBJ_{id}", $"Loading object {id}...", progress =>
            {
                if (GameType == GameTypes.DS3)
                {
                    var chrbnd = BND4.Read($@"{InterrootPath}\obj\{id}.objbnd.dcx");

                    obj = new Model(progress, id, chrbnd, 0, null, null);
                }
                else if (GameType == GameTypes.DS1)
                {
                    var chrbnd = BND3.Read($@"{InterrootPath}\obj\{id}.objbnd");

                    obj = new Model(progress, id, chrbnd, 0, null, null);
                }
                else if (GameType == GameTypes.DS1R)
                {
                    var chrbnd = BND4.Read($@"{InterrootPath}\obj\{id}.objbnd.dcx");

                    obj = new Model(progress, id, chrbnd, 0, null, null);
                }
                else if (GameType == GameTypes.BB)
                {
                    var chrbnd = BND4.Read($@"{InterrootPath}\obj\{id}.objbnd.dcx");

                    obj = new Model(progress, id, chrbnd, 0, null, null);
                }

                Scene.AddModel(obj);

                var texturesToLoad = obj.MainMesh.GetAllTexNamesToLoad();

                LoadingTaskMan.DoLoadingTask($"LOAD_OBJ_{id}_TEX",
                                             "Loading additional object textures...", innerProgress =>
                {
                    if (GameType == GameTypes.DS1)
                    {
                        foreach (var tex in texturesToLoad)
                        {
                            TexturePool.AddTpfFromPath($@"{InterrootPath}\map\tx\{tex}.tpf");
                        }
                    }
                    else if (GameType == GameTypes.DS3)
                    {
                        int objGroup = int.Parse(id.Substring(1)) / 1_0000;
                        var tpfBnds  = System.IO.Directory.GetFiles($@"{InterrootPath}\map\m{objGroup:D2}", "*.tpfbhd");
                        foreach (var t in tpfBnds)
                        {
                            TexturePool.AddSpecificTexturesFromBinder(t, texturesToLoad, directEntryNameMatch: true);
                        }
                    }
                    obj.MainMesh.TextureReloadQueued = true;
                });
            });

            return(obj);
        }
コード例 #2
0
ファイル: Model.cs プロジェクト: AinTunez/DSAnimStudio
        public void TryToLoadTexturesFromBinder(string path)
        {
            List <string> textures = MainMesh.GetAllTexNamesToLoad();

            TexturePool.AddSpecificTexturesFromBinder(path, textures);
        }