Esempio n. 1
0
        private void exportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var sf = new SaveFileDialog())
            {
                sf.Filter = "Irrlicht mesh | *.irrm | Collada mesh | *.coll | STL Mesh | *.stl | OBJ Mesh | *.obj | PLY Mesh | *.ply | B3D Mesh | *.b3d | FBX Mesh | *.fbx";
                if (sf.ShowDialog() == DialogResult.OK)
                {
                    MeshWriterType mwt = 0;
                    switch (Path.GetExtension(sf.FileName).Trim())
                    {
                    case ".irrm":
                        mwt = MeshWriterType.IrrMesh;
                        break;

                    case ".coll":
                        mwt = MeshWriterType.Collada;
                        break;

                    case ".obj":
                        mwt = MeshWriterType.Obj;
                        break;

                    case ".stl":
                        mwt = MeshWriterType.Stl;
                        break;

                    case ".ply":
                        mwt = MeshWriterType.Ply;
                        break;

                    case ".b3d":
                        mwt = MeshWriterType.B3d;
                        break;

                    case ".fbx":
                        mwt = MeshWriterType.Fbx;
                        break;

                    default:
                        MessageBox.Show(this, "Wrong file format selected, choose correct file format!", "WolvenKit", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    var mw = smgr.CreateMeshWriter(mwt);
                    //if (mw.WriteMesh(device.FileSystem.CreateWriteFile(sf.FileName), cdata.staticMesh, MeshWriterFlag.None))
                    if (mw.WriteMesh(device.FileSystem.CreateWriteFile(sf.FileName), skinnedMesh, MeshWriterFlag.None))
                    {
                        MessageBox.Show(this, "Sucessfully wrote file!", "WolvenKit", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show(this, "Failed to write file!", "WolvenKit", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Esempio n. 2
0
        private void exportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var sf = new SaveFileDialog())
            {
                sf.Filter = "Irrlicht mesh | *.irrm | Collada mesh | *.coll | STL Mesh | *.stl | OBJ Mesh | *.obj | PLY Mesh | *.ply | B3D Mesh | *.b3d";
                if (sf.ShowDialog() == DialogResult.OK)
                {
                    MeshWriterType mwt = MeshWriterType.Obj;
                    switch (Path.GetExtension(sf.FileName))
                    {
                    case "irrm":
                        mwt = MeshWriterType.IrrMesh;
                        break;

                    case "coll":
                        mwt = MeshWriterType.Collada;
                        break;

                    case "obj":
                        mwt = MeshWriterType.Obj;
                        break;

                    case "stl":
                        mwt = MeshWriterType.Stl;
                        break;

                    case "ply":
                        mwt = MeshWriterType.Ply;
                        break;

                    case "b3d":
                        mwt = MeshWriterType.B3d;
                        break;
                    }
                    var mw = smgr.CreateMeshWriter(mwt);
                    if (mw.WriteMesh(device.FileSystem.CreateWriteFile(sf.FileName), staticMesh, MeshWriterFlag.None))
                    {
                        MessageBox.Show(this, "Sucessfully wrote file!", "WolvenKit", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show(this, "Failed tos file!", "WolvenKit", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
        private void exportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var sf = new SaveFileDialog())
            {
                sf.Filter = "Irrlicht mesh | *.irrm | Collada mesh | *.coll | STL Mesh | *.stl | OBJ Mesh | *.obj | PLY Mesh | *.ply | B3D Mesh | *.b3d | FBX Mesh | *.fbx";
                if (sf.ShowDialog() == DialogResult.OK)
                {
                    MeshWriterType mwt = 0;
                    switch (Path.GetExtension(sf.FileName).Trim())
                    {
                    case ".irrm":
                        mwt = MeshWriterType.IrrMesh;
                        break;

                    case ".coll":
                        mwt = MeshWriterType.Collada;
                        break;

                    case ".obj":
                        mwt = MeshWriterType.Obj;
                        break;

                    case ".stl":
                        mwt = MeshWriterType.Stl;
                        break;

                    case ".ply":
                        mwt = MeshWriterType.Ply;
                        break;

                    case ".b3d":
                        mwt = MeshWriterType.B3d;
                        break;

                    case ".fbx":
                        mwt = MeshWriterType.Fbx;
                        break;

                    default:
                        MessageBox.Show(this, "Wrong file format selected, choose correct file format!", "WolvenKit", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    var          mw = smgr.CreateMeshWriter(mwt);
                    AnimatedMesh sm = mesh;
                    SkinnedMesh  s  = null;
                    if (meshToAnimate != null)
                    {
                        sm = meshToAnimate;
                    }
                    if (!string.IsNullOrEmpty(activeAnim))
                    {
                        s = helper.applyAnimation(activeAnim, meshToAnimate);
                        if (s != null)
                        {
                            sm = s;
                        }
                    }

                    if (mw.WriteMesh(dev.FileSystem.CreateWriteFile(sf.FileName), sm, MeshWriterFlag.None))
                    {
                        MessageBox.Show(this, "Sucessfully wrote file!", "WolvenKit", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show(this, "Failed to write file!", "WolvenKit", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    if (sm != null)
                    {
                        sm.Drop();
                    }
                    if (mw != null)
                    {
                        mw.Drop();
                    }
                    if (s != null)
                    {
                        s.Drop();
                    }
                }
            }
        }
Esempio n. 4
0
 public MeshWriter CreateMeshWriter(MeshWriterType type)
 {
     return (MeshWriter)
         NativeElement.GetObject(SceneManager_CreateMeshWriter(_raw, type),
             typeof(MeshWriter));
 }
Esempio n. 5
0
 static extern IntPtr SceneManager_CreateMeshWriter(IntPtr scenemanager, MeshWriterType type);