예제 #1
0
        IOWriteResult Write_OBJ(string sFilename, List <WriteMesh> vMeshes, WriteOptions options)
        {
            Stream stream = OpenStreamF(sFilename);

            if (stream == null)
            {
                return(new IOWriteResult(IOCode.FileAccessError, "Could not open file " + sFilename + " for writing"));
            }

            try
            {
                var w      = new StreamWriter(stream);
                var writer = new OBJWriter()
                {
                    OpenStreamF  = this.OpenStreamF,
                    CloseStreamF = this.CloseStreamF
                };
                var result = writer.Write(w, vMeshes, options);
                w.Flush();
                return(result);
            }
            finally
            {
                CloseStreamF(stream);
            }
        }
예제 #2
0
        IOWriteResult Write_OBJ(string sFilename, List <WriteMesh> vMeshes, WriteOptions options)
        {
            StreamWriter w = new StreamWriter(sFilename);

            if (w.BaseStream == null)
            {
                return(new IOWriteResult(IOCode.FileAccessError, "Could not open file " + sFilename + " for writing"));
            }

            OBJWriter writer = new OBJWriter();
            var       result = writer.Write(w, vMeshes, options);

            w.Close();
            return(result);
        }