Esempio n. 1
0
        public override void ExportSceneToFile(string FileName)
        {
            // update new single binds

            // update textures

            // Optimize Texture Sharing

            Dictionary <byte[], HSD_Image> imageDataToBuffer = new Dictionary <byte[], HSD_Image>(new ByteArrayComparer());

            foreach (var tobj in tobjToSurface)
            {
                var t = new HSD_TOBJ();
                t._s = tobj.Key;

                if (!imageDataToBuffer.ContainsKey(t.ImageData.ImageData))
                {
                    imageDataToBuffer.Add(t.ImageData.ImageData, t.ImageData);
                }

                t.ImageData = imageDataToBuffer[t.ImageData.ImageData];
            }

            // Save to file

            HSDFile.Save(FileName);
        }
Esempio n. 2
0
        public void Open(FileItem File)
        {
            var r = new HSDFile();

            r.Decompile(File.FilePath);

            foreach (var root in r.Roots)
            {
                Debug.WriteLine(root.Name);

                if (root.Node is HSD_JOBJ jobj)
                {
                    ParseJOBJs(jobj, null);
                }
                if (root.Node is HSD_SOBJ sobj)
                {
                    ParseJOBJs(sobj.JOBJDescs.Elements[0].RootJoint, null);
                }

                if (FirstJOBJ != null && outModel.Meshes.Count == 0)
                {
                    List <HSD_JOBJ> BoneList = FirstJOBJ.DepthFirstList;

                    ParseDOBJs(FirstJOBJ, null, BoneList);
                }
            }
        }