// TODO: usually when we save the gltf file, we need to amend/fix several features, // which goes against good practices of not modifying any file when it is being saved. // a possible solution would be to do a shallow copy of RootObject and update Buffers, BufferViews, etc // an issue that complicates things is that it requires to copy the extensions of root, buffers, etc /// <summary> /// Writes this <see cref="MODEL"/> to a file in GLB format. /// </summary> /// <param name="filePath">A valid file path to write to.</param> public void SaveGLB(string filePath) { var settings = WriteSettings.ForBinary(filePath); var name = Path.GetFileNameWithoutExtension(filePath); _Write(settings, name, this); }
/// <summary> /// Writes this <see cref="MODEL"/> to a <see cref="Stream"/> in GLB format. /// </summary> /// <param name="stream">A <see cref="Stream"/> open for writing.</param> public void WriteGLB(Stream stream) { Guard.NotNull(stream, nameof(stream)); Guard.IsTrue(stream.CanWrite, nameof(stream)); var settings = WriteSettings.ForBinary(stream); _Write(settings, "model", this); }
/// <summary> /// Writes this <see cref="MODEL"/> to a file in GLB format. /// </summary> /// <param name="filePath">A valid file path to write to.</param> public void SaveGLB(string filePath) { Guard.FilePathMustBeValid(filePath, nameof(filePath)); var settings = WriteSettings.ForBinary(filePath); var name = Path.GetFileNameWithoutExtension(filePath); _Write(settings, name, this); }