Exemplo n.º 1
0
        public void Load()
        {
            IsActive = true;
            CanSave  = true;

            using (FileReader reader = new FileReader(new MemoryStream(Data)))
            {
                reader.Seek(4);
                if (reader.ReadInt32() != 0x20202020)
                {
                    IsWiiU = true;
                }
                reader.Close();
            }

            bfres                         = new BFRESRender();
            bfres.ResFileNode             = new ResourceFile(this);
            bfres.ResFileNode.BFRESRender = bfres;

            EditorRoot = bfres.ResFileNode;

            if (IsWiiU)
            {
                bfres.LoadFile(new Syroot.NintenTools.Bfres.ResFile(new System.IO.MemoryStream(Data)));
            }
            else
            {
                bfres.LoadFile(new Syroot.NintenTools.NSW.Bfres.ResFile(new System.IO.MemoryStream(Data)));
            }

            Runtime.abstractGlDrawables.Add(bfres);
        }
Exemplo n.º 2
0
        public void LoadMaterial(FMAT mat, BFRESRender bfres)
        {
            bfresRender = bfres;
            material    = mat;
            textBoxMaterialName.Text = material.Text;

            SetActiveGameByShader(material.shaderassign.ShaderArchive, material.shaderassign.ShaderModel);

            chkboxVisible.Checked = mat.Enabled;

            FillForm();
        }
Exemplo n.º 3
0
        public static void Read(BFRESRender renderer, ResFile resFile, TreeNode ResFileNode)
        {
            int CurMdl = 0;

            foreach (Model mdl in resFile.Models.Values)
            {
                FMDL model = new FMDL();
                model.Text     = mdl.Name;
                model.Skeleton = new FSKL(mdl.Skeleton);
                model.Nodes.Add(model.Skeleton.node);
                model.Skeleton.reset();
                model.Skeleton.update();
                model.BFRESRender = renderer;
                model.Skeleton.node.BFRESRender = renderer;
                model.ModelU = mdl;
                foreach (Material mat in mdl.Materials.Values)
                {
                    FMAT FMAT = new FMAT();
                    FMAT.BFRESRender = renderer;
                    FMAT.Text        = mat.Name;
                    FMAT.ReadMaterial(mat);
                    model.Nodes[1].Nodes.Add(FMAT);
                    model.materials.Add(FMAT.Text, FMAT);
                }
                foreach (Shape shp in mdl.Shapes.Values)
                {
                    VertexBuffer vertexBuffer = mdl.VertexBuffers[shp.VertexBufferIndex];
                    Material     material     = mdl.Materials[shp.MaterialIndex];
                    FSHP         mesh         = new FSHP();
                    mesh.BFRESRender = renderer;
                    mesh.ModelIndex  = CurMdl;
                    ReadShapesVertices(mesh, shp, vertexBuffer, model);
                    mesh.MaterialIndex = shp.MaterialIndex;

                    model.Nodes[0].Nodes.Add(mesh);
                    model.shapes.Add(mesh);
                }
                ResFileNode.Nodes[0].Nodes.Add(model);
                renderer.models.Add(model);

                CurMdl++;
            }
        }
Exemplo n.º 4
0
        public void Load()
        {
            IsActive = true;
            CanSave  = true;



            ImageKey         = "bfres";
            SelectedImageKey = "bfres";

            ContextMenu = new ContextMenu();
            MenuItem save = new MenuItem("Save");

            ContextMenu.MenuItems.Add(save);
            save.Click += Save;

            MenuItem newMenu = new MenuItem("New");
            MenuItem import  = new MenuItem("Import");
            //       ContextMenu.MenuItems.Add(newMenu);
            //       ContextMenu.MenuItems.Add(import);

            MenuItem rename = new MenuItem("Rename");

            ContextMenu.MenuItems.Add(rename);
            rename.Click += Rename;
            MenuItem remove = new MenuItem("Remove");

            ContextMenu.MenuItems.Add(remove);
            remove.Click += Remove;

            if (Parent == null)
            {
                remove.Enabled = false;
            }

            if (IsWiiU)
            {
            }
            else
            {
                MenuItem model    = new MenuItem("Model");
                MenuItem fska     = new MenuItem("Skeletal Animation");
                MenuItem fmaa     = new MenuItem("Material Animation");
                MenuItem bonevis  = new MenuItem("Bone Visual Animation");
                MenuItem shape    = new MenuItem("Shape Animation");
                MenuItem scene    = new MenuItem("Scene Animation");
                MenuItem embedded = new MenuItem("Embedded File");
                MenuItem texture  = new MenuItem("Texture File");
                texture.Click += NewTextureFile;
                newMenu.MenuItems.Add(model);
                newMenu.MenuItems.Add(fska);
                newMenu.MenuItems.Add(fmaa);
                newMenu.MenuItems.Add(bonevis);
                newMenu.MenuItems.Add(shape);
                newMenu.MenuItems.Add(scene);
                newMenu.MenuItems.Add(embedded);
                newMenu.MenuItems.Add(texture);

                MenuItem importmodel    = new MenuItem("Model");
                MenuItem importfska     = new MenuItem("Skeletal Animation");
                MenuItem importfmaa     = new MenuItem("Material Animation");
                MenuItem importbonevis  = new MenuItem("Bone Visual Animation");
                MenuItem importshape    = new MenuItem("Shape Animation");
                MenuItem importscene    = new MenuItem("Scene Animation");
                MenuItem importembedded = new MenuItem("Embedded File");
                MenuItem importtexture  = new MenuItem("Texture File");
                import.MenuItems.Add(importmodel);
                import.MenuItems.Add(importfska);
                import.MenuItems.Add(importfmaa);
                import.MenuItems.Add(importbonevis);
                import.MenuItems.Add(importshape);
                import.MenuItems.Add(importscene);
                import.MenuItems.Add(importembedded);
                import.MenuItems.Add(importtexture);
            }

            BFRESRender             = new BFRESRender();
            BFRESRender.ResFileNode = this;

            if (IsWiiU)
            {
                BFRESRender.LoadFile(new Syroot.NintenTools.Bfres.ResFile(new System.IO.MemoryStream(Data)));
            }
            else
            {
                BFRESRender.LoadFile(new Syroot.NintenTools.NSW.Bfres.ResFile(new System.IO.MemoryStream(Data)));
            }

            Runtime.abstractGlDrawables.Add(BFRESRender);
        }