Ejemplo n.º 1
0
        /// <summary>
        /// Import data asynchronously from a byte array.
        /// </summary>
        /// <param name="filename">The name of the file corresponding to the imported data. The extension is used to determine which codec use.</param>
        /// <param name="data">The data to import from.</param>
        /// <param name="return_callback">The calback used to notify the caller when the import is completed.</param>
        /// <param name="progress_callback">The callback to regularly notify the caller of the import progress.</param>
        /// <returns>An iterator to use inside a coroutine.</returns>
        public IEnumerator ImportFromBytes(string filename, byte[] data, ImporterReturnCallback return_callback, ProgressCallback progress_callback)
        {
            aiPostProcessSteps steps;
            string             extension;

            SetProperties(filename, out extension, out steps);

            return(Type.Scene.FromAssimp(context, Importer, () => Importer.ReadFileFromMemory(data, (uint)data.Length, steps, extension), return_callback, progress_callback));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Import data asynchronously from a source file.
        /// </summary>
        /// <param name="filename">The name of the file to import from.</param>
        /// <param name="return_callback">The calback used to notify the caller when the import is completed.</param>
        /// <param name="progress_callback">The callback to regularly notify the caller of the import progress.</param>
        /// <returns>An iterator to use inside a coroutine.</returns>
        public IEnumerator ImportFromFile(string filename, ImporterReturnCallback return_callback, ProgressCallback progress_callback)
        {
            aiPostProcessSteps steps;
            string             extension;

            SetProperties(filename, out extension, out steps);

            byte[] ascii_data = Encoding.Convert(Encoding.Unicode, Encoding.GetEncoding("iso-8859-1"), Encoding.Unicode.GetBytes(filename));

            return(Type.Scene.FromAssimp(context, Importer, () => Importer.ReadFile(ascii_data, (uint)ascii_data.Length, steps), return_callback, progress_callback));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Import data asynchronously from a byte array.
 /// </summary>
 /// <param name="filename">The name of the file corresponding to the imported data.</param>
 /// <param name="data">The data to import from.</param>
 /// <param name="return_callback">The calback used to notify the caller when the import is completed.</param>
 /// <param name="progress_callback">The callback to regularly notify the caller of the import progress.</param>
 /// <returns>An iterator to use inside a coroutine.</returns>
 public IEnumerator ImportFromBytes(string filename, byte[] data, ImporterReturnCallback return_callback, ProgressCallback progress_callback)
 {
     return(serializer.Deserialize(data, s => return_callback((Type.Scene)s), p => progress_callback(p)));
 }