Ejemplo n.º 1
0
            public void CreateNew(object sender, EventArgs args)
            {
                var ByteOrder = Syroot.BinaryData.ByteOrder.LittleEndian;

                if (sender.ToString() == "KCL (Wii U)")
                {
                    ByteOrder = Syroot.BinaryData.ByteOrder.BigEndian;
                }

                OpenFileDialog opn = new OpenFileDialog();

                if (opn.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                var mod = EditorCore.Common.OBJ.Read(new MemoryStream(File.ReadAllBytes(opn.FileName)), null);

                string name = Path.GetFileNameWithoutExtension(opn.FileName);

                var f = MarioKart.MK7.KCL.FromOBJ(mod);

                KCL kcl = new KCL();

                kcl.Text      = name;
                kcl.IFileInfo = new IFileInfo();
                kcl.FileName  = name;
                kcl.Renderer  = new KCLRendering();
                kcl.Read(f.Write(ByteOrder));

                ObjectEditor editor = new ObjectEditor();

                editor.Text = name;
                editor.treeViewCustom1.Nodes.Add(kcl);
                LibraryGUI.Instance.CreateMdiWindow(editor);
            }
Ejemplo n.º 2
0
        public KCLRendering2D(KCL kcl)
        {
            string vertPath = System.IO.Path.Combine(Runtime.ExecutableDir, "Shader", "Drawing2D", "KCL.vert");
            string fragPath = System.IO.Path.Combine(Runtime.ExecutableDir, "Shader", "Drawing2D", "KCL.frag");

            Shader = new GLShaderGeneric();
            Shader.VertexShader   = System.IO.File.ReadAllText(vertPath);
            Shader.FragmentShader = System.IO.File.ReadAllText(fragPath);
            Shader.Compile();

            models = kcl.GetKclModels();
        }
Ejemplo n.º 3
0
            public void CreateNew(object sender, EventArgs args)
            {
                var ByteOrder = Syroot.BinaryData.ByteOrder.LittleEndian;

                if (sender.ToString() == "KCL (Wii U)")
                {
                    ByteOrder = Syroot.BinaryData.ByteOrder.BigEndian;
                }

                OpenFileDialog opn = new OpenFileDialog();

                opn.Filter = "Supported Formats|*.obj";
                if (opn.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                var mod = EditorCore.Common.OBJ.Read(new MemoryStream(File.ReadAllBytes(opn.FileName)), null);

                var f = MarioKart.MK7.KCL.FromOBJ(mod);

                string name = System.IO.Path.GetFileNameWithoutExtension(opn.FileName);

                KCL kcl = new KCL();

                kcl.Text      = name;
                kcl.IFileInfo = new IFileInfo();
                kcl.FileName  = name;
                kcl.Renderer  = new KCLRendering();

                kcl.DrawableContainer = new DrawableContainer()
                {
                    Name      = kcl.FileName,
                    Drawables = new List <AbstractGlDrawable>()
                    {
                        kcl.Renderer
                    },
                };

                kcl.Read(f.Write(ByteOrder));

                ObjectEditor editor = new ObjectEditor(kcl);

                editor.Text = name;
                LibraryGUI.CreateMdiWindow(editor);
            }
Ejemplo n.º 4
0
            public void CreateNew(object sender, EventArgs args)
            {
                bool isBigEndian = false;

                if (sender.ToString() == "KCL (Wii U)")
                {
                    isBigEndian = true;
                }

                OpenFileDialog ofd = new OpenFileDialog();

                ofd.Filter = "Supported Formats|*.obj";
                if (ofd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                string path = Path.Combine(Runtime.ExecutableDir, "KclMaterialPresets");

                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                CollisionPresetData.LoadPresets(Directory.GetFiles("KclMaterialPresets"));

                var form = Runtime.MainForm;

                var thread = new Thread(() =>
                {
                    //Load runtime values to gui handler
                    MaterialWindowSettings.GamePreset      = Runtime.CollisionSettings.KCLGamePreset;
                    MaterialWindowSettings.Platform        = Runtime.CollisionSettings.KCLGamePreset;
                    MaterialWindowSettings.UsePresetEditor = Runtime.CollisionSettings.KCLUsePresetEditor;

                    var result = CollisionLoader.CreateCollisionFromObject(form, ofd.FileName);
                    CollisionLoader.CloseConsole(form);

                    if (result.KclFie == null)
                    {
                        return;
                    }

                    SaveMaterialWindowSettings();

                    form.Invoke((MethodInvoker) delegate
                    {
                        string name = Path.GetFileNameWithoutExtension(ofd.FileName);

                        KCL kcl     = new KCL();
                        kcl.KclFile = result.KclFie;
                        if (result.AttributeFile is MaterialAttributeBymlFile)
                        {
                            kcl.AttributeByml = ((MaterialAttributeBymlFile)result.AttributeFile).BymlFile;
                        }
                        kcl.Text      = name;
                        kcl.IFileInfo = new IFileInfo();
                        kcl.FileName  = name;
                        kcl.Renderer  = new KCLRendering();
                        kcl.ReloadData();

                        kcl.DrawableContainer = new DrawableContainer()
                        {
                            Name      = kcl.FileName,
                            Drawables = new List <AbstractGlDrawable>()
                            {
                                kcl.Renderer
                            },
                        };

                        ObjectEditor editor = new ObjectEditor(kcl);
                        editor.Text         = name;
                        LibraryGUI.CreateMdiWindow(editor);
                    });
                });

                thread.Start();
            }