Example #1
0
        /// <summary>
        /// Writes this <see cref="MODEL"/> to a dictionary where every key is an individual file
        /// </summary>
        /// <param name="fileName">the base name to use for the dictionary keys</param>
        /// <returns>a dictionary instance.</returns>
        public Dictionary <String, BYTES> WriteToDictionary(string fileName)
        {
            var dict = new Dictionary <string, BYTES>();

            var settings = WriteSettings.ForText(dict);

            _Write(settings, fileName, this);

            return(dict);
        }
        /// <summary>
        /// Writes this <see cref="MODEL"/> to a file in GLTF format.
        /// </summary>
        /// <param name="filePath">A valid file path to write to.</param>
        /// <param name="fmt">The formatting of the JSON document.</param>
        /// <remarks>
        /// Satellite files like buffers and images are also saved with the file name formatted as "FILE_{Index}.EXT".
        /// </remarks>
        public void SaveGLTF(string filePath, Formatting fmt = Formatting.None)
        {
            var settings = WriteSettings.ForText(filePath);

            settings.JsonFormatting = fmt;

            var name = Path.GetFileNameWithoutExtension(filePath);

            _Write(settings, name, this);
        }